@nuralyui/dropdown 0.0.9 → 0.0.15
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/bundle.js +868 -0
- package/dropdown.component.d.ts +118 -0
- package/dropdown.component.js +376 -0
- package/dropdown.component.js.map +1 -0
- package/{hy-dropdown.style.d.ts → dropdown.style.d.ts} +1 -1
- package/dropdown.style.js +438 -0
- package/dropdown.style.js.map +1 -0
- package/dropdown.types.d.ts +83 -1
- package/dropdown.types.js.map +1 -1
- package/index.d.ts +2 -1
- package/index.js +2 -1
- package/index.js.map +1 -1
- package/package.json +17 -6
- package/react.d.ts +6 -2
- package/react.js +9 -5
- package/react.js.map +1 -1
- package/demo/hy-dropdowns-demo.d.ts +0 -19
- package/demo/hy-dropdowns-demo.d.ts.map +0 -1
- package/demo/hy-dropdowns-demo.js +0 -205
- package/demo/hy-dropdowns-demo.js.map +0 -1
- package/dropdown.types.d.ts.map +0 -1
- package/hy-dropdown.component.d.ts +0 -30
- package/hy-dropdown.component.d.ts.map +0 -1
- package/hy-dropdown.component.js +0 -183
- package/hy-dropdown.component.js.map +0 -1
- package/hy-dropdown.style.d.ts.map +0 -1
- package/hy-dropdown.style.js +0 -47
- package/hy-dropdown.style.js.map +0 -1
- package/index.d.ts.map +0 -1
- package/react.d.ts.map +0 -1
- package/templates/hy-dropdown-item.d.ts +0 -12
- package/templates/hy-dropdown-item.d.ts.map +0 -1
- package/templates/hy-dropdown-item.js +0 -55
- package/templates/hy-dropdown-item.js.map +0 -1
- package/templates/hy-dropdown-item.style.d.ts +0 -2
- package/templates/hy-dropdown-item.style.d.ts.map +0 -1
- package/templates/hy-dropdown-item.style.js +0 -34
- package/templates/hy-dropdown-item.style.js.map +0 -1
- package/templates/hy-dropdown-menu.d.ts +0 -18
- package/templates/hy-dropdown-menu.d.ts.map +0 -1
- package/templates/hy-dropdown-menu.js +0 -70
- package/templates/hy-dropdown-menu.js.map +0 -1
- package/templates/hy-dropdown-menu.style.d.ts +0 -2
- package/templates/hy-dropdown-menu.style.d.ts.map +0 -1
- package/templates/hy-dropdown-menu.style.js +0 -49
- package/templates/hy-dropdown-menu.style.js.map +0 -1
- package/test/hy-dropdown_test.d.ts +0 -4
- package/test/hy-dropdown_test.d.ts.map +0 -1
- package/test/hy-dropdown_test.js +0 -132
- package/test/hy-dropdown_test.js.map +0 -1
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
/**
|
|
3
|
-
* @license
|
|
4
|
-
* Copyright 2023 Google Laabidi Aymen
|
|
5
|
-
* SPDX-License-Identifier: MIT
|
|
6
|
-
*/
|
|
7
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
8
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
10
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
11
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12
|
-
};
|
|
13
|
-
import { LitElement, css, html } from 'lit';
|
|
14
|
-
import { customElement, state } from 'lit/decorators.js';
|
|
15
|
-
import '../hy-dropdown.component';
|
|
16
|
-
let ElButtonDemoElement = class ElButtonDemoElement extends LitElement {
|
|
17
|
-
constructor() {
|
|
18
|
-
super(...arguments);
|
|
19
|
-
this.options = [
|
|
20
|
-
{ label: 'option1', value: 'value1', icon: 'bomb' },
|
|
21
|
-
{
|
|
22
|
-
label: 'option2',
|
|
23
|
-
value: 'value2',
|
|
24
|
-
children: [
|
|
25
|
-
{ label: 'option3', value: 'value3', icon: 'car' },
|
|
26
|
-
{ label: 'option13', value: 'value13', icon: 'car' },
|
|
27
|
-
],
|
|
28
|
-
},
|
|
29
|
-
{ label: 'option4', value: 'value4', icon: 'bomb', disabled: true },
|
|
30
|
-
{
|
|
31
|
-
label: 'option5',
|
|
32
|
-
value: 'value5',
|
|
33
|
-
children: [
|
|
34
|
-
{
|
|
35
|
-
label: 'option6',
|
|
36
|
-
value: 'value6',
|
|
37
|
-
icon: 'car',
|
|
38
|
-
disabled: true,
|
|
39
|
-
children: [{ label: 'option7', value: 'value7', icon: 'cog' }],
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
label: 'option8',
|
|
45
|
-
value: 'value8',
|
|
46
|
-
icon: 'book',
|
|
47
|
-
children: [
|
|
48
|
-
{
|
|
49
|
-
label: 'option9',
|
|
50
|
-
value: 'value9',
|
|
51
|
-
icon: 'bolt',
|
|
52
|
-
children: [
|
|
53
|
-
{ label: 'option10', value: 'value10', icon: 'bell', disabled: true },
|
|
54
|
-
{ label: 'option11', value: 'value11', icon: 'bell' },
|
|
55
|
-
],
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
},
|
|
59
|
-
{ label: 'option12', value: 'value12', disabled: true },
|
|
60
|
-
];
|
|
61
|
-
}
|
|
62
|
-
render() {
|
|
63
|
-
return html `
|
|
64
|
-
<h3>With template</h3>
|
|
65
|
-
<hy-dropdown .template=${html `<div style='color:red;'>hello</div>`}>
|
|
66
|
-
<span>click me</span>
|
|
67
|
-
</hy-dropdown>
|
|
68
|
-
<div id="centered">
|
|
69
|
-
<h3>Centered trigger</h3>
|
|
70
|
-
<hy-dropdown .options=${this.options} @click-item=${(e) => console.log('value clicked', e.detail)}>
|
|
71
|
-
<div style="overflow-y:scroll;max-height:100px;width:100px"> hover meee, hover meeehover meeehover meeehover meeehover meeehover meeehover meee</div>
|
|
72
|
-
</hy-dropdown>
|
|
73
|
-
|
|
74
|
-
<br /><br />
|
|
75
|
-
|
|
76
|
-
<hy-dropdown
|
|
77
|
-
trigger="click"
|
|
78
|
-
.options=${this.options}
|
|
79
|
-
@click-item=${(e) => console.log('value clicked', e.detail)}
|
|
80
|
-
>
|
|
81
|
-
<span> click me</span>
|
|
82
|
-
</hy-dropdown>
|
|
83
|
-
<br /><br />
|
|
84
|
-
<hy-dropdown .options=${this.options} @click-item=${(e) => console.log('value clicked', e.detail)}>
|
|
85
|
-
<span> hover me</span>
|
|
86
|
-
</hy-dropdown>
|
|
87
|
-
|
|
88
|
-
<br /><br />
|
|
89
|
-
|
|
90
|
-
<hy-dropdown
|
|
91
|
-
trigger="click"
|
|
92
|
-
.options=${this.options}
|
|
93
|
-
@click-item=${(e) => console.log('value clicked', e.detail)}
|
|
94
|
-
>
|
|
95
|
-
<span> click me</span>
|
|
96
|
-
</hy-dropdown>
|
|
97
|
-
<br /><br />
|
|
98
|
-
<hy-dropdown .options=${this.options} @click-item=${(e) => console.log('value clicked', e.detail)}>
|
|
99
|
-
<span> hover me</span>
|
|
100
|
-
</hy-dropdown>
|
|
101
|
-
</div>
|
|
102
|
-
<div id="left">
|
|
103
|
-
<h3>Left trigger</h3>
|
|
104
|
-
|
|
105
|
-
<hy-dropdown .options=${this.options} @click-item=${(e) => console.log('value clicked', e.detail)}>
|
|
106
|
-
<span> hover me</span>
|
|
107
|
-
</hy-dropdown>
|
|
108
|
-
|
|
109
|
-
<br /><br />
|
|
110
|
-
|
|
111
|
-
<hy-dropdown
|
|
112
|
-
trigger="click"
|
|
113
|
-
.options=${this.options}
|
|
114
|
-
@click-item=${(e) => console.log('value clicked', e.detail)}
|
|
115
|
-
>
|
|
116
|
-
<span> click me</span>
|
|
117
|
-
</hy-dropdown>
|
|
118
|
-
<br /><br />
|
|
119
|
-
<hy-dropdown .options=${this.options} @click-item=${(e) => console.log('value clicked', e.detail)}>
|
|
120
|
-
<span> hover me</span>
|
|
121
|
-
</hy-dropdown>
|
|
122
|
-
|
|
123
|
-
<br /><br />
|
|
124
|
-
|
|
125
|
-
<hy-dropdown
|
|
126
|
-
trigger="click"
|
|
127
|
-
.options=${this.options}
|
|
128
|
-
@click-item=${(e) => console.log('value clicked', e.detail)}
|
|
129
|
-
>
|
|
130
|
-
<span> click me</span>
|
|
131
|
-
</hy-dropdown>
|
|
132
|
-
<br /><br />
|
|
133
|
-
<hy-dropdown .options=${this.options} @click-item=${(e) => console.log('value clicked', e.detail)}>
|
|
134
|
-
<span> hover me</span>
|
|
135
|
-
</hy-dropdown>
|
|
136
|
-
</div>
|
|
137
|
-
<div id="right">
|
|
138
|
-
<h3>Right trigger</h3>
|
|
139
|
-
<hy-dropdown .options=${this.options} @click-item=${(e) => console.log('value clicked', e.detail)}>
|
|
140
|
-
<span> hover me</span>
|
|
141
|
-
</hy-dropdown>
|
|
142
|
-
|
|
143
|
-
<br /><br />
|
|
144
|
-
|
|
145
|
-
<hy-dropdown
|
|
146
|
-
trigger="click"
|
|
147
|
-
.options=${this.options}
|
|
148
|
-
@click-item=${(e) => console.log('value clicked', e.detail)}
|
|
149
|
-
>
|
|
150
|
-
<span> click me</span>
|
|
151
|
-
</hy-dropdown>
|
|
152
|
-
<br /><br />
|
|
153
|
-
<hy-dropdown .options=${this.options} @click-item=${(e) => console.log('value clicked', e.detail)}>
|
|
154
|
-
<span> hover me</span>
|
|
155
|
-
</hy-dropdown>
|
|
156
|
-
|
|
157
|
-
<br /><br />
|
|
158
|
-
|
|
159
|
-
<hy-dropdown
|
|
160
|
-
trigger="click"
|
|
161
|
-
.options=${this.options}
|
|
162
|
-
@click-item=${(e) => console.log('value clicked', e.detail)}
|
|
163
|
-
>
|
|
164
|
-
<span> click me</span>
|
|
165
|
-
</hy-dropdown>
|
|
166
|
-
<br /><br />
|
|
167
|
-
<hy-dropdown .options=${this.options} @click-item=${(e) => console.log('value clicked', e.detail)}>
|
|
168
|
-
<span> hover me</span>
|
|
169
|
-
</hy-dropdown>
|
|
170
|
-
</div>
|
|
171
|
-
`;
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
ElButtonDemoElement.styles = [
|
|
175
|
-
css `
|
|
176
|
-
#centered {
|
|
177
|
-
display: flex;
|
|
178
|
-
align-items: center;
|
|
179
|
-
flex-direction: column;
|
|
180
|
-
gap: 30px;
|
|
181
|
-
}
|
|
182
|
-
#left {
|
|
183
|
-
display: flex;
|
|
184
|
-
align-items: start;
|
|
185
|
-
flex-direction: column;
|
|
186
|
-
gap: 10px;
|
|
187
|
-
margin-left: 50px;
|
|
188
|
-
}
|
|
189
|
-
#right {
|
|
190
|
-
display: flex;
|
|
191
|
-
align-items: end;
|
|
192
|
-
flex-direction: column;
|
|
193
|
-
gap: 10px;
|
|
194
|
-
margin-right: 50px;
|
|
195
|
-
}
|
|
196
|
-
`,
|
|
197
|
-
];
|
|
198
|
-
__decorate([
|
|
199
|
-
state()
|
|
200
|
-
], ElButtonDemoElement.prototype, "options", void 0);
|
|
201
|
-
ElButtonDemoElement = __decorate([
|
|
202
|
-
customElement('hy-dropdwon-demo')
|
|
203
|
-
], ElButtonDemoElement);
|
|
204
|
-
export { ElButtonDemoElement };
|
|
205
|
-
//# sourceMappingURL=hy-dropdowns-demo.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hy-dropdowns-demo.js","sourceRoot":"","sources":["../../../../src/components/dropdown/demo/hy-dropdowns-demo.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD;;;;GAIG;;;;;;;AAEH,OAAO,EAAC,UAAU,EAAE,GAAG,EAAE,IAAI,EAAC,MAAM,KAAK,CAAC;AAC1C,OAAO,EAAC,aAAa,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAEvD,OAAO,0BAA0B,CAAC;AAIlC,IAAa,mBAAmB,GAAhC,MAAa,mBAAoB,SAAQ,UAAU;IAAnD;;QA0BE,YAAO,GAAc;YACnB,EAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAC;YACjD;gBACE,KAAK,EAAE,SAAS;gBAChB,KAAK,EAAE,QAAQ;gBACf,QAAQ,EAA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G,CAAC,eAAe,EAAE,CAAC,CAAC,MAAM,CAAC;;;;;;gCAMtF,IAAI,CAAC,OAAO,gBAAgB,CAAC,CAAc,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC,CAAC,MAAM,CAAC;;;;;;;;qBAQjG,IAAI,CAAC,OAAO;wBACT,CAAC,CAAc,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC,CAAC,MAAM,CAAC;;;;;gCAKlD,IAAI,CAAC,OAAO,gBAAgB,CAAC,CAAc,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC,CAAC,MAAM,CAAC;;;;;;;;qBAQjG,IAAI,CAAC,OAAO;wBACT,CAAC,CAAc,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC,CAAC,MAAM,CAAC;;;;;gCAKlD,IAAI,CAAC,OAAO,gBAAgB,CAAC,CAAc,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC,CAAC,MAAM,CAAC;;;;KAIjH,CAAC;IACJ,CAAC;CACF,CAAA;AAlLiB,0BAAM,GAAG;IACvB,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;KAqBF;CACD,CAAA;AAEF;IADC,KAAK,EAAE;oDA0CN;AAnES,mBAAmB;IAD/B,aAAa,CAAC,kBAAkB,CAAC;GACrB,mBAAmB,CAmL/B;SAnLY,mBAAmB","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/**\n * @license\n * Copyright 2023 Google Laabidi Aymen\n * SPDX-License-Identifier: MIT\n */\n\nimport {LitElement, css, html} from 'lit';\nimport {customElement, state} from 'lit/decorators.js';\n\nimport '../hy-dropdown.component';\nimport {IOption} from '../dropdown.types';\n\n@customElement('hy-dropdwon-demo')\nexport class ElButtonDemoElement extends LitElement {\n static override styles = [\n css`\n #centered {\n display: flex;\n align-items: center;\n flex-direction: column;\n gap: 30px;\n }\n #left {\n display: flex;\n align-items: start;\n flex-direction: column;\n gap: 10px;\n margin-left: 50px;\n }\n #right {\n display: flex;\n align-items: end;\n flex-direction: column;\n gap: 10px;\n margin-right: 50px;\n }\n `,\n ];\n @state()\n options: IOption[] = [\n {label: 'option1', value: 'value1', icon: 'bomb'},\n {\n label: 'option2',\n value: 'value2',\n children: [\n {label: 'option3', value: 'value3', icon: 'car'},\n {label: 'option13', value: 'value13', icon: 'car'},\n ],\n },\n {label: 'option4', value: 'value4', icon: 'bomb', disabled: true},\n {\n label: 'option5',\n value: 'value5',\n children: [\n {\n label: 'option6',\n value: 'value6',\n icon: 'car',\n disabled: true,\n children: [{label: 'option7', value: 'value7', icon: 'cog'}],\n },\n ],\n },\n {\n label: 'option8',\n value: 'value8',\n icon: 'book',\n children: [\n {\n label: 'option9',\n value: 'value9',\n icon: 'bolt',\n children: [\n {label: 'option10', value: 'value10', icon: 'bell', disabled: true},\n {label: 'option11', value: 'value11', icon: 'bell'},\n ],\n },\n ],\n },\n {label: 'option12', value: 'value12', disabled: true},\n ];\n override render() {\n return html` \n <h3>With template</h3>\n <hy-dropdown .template=${html`<div style='color:red;'>hello</div>`}>\n <span>click me</span>\n </hy-dropdown>\n <div id=\"centered\">\n <h3>Centered trigger</h3>\n <hy-dropdown .options=${this.options} @click-item=${(e: CustomEvent) => console.log('value clicked', e.detail)}>\n <div style=\"overflow-y:scroll;max-height:100px;width:100px\"> hover meee, hover meeehover meeehover meeehover meeehover meeehover meeehover meee</div>\n </hy-dropdown>\n\n <br /><br />\n\n <hy-dropdown\n trigger=\"click\"\n .options=${this.options}\n @click-item=${(e: CustomEvent) => console.log('value clicked', e.detail)}\n >\n <span> click me</span>\n </hy-dropdown>\n <br /><br />\n <hy-dropdown .options=${this.options} @click-item=${(e: CustomEvent) => console.log('value clicked', e.detail)}>\n <span> hover me</span>\n </hy-dropdown>\n\n <br /><br />\n\n <hy-dropdown\n trigger=\"click\"\n .options=${this.options}\n @click-item=${(e: CustomEvent) => console.log('value clicked', e.detail)}\n >\n <span> click me</span>\n </hy-dropdown>\n <br /><br />\n <hy-dropdown .options=${this.options} @click-item=${(e: CustomEvent) => console.log('value clicked', e.detail)}>\n <span> hover me</span>\n </hy-dropdown>\n </div>\n <div id=\"left\">\n <h3>Left trigger</h3>\n\n <hy-dropdown .options=${this.options} @click-item=${(e: CustomEvent) => console.log('value clicked', e.detail)}>\n <span> hover me</span>\n </hy-dropdown>\n\n <br /><br />\n\n <hy-dropdown\n trigger=\"click\"\n .options=${this.options}\n @click-item=${(e: CustomEvent) => console.log('value clicked', e.detail)}\n >\n <span> click me</span>\n </hy-dropdown>\n <br /><br />\n <hy-dropdown .options=${this.options} @click-item=${(e: CustomEvent) => console.log('value clicked', e.detail)}>\n <span> hover me</span>\n </hy-dropdown>\n\n <br /><br />\n\n <hy-dropdown\n trigger=\"click\"\n .options=${this.options}\n @click-item=${(e: CustomEvent) => console.log('value clicked', e.detail)}\n >\n <span> click me</span>\n </hy-dropdown>\n <br /><br />\n <hy-dropdown .options=${this.options} @click-item=${(e: CustomEvent) => console.log('value clicked', e.detail)}>\n <span> hover me</span>\n </hy-dropdown>\n </div>\n <div id=\"right\">\n <h3>Right trigger</h3>\n <hy-dropdown .options=${this.options} @click-item=${(e: CustomEvent) => console.log('value clicked', e.detail)}>\n <span> hover me</span>\n </hy-dropdown>\n\n <br /><br />\n\n <hy-dropdown\n trigger=\"click\"\n .options=${this.options}\n @click-item=${(e: CustomEvent) => console.log('value clicked', e.detail)}\n >\n <span> click me</span>\n </hy-dropdown>\n <br /><br />\n <hy-dropdown .options=${this.options} @click-item=${(e: CustomEvent) => console.log('value clicked', e.detail)}>\n <span> hover me</span>\n </hy-dropdown>\n\n <br /><br />\n\n <hy-dropdown\n trigger=\"click\"\n .options=${this.options}\n @click-item=${(e: CustomEvent) => console.log('value clicked', e.detail)}\n >\n <span> click me</span>\n </hy-dropdown>\n <br /><br />\n <hy-dropdown .options=${this.options} @click-item=${(e: CustomEvent) => console.log('value clicked', e.detail)}>\n <span> hover me</span>\n </hy-dropdown>\n </div>\n `;\n }\n}\ndeclare global {\n interface HTMLElementTagNameMap {\n 'hy-dropdwon-demo': ElButtonDemoElement;\n }\n}\n"]}
|
package/dropdown.types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown.types.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown/dropdown.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,cAAc,CAAC,EAAE,GAAG,CAAC;CACtB;AAED,0BAAkB,WAAW;IAC3B,KAAK,UAAU;IACf,KAAK,UAAU;CAChB;AACD,0BAAkB,iBAAiB;IACjC,KAAK,UAAU;IACf,IAAI,SAAS;CACd"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { LitElement, TemplateResult } from 'lit';
|
|
2
|
-
import { DropDownDirection, IOption, TriggerMode } from './dropdown.types';
|
|
3
|
-
import './templates/hy-dropdown-item.js';
|
|
4
|
-
import './templates/hy-dropdown-menu.js';
|
|
5
|
-
export declare class HyDropdownComponent extends LitElement {
|
|
6
|
-
static styles: import("lit").CSSResult;
|
|
7
|
-
triggerElement: HTMLElement;
|
|
8
|
-
dropDownContainer: HTMLElement;
|
|
9
|
-
options: IOption[];
|
|
10
|
-
show: boolean;
|
|
11
|
-
trigger: TriggerMode;
|
|
12
|
-
template: TemplateResult<1>;
|
|
13
|
-
always: boolean;
|
|
14
|
-
isDropDownVisited: boolean;
|
|
15
|
-
dropDownDirection: DropDownDirection;
|
|
16
|
-
firstUpdated(): void;
|
|
17
|
-
onTriggerClick: () => Promise<void>;
|
|
18
|
-
calculatePosition: () => void;
|
|
19
|
-
initPosition(): void;
|
|
20
|
-
onClickOutside: (event: Event) => void;
|
|
21
|
-
onMouseEnterTriggerElement: () => Promise<void>;
|
|
22
|
-
onMouseLeaveTriggerElement: () => void;
|
|
23
|
-
onMouseEnterDropDown: () => void;
|
|
24
|
-
onMouseLeaveDropDown: () => void;
|
|
25
|
-
onOptionClick(): void;
|
|
26
|
-
disconnectedCallback(): void;
|
|
27
|
-
display(options: IOption[]): TemplateResult[];
|
|
28
|
-
render(): TemplateResult<1>;
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=hy-dropdown.component.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hy-dropdown.component.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown/hy-dropdown.component.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAiB,MAAM,KAAK,CAAC;AAGhE,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,iCAAiC,CAAC;AACzC,OAAO,iCAAiC,CAAC;AAEzC,qBACa,mBAAoB,SAAQ,UAAU;IACjD,OAAgB,MAAM,0BAAU;IAEjB,cAAc,EAAG,WAAW,CAAC;IACd,iBAAiB,EAAG,WAAW,CAAC;IAEnC,OAAO,EAAG,OAAO,EAAE,CAAC;IACH,IAAI,UAAS;IAC7C,OAAO,cAAqB;IACZ,QAAQ,EAAG,cAAc,CAAC,CAAC,CAAC,CAAC;IACb,MAAM,UAAS;IAElD,iBAAiB,UAAS;IAC1B,iBAAiB,oBAA2B;IAE5C,YAAY,IAAI,IAAI;IAe7B,cAAc,sBAIZ;IAEF,iBAAiB,aAqBf;IAEF,YAAY;IAMZ,cAAc,UAAW,KAAK,UAM5B;IAEF,0BAA0B,sBAIxB;IAEF,0BAA0B,aAKxB;IAEF,oBAAoB,aAElB;IAEF,oBAAoB,aAIlB;IAEF,aAAa;IAIJ,oBAAoB;IAe7B,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,cAAc,EAAE;IAyBpC,MAAM;CAQhB"}
|
package/hy-dropdown.component.js
DELETED
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
9
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
13
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
17
|
-
import { LitElement, html, nothing } from 'lit';
|
|
18
|
-
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
19
|
-
import { styles } from './hy-dropdown.style.js';
|
|
20
|
-
import './templates/hy-dropdown-item.js';
|
|
21
|
-
import './templates/hy-dropdown-menu.js';
|
|
22
|
-
let HyDropdownComponent = class HyDropdownComponent extends LitElement {
|
|
23
|
-
constructor() {
|
|
24
|
-
super(...arguments);
|
|
25
|
-
this.show = false;
|
|
26
|
-
this.trigger = "click" /* TriggerMode.Click */;
|
|
27
|
-
this.always = false;
|
|
28
|
-
this.isDropDownVisited = false;
|
|
29
|
-
this.dropDownDirection = "right" /* DropDownDirection.Right */;
|
|
30
|
-
this.onTriggerClick = () => __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
this.show = !this.show;
|
|
32
|
-
yield this.updateComplete;
|
|
33
|
-
this.calculatePosition();
|
|
34
|
-
});
|
|
35
|
-
this.calculatePosition = () => {
|
|
36
|
-
var _a, _b;
|
|
37
|
-
const triggerClientRect = this.shadowRoot.querySelector('slot').assignedElements()[0].getBoundingClientRect();
|
|
38
|
-
const dropDownWidth = (_a = this.dropDownContainer) === null || _a === void 0 ? void 0 : _a.clientWidth;
|
|
39
|
-
const dropDownHeight = (_b = this.dropDownContainer) === null || _b === void 0 ? void 0 : _b.clientHeight;
|
|
40
|
-
const availableBottomSpace = window.visualViewport.height - triggerClientRect.bottom;
|
|
41
|
-
const availableRightSpace = window.visualViewport.width - triggerClientRect.left - triggerClientRect.width;
|
|
42
|
-
const availableLeftSpace = triggerClientRect.right;
|
|
43
|
-
this.dropDownContainer.style.position = 'fixed';
|
|
44
|
-
if (dropDownHeight > availableBottomSpace) {
|
|
45
|
-
this.dropDownContainer.style.top = `${triggerClientRect.top - dropDownHeight}px`;
|
|
46
|
-
}
|
|
47
|
-
if (dropDownWidth > availableRightSpace && dropDownWidth < availableLeftSpace) {
|
|
48
|
-
this.dropDownContainer.style.right = `${availableRightSpace}px`;
|
|
49
|
-
this.dropDownDirection = "left" /* DropDownDirection.Left */;
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
this.dropDownDirection = "right" /* DropDownDirection.Right */;
|
|
53
|
-
this.dropDownContainer.style.removeProperty('right');
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
this.onClickOutside = (event) => {
|
|
57
|
-
const outsideClick = !event.composedPath().includes(this);
|
|
58
|
-
if (outsideClick && this.show && !this.always) {
|
|
59
|
-
this.show = false;
|
|
60
|
-
this.initPosition();
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
this.onMouseEnterTriggerElement = () => __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
this.show = true;
|
|
65
|
-
yield this.updateComplete;
|
|
66
|
-
this.calculatePosition();
|
|
67
|
-
});
|
|
68
|
-
this.onMouseLeaveTriggerElement = () => {
|
|
69
|
-
const waitIsDropDownVisited = 50;
|
|
70
|
-
setTimeout(() => {
|
|
71
|
-
if (!this.isDropDownVisited)
|
|
72
|
-
this.show = false;
|
|
73
|
-
}, waitIsDropDownVisited);
|
|
74
|
-
};
|
|
75
|
-
this.onMouseEnterDropDown = () => {
|
|
76
|
-
this.isDropDownVisited = true;
|
|
77
|
-
};
|
|
78
|
-
this.onMouseLeaveDropDown = () => {
|
|
79
|
-
this.isDropDownVisited = false;
|
|
80
|
-
this.show = false;
|
|
81
|
-
this.initPosition();
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
firstUpdated() {
|
|
85
|
-
document.addEventListener('scroll', this.calculatePosition);
|
|
86
|
-
window.addEventListener('resize', this.calculatePosition);
|
|
87
|
-
if (this.trigger === "hover" /* TriggerMode.Hover */) {
|
|
88
|
-
this.triggerElement.addEventListener('mouseenter', this.onMouseEnterTriggerElement);
|
|
89
|
-
this.triggerElement.addEventListener('mouseleave', this.onMouseLeaveTriggerElement);
|
|
90
|
-
this.dropDownContainer.addEventListener('mouseenter', this.onMouseEnterDropDown);
|
|
91
|
-
this.dropDownContainer.addEventListener('mouseleave', this.onMouseLeaveDropDown);
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
this.triggerElement.addEventListener('click', this.onTriggerClick);
|
|
95
|
-
window.addEventListener('click', this.onClickOutside);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
initPosition() {
|
|
99
|
-
this.dropDownContainer.style.removeProperty('top');
|
|
100
|
-
this.dropDownContainer.style.removeProperty('position');
|
|
101
|
-
this.dropDownContainer.style.removeProperty('right');
|
|
102
|
-
}
|
|
103
|
-
onOptionClick() {
|
|
104
|
-
this.show = false;
|
|
105
|
-
}
|
|
106
|
-
disconnectedCallback() {
|
|
107
|
-
document.removeEventListener('scroll', this.calculatePosition);
|
|
108
|
-
window.removeEventListener('resize', this.calculatePosition);
|
|
109
|
-
if (this.trigger === "hover" /* TriggerMode.Hover */) {
|
|
110
|
-
this.triggerElement.removeEventListener('mouseenter', this.onMouseEnterTriggerElement);
|
|
111
|
-
this.triggerElement.removeEventListener('mouseleave', this.onMouseLeaveTriggerElement);
|
|
112
|
-
this.dropDownContainer.removeEventListener('mouseenter', this.onMouseEnterDropDown);
|
|
113
|
-
this.dropDownContainer.removeEventListener('mouseleave', this.onMouseLeaveDropDown);
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
this.triggerElement.removeEventListener('click', this.onTriggerClick);
|
|
117
|
-
window.removeEventListener('click', this.onClickOutside);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
display(options) {
|
|
121
|
-
return options.map((option) => option.children
|
|
122
|
-
? html `
|
|
123
|
-
<hy-dropdown-menu
|
|
124
|
-
.direction=${this.dropDownDirection}
|
|
125
|
-
.disabled=${option.disabled}
|
|
126
|
-
.icon=${option.icon}
|
|
127
|
-
.label=${option.label}
|
|
128
|
-
>
|
|
129
|
-
<div class="dropdown-container">${this.display(option.children)}</div>
|
|
130
|
-
</hy-dropdown-menu>
|
|
131
|
-
`
|
|
132
|
-
: html `
|
|
133
|
-
<hy-dropdown-item
|
|
134
|
-
.disabled=${option.disabled}
|
|
135
|
-
.icon=${option.icon}
|
|
136
|
-
.label=${option.label}
|
|
137
|
-
.value=${option.value}
|
|
138
|
-
.additionalData=${option.additionalData}
|
|
139
|
-
></hy-dropdown-item>
|
|
140
|
-
`);
|
|
141
|
-
}
|
|
142
|
-
render() {
|
|
143
|
-
return html `
|
|
144
|
-
<slot></slot>
|
|
145
|
-
<div class="dropdown-container" @click-item=${this.onOptionClick}>
|
|
146
|
-
${this.template ? html `${this.show ? this.template : nothing}` : this.display(this.options)}
|
|
147
|
-
</div>
|
|
148
|
-
`;
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
HyDropdownComponent.styles = styles;
|
|
152
|
-
__decorate([
|
|
153
|
-
query('slot')
|
|
154
|
-
], HyDropdownComponent.prototype, "triggerElement", void 0);
|
|
155
|
-
__decorate([
|
|
156
|
-
query('.dropdown-container')
|
|
157
|
-
], HyDropdownComponent.prototype, "dropDownContainer", void 0);
|
|
158
|
-
__decorate([
|
|
159
|
-
property({ type: Array })
|
|
160
|
-
], HyDropdownComponent.prototype, "options", void 0);
|
|
161
|
-
__decorate([
|
|
162
|
-
property({ type: Boolean, reflect: true })
|
|
163
|
-
], HyDropdownComponent.prototype, "show", void 0);
|
|
164
|
-
__decorate([
|
|
165
|
-
property()
|
|
166
|
-
], HyDropdownComponent.prototype, "trigger", void 0);
|
|
167
|
-
__decorate([
|
|
168
|
-
property({ type: Object })
|
|
169
|
-
], HyDropdownComponent.prototype, "template", void 0);
|
|
170
|
-
__decorate([
|
|
171
|
-
property({ type: Boolean, reflect: true })
|
|
172
|
-
], HyDropdownComponent.prototype, "always", void 0);
|
|
173
|
-
__decorate([
|
|
174
|
-
state()
|
|
175
|
-
], HyDropdownComponent.prototype, "isDropDownVisited", void 0);
|
|
176
|
-
__decorate([
|
|
177
|
-
state()
|
|
178
|
-
], HyDropdownComponent.prototype, "dropDownDirection", void 0);
|
|
179
|
-
HyDropdownComponent = __decorate([
|
|
180
|
-
customElement('hy-dropdown')
|
|
181
|
-
], HyDropdownComponent);
|
|
182
|
-
export { HyDropdownComponent };
|
|
183
|
-
//# sourceMappingURL=hy-dropdown.component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hy-dropdown.component.js","sourceRoot":"","sources":["../../../src/components/dropdown/hy-dropdown.component.ts"],"names":[],"mappings":";;;;;;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mB","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { LitElement, TemplateResult, html, nothing } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { styles } from './hy-dropdown.style.js';\nimport { DropDownDirection, IOption, TriggerMode } from './dropdown.types';\nimport './templates/hy-dropdown-item.js';\nimport './templates/hy-dropdown-menu.js';\n\n@customElement('hy-dropdown')\nexport class HyDropdownComponent extends LitElement {\n static override styles = styles;\n\n @query('slot') triggerElement!: HTMLElement;\n @query('.dropdown-container') dropDownContainer!: HTMLElement;\n\n @property({ type: Array }) options!: IOption[];\n @property({ type: Boolean, reflect: true }) show = false;\n @property() trigger = TriggerMode.Click;\n @property({ type: Object }) template!: TemplateResult<1>;\n @property({ type: Boolean, reflect: true }) always = false;\n\n @state() isDropDownVisited = false;\n @state() dropDownDirection = DropDownDirection.Right;\n\n override firstUpdated(): void {\n document.addEventListener('scroll', this.calculatePosition);\n window.addEventListener('resize', this.calculatePosition);\n\n if (this.trigger === TriggerMode.Hover) {\n this.triggerElement.addEventListener('mouseenter', this.onMouseEnterTriggerElement);\n this.triggerElement.addEventListener('mouseleave', this.onMouseLeaveTriggerElement);\n this.dropDownContainer.addEventListener('mouseenter', this.onMouseEnterDropDown);\n this.dropDownContainer.addEventListener('mouseleave', this.onMouseLeaveDropDown);\n } else {\n this.triggerElement.addEventListener('click', this.onTriggerClick);\n window.addEventListener('click', this.onClickOutside);\n }\n }\n\n onTriggerClick = async () => {\n this.show = !this.show;\n await this.updateComplete;\n this.calculatePosition();\n };\n\n calculatePosition = () => {\n const triggerClientRect = this.shadowRoot!.querySelector('slot')!.assignedElements()[0].getBoundingClientRect();\n const dropDownWidth = this.dropDownContainer?.clientWidth;\n const dropDownHeight = this.dropDownContainer?.clientHeight;\n const availableBottomSpace = window.visualViewport!.height - triggerClientRect.bottom;\n const availableRightSpace = window.visualViewport!.width - triggerClientRect.left - triggerClientRect.width;\n const availableLeftSpace = triggerClientRect.right;\n\n this.dropDownContainer.style.position = 'fixed';\n\n if (dropDownHeight > availableBottomSpace) {\n this.dropDownContainer.style.top = `${triggerClientRect.top - dropDownHeight}px`;\n }\n\n if (dropDownWidth > availableRightSpace && dropDownWidth < availableLeftSpace) {\n this.dropDownContainer.style.right = `${availableRightSpace}px`;\n this.dropDownDirection = DropDownDirection.Left;\n } else {\n this.dropDownDirection = DropDownDirection.Right;\n this.dropDownContainer.style.removeProperty('right');\n }\n };\n\n initPosition() {\n this.dropDownContainer.style.removeProperty('top');\n this.dropDownContainer.style.removeProperty('position');\n this.dropDownContainer.style.removeProperty('right');\n }\n\n onClickOutside = (event: Event) => {\n const outsideClick = !event.composedPath().includes(this);\n if (outsideClick && this.show && !this.always) {\n this.show = false;\n this.initPosition();\n }\n };\n\n onMouseEnterTriggerElement = async () => {\n this.show = true;\n await this.updateComplete;\n this.calculatePosition();\n };\n\n onMouseLeaveTriggerElement = () => {\n const waitIsDropDownVisited = 50;\n setTimeout(() => {\n if (!this.isDropDownVisited) this.show = false;\n }, waitIsDropDownVisited);\n };\n\n onMouseEnterDropDown = () => {\n this.isDropDownVisited = true;\n };\n\n onMouseLeaveDropDown = () => {\n this.isDropDownVisited = false;\n this.show = false;\n this.initPosition();\n };\n\n onOptionClick() {\n this.show = false;\n }\n\n override disconnectedCallback() {\n document.removeEventListener('scroll', this.calculatePosition);\n window.removeEventListener('resize', this.calculatePosition);\n\n if (this.trigger === TriggerMode.Hover) {\n this.triggerElement.removeEventListener('mouseenter', this.onMouseEnterTriggerElement);\n this.triggerElement.removeEventListener('mouseleave', this.onMouseLeaveTriggerElement);\n this.dropDownContainer.removeEventListener('mouseenter', this.onMouseEnterDropDown);\n this.dropDownContainer.removeEventListener('mouseleave', this.onMouseLeaveDropDown);\n } else {\n this.triggerElement.removeEventListener('click', this.onTriggerClick);\n window.removeEventListener('click', this.onClickOutside);\n }\n }\n\n display(options: IOption[]): TemplateResult[] {\n return options.map((option) =>\n option.children\n ? html`\n <hy-dropdown-menu\n .direction=${this.dropDownDirection}\n .disabled=${option.disabled}\n .icon=${option.icon}\n .label=${option.label}\n >\n <div class=\"dropdown-container\">${this.display(option.children)}</div>\n </hy-dropdown-menu>\n `\n : html`\n <hy-dropdown-item\n .disabled=${option.disabled}\n .icon=${option.icon}\n .label=${option.label}\n .value=${option.value}\n .additionalData=${option.additionalData}\n ></hy-dropdown-item>\n `\n );\n }\n\n override render() {\n return html`\n <slot></slot>\n <div class=\"dropdown-container\" @click-item=${this.onOptionClick}>\n ${this.template ? html`${this.show ? this.template : nothing}` : this.display(this.options)}\n </div>\n `;\n }\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hy-dropdown.style.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown/hy-dropdown.style.ts"],"names":[],"mappings":"AA8CA,eAAO,MAAM,MAAM,yBAAgB,CAAC"}
|
package/hy-dropdown.style.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { css } from 'lit';
|
|
2
|
-
const dropdownStyle = css `
|
|
3
|
-
.dropdown-container {
|
|
4
|
-
display: none;
|
|
5
|
-
z-index:1;
|
|
6
|
-
border-radius: var(--hybrid-dropdown-border-radius, var(--hybrid-dropdown-border-radius));
|
|
7
|
-
font-family: var(--hybrid-dropdown-font-family, Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "system-ui", "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, SFProLocalRange;);
|
|
8
|
-
}
|
|
9
|
-
:host {
|
|
10
|
-
cursor: pointer;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
:host([show]) .dropdown-container {
|
|
14
|
-
display: block;
|
|
15
|
-
position: absolute;
|
|
16
|
-
width: var(--hybrid-dropdown-width);
|
|
17
|
-
box-shadow: var(--hybrid-dropdown-box-shadow);
|
|
18
|
-
}
|
|
19
|
-
:host {
|
|
20
|
-
--hybrid-icon-color: #5d5d5d;
|
|
21
|
-
--hybrid-dropdown-width: 150px;
|
|
22
|
-
--hybrid-dropdown-box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 3px 10px 0 rgba(0, 0, 0, 0.1);
|
|
23
|
-
--hybrid-dropdown-padding: 10px;
|
|
24
|
-
--hybrid-dropdown-background-color: #f4f4f4;
|
|
25
|
-
--hybrid-dropdown-hovered-background-color: #e4e3e3;
|
|
26
|
-
--hybrid-dropdown-text-color: #000000;
|
|
27
|
-
--hybrid-dropdown-disabled-background-color: #f4f4f4;
|
|
28
|
-
--hybrid-dropdown-disabled-text-color: rgba(0, 0, 0, 0.5);
|
|
29
|
-
--hybrid-dropdown-only-text-padding-left: 18px;
|
|
30
|
-
--hybrid-dropdown-icon-and-text-padding-left: 4px;
|
|
31
|
-
--hybrid-dropdown-menu-children-top: 0px;
|
|
32
|
-
--hybrid-dropdown-menu-children-offset: 0px;
|
|
33
|
-
--hybrid-dropdown-menu-children-z-index: 2;
|
|
34
|
-
--hybrid-dropdown-font-size-local: 13px;
|
|
35
|
-
--hybrid-dropdown-border-radius : 0px;
|
|
36
|
-
}
|
|
37
|
-
@media (prefers-color-scheme: dark) {
|
|
38
|
-
:host {
|
|
39
|
-
--hybrid-dropdown-background-color: #232323;
|
|
40
|
-
--hybrid-dropdown-hovered-background-color: #2b2b2b;
|
|
41
|
-
--hybrid-dropdown-disabled-background-color: #6f6f6f;
|
|
42
|
-
--hybrid-dropdown-text-color: #f4f4f4;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
`;
|
|
46
|
-
export const styles = dropdownStyle;
|
|
47
|
-
//# sourceMappingURL=hy-dropdown.style.js.map
|
package/hy-dropdown.style.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hy-dropdown.style.js","sourceRoot":"","sources":["../../../src/components/dropdown/hy-dropdown.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,aAAa,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CxB,CAAC;AACF,MAAM,CAAC,MAAM,MAAM,GAAG,aAAa,CAAC","sourcesContent":["import { css } from 'lit';\n\nconst dropdownStyle = css`\n .dropdown-container {\n display: none;\n z-index:1;\n border-radius: var(--hybrid-dropdown-border-radius, var(--hybrid-dropdown-border-radius));\n font-family: var(--hybrid-dropdown-font-family, Inter, ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif, \"system-ui\", \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"Noto Sans\", sans-serif, SFProLocalRange;);\n }\n :host {\n cursor: pointer;\n }\n\n :host([show]) .dropdown-container {\n display: block;\n position: absolute;\n width: var(--hybrid-dropdown-width);\n box-shadow: var(--hybrid-dropdown-box-shadow);\n }\n :host {\n --hybrid-icon-color: #5d5d5d;\n --hybrid-dropdown-width: 150px;\n --hybrid-dropdown-box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 3px 10px 0 rgba(0, 0, 0, 0.1);\n --hybrid-dropdown-padding: 10px;\n --hybrid-dropdown-background-color: #f4f4f4;\n --hybrid-dropdown-hovered-background-color: #e4e3e3;\n --hybrid-dropdown-text-color: #000000;\n --hybrid-dropdown-disabled-background-color: #f4f4f4;\n --hybrid-dropdown-disabled-text-color: rgba(0, 0, 0, 0.5);\n --hybrid-dropdown-only-text-padding-left: 18px;\n --hybrid-dropdown-icon-and-text-padding-left: 4px;\n --hybrid-dropdown-menu-children-top: 0px;\n --hybrid-dropdown-menu-children-offset: 0px;\n --hybrid-dropdown-menu-children-z-index: 2;\n --hybrid-dropdown-font-size-local: 13px;\n --hybrid-dropdown-border-radius : 0px;\n }\n @media (prefers-color-scheme: dark) {\n :host {\n --hybrid-dropdown-background-color: #232323;\n --hybrid-dropdown-hovered-background-color: #2b2b2b;\n --hybrid-dropdown-disabled-background-color: #6f6f6f;\n --hybrid-dropdown-text-color: #f4f4f4;\n }\n }\n`;\nexport const styles = dropdownStyle;\n"]}
|
package/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
|
package/react.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown/react.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,mBAAmB,EAAC,MAAM,4BAA4B,CAAC;AAC/D,eAAO,MAAM,UAAU,sEAKrB,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
|
-
export declare class HyDropdownItem extends LitElement {
|
|
3
|
-
static styles: import("lit").CSSResult[];
|
|
4
|
-
icon: string;
|
|
5
|
-
disabled: boolean;
|
|
6
|
-
label: string;
|
|
7
|
-
value: string;
|
|
8
|
-
additionalData: any;
|
|
9
|
-
onClick(clickItemEvent: Event): void;
|
|
10
|
-
render(): import("lit").TemplateResult<1>;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=hy-dropdown-item.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hy-dropdown-item.d.ts","sourceRoot":"","sources":["../../../../src/components/dropdown/templates/hy-dropdown-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAiB,MAAM,KAAK,CAAC;AAIhD,qBACa,cAAe,SAAQ,UAAU;IAC5C,OAAgB,MAAM,4BAAU;IAGhC,IAAI,EAAG,MAAM,CAAC;IAGd,QAAQ,UAAS;IAGjB,KAAK,EAAG,MAAM,CAAC;IAGf,KAAK,EAAG,MAAM,CAAC;IAGf,cAAc,EAAG,GAAG,CAAC;IAErB,OAAO,CAAC,cAAc,EAAE,KAAK;IAepB,MAAM;CAQhB"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { LitElement, html, nothing } from 'lit';
|
|
8
|
-
import { customElement, property } from 'lit/decorators.js';
|
|
9
|
-
import { styles } from './hy-dropdown-item.style.js';
|
|
10
|
-
let HyDropdownItem = class HyDropdownItem extends LitElement {
|
|
11
|
-
constructor() {
|
|
12
|
-
super(...arguments);
|
|
13
|
-
this.disabled = false;
|
|
14
|
-
}
|
|
15
|
-
onClick(clickItemEvent) {
|
|
16
|
-
console.log(this.additionalData, 'clickItemEvent');
|
|
17
|
-
clickItemEvent.stopPropagation();
|
|
18
|
-
if (!this.disabled) {
|
|
19
|
-
this.dispatchEvent(new CustomEvent('click-item', {
|
|
20
|
-
detail: { value: this.value, additionalData: this.additionalData },
|
|
21
|
-
composed: true,
|
|
22
|
-
bubbles: true,
|
|
23
|
-
}));
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
render() {
|
|
27
|
-
return html `
|
|
28
|
-
<div @click=${this.onClick}>
|
|
29
|
-
${this.icon ? html `<hy-icon name=${this.icon}></hy-icon>` : nothing}
|
|
30
|
-
<hy-label class="option-label">${this.label}</hy-label>
|
|
31
|
-
</div>
|
|
32
|
-
`;
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
HyDropdownItem.styles = styles;
|
|
36
|
-
__decorate([
|
|
37
|
-
property({ reflect: true, type: String })
|
|
38
|
-
], HyDropdownItem.prototype, "icon", void 0);
|
|
39
|
-
__decorate([
|
|
40
|
-
property({ reflect: true, type: Boolean })
|
|
41
|
-
], HyDropdownItem.prototype, "disabled", void 0);
|
|
42
|
-
__decorate([
|
|
43
|
-
property()
|
|
44
|
-
], HyDropdownItem.prototype, "label", void 0);
|
|
45
|
-
__decorate([
|
|
46
|
-
property()
|
|
47
|
-
], HyDropdownItem.prototype, "value", void 0);
|
|
48
|
-
__decorate([
|
|
49
|
-
property()
|
|
50
|
-
], HyDropdownItem.prototype, "additionalData", void 0);
|
|
51
|
-
HyDropdownItem = __decorate([
|
|
52
|
-
customElement('hy-dropdown-item')
|
|
53
|
-
], HyDropdownItem);
|
|
54
|
-
export { HyDropdownItem };
|
|
55
|
-
//# sourceMappingURL=hy-dropdown-item.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hy-dropdown-item.js","sourceRoot":"","sources":["../../../../src/components/dropdown/templates/hy-dropdown-item.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAGrD,IAAa,cAAc,GAA3B,MAAa,cAAe,SAAQ,UAAU;IAA9C;;QAOE,aAAQ,GAAG,KAAK,CAAC;IAkCnB,CAAC;IAvBC,OAAO,CAAC,cAAqB;QAC3B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC;QACnD,cAAc,CAAC,eAAe,EAAE,CAAC;QAEjC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,YAAY,EAAE;gBAC5B,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE;gBAClE,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,IAAI;aACd,CAAC,CACH,CAAC;SACH;IACH,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA;oBACK,IAAI,CAAC,OAAO;UACtB,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA,iBAAiB,IAAI,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,OAAO;yCAClC,IAAI,CAAC,KAAK;;KAE9C,CAAC;IACJ,CAAC;CACF,CAAA;AAxCiB,qBAAM,GAAG,MAAO,CAAA;AAGhC;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAC5B;AAGd;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAC1B;AAGjB;IADC,QAAQ,EAAE;6CACI;AAGf;IADC,QAAQ,EAAE;6CACI;AAGf;IADC,QAAQ,EAAE;sDACU;AAhBV,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CAyC1B;SAzCY,cAAc","sourcesContent":["import { LitElement, html, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { styles } from './hy-dropdown-item.style.js';\n\n@customElement('hy-dropdown-item')\nexport class HyDropdownItem extends LitElement {\n static override styles = styles;\n\n @property({ reflect: true, type: String })\n icon!: string;\n\n @property({ reflect: true, type: Boolean })\n disabled = false;\n\n @property()\n label!: string;\n\n @property()\n value!: string;\n\n @property()\n additionalData!: any;\n\n onClick(clickItemEvent: Event) {\n console.log(this.additionalData, 'clickItemEvent');\n clickItemEvent.stopPropagation();\n\n if (!this.disabled) {\n this.dispatchEvent(\n new CustomEvent('click-item', {\n detail: { value: this.value, additionalData: this.additionalData },\n composed: true,\n bubbles: true,\n })\n );\n }\n }\n\n override render() {\n return html`\n <div @click=${this.onClick}>\n ${this.icon ? html`<hy-icon name=${this.icon}></hy-icon>` : nothing}\n <hy-label class=\"option-label\">${this.label}</hy-label>\n </div>\n `;\n }\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hy-dropdown-item.style.d.ts","sourceRoot":"","sources":["../../../../src/components/dropdown/templates/hy-dropdown-item.style.ts"],"names":[],"mappings":"AAkCA,eAAO,MAAM,MAAM,2BAAsB,CAAC"}
|