@digital-realty/ix-error-message 0.0.0-stage → 0.0.2-IXUAT-11213.568825

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ix-error-message
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,91 @@
1
- # Temporary Holding Version
1
+ # \<ix-error-message>
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ This webcomponent follows the [open-wc](https://github.com/open-wc/open-wc) recommendation.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm i @digital-realty/ix-error-message
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```html
14
+ <script type="module">
15
+ import '@digital-realty/ix-error-message/ix-error-message.js';
16
+ </script>
17
+
18
+ <ix-error-message></ix-error-message>
19
+ ```
20
+ ### In React
21
+ ```html
22
+ <script type="module">
23
+ import { IxErrorMessage } from '@digital-realty/ix-error-message/IxErrorMessage'
24
+ </script>
25
+ ```
26
+
27
+ ## Variations
28
+
29
+ `<ix-error-message>` always shows an icon, a "We've encountered a technical
30
+ issue." heading and support contact details. Three properties control
31
+ optional behaviour, and can be combined freely:
32
+
33
+ ### `dialog`
34
+
35
+ Type: `boolean` — default `false`
36
+
37
+ Renders the message inside an `ix-dialog` modal (with a "Close" button)
38
+ instead of directly inline. Use the `open` property to control whether the
39
+ dialog is currently shown; it has no effect when `dialog` is `false`.
40
+
41
+ ```html
42
+ <ix-error-message
43
+ dialog
44
+ .open=${this.open}
45
+ trace=${this.errorMessage}
46
+ ></ix-error-message>
47
+ ```
48
+
49
+ ### `retry`
50
+
51
+ Type: `((...args: any[]) => void) | undefined` — default `undefined`
52
+
53
+ When set to a function, replaces the default "email support" copy with a
54
+ "Retry" call-to-action button that invokes the function on click (plus a
55
+ secondary "Still not working?" message with the support contact details).
56
+ Leave it `undefined` to show only the default support-contact message.
57
+
58
+ ```js
59
+ document.querySelector('ix-error-message').retry = () => refetchData();
60
+ ```
61
+
62
+ ### `trace`
63
+
64
+ Type: `string | Record<string, unknown> | undefined` — default `undefined`
65
+
66
+ When set, shows a copyable error/trace-code panel with a "Copy" button
67
+ below the support message. The value is also included in the "email
68
+ support" link's body. Leave it `undefined`/empty to hide that panel
69
+ entirely.
70
+
71
+ A plain string is used as-is; a JS object is automatically JSON-stringified
72
+ wherever it's needed as text (clipboard copy, email body):
73
+
74
+ ```html
75
+ <ix-error-message trace="ERR-20261117-ABC123"></ix-error-message>
76
+ ```
77
+
78
+ ```js
79
+ document.querySelector('ix-error-message').trace = {
80
+ code: 'ERR-20261117-ABC123',
81
+ requestId: 'req-789',
82
+ };
83
+ ```
84
+
85
+ See the [Storybook stories](../../stories/ix-error-message.stories.js) for
86
+ live, combinable examples of each variation (`Dialog`, `Retry`, `TraceCode`,
87
+ `NoTraceCode`, `DialogWithRetryAndTrace`).
88
+
89
+ ## Demo and Documentation
90
+
91
+ Full documentation and demo are available at [DLR Component Gallery](https://inxn-p1-uicomponentgallery.azurewebsites.net/?path=/story/inxn-ix-error-message--default).
@@ -0,0 +1,24 @@
1
+ import { LitElement } from 'lit';
2
+ import '@digital-realty/ix-button/ix-button.js';
3
+ import '@digital-realty/ix-dialog/ix-dialog.js';
4
+ import '@digital-realty/ix-icon/ix-icon.js';
5
+ export declare class IxErrorMessage extends LitElement {
6
+ dialog: boolean;
7
+ open: boolean;
8
+ retry: ((...args: any[]) => void) | undefined;
9
+ trace: string | Record<string, unknown> | undefined;
10
+ copied: boolean;
11
+ /**
12
+ * String representation of `trace`, used wherever the value needs to be
13
+ * plain text (clipboard copy, email body): objects are JSON-stringified,
14
+ * strings are passed through unchanged.
15
+ */
16
+ get traceText(): string | undefined;
17
+ get emailLink(): import("lit").TemplateResult<1>;
18
+ retryMsg(): import("lit").TemplateResult<1>;
19
+ standardMsg(): import("lit").TemplateResult<1>;
20
+ errorTrace(): import("lit").TemplateResult<1>;
21
+ errorMsg(showHeading?: boolean): import("lit").TemplateResult<1>;
22
+ closeDialog(): void;
23
+ render(): import("lit").TemplateResult<1>;
24
+ }
@@ -0,0 +1,153 @@
1
+ import { __decorate } from "tslib";
2
+ import { html, LitElement, nothing } from 'lit';
3
+ import { property, state } from 'lit/decorators.js';
4
+ import '@digital-realty/ix-button/ix-button.js';
5
+ import '@digital-realty/ix-dialog/ix-dialog.js';
6
+ import '@digital-realty/ix-icon/ix-icon.js';
7
+ const HEADING_TEXT = 'We’ve encountered a technical issue.';
8
+ export class IxErrorMessage extends LitElement {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.dialog = false;
12
+ this.open = false;
13
+ this.retry = undefined; // () => {};
14
+ this.trace = undefined;
15
+ this.copied = false;
16
+ }
17
+ /**
18
+ * String representation of `trace`, used wherever the value needs to be
19
+ * plain text (clipboard copy, email body): objects are JSON-stringified,
20
+ * strings are passed through unchanged.
21
+ */
22
+ get traceText() {
23
+ if (this.trace === undefined)
24
+ return undefined;
25
+ return typeof this.trace === 'string'
26
+ ? this.trace
27
+ : JSON.stringify(this.trace);
28
+ }
29
+ get emailLink() {
30
+ var _a;
31
+ return html `<a
32
+ href="mailto:CustomerCare@digitalrealty.com?subject=Support%20Request&amp;body=${encodeURIComponent((_a = this.traceText) !== null && _a !== void 0 ? _a : 'no trace provided')}"
33
+ >CustomerCare@digitalrealty.com</a
34
+ >`;
35
+ }
36
+ retryMsg() {
37
+ return html `
38
+ <div class="retry">
39
+ <p class="error-msg">
40
+ Our apologies for the inconvenience. Please, retry below.
41
+ </p>
42
+ <ix-button appearance="filled" has-icon @click=${this.retry}>
43
+ <ix-icon slot="icon">refresh</ix-icon>
44
+ Retry
45
+ </ix-button>
46
+ </div>
47
+ <div>
48
+ <h3>Still not working?</h3>
49
+ <p>
50
+ Still not working? Copy this code and contact our Support team by
51
+ sending an email to ${this.emailLink}
52
+ </p>
53
+ </div>
54
+ `;
55
+ }
56
+ standardMsg() {
57
+ return html `
58
+ <p class="error-msg">
59
+ Our apologies for the inconvenience. To help us resolve this quickly,
60
+ please click the button below to copy the details and share them with
61
+ our Support team by sending an email to ${this.emailLink}
62
+ </p>
63
+ `;
64
+ }
65
+ errorTrace() {
66
+ return html `
67
+ <div class="error-trace-container">
68
+ <div class="error-trace">
69
+ <p class="error-trace-code">
70
+ <span class="visually-hidden">Error code: </span>${this.trace
71
+ ? '[Unique-Error-Code]'
72
+ : 'unavailable'}
73
+ </p>
74
+ <ix-button
75
+ @click=${async () => {
76
+ var _a;
77
+ try {
78
+ await navigator.clipboard.writeText((_a = this.traceText) !== null && _a !== void 0 ? _a : '');
79
+ this.copied = true;
80
+ setTimeout(() => {
81
+ this.copied = false;
82
+ }, 2000);
83
+ }
84
+ catch (err) {
85
+ console.error('Failed to copy error identifier to clipboard', err);
86
+ }
87
+ }}
88
+ appearance="outlined"
89
+ has-icon
90
+ aria-label="Copy error code to clipboard"
91
+ >
92
+ <ix-icon slot="icon">content_copy</ix-icon>
93
+ ${this.copied ? 'Copied!' : 'Copy'}
94
+ </ix-button>
95
+ <span role="status" aria-live="polite" class="visually-hidden">
96
+ ${this.copied ? 'Copied to clipboard' : nothing}
97
+ </span>
98
+ </div>
99
+ </div>
100
+ `;
101
+ }
102
+ errorMsg(showHeading = true) {
103
+ return html `
104
+ <div class="container ${this.dialog ? 'dialog' : ''}">
105
+ <ix-icon class="error">error</ix-icon>
106
+ ${showHeading
107
+ ? html `<h2
108
+ class="dlr-text-heading"
109
+ data-testid="ix-grid-no-rows-heading"
110
+ >
111
+ ${HEADING_TEXT}
112
+ </h2>`
113
+ : nothing}
114
+ ${this.retry ? this.retryMsg() : this.standardMsg()}
115
+ ${this.trace ? this.errorTrace() : nothing}
116
+ </div>
117
+ `;
118
+ }
119
+ closeDialog() {
120
+ this.open = false;
121
+ }
122
+ render() {
123
+ return this.dialog
124
+ ? html `<ix-dialog ?open=${this.open}>
125
+ <div slot="headline" class="sr-only">${HEADING_TEXT}</div>
126
+ <div slot="content">
127
+ <div>${this.errorMsg(true)}</div>
128
+ <div class="dialog-footer">
129
+ <ix-button appearance="text" @click=${this.closeDialog}
130
+ >Close</ix-button
131
+ >
132
+ </div>
133
+ </div></ix-dialog
134
+ >`
135
+ : html `<div role="alert">${this.errorMsg()}</div>`;
136
+ }
137
+ }
138
+ __decorate([
139
+ property({ type: Boolean })
140
+ ], IxErrorMessage.prototype, "dialog", void 0);
141
+ __decorate([
142
+ property({ type: Boolean })
143
+ ], IxErrorMessage.prototype, "open", void 0);
144
+ __decorate([
145
+ property({ attribute: false })
146
+ ], IxErrorMessage.prototype, "retry", void 0);
147
+ __decorate([
148
+ property({ type: String })
149
+ ], IxErrorMessage.prototype, "trace", void 0);
150
+ __decorate([
151
+ state()
152
+ ], IxErrorMessage.prototype, "copied", void 0);
153
+ //# sourceMappingURL=IxErrorMessage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file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AI,CAAA,oBAAoB,IAAI,CAAC,IAAI;iDACQ,YAAY;;mBAE1C,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;;oDAEc,IAAI,CAAC,WAAW;;;;;UAK1D;YACJ,CAAC,CAAC,IAAI,CAAA,qBAAqB,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC;IACvD,CAAC;CACF;AA/I8B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;8CAAyB;AAExB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4CAAuB;AAEnB;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;6CAEL;AAEE;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAGD;AAEjB;IAAR,KAAK,EAAE;8CAAgB","sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport '@digital-realty/ix-button/ix-button.js';\nimport '@digital-realty/ix-dialog/ix-dialog.js';\nimport '@digital-realty/ix-icon/ix-icon.js';\n\nconst HEADING_TEXT = 'We’ve encountered a technical issue.';\n\nexport class IxErrorMessage extends LitElement {\n @property({ type: Boolean }) dialog: boolean = false;\n\n @property({ type: Boolean }) open: boolean = false;\n\n @property({ attribute: false }) retry:\n | ((...args: any[]) => void)\n | undefined = undefined; // () => {};\n\n @property({ type: String }) trace:\n | string\n | Record<string, unknown>\n | undefined = undefined;\n\n @state() copied = false;\n\n /**\n * String representation of `trace`, used wherever the value needs to be\n * plain text (clipboard copy, email body): objects are JSON-stringified,\n * strings are passed through unchanged.\n */\n get traceText(): string | undefined {\n if (this.trace === undefined) return undefined;\n return typeof this.trace === 'string'\n ? this.trace\n : JSON.stringify(this.trace);\n }\n\n get emailLink() {\n return html`<a\n href=\"mailto:CustomerCare@digitalrealty.com?subject=Support%20Request&amp;body=${encodeURIComponent(\n this.traceText ?? 'no trace provided'\n )}\"\n >CustomerCare@digitalrealty.com</a\n >`;\n }\n\n retryMsg() {\n return html`\n <div class=\"retry\">\n <p class=\"error-msg\">\n Our apologies for the inconvenience. Please, retry below.\n </p>\n <ix-button appearance=\"filled\" has-icon @click=${this.retry}>\n <ix-icon slot=\"icon\">refresh</ix-icon>\n Retry\n </ix-button>\n </div>\n <div>\n <h3>Still not working?</h3>\n <p>\n Still not working? Copy this code and contact our Support team by\n sending an email to ${this.emailLink}\n </p>\n </div>\n `;\n }\n\n standardMsg() {\n return html`\n <p class=\"error-msg\">\n Our apologies for the inconvenience. To help us resolve this quickly,\n please click the button below to copy the details and share them with\n our Support team by sending an email to ${this.emailLink}\n </p>\n `;\n }\n\n errorTrace() {\n return html`\n <div class=\"error-trace-container\">\n <div class=\"error-trace\">\n <p class=\"error-trace-code\">\n <span class=\"visually-hidden\">Error code: </span>${this.trace\n ? '[Unique-Error-Code]'\n : 'unavailable'}\n </p>\n <ix-button\n @click=${async () => {\n try {\n await navigator.clipboard.writeText(this.traceText ?? '');\n this.copied = true;\n setTimeout(() => {\n this.copied = false;\n }, 2000);\n } catch (err) {\n console.error(\n 'Failed to copy error identifier to clipboard',\n err\n );\n }\n }}\n appearance=\"outlined\"\n has-icon\n aria-label=\"Copy error code to clipboard\"\n >\n <ix-icon slot=\"icon\">content_copy</ix-icon>\n ${this.copied ? 'Copied!' : 'Copy'}\n </ix-button>\n <span role=\"status\" aria-live=\"polite\" class=\"visually-hidden\">\n ${this.copied ? 'Copied to clipboard' : nothing}\n </span>\n </div>\n </div>\n `;\n }\n\n errorMsg(showHeading = true) {\n return html`\n <div class=\"container ${this.dialog ? 'dialog' : ''}\">\n <ix-icon class=\"error\">error</ix-icon>\n ${showHeading\n ? html`<h2\n class=\"dlr-text-heading\"\n data-testid=\"ix-grid-no-rows-heading\"\n >\n ${HEADING_TEXT}\n </h2>`\n : nothing}\n ${this.retry ? this.retryMsg() : this.standardMsg()}\n ${this.trace ? this.errorTrace() : nothing}\n </div>\n `;\n }\n\n closeDialog() {\n this.open = false;\n }\n\n render() {\n return this.dialog\n ? html`<ix-dialog ?open=${this.open}>\n <div slot=\"headline\" class=\"sr-only\">${HEADING_TEXT}</div>\n <div slot=\"content\">\n <div>${this.errorMsg(true)}</div>\n <div class=\"dialog-footer\">\n <ix-button appearance=\"text\" @click=${this.closeDialog}\n >Close</ix-button\n >\n </div>\n </div></ix-dialog\n >`\n : html`<div role=\"alert\">${this.errorMsg()}</div>`;\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ export { IxErrorMessage } from './IxErrorMessage.js';
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { IxErrorMessage } from './IxErrorMessage.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC","sourcesContent":["export { IxErrorMessage } from './IxErrorMessage.js';\n"]}
@@ -0,0 +1,4 @@
1
+ import { IxErrorMessage } from './IxErrorMessage.js';
2
+ export declare class IxErrorMessageStyled extends IxErrorMessage {
3
+ static styles: import("lit").CSSResult;
4
+ }
@@ -0,0 +1,133 @@
1
+ import { css } from 'lit';
2
+ import { IxErrorMessage } from './IxErrorMessage.js';
3
+ export class IxErrorMessageStyled extends IxErrorMessage {
4
+ }
5
+ IxErrorMessageStyled.styles = css `
6
+ ix-dialog {
7
+ --md-dialog-container-shape: 6px;
8
+ }
9
+ .container {
10
+ display: flex;
11
+ justify-content: center;
12
+ align-items: center;
13
+ flex-direction: column;
14
+ text-align: center;
15
+ max-width: 665px;
16
+ margin: 0 auto;
17
+ }
18
+ .container .error-msg {
19
+ margin: 0 0 1.5rem;
20
+ }
21
+ .error {
22
+ user-select: none;
23
+ display: inline-block;
24
+ --ix-icon-font-size: 88px;
25
+ color: rgba(255, 152, 0, 1);
26
+ }
27
+ .dialog .error {
28
+ --ix-icon-font-size: 66px;
29
+ margin-top: 0.5rem;
30
+ }
31
+ .retry {
32
+ width: 100%;
33
+ border-bottom: 1px solid rgba(9, 34, 65, 0.12);
34
+ }
35
+ .retry p {
36
+ margin: 0 0 16px 0;
37
+ font-family: Open Sans;
38
+ font-weight: 400;
39
+ font-size: 14px;
40
+ line-height: 24px;
41
+ letter-spacing: 0.25px;
42
+ text-align: center;
43
+ }
44
+ .retry ix-button {
45
+ display: inline-block;
46
+ margin: 0 0 16px 0;
47
+ }
48
+ h2 {
49
+ font-family: var(--ix-font-family, 'Red Hat Display');
50
+ font-weight: 700;
51
+ font-size: 34px;
52
+ line-height: 40px;
53
+ letter-spacing: 0.35px;
54
+ text-align: center;
55
+ margin: 1.5rem 0 16px 0;
56
+ }
57
+ .dialog h2 {
58
+ font-size: 24px;
59
+ line-height: 40px;
60
+ margin-top: 0.8rem;
61
+ letter-spacing: 0;
62
+ }
63
+ h3 {
64
+ font-family: Red Hat Display;
65
+ font-weight: 700;
66
+ font-size: 20px;
67
+ line-height: 24px;
68
+ letter-spacing: 0.15px;
69
+ text-align: center;
70
+ }
71
+ .error-trace-container {
72
+ width: 100%;
73
+ max-width: 489px;
74
+ }
75
+ .error-trace {
76
+ display: flex;
77
+ align-items: center;
78
+ padding-top: 16px;
79
+ padding-right: 24px;
80
+ padding-bottom: 16px;
81
+ padding-left: 24px;
82
+ background-color: var(--clr-surface, #fff);
83
+ gap: 8px;
84
+ border-radius: 12px;
85
+ border: 1px solid rgba(225, 228, 232, 1);
86
+ box-shadow: 0px 0px 0px 1px rgba(225, 228, 232, 1) inset;
87
+ box-shadow: 0px 12px 20px -12px rgba(0, 0, 0, 0.12);
88
+ --md-outlined-button-with-leading-icon-trailing-space: 1rem;
89
+ --md-outlined-button-with-leading-icon-leading-space: 1rem;
90
+ }
91
+ .error-trace-code {
92
+ flex: 1;
93
+ display: flex;
94
+ justify-content: center;
95
+ margin: 0;
96
+ letter-spacing: 0.15px;
97
+ }
98
+ .error-trace ix-button {
99
+ flex-shrink: 0;
100
+ }
101
+ .dialog-footer {
102
+ display: flex;
103
+ justify-content: flex-end;
104
+ margin: 1.5rem -1rem 0 0;
105
+ }
106
+ .visually-hidden {
107
+ position: absolute;
108
+ width: 1px;
109
+ height: 1px;
110
+ padding: 0;
111
+ margin: -1px;
112
+ overflow: hidden;
113
+ clip: rect(0, 0, 0, 0);
114
+ white-space: nowrap;
115
+ border: 0;
116
+ }
117
+ .sr-only {
118
+ position: absolute;
119
+ width: 1px;
120
+ height: 1px;
121
+ margin: -1px;
122
+ padding: 0;
123
+ overflow: hidden;
124
+ clip: rect(0, 0, 0, 0);
125
+ clip-path: inset(50%);
126
+ white-space: nowrap;
127
+ border: 0;
128
+ }
129
+ `;
130
+ if (!customElements.get('ix-error-message')) {
131
+ customElements.define('ix-error-message', IxErrorMessageStyled);
132
+ }
133
+ //# sourceMappingURL=ix-error-message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ix-error-message.js","sourceRoot":"","sources":["../src/ix-error-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,OAAO,oBAAqB,SAAQ,cAAc;;AACtC,2BAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4H3B,CAAC;AAGJ,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,kBAAkB,CAAC,EAAE,CAAC;IAC5C,cAAc,CAAC,MAAM,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,CAAC;AAClE,CAAC","sourcesContent":["import { css } from 'lit';\nimport { IxErrorMessage } from './IxErrorMessage.js';\n\nexport class IxErrorMessageStyled extends IxErrorMessage {\n static override styles = css`\n ix-dialog {\n --md-dialog-container-shape: 6px;\n }\n .container {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n text-align: center;\n max-width: 665px;\n margin: 0 auto;\n }\n .container .error-msg {\n margin: 0 0 1.5rem;\n }\n .error {\n user-select: none;\n display: inline-block;\n --ix-icon-font-size: 88px;\n color: rgba(255, 152, 0, 1);\n }\n .dialog .error {\n --ix-icon-font-size: 66px;\n margin-top: 0.5rem;\n }\n .retry {\n width: 100%;\n border-bottom: 1px solid rgba(9, 34, 65, 0.12);\n }\n .retry p {\n margin: 0 0 16px 0;\n font-family: Open Sans;\n font-weight: 400;\n font-size: 14px;\n line-height: 24px;\n letter-spacing: 0.25px;\n text-align: center;\n }\n .retry ix-button {\n display: inline-block;\n margin: 0 0 16px 0;\n }\n h2 {\n font-family: var(--ix-font-family, 'Red Hat Display');\n font-weight: 700;\n font-size: 34px;\n line-height: 40px;\n letter-spacing: 0.35px;\n text-align: center;\n margin: 1.5rem 0 16px 0;\n }\n .dialog h2 {\n font-size: 24px;\n line-height: 40px;\n margin-top: 0.8rem;\n letter-spacing: 0;\n }\n h3 {\n font-family: Red Hat Display;\n font-weight: 700;\n font-size: 20px;\n line-height: 24px;\n letter-spacing: 0.15px;\n text-align: center;\n }\n .error-trace-container {\n width: 100%;\n max-width: 489px;\n }\n .error-trace {\n display: flex;\n align-items: center;\n padding-top: 16px;\n padding-right: 24px;\n padding-bottom: 16px;\n padding-left: 24px;\n background-color: var(--clr-surface, #fff);\n gap: 8px;\n border-radius: 12px;\n border: 1px solid rgba(225, 228, 232, 1);\n box-shadow: 0px 0px 0px 1px rgba(225, 228, 232, 1) inset;\n box-shadow: 0px 12px 20px -12px rgba(0, 0, 0, 0.12);\n --md-outlined-button-with-leading-icon-trailing-space: 1rem;\n --md-outlined-button-with-leading-icon-leading-space: 1rem;\n }\n .error-trace-code {\n flex: 1;\n display: flex;\n justify-content: center;\n margin: 0;\n letter-spacing: 0.15px;\n }\n .error-trace ix-button {\n flex-shrink: 0;\n }\n .dialog-footer {\n display: flex;\n justify-content: flex-end;\n margin: 1.5rem -1rem 0 0;\n }\n .visually-hidden {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n }\n `;\n}\n\nif (!customElements.get('ix-error-message')) {\n customElements.define('ix-error-message', IxErrorMessageStyled);\n}\n"]}
@@ -0,0 +1,193 @@
1
+ import{LitElement as e,html as i,nothing as t,css as r}from"lit";import{__decorate as o}from"tslib";import{property as a,state as n}from"lit/decorators.js";import"@digital-realty/ix-button/ix-button.js";import"@digital-realty/ix-dialog/ix-dialog.js";import"@digital-realty/ix-icon/ix-icon.js";const s="We’ve encountered a technical issue.";class l extends e{constructor(){super(...arguments),this.dialog=!1,this.open=!1,this.retry=void 0,this.trace=void 0,this.copied=!1}get traceText(){if(void 0!==this.trace)return"string"==typeof this.trace?this.trace:JSON.stringify(this.trace)}get emailLink(){var e;return i`<a
2
+ href="mailto:CustomerCare@digitalrealty.com?subject=Support%20Request&amp;body=${encodeURIComponent(null!==(e=this.traceText)&&void 0!==e?e:"no trace provided")}"
3
+ >CustomerCare@digitalrealty.com</a
4
+ >`}retryMsg(){return i`
5
+ <div class="retry">
6
+ <p class="error-msg">
7
+ Our apologies for the inconvenience. Please, retry below.
8
+ </p>
9
+ <ix-button appearance="filled" has-icon @click=${this.retry}>
10
+ <ix-icon slot="icon">refresh</ix-icon>
11
+ Retry
12
+ </ix-button>
13
+ </div>
14
+ <div>
15
+ <h3>Still not working?</h3>
16
+ <p>
17
+ Still not working? Copy this code and contact our Support team by
18
+ sending an email to ${this.emailLink}
19
+ </p>
20
+ </div>
21
+ `}standardMsg(){return i`
22
+ <p class="error-msg">
23
+ Our apologies for the inconvenience. To help us resolve this quickly,
24
+ please click the button below to copy the details and share them with
25
+ our Support team by sending an email to ${this.emailLink}
26
+ </p>
27
+ `}errorTrace(){return i`
28
+ <div class="error-trace-container">
29
+ <div class="error-trace">
30
+ <p class="error-trace-code">
31
+ <span class="visually-hidden">Error code: </span>${this.trace?"[Unique-Error-Code]":"unavailable"}
32
+ </p>
33
+ <ix-button
34
+ @click=${async()=>{var e;try{await navigator.clipboard.writeText(null!==(e=this.traceText)&&void 0!==e?e:""),this.copied=!0,setTimeout(()=>{this.copied=!1},2e3)}catch(e){console.error("Failed to copy error identifier to clipboard",e)}}}
35
+ appearance="outlined"
36
+ has-icon
37
+ aria-label="Copy error code to clipboard"
38
+ >
39
+ <ix-icon slot="icon">content_copy</ix-icon>
40
+ ${this.copied?"Copied!":"Copy"}
41
+ </ix-button>
42
+ <span role="status" aria-live="polite" class="visually-hidden">
43
+ ${this.copied?"Copied to clipboard":t}
44
+ </span>
45
+ </div>
46
+ </div>
47
+ `}errorMsg(e=!0){return i`
48
+ <div class="container ${this.dialog?"dialog":""}">
49
+ <ix-icon class="error">error</ix-icon>
50
+ ${e?i`<h2
51
+ class="dlr-text-heading"
52
+ data-testid="ix-grid-no-rows-heading"
53
+ >
54
+ ${s}
55
+ </h2>`:t}
56
+ ${this.retry?this.retryMsg():this.standardMsg()}
57
+ ${this.trace?this.errorTrace():t}
58
+ </div>
59
+ `}closeDialog(){this.open=!1}render(){return this.dialog?i`<ix-dialog ?open=${this.open}>
60
+ <div slot="headline" class="sr-only">${s}</div>
61
+ <div slot="content">
62
+ <div>${this.errorMsg(!0)}</div>
63
+ <div class="dialog-footer">
64
+ <ix-button appearance="text" @click=${this.closeDialog}
65
+ >Close</ix-button
66
+ >
67
+ </div>
68
+ </div></ix-dialog
69
+ >`:i`<div role="alert">${this.errorMsg()}</div>`}}o([a({type:Boolean})],l.prototype,"dialog",void 0),o([a({type:Boolean})],l.prototype,"open",void 0),o([a({attribute:!1})],l.prototype,"retry",void 0),o([a({type:String})],l.prototype,"trace",void 0),o([n()],l.prototype,"copied",void 0);class p extends l{}p.styles=r`
70
+ ix-dialog {
71
+ --md-dialog-container-shape: 6px;
72
+ }
73
+ .container {
74
+ display: flex;
75
+ justify-content: center;
76
+ align-items: center;
77
+ flex-direction: column;
78
+ text-align: center;
79
+ max-width: 665px;
80
+ margin: 0 auto;
81
+ }
82
+ .container .error-msg {
83
+ margin: 0 0 1.5rem;
84
+ }
85
+ .error {
86
+ user-select: none;
87
+ display: inline-block;
88
+ --ix-icon-font-size: 88px;
89
+ color: rgba(255, 152, 0, 1);
90
+ }
91
+ .dialog .error {
92
+ --ix-icon-font-size: 66px;
93
+ margin-top: 0.5rem;
94
+ }
95
+ .retry {
96
+ width: 100%;
97
+ border-bottom: 1px solid rgba(9, 34, 65, 0.12);
98
+ }
99
+ .retry p {
100
+ margin: 0 0 16px 0;
101
+ font-family: Open Sans;
102
+ font-weight: 400;
103
+ font-size: 14px;
104
+ line-height: 24px;
105
+ letter-spacing: 0.25px;
106
+ text-align: center;
107
+ }
108
+ .retry ix-button {
109
+ display: inline-block;
110
+ margin: 0 0 16px 0;
111
+ }
112
+ h2 {
113
+ font-family: var(--ix-font-family, 'Red Hat Display');
114
+ font-weight: 700;
115
+ font-size: 34px;
116
+ line-height: 40px;
117
+ letter-spacing: 0.35px;
118
+ text-align: center;
119
+ margin: 1.5rem 0 16px 0;
120
+ }
121
+ .dialog h2 {
122
+ font-size: 24px;
123
+ line-height: 40px;
124
+ margin-top: 0.8rem;
125
+ letter-spacing: 0;
126
+ }
127
+ h3 {
128
+ font-family: Red Hat Display;
129
+ font-weight: 700;
130
+ font-size: 20px;
131
+ line-height: 24px;
132
+ letter-spacing: 0.15px;
133
+ text-align: center;
134
+ }
135
+ .error-trace-container {
136
+ width: 100%;
137
+ max-width: 489px;
138
+ }
139
+ .error-trace {
140
+ display: flex;
141
+ align-items: center;
142
+ padding-top: 16px;
143
+ padding-right: 24px;
144
+ padding-bottom: 16px;
145
+ padding-left: 24px;
146
+ background-color: var(--clr-surface, #fff);
147
+ gap: 8px;
148
+ border-radius: 12px;
149
+ border: 1px solid rgba(225, 228, 232, 1);
150
+ box-shadow: 0px 0px 0px 1px rgba(225, 228, 232, 1) inset;
151
+ box-shadow: 0px 12px 20px -12px rgba(0, 0, 0, 0.12);
152
+ --md-outlined-button-with-leading-icon-trailing-space: 1rem;
153
+ --md-outlined-button-with-leading-icon-leading-space: 1rem;
154
+ }
155
+ .error-trace-code {
156
+ flex: 1;
157
+ display: flex;
158
+ justify-content: center;
159
+ margin: 0;
160
+ letter-spacing: 0.15px;
161
+ }
162
+ .error-trace ix-button {
163
+ flex-shrink: 0;
164
+ }
165
+ .dialog-footer {
166
+ display: flex;
167
+ justify-content: flex-end;
168
+ margin: 1.5rem -1rem 0 0;
169
+ }
170
+ .visually-hidden {
171
+ position: absolute;
172
+ width: 1px;
173
+ height: 1px;
174
+ padding: 0;
175
+ margin: -1px;
176
+ overflow: hidden;
177
+ clip: rect(0, 0, 0, 0);
178
+ white-space: nowrap;
179
+ border: 0;
180
+ }
181
+ .sr-only {
182
+ position: absolute;
183
+ width: 1px;
184
+ height: 1px;
185
+ margin: -1px;
186
+ padding: 0;
187
+ overflow: hidden;
188
+ clip: rect(0, 0, 0, 0);
189
+ clip-path: inset(50%);
190
+ white-space: nowrap;
191
+ border: 0;
192
+ }
193
+ `,customElements.get("ix-error-message")||customElements.define("ix-error-message",p);export{p as IxErrorMessageStyled};
@@ -0,0 +1,3 @@
1
+ import { IxErrorMessageStyled } from '../ix-error-message.js';
2
+ export type IxErrorMessageElement = IxErrorMessageStyled;
3
+ export declare const IxErrorMessage: import("@lit/react").ReactWebComponent<IxErrorMessageStyled, {}>;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { createComponent } from '@lit/react';
3
+ import { IxErrorMessageStyled } from '../ix-error-message.js';
4
+ export const IxErrorMessage = createComponent({
5
+ tagName: 'ix-error-message',
6
+ elementClass: IxErrorMessageStyled,
7
+ react: React,
8
+ });
9
+ //# sourceMappingURL=IxErrorMessage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IxErrorMessage.js","sourceRoot":"","sources":["../../src/react/IxErrorMessage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAI9D,MAAM,CAAC,MAAM,cAAc,GAAG,eAAe,CAAC;IAC5C,OAAO,EAAE,kBAAkB;IAC3B,YAAY,EAAE,oBAAoB;IAClC,KAAK,EAAE,KAAK;CACb,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { createComponent } from '@lit/react';\nimport { IxErrorMessageStyled } from '../ix-error-message.js';\n\nexport type IxErrorMessageElement = IxErrorMessageStyled;\n\nexport const IxErrorMessage = createComponent({\n tagName: 'ix-error-message',\n elementClass: IxErrorMessageStyled,\n react: React,\n});\n"]}
package/package.json CHANGED
@@ -1,6 +1,107 @@
1
1
  {
2
2
  "name": "@digital-realty/ix-error-message",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "description": "Webcomponent ix-error-message following open-wc recommendations",
4
+ "license": "MIT",
5
+ "author": "Digital Realty",
6
+ "version": "0.0.2-IXUAT-11213.568825",
7
+ "type": "module",
8
+ "main": "dist/index.js",
9
+ "module": "dist/index.js",
10
+ "types": "dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "default": "./dist/index.js"
15
+ },
16
+ "./ix-error-message.js": "./dist/ix-error-message.js",
17
+ "./ix-error-message.min.js": "./dist/ix-error-message.min.js",
18
+ "./IxErrorMessage": "./dist/react/IxErrorMessage.js"
19
+ },
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "scripts": {
24
+ "analyze": "cem analyze --litelement",
25
+ "start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
26
+ "build": "tsc && pnpm run analyze --exclude dist && rollup -c",
27
+ "prepublish": "tsc && pnpm run analyze --exclude dist",
28
+ "lint": "eslint --ext .ts,.html . && prettier \"**/*.ts\" --check --ignore-path .gitignore",
29
+ "format": "eslint --ext .ts,.html . --fix && prettier \"**/*.ts\" --write --ignore-path .gitignore",
30
+ "test": "tsc && wtr --coverage",
31
+ "test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\""
32
+ },
33
+ "dependencies": {
34
+ "@digital-realty/ix-button": "^3.5.10",
35
+ "@digital-realty/ix-dialog": "^1.3.10-IXUAT-11213.568825",
36
+ "@digital-realty/ix-icon": "^1.3.5",
37
+ "@lit/react": "^1.0.2",
38
+ "@material/web": "2.4.0",
39
+ "@open-wc/lit-helpers": "^0.7.0",
40
+ "lit": "^3.2.1",
41
+ "react": "^18.2.0"
42
+ },
43
+ "devDependencies": {
44
+ "@custom-elements-manifest/analyzer": "^0.4.17",
45
+ "@open-wc/testing": "^3.1.6",
46
+ "@rollup/plugin-terser": "^1.0.0",
47
+ "@types/react": "^18.2.22",
48
+ "@typescript-eslint/eslint-plugin": "^8.58.2",
49
+ "@typescript-eslint/parser": "^8.58.2",
50
+ "@web/dev-server": "^0.4.6",
51
+ "@web/test-runner": "^0.20.2",
52
+ "@web/test-runner-commands": "^0.9.0",
53
+ "concurrently": "^9.2.1",
54
+ "eslint": "^9.39.4",
55
+ "eslint-config-prettier": "^8.3.0",
56
+ "lint-staged": "^10.5.4",
57
+ "prettier": "^2.4.1",
58
+ "rollup": "^4.29.1",
59
+ "rollup-plugin-summary": "^2.0.0",
60
+ "tslib": "^2.3.1",
61
+ "typescript": "^5.1.6"
62
+ },
63
+ "customElements": "custom-elements.json",
64
+ "eslintConfig": {
65
+ "parser": "@typescript-eslint/parser",
66
+ "root": true,
67
+ "plugins": [
68
+ "@typescript-eslint"
69
+ ],
70
+ "rules": {
71
+ "no-unused-vars": "off",
72
+ "@typescript-eslint/no-unused-vars": [
73
+ "error"
74
+ ],
75
+ "class-methods-use-this": "off",
76
+ "import/no-unresolved": "off",
77
+ "import/extensions": [
78
+ "error",
79
+ "always",
80
+ {
81
+ "ignorePackages": true
82
+ }
83
+ ]
84
+ },
85
+ "globals": {
86
+ "ShadowRootInit": true
87
+ }
88
+ },
89
+ "prettier": {
90
+ "singleQuote": true,
91
+ "arrowParens": "avoid"
92
+ },
93
+ "lint-staged": {
94
+ "*.ts": [
95
+ "eslint --fix",
96
+ "prettier --write"
97
+ ]
98
+ },
99
+ "files": [
100
+ "/dist",
101
+ "!/dist/test",
102
+ "package.json",
103
+ "README.md",
104
+ "LICENSE"
105
+ ],
106
+ "gitHead": "31fbc83483ed33cac9baa1a5a154003d1deb136a"
107
+ }