@haiilo/catalyst 0.11.0 → 0.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.
- package/dist/catalyst/catalyst.css +1 -1
- package/dist/catalyst/catalyst.esm.js +1 -1
- package/dist/catalyst/catalyst.esm.js.map +1 -1
- package/dist/catalyst/index.esm.js +1 -1
- package/dist/catalyst/p-5f9b3485.entry.js +12 -0
- package/dist/catalyst/p-5f9b3485.entry.js.map +1 -0
- package/dist/catalyst/p-933b6a7a.js +10 -0
- package/dist/catalyst/p-933b6a7a.js.map +1 -0
- package/dist/catalyst/{p-659073b5.js → p-a255bd64.js} +2 -2
- package/dist/catalyst/p-a255bd64.js.map +1 -0
- package/dist/catalyst/scss/core/_base.scss +0 -1
- package/dist/catalyst/scss/core/_toast.scss +22 -12
- package/dist/catalyst/scss/utils/_layout.scss +4 -4
- package/dist/catalyst/scss/utils/_sizing.mixins.scss +0 -4
- package/dist/catalyst/scss/utils/_typography.mixins.scss +3 -3
- package/dist/cjs/{cat-alert_21.cjs.entry.js → cat-alert_22.cjs.entry.js} +234 -63
- package/dist/cjs/cat-alert_22.cjs.entry.js.map +1 -0
- package/dist/cjs/{cat-notification-c2859ed7.js → cat-notification-6a438ad1.js} +374 -58
- package/dist/cjs/cat-notification-6a438ad1.js.map +1 -0
- package/dist/cjs/catalyst.cjs.js +2 -2
- package/dist/cjs/{index-936b777e.js → index-c7955116.js} +12 -1
- package/dist/cjs/index-c7955116.js.map +1 -0
- package/dist/cjs/index.cjs.js +1 -2
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/components/cat-alert/cat-alert.css +24 -14
- package/dist/collection/components/cat-alert/cat-alert.js +49 -1
- package/dist/collection/components/cat-alert/cat-alert.js.map +1 -1
- package/dist/collection/components/cat-button/cat-button.css +185 -0
- package/dist/collection/components/cat-checkbox/cat-checkbox.css +16 -9
- package/dist/collection/components/cat-input/cat-input.css +3 -0
- package/dist/collection/components/cat-input/cat-input.js +8 -3
- package/dist/collection/components/cat-input/cat-input.js.map +1 -1
- package/dist/collection/components/cat-input/input-type.js +2 -0
- package/dist/collection/components/cat-input/input-type.js.map +1 -0
- package/dist/collection/components/cat-notification/cat-notification.js +43 -44
- package/dist/collection/components/cat-notification/cat-notification.js.map +1 -1
- package/dist/collection/components/cat-radio/cat-radio.css +3 -0
- package/dist/collection/components/cat-radio-group/cat-radio-group.js +30 -0
- package/dist/collection/components/cat-radio-group/cat-radio-group.js.map +1 -1
- package/dist/collection/components/cat-select/cat-select.css +4 -2
- package/dist/collection/components/cat-select/cat-select.js +77 -20
- package/dist/collection/components/cat-select/cat-select.js.map +1 -1
- package/dist/collection/components/cat-tab/cat-tab.js +7 -7
- package/dist/collection/components/cat-tab/cat-tab.js.map +1 -1
- package/dist/collection/components/cat-tabs/cat-tabs.js +19 -2
- package/dist/collection/components/cat-tabs/cat-tabs.js.map +1 -1
- package/dist/collection/components/cat-textarea/cat-textarea.css +3 -0
- package/dist/collection/components/cat-toast-demo/cat-toast-demo.js +12 -1
- package/dist/collection/components/cat-toast-demo/cat-toast-demo.js.map +1 -1
- package/dist/collection/components/cat-toggle/cat-toggle.css +9 -9
- package/dist/collection/components/cat-tooltip/cat-tooltip.css +2 -3
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/scss/core/_base.scss +0 -1
- package/dist/collection/scss/core/_toast.scss +22 -12
- package/dist/collection/scss/utils/_layout.scss +4 -4
- package/dist/collection/scss/utils/_sizing.mixins.scss +0 -4
- package/dist/collection/scss/utils/_typography.mixins.scss +3 -3
- package/dist/components/cat-alert.js +23 -4
- package/dist/components/cat-alert.js.map +1 -1
- package/dist/components/cat-avatar.js.map +1 -1
- package/dist/components/cat-badge.js.map +1 -1
- package/dist/components/cat-button2.js +1 -1
- package/dist/components/cat-button2.js.map +1 -1
- package/dist/components/cat-checkbox.js +1 -1
- package/dist/components/cat-checkbox.js.map +1 -1
- package/dist/components/cat-icon2.js.map +1 -1
- package/dist/components/cat-input.js +1 -1
- package/dist/components/cat-input.js.map +1 -1
- package/dist/components/cat-radio-group.js +7 -1
- package/dist/components/cat-radio-group.js.map +1 -1
- package/dist/components/cat-radio.js +1 -1
- package/dist/components/cat-radio.js.map +1 -1
- package/dist/components/cat-select.js +53 -21
- package/dist/components/cat-select.js.map +1 -1
- package/dist/components/cat-skeleton.js.map +1 -1
- package/dist/components/cat-spinner2.js.map +1 -1
- package/dist/components/cat-tab.js +7 -7
- package/dist/components/cat-tab.js.map +1 -1
- package/dist/components/cat-tabs.js +19 -2
- package/dist/components/cat-tabs.js.map +1 -1
- package/dist/components/cat-textarea.js +1 -1
- package/dist/components/cat-textarea.js.map +1 -1
- package/dist/components/cat-toast-demo.js +55 -45
- package/dist/components/cat-toast-demo.js.map +1 -1
- package/dist/components/cat-toggle.js +1 -1
- package/dist/components/cat-toggle.js.map +1 -1
- package/dist/components/cat-tooltip.js +1 -1
- package/dist/components/cat-tooltip.js.map +1 -1
- package/dist/esm/{cat-alert_21.entry.js → cat-alert_22.entry.js} +219 -49
- package/dist/esm/cat-alert_22.entry.js.map +1 -0
- package/dist/esm/{cat-notification-3da6ddb1.js → cat-notification-5b6a2cd9.js} +360 -47
- package/dist/esm/cat-notification-5b6a2cd9.js.map +1 -0
- package/dist/esm/catalyst.js +2 -2
- package/dist/esm/{index-41ceb7da.js → index-17d2bcf3.js} +12 -1
- package/dist/esm/index-17d2bcf3.js.map +1 -0
- package/dist/esm/index.js +1 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/types/components/cat-alert/cat-alert.d.ts +9 -0
- package/dist/types/components/cat-input/cat-input.d.ts +2 -1
- package/dist/types/components/cat-input/input-type.d.ts +1 -0
- package/dist/types/components/cat-notification/cat-notification.d.ts +9 -4
- package/dist/types/components/cat-radio-group/cat-radio-group.d.ts +5 -0
- package/dist/types/components/cat-select/cat-select.d.ts +9 -0
- package/dist/types/components/cat-tabs/cat-tabs.d.ts +5 -1
- package/dist/types/components.d.ts +27 -2
- package/dist/types/index.d.ts +1 -1
- package/package.json +4 -4
- package/dist/catalyst/p-2ad6f8d8.js +0 -2
- package/dist/catalyst/p-2ad6f8d8.js.map +0 -1
- package/dist/catalyst/p-659073b5.js.map +0 -1
- package/dist/catalyst/p-6fce43dd.js +0 -2
- package/dist/catalyst/p-6fce43dd.js.map +0 -1
- package/dist/catalyst/p-8121572a.js +0 -10
- package/dist/catalyst/p-8121572a.js.map +0 -1
- package/dist/catalyst/p-aa382647.entry.js +0 -12
- package/dist/catalyst/p-aa382647.entry.js.map +0 -1
- package/dist/catalyst/p-c0b4200d.entry.js +0 -2
- package/dist/catalyst/p-c0b4200d.entry.js.map +0 -1
- package/dist/cjs/cat-alert_21.cjs.entry.js.map +0 -1
- package/dist/cjs/cat-form-hint-25fdfed5.js +0 -22
- package/dist/cjs/cat-form-hint-25fdfed5.js.map +0 -1
- package/dist/cjs/cat-notification-c2859ed7.js.map +0 -1
- package/dist/cjs/cat-textarea.cjs.entry.js +0 -92
- package/dist/cjs/cat-textarea.cjs.entry.js.map +0 -1
- package/dist/cjs/index-936b777e.js.map +0 -1
- package/dist/cjs/loglevel-b5d158ad.js +0 -324
- package/dist/cjs/loglevel-b5d158ad.js.map +0 -1
- package/dist/esm/cat-alert_21.entry.js.map +0 -1
- package/dist/esm/cat-form-hint-790d1e46.js +0 -20
- package/dist/esm/cat-form-hint-790d1e46.js.map +0 -1
- package/dist/esm/cat-notification-3da6ddb1.js.map +0 -1
- package/dist/esm/cat-textarea.entry.js +0 -88
- package/dist/esm/cat-textarea.entry.js.map +0 -1
- package/dist/esm/index-41ceb7da.js.map +0 -1
- package/dist/esm/loglevel-c8b59c3a.js +0 -319
- package/dist/esm/loglevel-c8b59c3a.js.map +0 -1
|
@@ -7,10 +7,21 @@ import { Component, h, Host, Prop } from '@stencil/core';
|
|
|
7
7
|
*/
|
|
8
8
|
export class CatAlert {
|
|
9
9
|
constructor() {
|
|
10
|
+
this.mapIcon = new Map([
|
|
11
|
+
['primary', 'star-circle-filled'],
|
|
12
|
+
['secondary', 'clock-filled'],
|
|
13
|
+
['success', 'check-circle-filled'],
|
|
14
|
+
['warning', 'danger-filled'],
|
|
15
|
+
['danger', 'cross-circle-filled']
|
|
16
|
+
]);
|
|
10
17
|
/**
|
|
11
18
|
* The color palette of the alert.
|
|
12
19
|
*/
|
|
13
20
|
this.color = 'primary';
|
|
21
|
+
/**
|
|
22
|
+
* Whether the icon of the alert is deactivated.
|
|
23
|
+
*/
|
|
24
|
+
this.noIcon = false;
|
|
14
25
|
}
|
|
15
26
|
render() {
|
|
16
27
|
return (h(Host, { tabindex: "0", role: this.role },
|
|
@@ -18,7 +29,9 @@ export class CatAlert {
|
|
|
18
29
|
alert: true,
|
|
19
30
|
[`alert-${this.color}`]: Boolean(this.color)
|
|
20
31
|
} },
|
|
21
|
-
h("
|
|
32
|
+
!this.noIcon && h("cat-icon", { size: "l", icon: this.icon ? this.icon : this.mapIcon.get(this.color) }),
|
|
33
|
+
h("div", { class: "content" },
|
|
34
|
+
h("slot", null)))));
|
|
22
35
|
}
|
|
23
36
|
get role() {
|
|
24
37
|
switch (this.color) {
|
|
@@ -55,6 +68,41 @@ export class CatAlert {
|
|
|
55
68
|
"attribute": "color",
|
|
56
69
|
"reflect": false,
|
|
57
70
|
"defaultValue": "'primary'"
|
|
71
|
+
},
|
|
72
|
+
"icon": {
|
|
73
|
+
"type": "string",
|
|
74
|
+
"mutable": false,
|
|
75
|
+
"complexType": {
|
|
76
|
+
"original": "string",
|
|
77
|
+
"resolved": "string | undefined",
|
|
78
|
+
"references": {}
|
|
79
|
+
},
|
|
80
|
+
"required": false,
|
|
81
|
+
"optional": true,
|
|
82
|
+
"docs": {
|
|
83
|
+
"tags": [],
|
|
84
|
+
"text": "The name of an icon to be displayed in the alert."
|
|
85
|
+
},
|
|
86
|
+
"attribute": "icon",
|
|
87
|
+
"reflect": false
|
|
88
|
+
},
|
|
89
|
+
"noIcon": {
|
|
90
|
+
"type": "boolean",
|
|
91
|
+
"mutable": false,
|
|
92
|
+
"complexType": {
|
|
93
|
+
"original": "boolean",
|
|
94
|
+
"resolved": "boolean",
|
|
95
|
+
"references": {}
|
|
96
|
+
},
|
|
97
|
+
"required": false,
|
|
98
|
+
"optional": false,
|
|
99
|
+
"docs": {
|
|
100
|
+
"tags": [],
|
|
101
|
+
"text": "Whether the icon of the alert is deactivated."
|
|
102
|
+
},
|
|
103
|
+
"attribute": "no-icon",
|
|
104
|
+
"reflect": false,
|
|
105
|
+
"defaultValue": "false"
|
|
58
106
|
}
|
|
59
107
|
}; }
|
|
60
108
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cat-alert.js","sourceRoot":"","sources":["../../../src/components/cat-alert/cat-alert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAEzD;;;;;GAKG;AAMH,MAAM,OAAO,QAAQ;EALrB;
|
|
1
|
+
{"version":3,"file":"cat-alert.js","sourceRoot":"","sources":["../../../src/components/cat-alert/cat-alert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAEzD;;;;;GAKG;AAMH,MAAM,OAAO,QAAQ;EALrB;IAMmB,YAAO,GAAwB,IAAI,GAAG,CAAC;MACtD,CAAC,SAAS,EAAE,oBAAoB,CAAC;MACjC,CAAC,WAAW,EAAE,cAAc,CAAC;MAC7B,CAAC,SAAS,EAAE,qBAAqB,CAAC;MAClC,CAAC,SAAS,EAAE,eAAe,CAAC;MAC5B,CAAC,QAAQ,EAAE,qBAAqB,CAAC;KAClC,CAAC,CAAC;IAEH;;OAEG;IACK,UAAK,GAA+D,SAAS,CAAC;IAOtF;;OAEG;IACK,WAAM,GAAG,KAAK,CAAC;GA8BxB;EA5BC,MAAM;IACJ,OAAO,CACL,EAAC,IAAI,IAAC,QAAQ,EAAC,GAAG,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI;MAChC,WACE,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE;UACL,KAAK,EAAE,IAAI;UACX,CAAC,SAAS,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;SAC7C;QAEA,CAAC,IAAI,CAAC,MAAM,IAAI,gBAAU,IAAI,EAAC,GAAG,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAa;QAC3G,WAAK,KAAK,EAAC,SAAS;UAClB,eAAa,CACT,CACF,CACD,CACR,CAAC;EACJ,CAAC;EAED,IAAY,IAAI;IACd,QAAQ,IAAI,CAAC,KAAK,EAAE;MAClB,KAAK,QAAQ,CAAC;MACd,KAAK,SAAS;QACZ,OAAO,OAAO,CAAC;MACjB;QACE,OAAO,QAAQ,CAAC;KACnB;EACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Host, Prop } from '@stencil/core';\n\n/**\n * Informs user about important changes or conditions in the interface. Use this\n * component if you need to capture user’s attention in a prominent way.\n *\n * @part alert - The alert element.\n */\n@Component({\n tag: 'cat-alert',\n styleUrl: 'cat-alert.scss',\n shadow: true\n})\nexport class CatAlert {\n private readonly mapIcon: Map<string, string> = new Map([\n ['primary', 'star-circle-filled'],\n ['secondary', 'clock-filled'],\n ['success', 'check-circle-filled'],\n ['warning', 'danger-filled'],\n ['danger', 'cross-circle-filled']\n ]);\n\n /**\n * The color palette of the alert.\n */\n @Prop() color: 'primary' | 'secondary' | 'danger' | 'success' | 'warning' = 'primary';\n\n /**\n * The name of an icon to be displayed in the alert.\n */\n @Prop() icon?: string;\n\n /**\n * Whether the icon of the alert is deactivated.\n */\n @Prop() noIcon = false;\n\n render() {\n return (\n <Host tabindex=\"0\" role={this.role}>\n <div\n part=\"alert\"\n class={{\n alert: true,\n [`alert-${this.color}`]: Boolean(this.color)\n }}\n >\n {!this.noIcon && <cat-icon size=\"l\" icon={this.icon ? this.icon : this.mapIcon.get(this.color)}></cat-icon>}\n <div class=\"content\">\n <slot></slot>\n </div>\n </div>\n </Host>\n );\n }\n\n private get role() {\n switch (this.color) {\n case 'danger':\n case 'warning':\n return 'alert';\n default:\n return 'status';\n }\n }\n}\n"]}
|
|
@@ -180,11 +180,42 @@
|
|
|
180
180
|
--text: 174, 42, 10;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
+
:host(.cat-button-pull:not([size])) {
|
|
184
|
+
margin: -0.625rem -0.75rem;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
:host(.cat-button-pull-h:not([size])) {
|
|
188
|
+
margin-left: -0.75rem;
|
|
189
|
+
margin-right: -0.75rem;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
:host(.cat-button-pull-v:not([size])) {
|
|
193
|
+
margin-top: -0.625rem;
|
|
194
|
+
margin-bottom: -0.625rem;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
:host(.cat-button-pull-t:not([size])) {
|
|
198
|
+
margin-top: -0.625rem;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
:host(.cat-button-pull-l:not([size])) {
|
|
202
|
+
margin-left: -0.75rem;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
:host(.cat-button-pull-b:not([size])) {
|
|
206
|
+
margin-bottom: -0.625rem;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
:host(.cat-button-pull-r:not([size])) {
|
|
210
|
+
margin-right: -0.75rem;
|
|
211
|
+
}
|
|
212
|
+
|
|
183
213
|
.cat-button-xs {
|
|
184
214
|
min-width: 1.5rem;
|
|
185
215
|
padding: 0.25rem 0.25rem;
|
|
186
216
|
font-size: 0.875rem;
|
|
187
217
|
line-height: 1rem;
|
|
218
|
+
font-weight: var(--cat-font-weight-body, 400);
|
|
188
219
|
}
|
|
189
220
|
.cat-button-xs .cat-button-prefix {
|
|
190
221
|
margin-right: 0.25rem;
|
|
@@ -202,11 +233,42 @@
|
|
|
202
233
|
padding-right: 1.25rem;
|
|
203
234
|
}
|
|
204
235
|
|
|
236
|
+
:host(.cat-button-pull[size=xs]) {
|
|
237
|
+
margin: -0.25rem -0.25rem;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
:host(.cat-button-pull-h[size=xs]) {
|
|
241
|
+
margin-left: -0.25rem;
|
|
242
|
+
margin-right: -0.25rem;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
:host(.cat-button-pull-v[size=xs]) {
|
|
246
|
+
margin-top: -0.25rem;
|
|
247
|
+
margin-bottom: -0.25rem;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
:host(.cat-button-pull-t[size=xs]) {
|
|
251
|
+
margin-top: -0.25rem;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
:host(.cat-button-pull-l[size=xs]) {
|
|
255
|
+
margin-left: -0.25rem;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
:host(.cat-button-pull-b[size=xs]) {
|
|
259
|
+
margin-bottom: -0.25rem;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
:host(.cat-button-pull-r[size=xs]) {
|
|
263
|
+
margin-right: -0.25rem;
|
|
264
|
+
}
|
|
265
|
+
|
|
205
266
|
.cat-button-s {
|
|
206
267
|
min-width: 2rem;
|
|
207
268
|
padding: 0.375rem 0.5rem;
|
|
208
269
|
font-size: 0.9375rem;
|
|
209
270
|
line-height: 1.25rem;
|
|
271
|
+
font-weight: var(--cat-font-weight-body, 400);
|
|
210
272
|
}
|
|
211
273
|
.cat-button-s .cat-button-prefix {
|
|
212
274
|
margin-right: 0.25rem;
|
|
@@ -228,11 +290,42 @@
|
|
|
228
290
|
padding-right: 1.25rem;
|
|
229
291
|
}
|
|
230
292
|
|
|
293
|
+
:host(.cat-button-pull[size=s]) {
|
|
294
|
+
margin: -0.375rem -0.5rem;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
:host(.cat-button-pull-h[size=s]) {
|
|
298
|
+
margin-left: -0.5rem;
|
|
299
|
+
margin-right: -0.5rem;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
:host(.cat-button-pull-v[size=s]) {
|
|
303
|
+
margin-top: -0.375rem;
|
|
304
|
+
margin-bottom: -0.375rem;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
:host(.cat-button-pull-t[size=s]) {
|
|
308
|
+
margin-top: -0.375rem;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
:host(.cat-button-pull-l[size=s]) {
|
|
312
|
+
margin-left: -0.5rem;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
:host(.cat-button-pull-b[size=s]) {
|
|
316
|
+
margin-bottom: -0.375rem;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
:host(.cat-button-pull-r[size=s]) {
|
|
320
|
+
margin-right: -0.5rem;
|
|
321
|
+
}
|
|
322
|
+
|
|
231
323
|
.cat-button-m {
|
|
232
324
|
min-width: 2.5rem;
|
|
233
325
|
padding: 0.625rem 0.75rem;
|
|
234
326
|
font-size: 0.9375rem;
|
|
235
327
|
line-height: 1.25rem;
|
|
328
|
+
font-weight: var(--cat-font-weight-body, 400);
|
|
236
329
|
}
|
|
237
330
|
.cat-button-m .cat-button-prefix {
|
|
238
331
|
margin-right: 0.25rem;
|
|
@@ -254,11 +347,42 @@
|
|
|
254
347
|
padding-right: 1.25rem;
|
|
255
348
|
}
|
|
256
349
|
|
|
350
|
+
:host(.cat-button-pull[size=m]) {
|
|
351
|
+
margin: -0.625rem -0.75rem;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
:host(.cat-button-pull-h[size=m]) {
|
|
355
|
+
margin-left: -0.75rem;
|
|
356
|
+
margin-right: -0.75rem;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
:host(.cat-button-pull-v[size=m]) {
|
|
360
|
+
margin-top: -0.625rem;
|
|
361
|
+
margin-bottom: -0.625rem;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
:host(.cat-button-pull-t[size=m]) {
|
|
365
|
+
margin-top: -0.625rem;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
:host(.cat-button-pull-l[size=m]) {
|
|
369
|
+
margin-left: -0.75rem;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
:host(.cat-button-pull-b[size=m]) {
|
|
373
|
+
margin-bottom: -0.625rem;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
:host(.cat-button-pull-r[size=m]) {
|
|
377
|
+
margin-right: -0.75rem;
|
|
378
|
+
}
|
|
379
|
+
|
|
257
380
|
.cat-button-l {
|
|
258
381
|
min-width: 3rem;
|
|
259
382
|
padding: 0.875rem 1rem;
|
|
260
383
|
font-size: 0.9375rem;
|
|
261
384
|
line-height: 1.25rem;
|
|
385
|
+
font-weight: var(--cat-font-weight-body, 400);
|
|
262
386
|
}
|
|
263
387
|
.cat-button-l .cat-button-prefix {
|
|
264
388
|
margin-right: 0.25rem;
|
|
@@ -280,11 +404,42 @@
|
|
|
280
404
|
padding-right: 1.25rem;
|
|
281
405
|
}
|
|
282
406
|
|
|
407
|
+
:host(.cat-button-pull[size=l]) {
|
|
408
|
+
margin: -0.875rem -1rem;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
:host(.cat-button-pull-h[size=l]) {
|
|
412
|
+
margin-left: -1rem;
|
|
413
|
+
margin-right: -1rem;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
:host(.cat-button-pull-v[size=l]) {
|
|
417
|
+
margin-top: -0.875rem;
|
|
418
|
+
margin-bottom: -0.875rem;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
:host(.cat-button-pull-t[size=l]) {
|
|
422
|
+
margin-top: -0.875rem;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
:host(.cat-button-pull-l[size=l]) {
|
|
426
|
+
margin-left: -1rem;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
:host(.cat-button-pull-b[size=l]) {
|
|
430
|
+
margin-bottom: -0.875rem;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
:host(.cat-button-pull-r[size=l]) {
|
|
434
|
+
margin-right: -1rem;
|
|
435
|
+
}
|
|
436
|
+
|
|
283
437
|
.cat-button-xl {
|
|
284
438
|
min-width: 3.5rem;
|
|
285
439
|
padding: 1rem 1.25rem;
|
|
286
440
|
font-size: 1.125rem;
|
|
287
441
|
line-height: 1.5rem;
|
|
442
|
+
font-weight: var(--cat-font-weight-body, 400);
|
|
288
443
|
}
|
|
289
444
|
.cat-button-xl .cat-button-prefix {
|
|
290
445
|
margin-right: 0.25rem;
|
|
@@ -302,6 +457,36 @@
|
|
|
302
457
|
padding-right: 1.25rem;
|
|
303
458
|
}
|
|
304
459
|
|
|
460
|
+
:host(.cat-button-pull[size=xl]) {
|
|
461
|
+
margin: -1rem -1.25rem;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
:host(.cat-button-pull-h[size=xl]) {
|
|
465
|
+
margin-left: -1.25rem;
|
|
466
|
+
margin-right: -1.25rem;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
:host(.cat-button-pull-v[size=xl]) {
|
|
470
|
+
margin-top: -1rem;
|
|
471
|
+
margin-bottom: -1rem;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
:host(.cat-button-pull-t[size=xl]) {
|
|
475
|
+
margin-top: -1rem;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
:host(.cat-button-pull-l[size=xl]) {
|
|
479
|
+
margin-left: -1.25rem;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
:host(.cat-button-pull-b[size=xl]) {
|
|
483
|
+
margin-bottom: -1rem;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
:host(.cat-button-pull-r[size=xl]) {
|
|
487
|
+
margin-right: -1.25rem;
|
|
488
|
+
}
|
|
489
|
+
|
|
305
490
|
.cat-button-active::before {
|
|
306
491
|
content: "";
|
|
307
492
|
display: block;
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
.hint-section ::slotted([slot=hint]) {
|
|
13
13
|
font-size: 0.875rem;
|
|
14
14
|
line-height: 1rem;
|
|
15
|
+
font-weight: var(--cat-font-weight-body, 400);
|
|
15
16
|
margin: 0;
|
|
16
17
|
}
|
|
17
18
|
|
|
@@ -32,28 +33,33 @@ label {
|
|
|
32
33
|
gap: 0.5rem;
|
|
33
34
|
font-size: 0.9375rem;
|
|
34
35
|
line-height: 1.25rem;
|
|
36
|
+
font-weight: var(--cat-font-weight-body, 400);
|
|
35
37
|
/* stylelint-disable property-no-vendor-prefix */
|
|
36
38
|
-webkit-user-select: none;
|
|
37
39
|
-ms-user-select: none;
|
|
38
40
|
user-select: none;
|
|
39
41
|
/* stylelint-enable property-no-vendor-prefix */
|
|
40
42
|
cursor: pointer;
|
|
43
|
+
position: relative;
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
.label-left {
|
|
44
47
|
flex-direction: row-reverse;
|
|
45
48
|
}
|
|
49
|
+
.label-left input {
|
|
50
|
+
right: 1px;
|
|
51
|
+
left: unset;
|
|
52
|
+
}
|
|
46
53
|
|
|
47
54
|
input {
|
|
48
|
-
position: absolute
|
|
49
|
-
width:
|
|
50
|
-
height:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
border: 0 !important;
|
|
55
|
+
position: absolute;
|
|
56
|
+
width: 1.25rem;
|
|
57
|
+
height: 1.25rem;
|
|
58
|
+
margin: 0;
|
|
59
|
+
opacity: 0;
|
|
60
|
+
cursor: inherit;
|
|
61
|
+
left: 1px;
|
|
62
|
+
top: 0.5px;
|
|
57
63
|
}
|
|
58
64
|
|
|
59
65
|
.box {
|
|
@@ -66,6 +72,7 @@ input {
|
|
|
66
72
|
border: 1px solid #d7dbe0;
|
|
67
73
|
border-radius: 0.125rem;
|
|
68
74
|
transition: background-color 0.13s ease, border-color 0.13s ease;
|
|
75
|
+
pointer-events: none;
|
|
69
76
|
}
|
|
70
77
|
.box svg {
|
|
71
78
|
fill: none;
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
.hint-section ::slotted([slot=hint]) {
|
|
13
13
|
font-size: 0.875rem;
|
|
14
14
|
line-height: 1rem;
|
|
15
|
+
font-weight: var(--cat-font-weight-body, 400);
|
|
15
16
|
margin: 0;
|
|
16
17
|
}
|
|
17
18
|
|
|
@@ -21,6 +22,7 @@
|
|
|
21
22
|
gap: 0.5rem;
|
|
22
23
|
font-size: 0.9375rem;
|
|
23
24
|
line-height: 1.25rem;
|
|
25
|
+
font-weight: var(--cat-font-weight-body, 400);
|
|
24
26
|
margin-bottom: 1rem;
|
|
25
27
|
}
|
|
26
28
|
|
|
@@ -74,6 +76,7 @@ label.hidden {
|
|
|
74
76
|
margin-left: 0.25rem;
|
|
75
77
|
font-size: 0.75rem;
|
|
76
78
|
line-height: 1rem;
|
|
79
|
+
font-weight: var(--cat-font-weight-body, 400);
|
|
77
80
|
color: rgb(var(--cat-font-color-muted, 105, 118, 135));
|
|
78
81
|
}
|
|
79
82
|
|
|
@@ -465,9 +465,14 @@ export class CatInput {
|
|
|
465
465
|
"type": "string",
|
|
466
466
|
"mutable": false,
|
|
467
467
|
"complexType": {
|
|
468
|
-
"original": "
|
|
469
|
-
"resolved": "\"email\" | \"number\" | \"password\" | \"search\" | \"tel\" | \"text\" | \"url\"",
|
|
470
|
-
"references": {
|
|
468
|
+
"original": "InputType",
|
|
469
|
+
"resolved": "\"button\" | \"color\" | \"date\" | \"datetime-local\" | \"email\" | \"file\" | \"month\" | \"number\" | \"password\" | \"range\" | \"reset\" | \"search\" | \"submit\" | \"tel\" | \"text\" | \"time\" | \"url\" | \"week\"",
|
|
470
|
+
"references": {
|
|
471
|
+
"InputType": {
|
|
472
|
+
"location": "import",
|
|
473
|
+
"path": "./input-type"
|
|
474
|
+
}
|
|
475
|
+
}
|
|
471
476
|
},
|
|
472
477
|
"required": false,
|
|
473
478
|
"optional": false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cat-input.js","sourceRoot":"","sources":["../../../src/components/cat-input/cat-input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtG,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,IAAI,YAAY,GAAG,CAAC,CAAC;AAErB;;;;;;;;;;GAUG;AAMH,MAAM,OAAO,QAAQ;EALrB;IAMmB,SAAI,GAAG,eAAe,CAAC,WAAW,EAAE,CAAC;IACrC,OAAE,GAAG,aAAa,YAAY,EAAE,EAAE,CAAC;IAK3C,oBAAe,GAAG,KAAK,CAAC;IAOjC;;OAEG;IACK,cAAS,GAAG,KAAK,CAAC;IAE1B;;OAEG;IACK,aAAQ,GAAG,KAAK,CAAC;IAYzB;;OAEG;IACK,cAAS,GAAG,KAAK,CAAC;IAE1B;;OAEG;IACK,UAAK,GAAG,EAAE,CAAC;IAEnB;;OAEG;IACK,gBAAW,GAAG,KAAK,CAAC;IAsB5B;;OAEG;IACK,SAAI,GAAG,EAAE,CAAC;IAiBlB;;OAEG;IACK,aAAQ,GAAG,KAAK,CAAC;IAEzB;;OAEG;IACK,aAAQ,GAAG,KAAK,CAAC;IAEzB;;OAEG;IACK,UAAK,GAAG,KAAK,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C,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;EAC3B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State } from '@stencil/core';\nimport log from 'loglevel';\nimport { CatFormHint } from '../cat-form-hint/cat-form-hint';\nimport { CatI18nRegistry } from '../cat-i18n/cat-i18n-registry';\n\nlet nextUniqueId = 0;\n\n/**\n * Inputs are used to allow users to provide text input when the expected input\n * is short. As well as plain text, Input supports various types of text,\n * including passwords and numbers.\n *\n * @slot hint - Optional hint element to be displayed with the input.\n * @slot label - The slotted label. If both the label property and the label slot are present, only the label slot will be displayed.\n * @part label - The label content.\n * @part prefix - The text prefix.\n * @part suffix - The text suffix.\n */\n@Component({\n tag: 'cat-input',\n styleUrl: 'cat-input.scss',\n shadow: true\n})\nexport class CatInput {\n private readonly i18n = CatI18nRegistry.getInstance();\n private readonly id = `cat-input-${nextUniqueId++}`;\n private input!: HTMLInputElement;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedLabel = false;\n\n /**\n * Hint for form autofill feature.\n */\n @Prop() autoComplete?: string;\n\n /**\n * Whether the input should show a clear button.\n */\n @Prop() clearable = false;\n\n /**\n * Whether the input is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Optional hint text(s) to be displayed with the input.\n */\n @Prop() hint?: string | string[];\n\n /**\n * The name of an icon to be displayed in the input.\n */\n @Prop() icon?: string;\n\n /**\n * Display the icon on the right.\n */\n @Prop() iconRight = false;\n\n /**\n * The label for the input.\n */\n @Prop() label = '';\n\n /**\n * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @Prop() labelHidden = false;\n\n /**\n * A maximum value for numeric values.\n */\n @Prop() max?: number;\n\n /**\n * A maximum length (number of characters) for textual values.\n */\n @Prop() maxLength?: number;\n\n /**\n * A minimum value for numeric values.\n */\n @Prop() min?: number;\n\n /**\n * A minimum length (number of characters) for textual values.\n */\n @Prop() minLength?: number;\n\n /**\n * The name of the form control. Submitted with the form as part of a name/value pair.\n */\n @Prop() name = '';\n\n /**\n * The placeholder text to display within the input.\n */\n @Prop() placeholder?: string;\n\n /**\n * A textual prefix to be displayed in the input.\n */\n @Prop() textPrefix?: string;\n\n /**\n * A textual suffix to be displayed in the input.\n */\n @Prop() textSuffix?: string;\n\n /**\n * The value is not editable.\n */\n @Prop() readonly = false;\n\n /**\n * A value is required or must be check for the form to be submittable.\n */\n @Prop() required = false;\n\n /**\n * Use round input edges.\n */\n @Prop() round = false;\n\n /**\n * Type of form control.\n */\n @Prop() type: 'text' | 'email' | 'password' | 'tel' | 'url' | 'search' | 'number' = 'text';\n\n /**\n * The value of the control.\n */\n @Prop({ mutable: true }) value?: string | number;\n\n /**\n * Emitted when the value is changed.\n */\n @Event() catChange!: EventEmitter;\n\n /**\n * Emitted when the input received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillRender(): void {\n this.hasSlottedLabel = !!this.hostElement.querySelector('[slot=\"label\"]');\n if (!this.label && !this.hasSlottedLabel) {\n log.error('[A11y] Missing ARIA label on input', this);\n }\n }\n\n /**\n * Sets focus on the input. Use this method instead of `input.focus()`.\n *\n * @param options An optional object providing options to control aspects of\n * the focusing process.\n */\n @Method()\n async setFocus(options?: FocusOptions): Promise<void> {\n this.input.focus(options);\n }\n\n /**\n * Clear the input.\n */\n @Method()\n async clear(): Promise<void> {\n this.value = '';\n }\n\n render() {\n return (\n <Host>\n {(this.hasSlottedLabel || this.label) && (\n <label htmlFor={this.id} class={{ hidden: this.labelHidden }}>\n <span part=\"label\">\n {(this.hasSlottedLabel && <slot name=\"label\"></slot>) || this.label}\n {!this.required && (\n <span class=\"input-optional\" aria-hidden=\"true\">\n ({this.i18n.t('input.optional')})\n </span>\n )}\n </span>\n </label>\n )}\n <div\n class={{\n 'input-wrapper': true,\n 'input-round': this.round,\n 'input-disabled': this.disabled\n }}\n onClick={() => this.input.focus()}\n >\n {this.textPrefix && (\n <span class=\"text-prefix\" part=\"prefix\">\n {this.textPrefix}\n </span>\n )}\n {this.icon && !this.iconRight && <cat-icon icon={this.icon} class=\"icon-prefix\" size=\"l\"></cat-icon>}\n <div class=\"input-inner-wrapper\">\n <input\n ref={el => (this.input = el as HTMLInputElement)}\n id={this.id}\n class={{\n 'has-clearable': this.clearable && !this.disabled\n }}\n autocomplete={this.autoComplete}\n disabled={this.disabled}\n max={this.max}\n maxlength={this.maxLength}\n min={this.max}\n minlength={this.minLength}\n name={this.name}\n placeholder={this.placeholder}\n readonly={this.readonly}\n required={this.required}\n type={this.type}\n value={this.value}\n onInput={this.onInput.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n ></input>\n {this.clearable && !this.disabled && this.value && (\n <cat-button\n class=\"clearable\"\n icon=\"cross-circle-outlined\"\n icon-only=\"true\"\n size=\"s\"\n variant=\"text\"\n a11y-label={this.i18n.t('input.clear')}\n onClick={this.clear.bind(this)}\n ></cat-button>\n )}\n </div>\n {this.icon && this.iconRight && <cat-icon icon={this.icon} class=\"icon-suffix\" size=\"l\"></cat-icon>}\n {this.textSuffix && (\n <span class=\"text-suffix\" part=\"suffix\">\n {this.textSuffix}\n </span>\n )}\n </div>\n {this.hintSection}\n </Host>\n );\n }\n\n private get hintSection() {\n const hasSlottedHint = !!this.hostElement.querySelector('[slot=\"hint\"]');\n return (\n (this.hint || hasSlottedHint) && (\n <CatFormHint hint={this.hint} slottedHint={hasSlottedHint && <slot name=\"hint\"></slot>} />\n )\n );\n }\n\n private onInput(event: Event) {\n this.value = this.input.value;\n this.catChange.emit(event);\n }\n\n private onFocus(event: FocusEvent) {\n this.catFocus.emit(event);\n }\n\n private onBlur(event: FocusEvent) {\n this.catBlur.emit(event);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"cat-input.js","sourceRoot":"","sources":["../../../src/components/cat-input/cat-input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtG,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAGhE,IAAI,YAAY,GAAG,CAAC,CAAC;AAErB;;;;;;;;;;GAUG;AAMH,MAAM,OAAO,QAAQ;EALrB;IAMmB,SAAI,GAAG,eAAe,CAAC,WAAW,EAAE,CAAC;IACrC,OAAE,GAAG,aAAa,YAAY,EAAE,EAAE,CAAC;IAK3C,oBAAe,GAAG,KAAK,CAAC;IAOjC;;OAEG;IACK,cAAS,GAAG,KAAK,CAAC;IAE1B;;OAEG;IACK,aAAQ,GAAG,KAAK,CAAC;IAYzB;;OAEG;IACK,cAAS,GAAG,KAAK,CAAC;IAE1B;;OAEG;IACK,UAAK,GAAG,EAAE,CAAC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C9B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;EAC7B,CAAC;EAEO,OAAO,CAAC,KAAiB;IAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;EAC5B,CAAC;EAEO,MAAM,CAAC,KAAiB;IAC9B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;EAC3B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State } from '@stencil/core';\nimport log from 'loglevel';\nimport { CatFormHint } from '../cat-form-hint/cat-form-hint';\nimport { CatI18nRegistry } from '../cat-i18n/cat-i18n-registry';\nimport { InputType } from './input-type';\n\nlet nextUniqueId = 0;\n\n/**\n * Inputs are used to allow users to provide text input when the expected input\n * is short. As well as plain text, Input supports various types of text,\n * including passwords and numbers.\n *\n * @slot hint - Optional hint element to be displayed with the input.\n * @slot label - The slotted label. If both the label property and the label slot are present, only the label slot will be displayed.\n * @part label - The label content.\n * @part prefix - The text prefix.\n * @part suffix - The text suffix.\n */\n@Component({\n tag: 'cat-input',\n styleUrl: 'cat-input.scss',\n shadow: true\n})\nexport class CatInput {\n private readonly i18n = CatI18nRegistry.getInstance();\n private readonly id = `cat-input-${nextUniqueId++}`;\n private input!: HTMLInputElement;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedLabel = false;\n\n /**\n * Hint for form autofill feature.\n */\n @Prop() autoComplete?: string;\n\n /**\n * Whether the input should show a clear button.\n */\n @Prop() clearable = false;\n\n /**\n * Whether the input is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Optional hint text(s) to be displayed with the input.\n */\n @Prop() hint?: string | string[];\n\n /**\n * The name of an icon to be displayed in the input.\n */\n @Prop() icon?: string;\n\n /**\n * Display the icon on the right.\n */\n @Prop() iconRight = false;\n\n /**\n * The label for the input.\n */\n @Prop() label = '';\n\n /**\n * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @Prop() labelHidden = false;\n\n /**\n * A maximum value for numeric values.\n */\n @Prop() max?: number;\n\n /**\n * A maximum length (number of characters) for textual values.\n */\n @Prop() maxLength?: number;\n\n /**\n * A minimum value for numeric values.\n */\n @Prop() min?: number;\n\n /**\n * A minimum length (number of characters) for textual values.\n */\n @Prop() minLength?: number;\n\n /**\n * The name of the form control. Submitted with the form as part of a name/value pair.\n */\n @Prop() name = '';\n\n /**\n * The placeholder text to display within the input.\n */\n @Prop() placeholder?: string;\n\n /**\n * A textual prefix to be displayed in the input.\n */\n @Prop() textPrefix?: string;\n\n /**\n * A textual suffix to be displayed in the input.\n */\n @Prop() textSuffix?: string;\n\n /**\n * The value is not editable.\n */\n @Prop() readonly = false;\n\n /**\n * A value is required or must be check for the form to be submittable.\n */\n @Prop() required = false;\n\n /**\n * Use round input edges.\n */\n @Prop() round = false;\n\n /**\n * Type of form control.\n */\n @Prop() type: InputType = 'text';\n\n /**\n * The value of the control.\n */\n @Prop({ mutable: true }) value?: string | number;\n\n /**\n * Emitted when the value is changed.\n */\n @Event() catChange!: EventEmitter;\n\n /**\n * Emitted when the input received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillRender(): void {\n this.hasSlottedLabel = !!this.hostElement.querySelector('[slot=\"label\"]');\n if (!this.label && !this.hasSlottedLabel) {\n log.error('[A11y] Missing ARIA label on input', this);\n }\n }\n\n /**\n * Sets focus on the input. Use this method instead of `input.focus()`.\n *\n * @param options An optional object providing options to control aspects of\n * the focusing process.\n */\n @Method()\n async setFocus(options?: FocusOptions): Promise<void> {\n this.input.focus(options);\n }\n\n /**\n * Clear the input.\n */\n @Method()\n async clear(): Promise<void> {\n this.value = '';\n }\n\n render() {\n return (\n <Host>\n {(this.hasSlottedLabel || this.label) && (\n <label htmlFor={this.id} class={{ hidden: this.labelHidden }}>\n <span part=\"label\">\n {(this.hasSlottedLabel && <slot name=\"label\"></slot>) || this.label}\n {!this.required && (\n <span class=\"input-optional\" aria-hidden=\"true\">\n ({this.i18n.t('input.optional')})\n </span>\n )}\n </span>\n </label>\n )}\n <div\n class={{\n 'input-wrapper': true,\n 'input-round': this.round,\n 'input-disabled': this.disabled\n }}\n onClick={() => this.input.focus()}\n >\n {this.textPrefix && (\n <span class=\"text-prefix\" part=\"prefix\">\n {this.textPrefix}\n </span>\n )}\n {this.icon && !this.iconRight && <cat-icon icon={this.icon} class=\"icon-prefix\" size=\"l\"></cat-icon>}\n <div class=\"input-inner-wrapper\">\n <input\n ref={el => (this.input = el as HTMLInputElement)}\n id={this.id}\n class={{\n 'has-clearable': this.clearable && !this.disabled\n }}\n autocomplete={this.autoComplete}\n disabled={this.disabled}\n max={this.max}\n maxlength={this.maxLength}\n min={this.max}\n minlength={this.minLength}\n name={this.name}\n placeholder={this.placeholder}\n readonly={this.readonly}\n required={this.required}\n type={this.type}\n value={this.value}\n onInput={this.onInput.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n ></input>\n {this.clearable && !this.disabled && this.value && (\n <cat-button\n class=\"clearable\"\n icon=\"cross-circle-outlined\"\n icon-only=\"true\"\n size=\"s\"\n variant=\"text\"\n a11y-label={this.i18n.t('input.clear')}\n onClick={this.clear.bind(this)}\n ></cat-button>\n )}\n </div>\n {this.icon && this.iconRight && <cat-icon icon={this.icon} class=\"icon-suffix\" size=\"l\"></cat-icon>}\n {this.textSuffix && (\n <span class=\"text-suffix\" part=\"suffix\">\n {this.textSuffix}\n </span>\n )}\n </div>\n {this.hintSection}\n </Host>\n );\n }\n\n private get hintSection() {\n const hasSlottedHint = !!this.hostElement.querySelector('[slot=\"hint\"]');\n return (\n (this.hint || hasSlottedHint) && (\n <CatFormHint hint={this.hint} slottedHint={hasSlottedHint && <slot name=\"hint\"></slot>} />\n )\n );\n }\n\n private onInput(event: Event) {\n this.value = this.input.value;\n this.catChange.emit(event);\n }\n\n private onFocus(event: FocusEvent) {\n this.catFocus.emit(event);\n }\n\n private onBlur(event: FocusEvent) {\n this.catBlur.emit(event);\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-type.js","sourceRoot":"","sources":["../../../src/components/cat-input/input-type.ts"],"names":[],"mappings":"","sourcesContent":["export type InputType =\n | 'button'\n | 'color'\n | 'date'\n | 'datetime-local'\n | 'email'\n | 'file'\n | 'month'\n | 'number'\n | 'password'\n | 'range'\n | 'reset'\n | 'search'\n | 'submit'\n | 'tel'\n | 'text'\n | 'time'\n | 'url'\n | 'week';\n"]}
|
|
@@ -2,8 +2,10 @@ import Toastify from 'toastify-js';
|
|
|
2
2
|
export var TypeIcons;
|
|
3
3
|
(function (TypeIcons) {
|
|
4
4
|
TypeIcons["success"] = "check-circle-filled";
|
|
5
|
-
TypeIcons["error"] = "
|
|
6
|
-
TypeIcons["info"] = "
|
|
5
|
+
TypeIcons["error"] = "cross-circle-filled";
|
|
6
|
+
TypeIcons["info"] = "danger-filled";
|
|
7
|
+
TypeIcons["primary"] = "star-circle-filled";
|
|
8
|
+
TypeIcons["secondary"] = "info-circle-filled";
|
|
7
9
|
})(TypeIcons || (TypeIcons = {}));
|
|
8
10
|
export const ToastPositions = {
|
|
9
11
|
'top-left': {
|
|
@@ -32,16 +34,36 @@ export const ToastPositions = {
|
|
|
32
34
|
}
|
|
33
35
|
};
|
|
34
36
|
class CatNotificationService {
|
|
37
|
+
error(title, message = ' ', options) {
|
|
38
|
+
const toastOptions = this.extractOptions(title, message, options);
|
|
39
|
+
Toastify(toastOptions).showToast();
|
|
40
|
+
}
|
|
41
|
+
success(title, message = ' ', options) {
|
|
42
|
+
const toastOptions = this.extractOptions(title, message, options);
|
|
43
|
+
Toastify(toastOptions).showToast();
|
|
44
|
+
}
|
|
45
|
+
info(title, message = ' ', options) {
|
|
46
|
+
const toastOptions = this.extractOptions(title, message, options);
|
|
47
|
+
Toastify(toastOptions).showToast();
|
|
48
|
+
}
|
|
49
|
+
primary(title, message = ' ', options) {
|
|
50
|
+
const toastOptions = this.extractOptions(title, message, options);
|
|
51
|
+
Toastify(toastOptions).showToast();
|
|
52
|
+
}
|
|
53
|
+
secondary(title, message = ' ', options) {
|
|
54
|
+
const toastOptions = this.extractOptions(title, message, options);
|
|
55
|
+
Toastify(toastOptions).showToast();
|
|
56
|
+
}
|
|
35
57
|
toastHTMLTemplate(title, message = ' ', options) {
|
|
36
58
|
var _a;
|
|
37
59
|
const template = document.createElement('template');
|
|
38
|
-
const typeIcon = (options === null || options === void 0 ? void 0 : options.type) ? TypeIcons[options.type] : TypeIcons.
|
|
60
|
+
const typeIcon = (options === null || options === void 0 ? void 0 : options.type) ? TypeIcons[options.type] : TypeIcons.secondary;
|
|
39
61
|
title = title.trim();
|
|
40
62
|
message = message.trim();
|
|
41
63
|
const hasMessage = message && message !== '';
|
|
42
64
|
const hasMessageClass = hasMessage ? 'has-message' : '';
|
|
43
65
|
template.innerHTML = `<div class="cat-toastify-wrapper">
|
|
44
|
-
<div class="cat-toastify-icon-wrapper ${(_a = options === null || options === void 0 ? void 0 : options.type) !== null && _a !== void 0 ? _a : '
|
|
66
|
+
<div class="cat-toastify-icon-wrapper ${(_a = options === null || options === void 0 ? void 0 : options.type) !== null && _a !== void 0 ? _a : 'secondary'}">
|
|
45
67
|
<cat-icon icon="${typeIcon}"></cat-icon>
|
|
46
68
|
</div>
|
|
47
69
|
<div class="cat-toastify-title-wrapper ${hasMessageClass}">
|
|
@@ -50,57 +72,34 @@ class CatNotificationService {
|
|
|
50
72
|
</div>`;
|
|
51
73
|
return template.content.firstChild;
|
|
52
74
|
}
|
|
53
|
-
|
|
54
|
-
const position =
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
duration: CatNotificationService.DURATION,
|
|
58
|
-
close: true,
|
|
59
|
-
className: 'cat-toastify',
|
|
60
|
-
gravity: position.gravity,
|
|
61
|
-
position: position.position,
|
|
62
|
-
stopOnFocus: true
|
|
63
|
-
};
|
|
64
|
-
Toastify(toastOptions).showToast();
|
|
65
|
-
}
|
|
66
|
-
success(title, message = ' ', options) {
|
|
67
|
-
const position = this.getPosition(options);
|
|
68
|
-
const toastOptions = {
|
|
69
|
-
node: (options === null || options === void 0 ? void 0 : options.content) ? options.content : this.toastHTMLTemplate(title, message, options),
|
|
70
|
-
duration: CatNotificationService.DURATION,
|
|
71
|
-
close: true,
|
|
72
|
-
className: 'cat-toastify',
|
|
73
|
-
gravity: position.gravity,
|
|
74
|
-
position: position.position,
|
|
75
|
-
stopOnFocus: true
|
|
75
|
+
getPosition(options) {
|
|
76
|
+
const position = {
|
|
77
|
+
gravity: 'bottom',
|
|
78
|
+
position: 'left'
|
|
76
79
|
};
|
|
77
|
-
|
|
80
|
+
if ((options === null || options === void 0 ? void 0 : options.position) && ToastPositions[options.position]) {
|
|
81
|
+
position.position = ToastPositions[options.position].position;
|
|
82
|
+
position.gravity = ToastPositions[options.position].gravity;
|
|
83
|
+
}
|
|
84
|
+
return position;
|
|
78
85
|
}
|
|
79
|
-
|
|
86
|
+
extractOptions(title, message = ' ', options) {
|
|
80
87
|
const position = this.getPosition(options);
|
|
81
|
-
|
|
88
|
+
return {
|
|
82
89
|
node: (options === null || options === void 0 ? void 0 : options.content) ? options.content : this.toastHTMLTemplate(title, message, options),
|
|
83
90
|
duration: CatNotificationService.DURATION,
|
|
84
91
|
close: true,
|
|
85
92
|
className: 'cat-toastify',
|
|
86
93
|
gravity: position.gravity,
|
|
87
94
|
position: position.position,
|
|
88
|
-
stopOnFocus: true
|
|
95
|
+
stopOnFocus: true,
|
|
96
|
+
offset: {
|
|
97
|
+
x: '1.5rem',
|
|
98
|
+
y: '1.5rem'
|
|
99
|
+
}
|
|
89
100
|
};
|
|
90
|
-
Toastify(toastOptions).showToast();
|
|
91
|
-
}
|
|
92
|
-
getPosition(options) {
|
|
93
|
-
const position = {
|
|
94
|
-
gravity: 'bottom',
|
|
95
|
-
position: 'right'
|
|
96
|
-
};
|
|
97
|
-
if ((options === null || options === void 0 ? void 0 : options.position) && ToastPositions[options.position]) {
|
|
98
|
-
position.position = ToastPositions[options.position].position;
|
|
99
|
-
position.gravity = ToastPositions[options.position].gravity;
|
|
100
|
-
}
|
|
101
|
-
return position;
|
|
102
101
|
}
|
|
103
102
|
}
|
|
104
|
-
CatNotificationService.DURATION =
|
|
103
|
+
CatNotificationService.DURATION = 80000;
|
|
105
104
|
export const NotificationsService = new CatNotificationService();
|
|
106
105
|
//# sourceMappingURL=cat-notification.js.map
|