@saasquatch/mint-components 1.13.5 → 1.14.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.
Files changed (90) hide show
  1. package/dist/cjs/ErrorView-b2fcf954.js +35 -0
  2. package/dist/cjs/{ShadowViewAddon-14a02da4.js → ShadowViewAddon-787391f7.js} +6 -5
  3. package/dist/cjs/copy-text-view-c85acaaa.js +96 -0
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/mint-components.cjs.js +1 -1
  6. package/dist/cjs/sqm-banking-info-form_17.cjs.entry.js +3 -2
  7. package/dist/cjs/sqm-big-stat_41.cjs.entry.js +3 -2
  8. package/dist/cjs/{sqm-invoice-table-view-baded4af.js → sqm-invoice-table-view-16ac73d0.js} +2 -31
  9. package/dist/cjs/sqm-pagination_3.cjs.entry.js +6 -5
  10. package/dist/cjs/sqm-qr-code-view-15dfc0b6.js +103 -0
  11. package/dist/cjs/sqm-qr-code.cjs.entry.js +207 -0
  12. package/dist/cjs/sqm-stencilbook.cjs.entry.js +68 -5
  13. package/dist/cjs/{copy-text-view-a5524c20.js → useReferralCodes-82e8797b.js} +0 -93
  14. package/dist/collection/collection-manifest.json +1 -0
  15. package/dist/collection/components/sqm-qr-code/QRCode.stories.js +47 -0
  16. package/dist/collection/components/sqm-qr-code/sqm-qr-code-view.js +98 -0
  17. package/dist/collection/components/sqm-qr-code/sqm-qr-code.js +293 -0
  18. package/dist/collection/components/sqm-qr-code/useQRCode.js +124 -0
  19. package/dist/collection/components/sqm-stencilbook/sqm-stencilbook.js +2 -0
  20. package/dist/esm/ErrorView-48e2b969.js +33 -0
  21. package/dist/esm/{ShadowViewAddon-23a6afab.js → ShadowViewAddon-cf230f50.js} +2 -1
  22. package/dist/esm/copy-text-view-782137ba.js +94 -0
  23. package/dist/esm/loader.js +1 -1
  24. package/dist/esm/mint-components.js +1 -1
  25. package/dist/esm/sqm-banking-info-form_17.entry.js +2 -1
  26. package/dist/esm/sqm-big-stat_41.entry.js +3 -2
  27. package/dist/esm/{sqm-invoice-table-view-af69cd33.js → sqm-invoice-table-view-2c726568.js} +2 -30
  28. package/dist/esm/sqm-pagination_3.entry.js +2 -1
  29. package/dist/esm/sqm-qr-code-view-f1d0763b.js +101 -0
  30. package/dist/esm/sqm-qr-code.entry.js +203 -0
  31. package/dist/esm/sqm-stencilbook.entry.js +68 -5
  32. package/dist/esm/{copy-text-view-459a2e35.js → useReferralCodes-8f75921a.js} +1 -93
  33. package/dist/esm-es5/ErrorView-48e2b969.js +1 -0
  34. package/dist/esm-es5/ShadowViewAddon-cf230f50.js +1 -0
  35. package/dist/esm-es5/copy-text-view-782137ba.js +1 -0
  36. package/dist/esm-es5/loader.js +1 -1
  37. package/dist/esm-es5/mint-components.js +1 -1
  38. package/dist/esm-es5/sqm-banking-info-form_17.entry.js +1 -1
  39. package/dist/esm-es5/sqm-big-stat_41.entry.js +1 -1
  40. package/dist/esm-es5/sqm-invoice-table-view-2c726568.js +1 -0
  41. package/dist/esm-es5/sqm-pagination_3.entry.js +1 -1
  42. package/dist/esm-es5/sqm-qr-code-view-f1d0763b.js +1 -0
  43. package/dist/esm-es5/sqm-qr-code.entry.js +1 -0
  44. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  45. package/dist/esm-es5/useReferralCodes-8f75921a.js +1 -0
  46. package/dist/mint-components/mint-components.esm.js +1 -1
  47. package/dist/mint-components/p-0c78815e.system.entry.js +1 -0
  48. package/dist/mint-components/{p-01010af0.entry.js → p-116baa69.entry.js} +1 -1
  49. package/dist/mint-components/p-1f089c3f.system.entry.js +1 -0
  50. package/dist/mint-components/p-31015791.js +1 -0
  51. package/dist/mint-components/p-37996351.system.js +1 -1
  52. package/dist/mint-components/p-3a62a7e2.system.js +1 -0
  53. package/dist/mint-components/p-3b90e01b.system.js +1 -0
  54. package/dist/mint-components/p-3f067fd5.js +1 -0
  55. package/dist/mint-components/p-3f7b81b8.js +52 -0
  56. package/dist/mint-components/p-4e773bb1.system.entry.js +1 -0
  57. package/dist/mint-components/p-53730ffe.entry.js +17 -0
  58. package/dist/mint-components/p-562428ef.system.js +1 -0
  59. package/dist/mint-components/{p-23ed5e6f.entry.js → p-57eef0af.entry.js} +4 -4
  60. package/dist/mint-components/p-5cb7f9fc.system.entry.js +1 -0
  61. package/dist/mint-components/{p-d3d74266.js → p-6cc141b9.js} +2 -2
  62. package/dist/mint-components/{p-b51e79b3.entry.js → p-7846937e.entry.js} +2 -2
  63. package/dist/mint-components/p-9acb5038.js +1 -0
  64. package/dist/mint-components/p-a7746488.system.js +1 -0
  65. package/dist/mint-components/p-aad32fb6.system.js +1 -0
  66. package/dist/mint-components/p-daee25f9.system.entry.js +1 -0
  67. package/dist/mint-components/p-dbc0e4f8.system.js +1 -0
  68. package/dist/mint-components/{p-ba9b5b20.entry.js → p-ef6381d4.entry.js} +2 -2
  69. package/dist/mint-components/p-f56bedd5.js +1 -0
  70. package/dist/types/components/sqm-qr-code/QRCode.stories.d.ts +12 -0
  71. package/dist/types/components/sqm-qr-code/sqm-qr-code-view.d.ts +15 -0
  72. package/dist/types/components/sqm-qr-code/sqm-qr-code.d.ts +52 -0
  73. package/dist/types/components/sqm-qr-code/useQRCode.d.ts +3 -0
  74. package/dist/types/components.d.ts +94 -0
  75. package/docs/docs.docx +0 -0
  76. package/docs/raisins.json +1 -1
  77. package/grapesjs/grapesjs.js +1 -1
  78. package/package.json +1 -1
  79. package/dist/esm-es5/ShadowViewAddon-23a6afab.js +0 -1
  80. package/dist/esm-es5/copy-text-view-459a2e35.js +0 -1
  81. package/dist/esm-es5/sqm-invoice-table-view-af69cd33.js +0 -1
  82. package/dist/mint-components/p-33ed6f1c.system.entry.js +0 -1
  83. package/dist/mint-components/p-717cc8ac.system.js +0 -1
  84. package/dist/mint-components/p-71bc04d2.system.entry.js +0 -1
  85. package/dist/mint-components/p-7e7cbccf.system.js +0 -1
  86. package/dist/mint-components/p-7f2d4212.js +0 -52
  87. package/dist/mint-components/p-8da00a59.system.entry.js +0 -1
  88. package/dist/mint-components/p-8f8245da.system.entry.js +0 -1
  89. package/dist/mint-components/p-9320582e.system.js +0 -1
  90. package/dist/mint-components/p-962f3200.js +0 -1
