@aquera/nile-elements 0.0.5-2 → 0.0.5-4
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/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-link/nile-link.css.js +10 -2
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-link/nile-link.css.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-link/nile-link.d.ts +3 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-link/nile-link.js +20 -2
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-link/nile-link.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/index.iife.js +11 -3
- package/dist/nile-link/nile-link.cjs.js +1 -1
- package/dist/nile-link/nile-link.cjs.js.map +1 -1
- package/dist/nile-link/nile-link.css.cjs.js +1 -1
- package/dist/nile-link/nile-link.css.cjs.js.map +1 -1
- package/dist/nile-link/nile-link.css.esm.js +10 -2
- package/dist/nile-link/nile-link.esm.js +2 -2
- package/dist/src/nile-link/nile-link.css.js +10 -2
- package/dist/src/nile-link/nile-link.css.js.map +1 -1
- package/dist/src/nile-link/nile-link.d.ts +3 -0
- package/dist/src/nile-link/nile-link.js +20 -2
- package/dist/src/nile-link/nile-link.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-link/nile-link.css.ts +10 -2
- package/src/nile-link/nile-link.ts +43 -18
package/package.json
CHANGED
@@ -25,7 +25,7 @@ export const styles = css`
|
|
25
25
|
gap: 8px;
|
26
26
|
height: 38px;
|
27
27
|
box-sizing: border-box;
|
28
|
-
cursor: pointer
|
28
|
+
cursor: pointer;
|
29
29
|
}
|
30
30
|
|
31
31
|
.link__label {
|
@@ -43,7 +43,11 @@ export const styles = css`
|
|
43
43
|
color: rgba(0, 94, 166, 0.5);
|
44
44
|
cursor: not-allowed;
|
45
45
|
opacity: 0.6;
|
46
|
-
pointer-events:none;
|
46
|
+
pointer-events: none;
|
47
|
+
}
|
48
|
+
|
49
|
+
:host(.link--disabled) {
|
50
|
+
pointer-events: none;
|
47
51
|
}
|
48
52
|
|
49
53
|
.link:not(.link--disabled):not(.link__button):hover {
|
@@ -67,6 +71,10 @@ export const styles = css`
|
|
67
71
|
border-radius: 4px;
|
68
72
|
background: rgba(0, 94, 166, 0.1);
|
69
73
|
}
|
74
|
+
|
75
|
+
:host([disabled]) {
|
76
|
+
pointer-events: none;
|
77
|
+
}
|
70
78
|
`;
|
71
79
|
|
72
80
|
export default [styles];
|
@@ -22,16 +22,20 @@ import { watch } from '../internal/watch';
|
|
22
22
|
*/
|
23
23
|
@customElement('nile-link')
|
24
24
|
export class NileLink extends NileElement {
|
25
|
+
/**
|
26
|
+
* The styles for Link
|
27
|
+
* @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`
|
28
|
+
*/
|
29
|
+
public static get styles(): CSSResultArray {
|
30
|
+
return [styles];
|
31
|
+
}
|
25
32
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
}
|
33
|
-
|
34
|
-
private readonly hasSlotController = new HasSlotController(this, '[default]', 'prefix', 'suffix');
|
33
|
+
private readonly hasSlotController = new HasSlotController(
|
34
|
+
this,
|
35
|
+
'[default]',
|
36
|
+
'prefix',
|
37
|
+
'suffix'
|
38
|
+
);
|
35
39
|
|
36
40
|
@state() private hasFocus = false;
|
37
41
|
|
@@ -40,6 +44,25 @@ export class NileLink extends NileElement {
|
|
40
44
|
|
41
45
|
@property({ type: Boolean }) button = false;
|
42
46
|
|
47
|
+
connectedCallback() {
|
48
|
+
super.connectedCallback();
|
49
|
+
this.handleHostClick = this.handleHostClick.bind(this);
|
50
|
+
this.addEventListener('click', this.handleHostClick);
|
51
|
+
}
|
52
|
+
|
53
|
+
disconnectedCallback() {
|
54
|
+
super.disconnectedCallback();
|
55
|
+
this.removeEventListener('click', this.handleHostClick);
|
56
|
+
}
|
57
|
+
|
58
|
+
private handleHostClick(event: MouseEvent) {
|
59
|
+
// Prevent the click event from being emitted when the button is disabled
|
60
|
+
if (this.disabled) {
|
61
|
+
event.preventDefault();
|
62
|
+
event.stopImmediatePropagation();
|
63
|
+
event.stopPropagation();
|
64
|
+
}
|
65
|
+
}
|
43
66
|
|
44
67
|
private handleBlur() {
|
45
68
|
this.hasFocus = false;
|
@@ -51,21 +74,24 @@ export class NileLink extends NileElement {
|
|
51
74
|
this.emit('nile-focus');
|
52
75
|
}
|
53
76
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
77
|
+
/**
|
78
|
+
* Render method
|
79
|
+
* @slot This is a slot test
|
80
|
+
*/
|
81
|
+
public render(): TemplateResult {
|
59
82
|
return html`
|
60
83
|
<div
|
61
84
|
part="base"
|
62
85
|
class=${classMap({
|
63
86
|
link: true,
|
64
87
|
'link--disabled': this.disabled,
|
65
|
-
|
88
|
+
link__button: this.button,
|
66
89
|
})}
|
67
90
|
?disabled=${ifDefined(this.disabled)}
|
68
|
-
title=${
|
91
|
+
title=${
|
92
|
+
this
|
93
|
+
.title /* An empty title prevents browser validation tooltips from appearing on hover */
|
94
|
+
}
|
69
95
|
aria-disabled=${this.disabled ? 'true' : 'false'}
|
70
96
|
tabindex=${this.disabled ? '-1' : '0'}
|
71
97
|
@blur=${this.handleBlur}
|
@@ -78,8 +104,7 @@ export class NileLink extends NileElement {
|
|
78
104
|
`;
|
79
105
|
}
|
80
106
|
|
81
|
-
|
82
|
-
/* #endregion */
|
107
|
+
/* #endregion */
|
83
108
|
}
|
84
109
|
|
85
110
|
export default NileLink;
|