@dile/ui 2.20.0 → 2.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -33,27 +33,32 @@ export class DileCopyMarkdownUrl extends LitElement {
|
|
|
33
33
|
.feedbackText="${this.feedbackText}"
|
|
34
34
|
.copiedDuration="${this.copiedDuration}"
|
|
35
35
|
?hideIcon="${this.hideIcon}"
|
|
36
|
-
@click="${this.handleClick}"
|
|
37
36
|
>
|
|
38
37
|
<slot></slot>
|
|
39
38
|
</dile-copy-text>
|
|
40
39
|
`;
|
|
41
40
|
}
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
connectedCallback() {
|
|
43
|
+
super.connectedCallback();
|
|
44
|
+
// Listen in capture phase to intercept click before dile-copy-text handles it
|
|
45
|
+
this.addEventListener('click', (e) => this.handleClickCapture(e), true);
|
|
46
|
+
}
|
|
48
47
|
|
|
48
|
+
async handleClickCapture(e) {
|
|
49
|
+
// If no content yet and URL is set, fetch before letting dile-copy-text handle the copy
|
|
49
50
|
if (!this.content && this.url) {
|
|
50
51
|
e.preventDefault();
|
|
52
|
+
e.stopPropagation();
|
|
53
|
+
|
|
51
54
|
await this.fetchContent();
|
|
52
55
|
|
|
53
|
-
//
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
// Only trigger copy if fetch was successful
|
|
57
|
+
if (this.content && !this.error) {
|
|
58
|
+
const copyComponent = this.shadowRoot.querySelector('#copy-component');
|
|
59
|
+
if (copyComponent) {
|
|
60
|
+
await copyComponent.copy();
|
|
61
|
+
}
|
|
57
62
|
}
|
|
58
63
|
}
|
|
59
64
|
}
|
|
@@ -61,13 +66,7 @@ export class DileCopyMarkdownUrl extends LitElement {
|
|
|
61
66
|
async fetchContent() {
|
|
62
67
|
if (!this.url) {
|
|
63
68
|
this.error = 'URL is not set';
|
|
64
|
-
this.
|
|
65
|
-
new CustomEvent('dile-copy-markdown-url-error', {
|
|
66
|
-
detail: { message: this.error },
|
|
67
|
-
bubbles: true,
|
|
68
|
-
composed: true
|
|
69
|
-
})
|
|
70
|
-
);
|
|
69
|
+
this.dispatchError(this.error);
|
|
71
70
|
return;
|
|
72
71
|
}
|
|
73
72
|
|
|
@@ -84,16 +83,19 @@ export class DileCopyMarkdownUrl extends LitElement {
|
|
|
84
83
|
this.content = await response.text();
|
|
85
84
|
} catch (err) {
|
|
86
85
|
this.error = err.message || 'Error fetching content';
|
|
87
|
-
|
|
88
|
-
this.dispatchEvent(
|
|
89
|
-
new CustomEvent('dile-copy-markdown-url-error', {
|
|
90
|
-
detail: { message: this.error },
|
|
91
|
-
bubbles: true,
|
|
92
|
-
composed: true
|
|
93
|
-
})
|
|
94
|
-
);
|
|
86
|
+
this.dispatchError(this.error);
|
|
95
87
|
} finally {
|
|
96
88
|
this.loading = false;
|
|
97
89
|
}
|
|
98
90
|
}
|
|
91
|
+
|
|
92
|
+
dispatchError(message) {
|
|
93
|
+
this.dispatchEvent(
|
|
94
|
+
new CustomEvent('dile-copy-markdown-url-error', {
|
|
95
|
+
detail: { message },
|
|
96
|
+
bubbles: true,
|
|
97
|
+
composed: true
|
|
98
|
+
})
|
|
99
|
+
);
|
|
100
|
+
}
|
|
99
101
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LitElement, html, css } from 'lit';
|
|
2
2
|
import { DileEmmitChange } from '../../../mixins/form/index.js';
|
|
3
3
|
import '../radio.js';
|
|
4
|
+
import '../input/input-message.js';
|
|
4
5
|
|
|
5
6
|
export class DileRadioGroup extends DileEmmitChange(LitElement) {
|
|
6
7
|
static styles = [
|
|
@@ -31,6 +32,9 @@ export class DileRadioGroup extends DileEmmitChange(LitElement) {
|
|
|
31
32
|
label: { type: String },
|
|
32
33
|
value: { type: String },
|
|
33
34
|
name: { type: String },
|
|
35
|
+
message: { type: String },
|
|
36
|
+
errored: { type: Boolean },
|
|
37
|
+
hideErrorOnInput: { type: Boolean },
|
|
34
38
|
disabled: {
|
|
35
39
|
type: Boolean,
|
|
36
40
|
reflect: true
|
|
@@ -43,6 +47,7 @@ export class DileRadioGroup extends DileEmmitChange(LitElement) {
|
|
|
43
47
|
this.init = false;
|
|
44
48
|
this.disabled = false;
|
|
45
49
|
this.internals = this.attachInternals();
|
|
50
|
+
this.message = '';
|
|
46
51
|
}
|
|
47
52
|
|
|
48
53
|
updated(changedProperties) {
|
|
@@ -72,11 +77,19 @@ export class DileRadioGroup extends DileEmmitChange(LitElement) {
|
|
|
72
77
|
}
|
|
73
78
|
<slot></slot>
|
|
74
79
|
</div>
|
|
80
|
+
${this.message
|
|
81
|
+
? html`<dile-input-message message="${this.message}" ?errored=${this.errored}></dile-input-message>`
|
|
82
|
+
: ''
|
|
83
|
+
}
|
|
75
84
|
`;
|
|
76
85
|
}
|
|
77
86
|
|
|
78
87
|
changeValue(e) {
|
|
79
88
|
if(!this.disabled) {
|
|
89
|
+
if(this.hideErrorOnInput && this.errored) {
|
|
90
|
+
this.message = '';
|
|
91
|
+
this.errored = false;
|
|
92
|
+
}
|
|
80
93
|
this.value = e.detail.value;
|
|
81
94
|
}
|
|
82
95
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dile/ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.21.0",
|
|
4
4
|
"description": "UI Core components from dile-components.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "d5039b0bd0663c1d5e863cd1a0e65f6a183645ab"
|
|
30
30
|
}
|
package/styles/colors.css
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
--dile-link-color: #3399ff;
|
|
21
21
|
|
|
22
22
|
/* Color variations */
|
|
23
|
-
--dile-primary-light-color: #
|
|
23
|
+
--dile-primary-light-color: #fafadf;
|
|
24
24
|
--dile-on-primary-light-color: #303030;
|
|
25
25
|
--dile-primary-dark-color: #d7d353;
|
|
26
26
|
--dile-on-primary-dark-color: #303030;
|