@@ -0,0 +1,293 @@
1
+ import { isDemo } from "@saasquatch/component-boilerplate";
2
+ import { useState, withHooks } from "@saasquatch/stencil-hooks";
3
+ import { Component, h, Prop } from "@stencil/core";
4
+ import deepmerge from "deepmerge";
5
+ import { getProps } from "../../utils/utils";
6
+ import { QrCodeView } from "./sqm-qr-code-view";
7
+ import { useQRCode } from "./useQRCode";
8
+ /**
9
+ * @uiName QR Code
10
+ * @exampleGroup Sharing
11
+ * @example QR Code - <sqm-qr-code></sqm-qr-code>
12
+ */
13
+ export class QrCode {
14
+ constructor() {
15
+ /**
16
+ * @uiName Title
17
+ */
18
+ this.titleText = "Share your QR code";
19
+ /**
20
+ * @uiName View QR code text
21
+ */
22
+ this.viewCodeText = "View QR code";
23
+ /**
24
+ * @uiName Download QR code text
25
+ */
26
+ this.downloadCodeText = "Download";
27
+ /**
28
+ * @uiName Print QR code text
29
+ */
30
+ this.printCodeText = "Print";
31
+ /**
32
+ * @uiName Header for error banner
33
+ */
34
+ this.errorHeaderText = "There was an error loading your QR code";
35
+ /**
36
+ * @uiName Description for error banner
37
+ */
38
+ this.errorDescriptionText = "Please refresh this page and try again";
39
+ /**
40
+ * @uiName Hide title
41
+ */
42
+ this.hideTitle = false;
43
+ /**
44
+ * @uiName QR code alignment
45
+ * @uiType string
46
+ * @uiEnum ["left", "center", "right"]
47
+ * @uiEnumNames ["Left", "Center", "Right"]
48
+ */
49
+ this.alignment = "center";
50
+ withHooks(this);
51
+ }
52
+ disconnectedCallback() { }
53
+ render() {
54
+ const thisProps = getProps(this);
55
+ const props = isDemo() ? useDemoQRCode(thisProps) : useQRCode(thisProps);
56
+ return h(QrCodeView, Object.assign({}, props));
57
+ }
58
+ static get is() { return "sqm-qr-code"; }
59
+ static get encapsulation() { return "shadow"; }
60
+ static get properties() { return {
61
+ "titleText": {
62
+ "type": "string",
63
+ "mutable": false,
64
+ "complexType": {
65
+ "original": "string",
66
+ "resolved": "string",
67
+ "references": {}
68
+ },
69
+ "required": false,
70
+ "optional": true,
71
+ "docs": {
72
+ "tags": [{
73
+ "text": "Title",
74
+ "name": "uiName"
75
+ }],
76
+ "text": ""
77
+ },
78
+ "attribute": "title-text",
79
+ "reflect": false,
80
+ "defaultValue": "\"Share your QR code\""
81
+ },
82
+ "viewCodeText": {
83
+ "type": "string",
84
+ "mutable": false,
85
+ "complexType": {
86
+ "original": "string",
87
+ "resolved": "string",
88
+ "references": {}
89
+ },
90
+ "required": false,
91
+ "optional": true,
92
+ "docs": {
93
+ "tags": [{
94
+ "text": "View QR code text",
95
+ "name": "uiName"
96
+ }],
97
+ "text": ""
98
+ },
99
+ "attribute": "view-code-text",
100
+ "reflect": false,
101
+ "defaultValue": "\"View QR code\""
102
+ },
103
+ "downloadCodeText": {
104
+ "type": "string",
105
+ "mutable": false,
106
+ "complexType": {
107
+ "original": "string",
108
+ "resolved": "string",
109
+ "references": {}
110
+ },
111
+ "required": false,
112
+ "optional": true,
113
+ "docs": {
114
+ "tags": [{
115
+ "text": "Download QR code text",
116
+ "name": "uiName"
117
+ }],
118
+ "text": ""
119
+ },
120
+ "attribute": "download-code-text",
121
+ "reflect": false,
122
+ "defaultValue": "\"Download\""
123
+ },
124
+ "printCodeText": {
125
+ "type": "string",
126
+ "mutable": false,
127
+ "complexType": {
128
+ "original": "string",
129
+ "resolved": "string",
130
+ "references": {}
131
+ },
132
+ "required": false,
133
+ "optional": true,
134
+ "docs": {
135
+ "tags": [{
136
+ "text": "Print QR code text",
137
+ "name": "uiName"
138
+ }],
139
+ "text": ""
140
+ },
141
+ "attribute": "print-code-text",
142
+ "reflect": false,
143
+ "defaultValue": "\"Print\""
144
+ },
145
+ "errorHeaderText": {
146
+ "type": "string",
147
+ "mutable": false,
148
+ "complexType": {
149
+ "original": "string",
150
+ "resolved": "string",
151
+ "references": {}
152
+ },
153
+ "required": false,
154
+ "optional": true,
155
+ "docs": {
156
+ "tags": [{
157
+ "text": "Header for error banner",
158
+ "name": "uiName"
159
+ }],
160
+ "text": ""
161
+ },
162
+ "attribute": "error-header-text",
163
+ "reflect": false,
164
+ "defaultValue": "\"There was an error loading your QR code\""
165
+ },
166
+ "errorDescriptionText": {
167
+ "type": "string",
168
+ "mutable": false,
169
+ "complexType": {
170
+ "original": "string",
171
+ "resolved": "string",
172
+ "references": {}
173
+ },
174
+ "required": false,
175
+ "optional": true,
176
+ "docs": {
177
+ "tags": [{
178
+ "text": "Description for error banner",
179
+ "name": "uiName"
180
+ }],
181
+ "text": ""
182
+ },
183
+ "attribute": "error-description-text",
184
+ "reflect": false,
185
+ "defaultValue": "\"Please refresh this page and try again\""
186
+ },
187
+ "hideTitle": {
188
+ "type": "boolean",
189
+ "mutable": false,
190
+ "complexType": {
191
+ "original": "boolean",
192
+ "resolved": "boolean",
193
+ "references": {}
194
+ },
195
+ "required": false,
196
+ "optional": true,
197
+ "docs": {
198
+ "tags": [{
199
+ "text": "Hide title",
200
+ "name": "uiName"
201
+ }],
202
+ "text": ""
203
+ },
204
+ "attribute": "hide-title",
205
+ "reflect": false,
206
+ "defaultValue": "false"
207
+ },
208
+ "alignment": {
209
+ "type": "string",
210
+ "mutable": false,
211
+ "complexType": {
212
+ "original": "\"left\" | \"center\" | \"right\"",
213
+ "resolved": "\"center\" | \"left\" | \"right\"",
214
+ "references": {}
215
+ },
216
+ "required": false,
217
+ "optional": true,
218
+ "docs": {
219
+ "tags": [{
220
+ "text": "QR code alignment",
221
+ "name": "uiName"
222
+ }, {
223
+ "text": "string",
224
+ "name": "uiType"
225
+ }, {
226
+ "text": "[\"left\", \"center\", \"right\"]",
227
+ "name": "uiEnum"
228
+ }, {
229
+ "text": "[\"Left\", \"Center\", \"Right\"]",
230
+ "name": "uiEnumNames"
231
+ }],
232
+ "text": ""
233
+ },
234
+ "attribute": "alignment",
235
+ "reflect": false,
236
+ "defaultValue": "\"center\""
237
+ },
238
+ "demoData": {
239
+ "type": "unknown",
240
+ "mutable": false,
241
+ "complexType": {
242
+ "original": "DemoData<QRCodeViewProps>",
243
+ "resolved": "{ loading?: boolean; titleText?: string; alignment?: \"left\" | \"right\" | \"center\"; error?: boolean; qrLink?: string; createDownloadable?: () => void; hideTitle?: boolean; downloadCodeText?: string; printCodeText?: string; errorHeaderText?: string; errorDescriptionText?: string; createPrintable?: () => void; }",
244
+ "references": {
245
+ "DemoData": {
246
+ "location": "import",
247
+ "path": "../../global/demo"
248
+ },
249
+ "QRCodeViewProps": {
250
+ "location": "import",
251
+ "path": "./sqm-qr-code-view"
252
+ }
253
+ }
254
+ },
255
+ "required": false,
256
+ "optional": true,
257
+ "docs": {
258
+ "tags": [{
259
+ "text": undefined,
260
+ "name": "undocumented"
261
+ }, {
262
+ "text": "object",
263
+ "name": "uiType"
264
+ }],
265
+ "text": ""
266
+ }
267
+ }
268
+ }; }
269
+ }
270
+ function useDemoQRCode(props) {
271
+ const [dialogIsOpen, setDialog] = useState(false);
272
+ return deepmerge({
273
+ dialogIsOpen,
274
+ hideTitle: props.hideTitle,
275
+ showDialog: () => setDialog(true),
276
+ hideDialog: () => setDialog(false),
277
+ titleText: props.titleText,
278
+ viewCodeText: props.viewCodeText,
279
+ downloadCodeText: props.downloadCodeText,
280
+ printCodeText: props.printCodeText,
281
+ alignment: props.alignment,
282
+ qrLink: "https://media.istockphoto.com/id/1251071788/vector/qr-code-bar-code-black-icon-digital-technology.jpg?s=612x612&w=0&k=20&c=maw4OqMSEegAdSo8Drm9HO7i1ddddvP2YaL1UuWbRig=",
283
+ fireViewQrEvent: () => {
284
+ console.log("View QR Code clicked");
285
+ },
286
+ createDownloadable: async () => {
287
+ console.log("Download QR Code clicked");
288
+ },
289
+ createPrintable: async () => {
290
+ console.log("Print QR Code clicked");
291
+ },
292
+ }, props.demoData || {}, { arrayMerge: (_, a) => a });
293
+ }
@@ -0,0 +1,124 @@
1
+ import { useEngagementMedium, useMutation, useParentValue, useProgramId, useQuery, useUserIdentity, } from "@saasquatch/component-boilerplate";
2
+ import { useState } from "@saasquatch/stencil-hooks";
3
+ import { useEffect } from "@saasquatch/universal-hooks";
4
+ import { gql } from "graphql-request";
5
+ import { REFERRAL_CODES_NAMESPACE, } from "../sqm-referral-codes/useReferralCodes";
6
+ const ShareLinkQuery = gql `
7
+ query shareLink($programId: ID, $engagementMedium: UserEngagementMedium!) {
8
+ user: viewer {
9
+ ... on User {
10
+ shareLink(
11
+ programId: $programId
12
+ engagementMedium: $engagementMedium
13
+ shareMedium: DIRECT
14
+ )
15
+ }
16
+ }
17
+ }
18
+ `;
19
+ const WIDGET_ENGAGEMENT_EVENT = gql `
20
+ mutation loadEvent($eventMeta: UserAnalyticsEvent!) {
21
+ createUserAnalyticsEvent(eventMeta: $eventMeta)
22
+ }
23
+ `;
24
+ export function useQRCode(props) {
25
+ var _a;
26
+ const programId = useProgramId();
27
+ const user = useUserIdentity();
28
+ const engagementMedium = useEngagementMedium();
29
+ const contextData = useParentValue(REFERRAL_CODES_NAMESPACE);
30
+ const [qrLink, setQrUrl] = useState(null);
31
+ const [error, setError] = useState(false);
32
+ const [loading, setLoading] = useState(false);
33
+ const { data, errors, loading: requestLoading, } = useQuery(ShareLinkQuery, { programId, engagementMedium }, !(user === null || user === void 0 ? void 0 : user.jwt) || (contextData === null || contextData === void 0 ? void 0 : contextData.shareLink) !== undefined);
34
+ const [sendLoadEvent] = useMutation(WIDGET_ENGAGEMENT_EVENT);
35
+ const shareLink = (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.shareLink;
36
+ const qrPrefix = `${shareLink}?qrCode`;
37
+ const completeLoading = requestLoading || loading;
38
+ useEffect(() => {
39
+ if (!shareLink)
40
+ return;
41
+ const getQrCode = async () => {
42
+ setLoading(true);
43
+ try {
44
+ const res = await fetch(`${shareLink}?qrCode&qrCodeImageFormat=svg&qrCodeQuietZoneSize=0`);
45
+ const blob = await res.blob();
46
+ const url = URL.createObjectURL(blob);
47
+ setQrUrl(url);
48
+ }
49
+ catch (e) {
50
+ setError(true);
51
+ }
52
+ finally {
53
+ setLoading(false);
54
+ }
55
+ };
56
+ getQrCode();
57
+ }, [shareLink]);
58
+ const fireEvent = async () => {
59
+ sendLoadEvent({
60
+ eventMeta: {
61
+ programId,
62
+ id: user === null || user === void 0 ? void 0 : user.id,
63
+ accountId: user === null || user === void 0 ? void 0 : user.accountId,
64
+ type: "USER_REFERRAL_PROGRAM_ENGAGEMENT_EVENT",
65
+ meta: {
66
+ engagementMedium,
67
+ shareMedium: "DIRECT",
68
+ },
69
+ },
70
+ });
71
+ };
72
+ const createDownloadable = async () => {
73
+ try {
74
+ const res = await fetch(`${qrPrefix}&qrCodeSize=800&qrCodeImageFormat=png`);
75
+ const blob = await res.blob();
76
+ const url = URL.createObjectURL(blob);
77
+ // Successful
78
+ if (blob)
79
+ fireEvent();
80
+ // Trigger download
81
+ const link = document.createElement("a");
82
+ link.href = url;
83
+ link.download = "qrCode.png";
84
+ document.body.appendChild(link);
85
+ link.click();
86
+ document.body.removeChild(link);
87
+ }
88
+ catch (e) {
89
+ console.error("Failed to fetch QR code:", e);
90
+ setError(true);
91
+ }
92
+ };
93
+ const createPrintable = async () => {
94
+ try {
95
+ const res = await fetch(`${qrPrefix}&qrCodeSize=1000&qrCodeImageFormat=png&qrCodeErrorCorrectionLevel=H`);
96
+ const blob = await res.blob();
97
+ const url = URL.createObjectURL(blob);
98
+ // Successful
99
+ if (blob)
100
+ fireEvent();
101
+ // Trigger print
102
+ const page = window.open("about:blank", "_new");
103
+ const img = page.document.createElement("img");
104
+ img.src = url;
105
+ img.onload = () => {
106
+ page.print();
107
+ page.close();
108
+ };
109
+ page.document.body.appendChild(img);
110
+ }
111
+ catch (e) {
112
+ console.error("Failed to fetch QR code: ", e);
113
+ setError(true);
114
+ }
115
+ };
116
+ return {
117
+ ...props,
118
+ loading: completeLoading,
119
+ qrLink,
120
+ error: error,
121
+ createDownloadable,
122
+ createPrintable,
123
+ };
124
+ }
@@ -96,6 +96,7 @@ import * as ReferralCodes from "../sqm-referral-codes/ReferralCodes.stories";
96
96
  import * as BaseRegistrationForm from "../sqm-base-registration/BaseRegistrationForm.stories";
97
97
  import * as PortalRegistrationForm from "../sqm-portal-registration-form/PortalRegistrationForm.stories";
98
98
  import * as PortalGoogleRegistrationFormStories from "../sqm-portal-google-registration-form/PortalGoogleRegistrationForm.stories";
99
+ import * as QRCode from "../sqm-qr-code/QRCode.stories";
99
100
  import * as Themes from "./Themes";
100
101
  import { CucumberAddon } from "./CucumberAddon";
101
102
  import { HookStoryAddon } from "./HookStoryAddon";
@@ -197,6 +198,7 @@ const stories = [
197
198
  WidgetCodeVerification,
198
199
  PayoutButtonScroll,
199
200
  PayoutStatusAlert,
201
+ QRCode,
200
202
  ];
201
203
  /**
202
204
  * For internal documentation
@@ -0,0 +1,33 @@
1
+ import { h } from './index-91e7729f.js';
2
+ import { c as createStyleSheet } from './JSS-67b5cff8.js';
3
+
4
+ const styles = {
5
+ Alert: {
6
+ "&::part(base)": {
7
+ backgroundColor: "var(--sl-color-danger-100)",
8
+ border: "1px solid var(--sl-color-danger-200)",
9
+ padding: "0 16px",
10
+ },
11
+ "& sl-icon": {
12
+ margin: 0,
13
+ },
14
+ "& sl-icon::part(base)": {
15
+ color: "var(--sl-color-danger-500)",
16
+ margin: 0,
17
+ },
18
+ },
19
+ };
20
+ const ErrorView = (props) => {
21
+ const sheet = createStyleSheet(styles);
22
+ const styleString = sheet.toString();
23
+ const { classes } = sheet;
24
+ return (h("div", null,
25
+ h("style", null, styleString),
26
+ h("sl-alert", { exportparts: "base: alert-base, icon:alert-icon", type: "danger", open: true, class: classes.Alert },
27
+ h("sl-icon", { slot: "icon", name: "exclamation-octagon", class: "Error" }),
28
+ h("strong", null, props.loadingErrorAlertHeader),
29
+ h("br", null),
30
+ props.loadingErrorAlertDescription)));
31
+ };
32
+
33
+ export { ErrorView as E };
@@ -5,8 +5,9 @@ import { d as dist, H, J, F as Fn, w as wn, $ as $e, B, g as getEnvironmentSDK,
5
5
  import { c as cjs } from './cjs-bdfb4486.js';
6
6
  import { l as luxonLocale } from './utils-334c1e34.js';
7
7
  import { c as createStyleSheet, j as jss, a as create } from './JSS-67b5cff8.js';
8
- import { a as REFERRAL_CODES_NAMESPACE, S as SET_CODE_COPIED, C as CopyTextView } from './copy-text-view-459a2e35.js';
8
+ import { a as REFERRAL_CODES_NAMESPACE, S as SET_CODE_COPIED } from './useReferralCodes-8f75921a.js';
9
9
  import { H as HostBlock, A as AuthWrapper, a as AuthColumn, b as AuthButtonsContainer, E as ErrorStyles } from './mixins-83f90fa1.js';
10
+ import { C as CopyTextView } from './copy-text-view-782137ba.js';
10
11
  import { u as useChildElements } from './useChildElements-7945ae56.js';
11
12
  import { l as luxon } from './luxon-8d51c92b.js';
12
13
  import { T as TextSpanView } from './sqm-text-span-view-ca32495e.js';
@@ -0,0 +1,94 @@
1
+ import { h } from './index-91e7729f.js';
2
+ import { c as createStyleSheet } from './JSS-67b5cff8.js';
3
+ import { H as HostBlock } from './mixins-83f90fa1.js';
4
+
5
+ const style = {
6
+ HostBlock: HostBlock,
7
+ inputStyle: {
8
+ "&::part(input)": { textOverflow: "ellipsis", width: "100%" },
9
+ "&::part(base)": { cursor: "pointer", overflow: "visible" },
10
+ width: "100%",
11
+ },
12
+ inputErrorStyle: {
13
+ "&::part(base)": {
14
+ border: "2px solid red",
15
+ },
16
+ },
17
+ ContainerDiv: {
18
+ display: "flex",
19
+ alignItems: "flex-start",
20
+ flexDirection: "column",
21
+ justifyContent: "center",
22
+ gap: "var(--sl-spacing-x-small)",
23
+ width: "100%",
24
+ },
25
+ containerStyle: {
26
+ display: "flex",
27
+ alignItems: "center",
28
+ gap: "var(--sl-spacing-x-small)",
29
+ width: "100%",
30
+ },
31
+ errorTextStyle: {
32
+ margin: "0",
33
+ color: "var(--sl-color-danger-500)",
34
+ },
35
+ notificationTextStyle: {
36
+ margin: "0",
37
+ color: "var(--sl-color-neutral-500)",
38
+ },
39
+ };
40
+ const vanillaStyle = `
41
+ :host{
42
+ display: block;
43
+ width: 100%;
44
+ }
45
+ `;
46
+ const textAlignStyle = {
47
+ right: `
48
+ sl-input::part(input){
49
+ text-align: right;
50
+ }`,
51
+ center: `
52
+ sl-input::part(input){
53
+ text-align: center;
54
+ }`,
55
+ left: ``,
56
+ };
57
+ const disabledStyles = `
58
+ sl-input::part(input){
59
+ cursor: default;
60
+ }
61
+ `;
62
+ const sheet = createStyleSheet(style);
63
+ const styleString = sheet.toString();
64
+ function CopyTextView(props) {
65
+ const { buttonStyle = "icon" } = props;
66
+ const error = !props.loading && props.error;
67
+ const inputText = error ? props.inputPlaceholderText : props.copyString;
68
+ const disabled = error || props.loading || props.disabled;
69
+ const tooltipPlacement = props.buttonStyle === "button-below"
70
+ ? "bottom"
71
+ : props.buttonStyle === "button-outside"
72
+ ? "top"
73
+ : "top-end";
74
+ const copyButton = (h("sl-tooltip", { trigger: "manual", content: props.tooltiptext, placement: tooltipPlacement, disabled: props.disabled, open: props.open, skidding: props.buttonStyle === "icon" ? -5 : 0, slot: "suffix" }, buttonStyle === "icon" ? (h("sl-icon-button", { exportparts: "base: icon-button-base", onClick: () => { var _a; return (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props); }, name: "files", disabled: disabled })) : (h("sl-button", { exportparts: "base: copy-button-base", onClick: () => { var _a; return (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props); }, size: "medium", style: { width: `${buttonStyle === "button-below" && "100%"}` }, disabled: disabled, type: "primary" }, props.copyButtonLabel || "Copy"))));
75
+ return (h("div", { class: sheet.classes.ContainerDiv },
76
+ h("style", { type: "text/css" },
77
+ styleString,
78
+ vanillaStyle,
79
+ textAlignStyle[props.textAlign],
80
+ disabled && disabledStyles),
81
+ h("div", { class: sheet.classes.containerStyle, style: {
82
+ flexDirection: `${buttonStyle === "button-below" ? "column" : "row"}`,
83
+ } },
84
+ h("sl-input", { class: `${sheet.classes.inputStyle} ${error ? sheet.classes.inputErrorStyle : ""}`, exportparts: "base: input-base, input: input-label", value: props.loading ? "Loading..." : inputText, readonly: true, disabled: disabled },
85
+ buttonStyle === "icon" && copyButton,
86
+ error && (h("p", { slot: "help-text", class: sheet.classes.errorTextStyle }, props.errorText))),
87
+ (buttonStyle === "button-outside" || buttonStyle === "button-below") &&
88
+ copyButton),
89
+ props.isCopied &&
90
+ props.showNotificationText &&
91
+ props.notificationText && (h("p", { part: "sqm-notification-text", class: sheet.classes.notificationTextStyle }, props.notificationText))));
92
+ }
93
+
94
+ export { CopyTextView as C };