@paperless/core 0.1.0-alpha.3 → 0.1.0-alpha.30
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 +273 -0
- package/README.md +18 -1
- package/dist/assets/icons/checklist.svg +17 -0
- package/dist/assets/icons/folder.svg +19 -0
- package/dist/assets/icons/integration.svg +17 -0
- package/dist/assets/icons/task.svg +17 -0
- package/dist/assets/icons/template.svg +17 -0
- package/dist/assets/images/avatar/company-default.svg +12 -0
- package/dist/assets/images/avatar/user-default.svg +12 -0
- package/dist/assets/images/helper/helper-hover.svg +15 -0
- package/dist/assets/images/helper/helper.svg +15 -0
- package/dist/build/p-17c11169.entry.js +1 -0
- package/dist/build/p-1d8fa6a1.entry.js +1 -0
- package/dist/build/p-41e5458b.entry.js +1 -0
- package/dist/build/p-42dab9d4.entry.js +1 -0
- package/dist/build/p-47b52f92.entry.js +1 -0
- package/dist/build/p-5ec6ea71.entry.js +1 -0
- package/dist/build/p-75f909ab.entry.js +1 -0
- package/dist/build/p-76464e0b.js +2 -0
- package/dist/build/{p-f04c4de0.entry.js → p-8501ba07.entry.js} +1 -1
- package/dist/build/p-a669807e.entry.js +1 -0
- package/dist/build/p-a7086ffa.js +1 -0
- package/dist/build/p-aa28fef8.entry.js +1 -0
- package/dist/build/p-aae3d4f0.entry.js +1 -0
- package/dist/build/p-adcb0b93.entry.js +1 -0
- package/dist/build/p-bbec0e86.entry.js +1 -0
- package/dist/build/p-d7c82962.entry.js +1 -0
- package/dist/build/p-e7019eab.entry.js +1 -0
- package/dist/build/p-f689996b.entry.js +1 -0
- package/dist/build/p-faa4ee42.entry.js +1 -0
- package/dist/build/paperless.esm.js +1 -1
- package/dist/cjs/{index-a2da05ae.js → index-a46a39a5.js} +88 -2
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/p-avatar.cjs.entry.js +32 -0
- package/dist/cjs/p-button_3.cjs.entry.js +106 -12
- package/dist/cjs/p-counter.cjs.entry.js +19 -0
- package/dist/cjs/p-divider.cjs.entry.js +19 -0
- package/dist/cjs/p-dropdown-menu-container.cjs.entry.js +19 -0
- package/dist/cjs/p-dropdown-menu-item.cjs.entry.js +23 -0
- package/dist/cjs/p-dropdown.cjs.entry.js +131 -0
- package/dist/cjs/p-helper.cjs.entry.js +19 -0
- package/dist/cjs/p-illustration.cjs.entry.js +9 -12
- package/dist/cjs/p-info-panel.cjs.entry.js +31 -0
- package/dist/cjs/p-navigation-item.cjs.entry.js +23 -0
- package/dist/cjs/p-pagination-item.cjs.entry.js +23 -0
- package/dist/cjs/p-pagination.cjs.entry.js +171 -0
- package/dist/cjs/p-segment-container.cjs.entry.js +19 -0
- package/dist/cjs/p-segment-item.cjs.entry.js +29 -0
- package/dist/cjs/p-status.cjs.entry.js +49 -0
- package/dist/cjs/p-tooltip.cjs.entry.js +75 -1811
- package/dist/cjs/paperless.cjs.js +2 -2
- package/dist/cjs/popper-e0c4ed4c.js +1790 -0
- package/dist/collection/assets/icons/checklist.svg +17 -0
- package/dist/collection/assets/icons/folder.svg +19 -0
- package/dist/collection/assets/icons/integration.svg +17 -0
- package/dist/collection/assets/icons/task.svg +17 -0
- package/dist/collection/assets/icons/template.svg +17 -0
- package/dist/collection/assets/images/avatar/company-default.svg +12 -0
- package/dist/collection/assets/images/avatar/user-default.svg +12 -0
- package/dist/collection/assets/images/helper/helper-hover.svg +15 -0
- package/dist/collection/assets/images/helper/helper.svg +15 -0
- package/dist/collection/collection-manifest.json +15 -1
- package/dist/collection/components/atoms/avatar/avatar.component.css +31 -0
- package/dist/collection/components/atoms/avatar/avatar.component.js +105 -0
- package/dist/collection/components/atoms/button/button.component.css +24 -0
- package/dist/collection/components/atoms/button/button.component.js +5 -5
- package/dist/collection/components/atoms/counter/counter.component.css +5 -0
- package/dist/collection/components/atoms/counter/counter.component.js +15 -0
- package/dist/collection/components/atoms/divider/divider.component.css +3 -0
- package/dist/collection/components/atoms/divider/divider.component.js +14 -0
- package/dist/collection/components/atoms/dropdown-menu-container/dropdown-menu-container.component.css +5 -0
- package/dist/collection/components/atoms/dropdown-menu-container/dropdown-menu-container.component.js +14 -0
- package/dist/collection/components/atoms/dropdown-menu-item/dropdown-menu-item.component.css +13 -0
- package/dist/collection/components/atoms/dropdown-menu-item/dropdown-menu-item.component.js +41 -0
- package/dist/collection/components/atoms/helper/helper.component.css +7 -0
- package/dist/collection/components/atoms/helper/helper.component.js +18 -0
- package/dist/collection/components/atoms/icon/icon.component.js +3 -8
- package/dist/collection/components/atoms/illustration/illustration.component.js +2 -9
- package/dist/collection/components/atoms/info-panel/info-panel.component.css +28 -0
- package/dist/collection/components/atoms/info-panel/info-panel.component.js +106 -0
- package/dist/collection/components/atoms/loader/loader.component.css +1 -1
- package/dist/collection/components/atoms/loader/loader.component.js +4 -3
- package/dist/collection/components/atoms/pagination-item/pagination-item.component.css +16 -0
- package/dist/collection/components/atoms/pagination-item/pagination-item.component.js +41 -0
- package/dist/collection/components/atoms/segment-container/segment-container.component.css +5 -0
- package/dist/collection/components/atoms/segment-container/segment-container.component.js +14 -0
- package/dist/collection/components/atoms/segment-item/segment-item.component.css +21 -0
- package/dist/collection/components/atoms/segment-item/segment-item.component.js +107 -0
- package/dist/collection/components/atoms/status/status.component.css +16 -0
- package/dist/collection/components/atoms/status/status.component.js +128 -0
- package/dist/collection/components/atoms/tooltip/tooltip.component.css +18 -12
- package/dist/collection/components/atoms/tooltip/tooltip.component.js +133 -35
- package/dist/collection/components/molecules/dropdown/dropdown.component.css +9 -0
- package/dist/collection/components/molecules/dropdown/dropdown.component.js +223 -0
- package/dist/collection/components/molecules/navigation-item/navigation-item.component.css +28 -0
- package/dist/collection/components/molecules/navigation-item/navigation-item.component.js +118 -0
- package/dist/collection/components/molecules/pagination/pagination.component.css +3 -0
- package/dist/collection/components/molecules/pagination/pagination.component.js +242 -0
- package/dist/collection/tailwind/border-radius.js +8 -6
- package/dist/collection/tailwind/grid.js +24 -4
- package/dist/collection/tailwind.config.js +1 -1
- package/dist/collection/utils/child-of.js +5 -0
- package/dist/collection/utils/icons.js +10 -0
- package/dist/components/counter.component.js +30 -0
- package/dist/components/dropdown-menu-container.component.js +29 -0
- package/dist/components/icon.component.js +97 -4
- package/dist/components/index.d.ts +14 -0
- package/dist/components/index.js +14 -0
- package/dist/components/loader.component.js +5 -4
- package/dist/components/p-avatar.d.ts +11 -0
- package/dist/components/p-avatar.js +52 -0
- package/dist/components/p-button.js +3 -3
- package/dist/components/p-counter.d.ts +11 -0
- package/dist/components/p-counter.js +6 -0
- package/dist/components/p-divider.d.ts +11 -0
- package/dist/components/p-divider.js +33 -0
- package/dist/components/p-dropdown-menu-container.d.ts +11 -0
- package/dist/components/p-dropdown-menu-container.js +6 -0
- package/dist/components/p-dropdown-menu-item.d.ts +11 -0
- package/dist/components/p-dropdown-menu-item.js +39 -0
- package/dist/components/p-dropdown.d.ts +11 -0
- package/dist/components/p-dropdown.js +156 -0
- package/dist/components/p-helper.d.ts +11 -0
- package/dist/components/p-helper.js +39 -0
- package/dist/components/p-illustration.js +0 -4
- package/dist/components/p-info-panel.d.ts +11 -0
- package/dist/components/p-info-panel.js +56 -0
- package/dist/components/p-navigation-item.d.ts +11 -0
- package/dist/components/p-navigation-item.js +55 -0
- package/dist/components/p-pagination-item.d.ts +11 -0
- package/dist/components/p-pagination-item.js +6 -0
- package/dist/components/p-pagination.d.ts +11 -0
- package/dist/components/p-pagination.js +200 -0
- package/dist/components/p-segment-container.d.ts +11 -0
- package/dist/components/p-segment-container.js +32 -0
- package/dist/components/p-segment-item.d.ts +11 -0
- package/dist/components/p-segment-item.js +54 -0
- package/dist/components/p-status.d.ts +11 -0
- package/dist/components/p-status.js +73 -0
- package/dist/components/p-tooltip.js +1 -1886
- package/dist/components/pagination-item.component.js +36 -0
- package/dist/components/popper.js +1788 -0
- package/dist/components/tooltip.component.js +154 -0
- package/dist/esm/{index-d08bfe75.js → index-a68e547b.js} +88 -2
- package/dist/esm/loader.js +2 -2
- package/dist/esm/p-avatar.entry.js +28 -0
- package/dist/esm/p-button_3.entry.js +106 -12
- package/dist/esm/p-counter.entry.js +15 -0
- package/dist/esm/p-divider.entry.js +15 -0
- package/dist/esm/p-dropdown-menu-container.entry.js +15 -0
- package/dist/esm/p-dropdown-menu-item.entry.js +19 -0
- package/dist/esm/p-dropdown.entry.js +127 -0
- package/dist/esm/p-helper.entry.js +15 -0
- package/dist/esm/p-illustration.entry.js +9 -12
- package/dist/esm/p-info-panel.entry.js +27 -0
- package/dist/esm/p-navigation-item.entry.js +19 -0
- package/dist/esm/p-pagination-item.entry.js +19 -0
- package/dist/esm/p-pagination.entry.js +167 -0
- package/dist/esm/p-segment-container.entry.js +15 -0
- package/dist/esm/p-segment-item.entry.js +25 -0
- package/dist/esm/p-status.entry.js +45 -0
- package/dist/esm/p-tooltip.entry.js +75 -1811
- package/dist/esm/paperless.js +2 -2
- package/dist/esm/popper-41c6f9cd.js +1788 -0
- package/dist/index.html +1 -1
- package/dist/paperless/p-17c11169.entry.js +1 -0
- package/dist/paperless/p-1d8fa6a1.entry.js +1 -0
- package/dist/paperless/p-41e5458b.entry.js +1 -0
- package/dist/paperless/p-42dab9d4.entry.js +1 -0
- package/dist/paperless/p-47b52f92.entry.js +1 -0
- package/dist/paperless/p-5ec6ea71.entry.js +1 -0
- package/dist/paperless/p-75f909ab.entry.js +1 -0
- package/dist/paperless/p-76464e0b.js +2 -0
- package/dist/paperless/{p-f04c4de0.entry.js → p-8501ba07.entry.js} +1 -1
- package/dist/paperless/p-a669807e.entry.js +1 -0
- package/dist/paperless/p-a7086ffa.js +1 -0
- package/dist/paperless/p-aa28fef8.entry.js +1 -0
- package/dist/paperless/p-aae3d4f0.entry.js +1 -0
- package/dist/paperless/p-adcb0b93.entry.js +1 -0
- package/dist/paperless/p-bbec0e86.entry.js +1 -0
- package/dist/paperless/p-d7c82962.entry.js +1 -0
- package/dist/paperless/p-e7019eab.entry.js +1 -0
- package/dist/paperless/p-f689996b.entry.js +1 -0
- package/dist/paperless/p-faa4ee42.entry.js +1 -0
- package/dist/paperless/paperless.css +136 -0
- package/dist/paperless/paperless.esm.js +1 -1
- package/dist/sw.js +421 -37
- package/dist/tailwind.config.js +1 -1
- package/dist/types/components/atoms/avatar/avatar.component.d.ts +21 -0
- package/dist/types/components/atoms/button/button.component.d.ts +2 -2
- package/dist/types/components/atoms/counter/counter.component.d.ts +3 -0
- package/dist/types/components/atoms/divider/divider.component.d.ts +3 -0
- package/dist/types/components/atoms/dropdown-menu-container/dropdown-menu-container.component.d.ts +3 -0
- package/dist/types/components/atoms/dropdown-menu-item/dropdown-menu-item.component.d.ts +7 -0
- package/dist/types/components/atoms/helper/helper.component.d.ts +3 -0
- package/dist/types/components/atoms/info-panel/info-panel.component.d.ts +24 -0
- package/dist/types/components/atoms/pagination-item/pagination-item.component.d.ts +7 -0
- package/dist/types/components/atoms/segment-container/segment-container.component.d.ts +3 -0
- package/dist/types/components/atoms/segment-item/segment-item.component.d.ts +21 -0
- package/dist/types/components/atoms/status/status.component.d.ts +22 -0
- package/dist/types/components/atoms/tooltip/tooltip.component.d.ts +20 -8
- package/dist/types/components/molecules/dropdown/dropdown.component.d.ts +41 -0
- package/dist/types/components/molecules/navigation-item/navigation-item.component.d.ts +24 -0
- package/dist/types/components/molecules/pagination/pagination.component.d.ts +28 -0
- package/dist/types/components.d.ts +467 -16
- package/dist/types/utils/child-of.d.ts +1 -0
- package/dist/types/utils/icons.d.ts +5 -0
- package/package.json +1 -1
- package/dist/build/p-4144f8a0.entry.js +0 -1
- package/dist/build/p-8538576c.entry.js +0 -1
- package/dist/build/p-f33e1285.js +0 -2
- package/dist/paperless/p-4144f8a0.entry.js +0 -1
- package/dist/paperless/p-8538576c.entry.js +0 -1
- package/dist/paperless/p-f33e1285.js +0 -2
|
@@ -3,60 +3,104 @@ import { Component, Element, h, Host, Listen, Prop } from '@stencil/core';
|
|
|
3
3
|
export class Tooltip {
|
|
4
4
|
constructor() {
|
|
5
5
|
/**
|
|
6
|
-
* The
|
|
6
|
+
* The variant of the popover
|
|
7
7
|
*/
|
|
8
|
-
this.
|
|
8
|
+
this.variant = 'hover';
|
|
9
9
|
/**
|
|
10
|
-
* The content of the
|
|
10
|
+
* The content of the popover
|
|
11
|
+
*/
|
|
12
|
+
this.popover = null;
|
|
13
|
+
/**
|
|
14
|
+
* The content of the popover
|
|
11
15
|
*/
|
|
12
16
|
this.placement = 'top';
|
|
13
17
|
/**
|
|
14
|
-
* Wether to
|
|
18
|
+
* Wether to show the popover
|
|
19
|
+
*/
|
|
20
|
+
this.show = false;
|
|
21
|
+
/**
|
|
22
|
+
* Wether to someone can manually close the popover
|
|
15
23
|
*/
|
|
16
|
-
this.
|
|
24
|
+
this.canManuallyClose = true;
|
|
17
25
|
this._loaded = false;
|
|
18
26
|
}
|
|
19
27
|
componentShouldUpdate() {
|
|
20
28
|
this._setOptions();
|
|
21
|
-
if (this.
|
|
29
|
+
if (this._loaded && this.show) {
|
|
22
30
|
this._show();
|
|
23
31
|
}
|
|
24
32
|
}
|
|
25
33
|
render() {
|
|
26
|
-
return (h(Host, { class: "p-
|
|
27
|
-
h("slot",
|
|
28
|
-
h("div", { class:
|
|
29
|
-
this.
|
|
34
|
+
return (h(Host, { class: "p-popover" },
|
|
35
|
+
h("slot", { name: "content" }),
|
|
36
|
+
h("div", { class: `popover variant-${this.variant}`, role: "popover", ref: (el) => this._load(el) },
|
|
37
|
+
this.popover ? this.popover : h("slot", { name: "popover" }),
|
|
30
38
|
h("div", { class: "arrow", "data-popper-arrow": true }))));
|
|
31
39
|
}
|
|
40
|
+
clickHandler() {
|
|
41
|
+
if (this.variant !== 'click') {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (this._popover.hasAttribute('data-show')) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
this._show();
|
|
48
|
+
}
|
|
49
|
+
documentClickHandler() {
|
|
50
|
+
if (this.variant !== 'click' || !this.canManuallyClose) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (!this._popover.hasAttribute('data-show')) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
this._hide();
|
|
57
|
+
}
|
|
58
|
+
mouseEnterHandler() {
|
|
59
|
+
if (this.variant !== 'hover') {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
this._show();
|
|
63
|
+
}
|
|
64
|
+
mouseLeaveHandler() {
|
|
65
|
+
if (this.show || this.variant !== 'hover') {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
this._hide();
|
|
69
|
+
}
|
|
32
70
|
_show() {
|
|
33
71
|
if (!this._loaded) {
|
|
34
72
|
return;
|
|
35
73
|
}
|
|
36
|
-
// Make the
|
|
37
|
-
this.
|
|
74
|
+
// Make the popover visible
|
|
75
|
+
this._popover.setAttribute('data-show', '');
|
|
38
76
|
// Enable the event listeners
|
|
39
|
-
this._popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [
|
|
77
|
+
this._popper.setOptions((options) => (Object.assign(Object.assign({}, options), { modifiers: [
|
|
78
|
+
...options.modifiers,
|
|
79
|
+
{ name: 'eventListeners', enabled: true },
|
|
80
|
+
] })));
|
|
40
81
|
// Update its position
|
|
41
82
|
this._popper.update();
|
|
42
83
|
}
|
|
43
84
|
_hide() {
|
|
44
|
-
if (!this._loaded
|
|
85
|
+
if (!this._loaded) {
|
|
45
86
|
return;
|
|
46
87
|
}
|
|
47
|
-
// Hide the
|
|
48
|
-
this.
|
|
88
|
+
// Hide the popover
|
|
89
|
+
this._popover.removeAttribute('data-show');
|
|
49
90
|
// Disable the event listeners
|
|
50
|
-
this._popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [
|
|
91
|
+
this._popper.setOptions((options) => (Object.assign(Object.assign({}, options), { modifiers: [
|
|
92
|
+
...options.modifiers,
|
|
93
|
+
{ name: 'eventListeners', enabled: false },
|
|
94
|
+
] })));
|
|
51
95
|
}
|
|
52
|
-
_load(
|
|
53
|
-
this.
|
|
54
|
-
if (
|
|
55
|
-
this._popper = createPopper(this._el,
|
|
96
|
+
_load(popover) {
|
|
97
|
+
this._popover = popover;
|
|
98
|
+
if (popover) {
|
|
99
|
+
this._popper = createPopper(this._el, popover);
|
|
56
100
|
this._setOptions();
|
|
57
101
|
this._loaded = true;
|
|
58
|
-
if (this.
|
|
59
|
-
this._show();
|
|
102
|
+
if (this.show) {
|
|
103
|
+
setTimeout(() => this._show(), 100);
|
|
60
104
|
}
|
|
61
105
|
}
|
|
62
106
|
}
|
|
@@ -65,7 +109,7 @@ export class Tooltip {
|
|
|
65
109
|
return;
|
|
66
110
|
}
|
|
67
111
|
this._popper.setOptions({
|
|
68
|
-
placement: this.placement,
|
|
112
|
+
placement: this.variant === 'error' ? 'bottom-start' : this.placement,
|
|
69
113
|
modifiers: [
|
|
70
114
|
{
|
|
71
115
|
name: 'offset',
|
|
@@ -73,6 +117,12 @@ export class Tooltip {
|
|
|
73
117
|
offset: [0, 8],
|
|
74
118
|
},
|
|
75
119
|
},
|
|
120
|
+
{
|
|
121
|
+
name: 'arrow',
|
|
122
|
+
options: {
|
|
123
|
+
padding: 4,
|
|
124
|
+
},
|
|
125
|
+
},
|
|
76
126
|
],
|
|
77
127
|
});
|
|
78
128
|
}
|
|
@@ -85,7 +135,25 @@ export class Tooltip {
|
|
|
85
135
|
"$": ["tooltip.component.css"]
|
|
86
136
|
}; }
|
|
87
137
|
static get properties() { return {
|
|
88
|
-
"
|
|
138
|
+
"variant": {
|
|
139
|
+
"type": "string",
|
|
140
|
+
"mutable": false,
|
|
141
|
+
"complexType": {
|
|
142
|
+
"original": "'hover' | 'click' | 'error'",
|
|
143
|
+
"resolved": "\"click\" | \"error\" | \"hover\"",
|
|
144
|
+
"references": {}
|
|
145
|
+
},
|
|
146
|
+
"required": false,
|
|
147
|
+
"optional": false,
|
|
148
|
+
"docs": {
|
|
149
|
+
"tags": [],
|
|
150
|
+
"text": "The variant of the popover"
|
|
151
|
+
},
|
|
152
|
+
"attribute": "variant",
|
|
153
|
+
"reflect": false,
|
|
154
|
+
"defaultValue": "'hover'"
|
|
155
|
+
},
|
|
156
|
+
"popover": {
|
|
89
157
|
"type": "any",
|
|
90
158
|
"mutable": false,
|
|
91
159
|
"complexType": {
|
|
@@ -97,9 +165,9 @@ export class Tooltip {
|
|
|
97
165
|
"optional": false,
|
|
98
166
|
"docs": {
|
|
99
167
|
"tags": [],
|
|
100
|
-
"text": "The content of the
|
|
168
|
+
"text": "The content of the popover"
|
|
101
169
|
},
|
|
102
|
-
"attribute": "
|
|
170
|
+
"attribute": "popover",
|
|
103
171
|
"reflect": false,
|
|
104
172
|
"defaultValue": "null"
|
|
105
173
|
},
|
|
@@ -120,13 +188,13 @@ export class Tooltip {
|
|
|
120
188
|
"optional": false,
|
|
121
189
|
"docs": {
|
|
122
190
|
"tags": [],
|
|
123
|
-
"text": "The content of the
|
|
191
|
+
"text": "The content of the popover"
|
|
124
192
|
},
|
|
125
193
|
"attribute": "placement",
|
|
126
194
|
"reflect": false,
|
|
127
195
|
"defaultValue": "'top'"
|
|
128
196
|
},
|
|
129
|
-
"
|
|
197
|
+
"show": {
|
|
130
198
|
"type": "boolean",
|
|
131
199
|
"mutable": false,
|
|
132
200
|
"complexType": {
|
|
@@ -138,35 +206,65 @@ export class Tooltip {
|
|
|
138
206
|
"optional": false,
|
|
139
207
|
"docs": {
|
|
140
208
|
"tags": [],
|
|
141
|
-
"text": "Wether to
|
|
209
|
+
"text": "Wether to show the popover"
|
|
142
210
|
},
|
|
143
|
-
"attribute": "
|
|
211
|
+
"attribute": "show",
|
|
144
212
|
"reflect": false,
|
|
145
213
|
"defaultValue": "false"
|
|
214
|
+
},
|
|
215
|
+
"canManuallyClose": {
|
|
216
|
+
"type": "boolean",
|
|
217
|
+
"mutable": false,
|
|
218
|
+
"complexType": {
|
|
219
|
+
"original": "boolean",
|
|
220
|
+
"resolved": "boolean",
|
|
221
|
+
"references": {}
|
|
222
|
+
},
|
|
223
|
+
"required": false,
|
|
224
|
+
"optional": false,
|
|
225
|
+
"docs": {
|
|
226
|
+
"tags": [],
|
|
227
|
+
"text": "Wether to someone can manually close the popover"
|
|
228
|
+
},
|
|
229
|
+
"attribute": "can-manually-close",
|
|
230
|
+
"reflect": false,
|
|
231
|
+
"defaultValue": "true"
|
|
146
232
|
}
|
|
147
233
|
}; }
|
|
148
234
|
static get elementRef() { return "_el"; }
|
|
149
235
|
static get listeners() { return [{
|
|
236
|
+
"name": "click",
|
|
237
|
+
"method": "clickHandler",
|
|
238
|
+
"target": undefined,
|
|
239
|
+
"capture": true,
|
|
240
|
+
"passive": false
|
|
241
|
+
}, {
|
|
242
|
+
"name": "click",
|
|
243
|
+
"method": "documentClickHandler",
|
|
244
|
+
"target": "document",
|
|
245
|
+
"capture": true,
|
|
246
|
+
"passive": false
|
|
247
|
+
}, {
|
|
150
248
|
"name": "mouseenter",
|
|
151
|
-
"method": "
|
|
249
|
+
"method": "mouseEnterHandler",
|
|
152
250
|
"target": undefined,
|
|
153
251
|
"capture": false,
|
|
154
252
|
"passive": true
|
|
155
253
|
}, {
|
|
156
254
|
"name": "focus",
|
|
157
|
-
"method": "
|
|
255
|
+
"method": "mouseEnterHandler",
|
|
158
256
|
"target": undefined,
|
|
159
257
|
"capture": false,
|
|
160
258
|
"passive": false
|
|
161
259
|
}, {
|
|
162
260
|
"name": "mouseleave",
|
|
163
|
-
"method": "
|
|
261
|
+
"method": "mouseLeaveHandler",
|
|
164
262
|
"target": undefined,
|
|
165
263
|
"capture": false,
|
|
166
264
|
"passive": true
|
|
167
265
|
}, {
|
|
168
266
|
"name": "blur",
|
|
169
|
-
"method": "
|
|
267
|
+
"method": "mouseLeaveHandler",
|
|
170
268
|
"target": undefined,
|
|
171
269
|
"capture": false,
|
|
172
270
|
"passive": false
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { createPopper } from '@popperjs/core';
|
|
2
|
+
import { Component, Element, Event, h, Host, Listen, Prop, } from '@stencil/core';
|
|
3
|
+
import { childOf } from '../../../utils/child-of';
|
|
4
|
+
export class Dropdown {
|
|
5
|
+
constructor() {
|
|
6
|
+
/**
|
|
7
|
+
* The content of the dropdown menu
|
|
8
|
+
*/
|
|
9
|
+
this.placement = 'bottom';
|
|
10
|
+
/**
|
|
11
|
+
* Wether to show the dropdown menu
|
|
12
|
+
*/
|
|
13
|
+
this.show = false;
|
|
14
|
+
/**
|
|
15
|
+
* Wether to automatically close the dropdown menu after clicking inside
|
|
16
|
+
*/
|
|
17
|
+
this.insideClick = false;
|
|
18
|
+
/**
|
|
19
|
+
* Wether to automatically close the dropdown menu after clicking inside
|
|
20
|
+
*/
|
|
21
|
+
this.disableTriggerClick = false;
|
|
22
|
+
this._loaded = false;
|
|
23
|
+
}
|
|
24
|
+
componentShouldUpdate() {
|
|
25
|
+
this._setOptions();
|
|
26
|
+
if (this._loaded && this.show) {
|
|
27
|
+
this._show();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
render() {
|
|
31
|
+
return (h(Host, { class: "p-dropdown" },
|
|
32
|
+
h("div", { class: "trigger", onClick: () => this._triggerClickHandler() },
|
|
33
|
+
h("slot", { name: "trigger" })),
|
|
34
|
+
h("p-dropdown-menu-container", { role: "popover", ref: (el) => this._load(el), onClick: () => this._containerClickHandler() },
|
|
35
|
+
h("slot", { name: "items" }))));
|
|
36
|
+
}
|
|
37
|
+
_containerClickHandler() {
|
|
38
|
+
if (this.insideClick) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (this._menu.hasAttribute('data-show')) {
|
|
42
|
+
this._hide();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
_triggerClickHandler() {
|
|
46
|
+
if (this.disableTriggerClick) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (this._menu.hasAttribute('data-show')) {
|
|
50
|
+
this._hide();
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
this._show();
|
|
54
|
+
}
|
|
55
|
+
documentClickHandler({ target }) {
|
|
56
|
+
if (!this._menu.hasAttribute('data-show') ||
|
|
57
|
+
childOf(target, this._el)) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
this._hide();
|
|
61
|
+
}
|
|
62
|
+
_load(popover) {
|
|
63
|
+
this._menu = popover;
|
|
64
|
+
if (popover) {
|
|
65
|
+
this._popper = createPopper(this._el, popover);
|
|
66
|
+
this._setOptions();
|
|
67
|
+
this._loaded = true;
|
|
68
|
+
if (this.show) {
|
|
69
|
+
setTimeout(() => this._show(), 100);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
_setOptions() {
|
|
74
|
+
if (!this._popper) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
this._popper.setOptions({
|
|
78
|
+
placement: `${this.placement}-start`,
|
|
79
|
+
modifiers: [
|
|
80
|
+
{
|
|
81
|
+
name: 'offset',
|
|
82
|
+
options: {
|
|
83
|
+
offset: [0, 8],
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
_show() {
|
|
90
|
+
if (!this._loaded) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
// Make the popover visible
|
|
94
|
+
this._menu.setAttribute('data-show', '');
|
|
95
|
+
this.isOpen.emit(true);
|
|
96
|
+
// Enable the event listeners
|
|
97
|
+
this._popper.setOptions((options) => (Object.assign(Object.assign({}, options), { modifiers: [
|
|
98
|
+
...options.modifiers,
|
|
99
|
+
{ name: 'eventListeners', enabled: true },
|
|
100
|
+
] })));
|
|
101
|
+
// Update its position
|
|
102
|
+
this._popper.update();
|
|
103
|
+
}
|
|
104
|
+
_hide() {
|
|
105
|
+
if (!this._loaded || this.show) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
// Hide the popover
|
|
109
|
+
this._menu.removeAttribute('data-show');
|
|
110
|
+
this.isOpen.emit(false);
|
|
111
|
+
// Disable the event listeners
|
|
112
|
+
this._popper.setOptions((options) => (Object.assign(Object.assign({}, options), { modifiers: [
|
|
113
|
+
...options.modifiers,
|
|
114
|
+
{ name: 'eventListeners', enabled: false },
|
|
115
|
+
] })));
|
|
116
|
+
}
|
|
117
|
+
static get is() { return "p-dropdown"; }
|
|
118
|
+
static get encapsulation() { return "shadow"; }
|
|
119
|
+
static get originalStyleUrls() { return {
|
|
120
|
+
"$": ["dropdown.component.scss"]
|
|
121
|
+
}; }
|
|
122
|
+
static get styleUrls() { return {
|
|
123
|
+
"$": ["dropdown.component.css"]
|
|
124
|
+
}; }
|
|
125
|
+
static get properties() { return {
|
|
126
|
+
"placement": {
|
|
127
|
+
"type": "string",
|
|
128
|
+
"mutable": false,
|
|
129
|
+
"complexType": {
|
|
130
|
+
"original": "'bottom' | 'top'",
|
|
131
|
+
"resolved": "\"bottom\" | \"top\"",
|
|
132
|
+
"references": {}
|
|
133
|
+
},
|
|
134
|
+
"required": false,
|
|
135
|
+
"optional": false,
|
|
136
|
+
"docs": {
|
|
137
|
+
"tags": [],
|
|
138
|
+
"text": "The content of the dropdown menu"
|
|
139
|
+
},
|
|
140
|
+
"attribute": "placement",
|
|
141
|
+
"reflect": false,
|
|
142
|
+
"defaultValue": "'bottom'"
|
|
143
|
+
},
|
|
144
|
+
"show": {
|
|
145
|
+
"type": "boolean",
|
|
146
|
+
"mutable": false,
|
|
147
|
+
"complexType": {
|
|
148
|
+
"original": "boolean",
|
|
149
|
+
"resolved": "boolean",
|
|
150
|
+
"references": {}
|
|
151
|
+
},
|
|
152
|
+
"required": false,
|
|
153
|
+
"optional": false,
|
|
154
|
+
"docs": {
|
|
155
|
+
"tags": [],
|
|
156
|
+
"text": "Wether to show the dropdown menu"
|
|
157
|
+
},
|
|
158
|
+
"attribute": "show",
|
|
159
|
+
"reflect": false,
|
|
160
|
+
"defaultValue": "false"
|
|
161
|
+
},
|
|
162
|
+
"insideClick": {
|
|
163
|
+
"type": "boolean",
|
|
164
|
+
"mutable": false,
|
|
165
|
+
"complexType": {
|
|
166
|
+
"original": "boolean",
|
|
167
|
+
"resolved": "boolean",
|
|
168
|
+
"references": {}
|
|
169
|
+
},
|
|
170
|
+
"required": false,
|
|
171
|
+
"optional": false,
|
|
172
|
+
"docs": {
|
|
173
|
+
"tags": [],
|
|
174
|
+
"text": "Wether to automatically close the dropdown menu after clicking inside"
|
|
175
|
+
},
|
|
176
|
+
"attribute": "inside-click",
|
|
177
|
+
"reflect": false,
|
|
178
|
+
"defaultValue": "false"
|
|
179
|
+
},
|
|
180
|
+
"disableTriggerClick": {
|
|
181
|
+
"type": "boolean",
|
|
182
|
+
"mutable": false,
|
|
183
|
+
"complexType": {
|
|
184
|
+
"original": "boolean",
|
|
185
|
+
"resolved": "boolean",
|
|
186
|
+
"references": {}
|
|
187
|
+
},
|
|
188
|
+
"required": false,
|
|
189
|
+
"optional": false,
|
|
190
|
+
"docs": {
|
|
191
|
+
"tags": [],
|
|
192
|
+
"text": "Wether to automatically close the dropdown menu after clicking inside"
|
|
193
|
+
},
|
|
194
|
+
"attribute": "disable-trigger-click",
|
|
195
|
+
"reflect": false,
|
|
196
|
+
"defaultValue": "false"
|
|
197
|
+
}
|
|
198
|
+
}; }
|
|
199
|
+
static get events() { return [{
|
|
200
|
+
"method": "isOpen",
|
|
201
|
+
"name": "isOpen",
|
|
202
|
+
"bubbles": true,
|
|
203
|
+
"cancelable": true,
|
|
204
|
+
"composed": true,
|
|
205
|
+
"docs": {
|
|
206
|
+
"tags": [],
|
|
207
|
+
"text": "Open change event"
|
|
208
|
+
},
|
|
209
|
+
"complexType": {
|
|
210
|
+
"original": "boolean",
|
|
211
|
+
"resolved": "boolean",
|
|
212
|
+
"references": {}
|
|
213
|
+
}
|
|
214
|
+
}]; }
|
|
215
|
+
static get elementRef() { return "_el"; }
|
|
216
|
+
static get listeners() { return [{
|
|
217
|
+
"name": "click",
|
|
218
|
+
"method": "documentClickHandler",
|
|
219
|
+
"target": "document",
|
|
220
|
+
"capture": true,
|
|
221
|
+
"passive": false
|
|
222
|
+
}]; }
|
|
223
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
@apply w-full inline-block mb-1;
|
|
3
|
+
}
|
|
4
|
+
:host > a {
|
|
5
|
+
@apply w-full h-8 px-2 cursor-pointer rounded-large;
|
|
6
|
+
@apply flex items-center;
|
|
7
|
+
@apply text-storm-medium font-medium;
|
|
8
|
+
@apply hover:bg-indigo-light hover:text-storm-dark;
|
|
9
|
+
}
|
|
10
|
+
:host > a > p-icon {
|
|
11
|
+
@apply text-mystic-dark mr-3;
|
|
12
|
+
}
|
|
13
|
+
:host > a > p-counter {
|
|
14
|
+
@apply ml-auto;
|
|
15
|
+
}
|
|
16
|
+
:host > a > span.has-counter {
|
|
17
|
+
@apply mr-3;
|
|
18
|
+
}
|
|
19
|
+
:host > a:hover > p-icon {
|
|
20
|
+
@apply text-storm-vague;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
:host(.active) > a {
|
|
24
|
+
@apply text-indigo bg-indigo-light;
|
|
25
|
+
}
|
|
26
|
+
:host(.active) > a > p-icon {
|
|
27
|
+
@apply text-indigo;
|
|
28
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { Component, h, Host, Prop } from '@stencil/core';
|
|
2
|
+
export class NavigationItem {
|
|
3
|
+
constructor() {
|
|
4
|
+
/**
|
|
5
|
+
* Wether the navigation item is active
|
|
6
|
+
*/
|
|
7
|
+
this.active = false;
|
|
8
|
+
}
|
|
9
|
+
render() {
|
|
10
|
+
return (h(Host, { class: `p-navigation-item ${this.active && 'active'}` },
|
|
11
|
+
h("a", { href: this.href, target: this.target },
|
|
12
|
+
this.icon && h("p-icon", { variant: this.icon }),
|
|
13
|
+
h("span", { class: this.counter && 'has-counter' },
|
|
14
|
+
h("slot", null)),
|
|
15
|
+
this.counter && h("p-counter", null, this.counter))));
|
|
16
|
+
}
|
|
17
|
+
static get is() { return "p-navigation-item"; }
|
|
18
|
+
static get encapsulation() { return "shadow"; }
|
|
19
|
+
static get originalStyleUrls() { return {
|
|
20
|
+
"$": ["navigation-item.component.scss"]
|
|
21
|
+
}; }
|
|
22
|
+
static get styleUrls() { return {
|
|
23
|
+
"$": ["navigation-item.component.css"]
|
|
24
|
+
}; }
|
|
25
|
+
static get properties() { return {
|
|
26
|
+
"active": {
|
|
27
|
+
"type": "boolean",
|
|
28
|
+
"mutable": false,
|
|
29
|
+
"complexType": {
|
|
30
|
+
"original": "boolean",
|
|
31
|
+
"resolved": "boolean",
|
|
32
|
+
"references": {}
|
|
33
|
+
},
|
|
34
|
+
"required": false,
|
|
35
|
+
"optional": false,
|
|
36
|
+
"docs": {
|
|
37
|
+
"tags": [],
|
|
38
|
+
"text": "Wether the navigation item is active"
|
|
39
|
+
},
|
|
40
|
+
"attribute": "active",
|
|
41
|
+
"reflect": false,
|
|
42
|
+
"defaultValue": "false"
|
|
43
|
+
},
|
|
44
|
+
"icon": {
|
|
45
|
+
"type": "string",
|
|
46
|
+
"mutable": false,
|
|
47
|
+
"complexType": {
|
|
48
|
+
"original": "IconVariant",
|
|
49
|
+
"resolved": "\"arrow\" | \"attachment\" | \"bread\" | \"calendar\" | \"car\" | \"checklist\" | \"checkmark\" | \"chevron\" | \"clock\" | \"cogs\" | \"comment\" | \"document\" | \"download\" | \"envelope\" | \"explanation\" | \"eye\" | \"filter\" | \"folder\" | \"grid\" | \"headset\" | \"integration\" | \"list\" | \"location\" | \"megaphone\" | \"minus\" | \"negative\" | \"pagination\" | \"payment\" | \"pencil\" | \"person\" | \"plus\" | \"question\" | \"receipt\" | \"report\" | \"search\" | \"settings\" | \"sick\" | \"tachometer\" | \"task\" | \"template\" | \"tool\" | \"trash\" | \"turn\" | \"upload\" | \"warning\"",
|
|
50
|
+
"references": {
|
|
51
|
+
"IconVariant": {
|
|
52
|
+
"location": "import",
|
|
53
|
+
"path": "../../atoms/icon/icon.component"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"required": false,
|
|
58
|
+
"optional": false,
|
|
59
|
+
"docs": {
|
|
60
|
+
"tags": [],
|
|
61
|
+
"text": "Icon of the navigation item"
|
|
62
|
+
},
|
|
63
|
+
"attribute": "icon",
|
|
64
|
+
"reflect": false
|
|
65
|
+
},
|
|
66
|
+
"counter": {
|
|
67
|
+
"type": "any",
|
|
68
|
+
"mutable": false,
|
|
69
|
+
"complexType": {
|
|
70
|
+
"original": "number | string",
|
|
71
|
+
"resolved": "number | string",
|
|
72
|
+
"references": {}
|
|
73
|
+
},
|
|
74
|
+
"required": false,
|
|
75
|
+
"optional": false,
|
|
76
|
+
"docs": {
|
|
77
|
+
"tags": [],
|
|
78
|
+
"text": "Icon of the navigation item"
|
|
79
|
+
},
|
|
80
|
+
"attribute": "counter",
|
|
81
|
+
"reflect": false
|
|
82
|
+
},
|
|
83
|
+
"href": {
|
|
84
|
+
"type": "string",
|
|
85
|
+
"mutable": false,
|
|
86
|
+
"complexType": {
|
|
87
|
+
"original": "string",
|
|
88
|
+
"resolved": "string",
|
|
89
|
+
"references": {}
|
|
90
|
+
},
|
|
91
|
+
"required": false,
|
|
92
|
+
"optional": false,
|
|
93
|
+
"docs": {
|
|
94
|
+
"tags": [],
|
|
95
|
+
"text": "The href of the navigation item"
|
|
96
|
+
},
|
|
97
|
+
"attribute": "href",
|
|
98
|
+
"reflect": false
|
|
99
|
+
},
|
|
100
|
+
"target": {
|
|
101
|
+
"type": "string",
|
|
102
|
+
"mutable": false,
|
|
103
|
+
"complexType": {
|
|
104
|
+
"original": "string",
|
|
105
|
+
"resolved": "string",
|
|
106
|
+
"references": {}
|
|
107
|
+
},
|
|
108
|
+
"required": false,
|
|
109
|
+
"optional": false,
|
|
110
|
+
"docs": {
|
|
111
|
+
"tags": [],
|
|
112
|
+
"text": "The target of the navigation item"
|
|
113
|
+
},
|
|
114
|
+
"attribute": "target",
|
|
115
|
+
"reflect": false
|
|
116
|
+
}
|
|
117
|
+
}; }
|
|
118
|
+
}
|