@haiilo/catalyst 0.3.1 → 0.5.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/assets/fonts/AzeretMono-Regular.woff2 +0 -0
- package/dist/catalyst/assets/fonts/DMSans-Bold.woff2 +0 -0
- package/dist/catalyst/assets/fonts/DMSans-BoldItalic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/DMSans-Italic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/DMSans-Medium.woff2 +0 -0
- package/dist/catalyst/assets/fonts/DMSans-MediumItalic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/DMSans-Regular.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-Black.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-Black.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-BlackItalic.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-BlackItalic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-Bold.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-Bold.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-BoldItalic.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-BoldItalic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-Hairline.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-Hairline.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-HairlineItalic.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-HairlineItalic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-Heavy.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-Heavy.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-HeavyItalic.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-HeavyItalic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-Italic.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-Italic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-Light.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-Light.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-LightItalic.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-LightItalic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-Medium.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-Medium.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-MediumItalic.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-MediumItalic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-Regular.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-Regular.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-Semibold.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-Semibold.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-SemiboldItalic.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-SemiboldItalic.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-Thin.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-Thin.woff2 +0 -0
- package/dist/catalyst/assets/fonts/Lato-ThinItalic.woff +0 -0
- package/dist/catalyst/assets/fonts/Lato-ThinItalic.woff2 +0 -0
- 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-23d54bc6.js +2 -0
- package/dist/catalyst/p-23d54bc6.js.map +1 -0
- package/dist/catalyst/p-84693f87.entry.js +24 -0
- package/dist/catalyst/p-84693f87.entry.js.map +1 -0
- package/dist/catalyst/p-8f5cfa78.js +2 -0
- package/dist/catalyst/p-8f5cfa78.js.map +1 -0
- package/dist/catalyst/{p-ed826597.js → p-fa7da4c6.js} +2 -2
- package/dist/catalyst/p-fa7da4c6.js.map +1 -0
- package/dist/cjs/{app-globals-7f2b1f8e.js → app-globals-50e7504d.js} +9 -2
- package/dist/cjs/app-globals-50e7504d.js.map +1 -0
- package/dist/cjs/{cat-alert_8.cjs.entry.js → cat-alert_15.cjs.entry.js} +602 -400
- package/dist/cjs/cat-alert_15.cjs.entry.js.map +1 -0
- package/dist/cjs/cat-icon-registry-6895750f.js +441 -0
- package/dist/cjs/cat-icon-registry-6895750f.js.map +1 -0
- package/dist/cjs/catalyst.cjs.js +4 -4
- package/dist/cjs/{index-c0881ae0.js → index-2db8e23d.js} +1 -2
- package/dist/cjs/index-2db8e23d.js.map +1 -0
- package/dist/cjs/index.cjs.js +2 -1
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +4 -4
- package/dist/collection/assets/fonts/AzeretMono-Regular.woff2 +0 -0
- package/dist/collection/assets/fonts/DMSans-Bold.woff2 +0 -0
- package/dist/collection/assets/fonts/DMSans-BoldItalic.woff2 +0 -0
- package/dist/collection/assets/fonts/DMSans-Italic.woff2 +0 -0
- package/dist/collection/assets/fonts/DMSans-Medium.woff2 +0 -0
- package/dist/collection/assets/fonts/DMSans-MediumItalic.woff2 +0 -0
- package/dist/collection/assets/fonts/DMSans-Regular.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-Black.woff +0 -0
- package/dist/collection/assets/fonts/Lato-Black.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-BlackItalic.woff +0 -0
- package/dist/collection/assets/fonts/Lato-BlackItalic.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-Bold.woff +0 -0
- package/dist/collection/assets/fonts/Lato-Bold.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-BoldItalic.woff +0 -0
- package/dist/collection/assets/fonts/Lato-BoldItalic.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-Hairline.woff +0 -0
- package/dist/collection/assets/fonts/Lato-Hairline.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-HairlineItalic.woff +0 -0
- package/dist/collection/assets/fonts/Lato-HairlineItalic.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-Heavy.woff +0 -0
- package/dist/collection/assets/fonts/Lato-Heavy.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-HeavyItalic.woff +0 -0
- package/dist/collection/assets/fonts/Lato-HeavyItalic.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-Italic.woff +0 -0
- package/dist/collection/assets/fonts/Lato-Italic.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-Light.woff +0 -0
- package/dist/collection/assets/fonts/Lato-Light.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-LightItalic.woff +0 -0
- package/dist/collection/assets/fonts/Lato-LightItalic.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-Medium.woff +0 -0
- package/dist/collection/assets/fonts/Lato-Medium.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-MediumItalic.woff +0 -0
- package/dist/collection/assets/fonts/Lato-MediumItalic.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-Regular.woff +0 -0
- package/dist/collection/assets/fonts/Lato-Regular.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-Semibold.woff +0 -0
- package/dist/collection/assets/fonts/Lato-Semibold.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-SemiboldItalic.woff +0 -0
- package/dist/collection/assets/fonts/Lato-SemiboldItalic.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-Thin.woff +0 -0
- package/dist/collection/assets/fonts/Lato-Thin.woff2 +0 -0
- package/dist/collection/assets/fonts/Lato-ThinItalic.woff +0 -0
- package/dist/collection/assets/fonts/Lato-ThinItalic.woff2 +0 -0
- package/dist/collection/collection-manifest.json +8 -1
- package/dist/collection/components/cat-alert/cat-alert.css +11 -6
- package/dist/collection/components/cat-alert/cat-alert.js +19 -8
- package/dist/collection/components/cat-alert/cat-alert.js.map +1 -1
- package/dist/collection/components/cat-badge/cat-badge.css +17 -17
- package/dist/collection/components/cat-badge/cat-badge.js +9 -8
- package/dist/collection/components/cat-badge/cat-badge.js.map +1 -1
- package/dist/collection/components/cat-button/cat-button.css +18 -8
- package/dist/collection/components/cat-button/cat-button.js +32 -8
- package/dist/collection/components/cat-button/cat-button.js.map +1 -1
- package/dist/collection/components/cat-card/cat-card.css +25 -0
- package/dist/collection/components/cat-card/cat-card.js +20 -0
- package/dist/collection/components/cat-card/cat-card.js.map +1 -0
- package/dist/collection/components/cat-checkbox/cat-checkbox.css +105 -0
- package/dist/collection/components/cat-checkbox/cat-checkbox.js +314 -0
- package/dist/collection/components/cat-checkbox/cat-checkbox.js.map +1 -0
- package/dist/collection/components/cat-i18n/cat-i18n-registry.js +69 -0
- package/dist/collection/components/cat-i18n/cat-i18n-registry.js.map +1 -0
- package/dist/collection/components/cat-icon/cat-icon-registry.js +14 -1
- package/dist/collection/components/cat-icon/cat-icon-registry.js.map +1 -1
- package/dist/collection/components/cat-icon/cat-icon.css +5 -5
- package/dist/collection/components/cat-icon/cat-icon.js +3 -2
- package/dist/collection/components/cat-icon/cat-icon.js.map +1 -1
- package/dist/collection/components/cat-input/cat-input.css +131 -0
- package/dist/collection/components/cat-input/cat-input.js +606 -0
- package/dist/collection/components/cat-input/cat-input.js.map +1 -0
- package/dist/collection/components/cat-menu/cat-menu.css +2 -1
- package/dist/collection/components/cat-menu/cat-menu.js +3 -5
- package/dist/collection/components/cat-menu/cat-menu.js.map +1 -1
- package/dist/collection/components/cat-radio/cat-radio.css +84 -0
- package/dist/collection/components/cat-radio/cat-radio.js +283 -0
- package/dist/collection/components/cat-radio/cat-radio.js.map +1 -0
- package/dist/collection/components/cat-scrollable/cat-scrollable.js +4 -2
- package/dist/collection/components/cat-scrollable/cat-scrollable.js.map +1 -1
- package/dist/collection/components/cat-skeleton/cat-skeleton.css +30 -30
- package/dist/collection/components/cat-skeleton/cat-skeleton.js +4 -4
- package/dist/collection/components/cat-skeleton/cat-skeleton.js.map +1 -1
- package/dist/collection/components/cat-spinner/cat-spinner.css +7 -7
- package/dist/collection/components/cat-spinner/cat-spinner.js +1 -1
- package/dist/collection/components/cat-spinner/cat-spinner.js.map +1 -1
- package/dist/collection/components/cat-textarea/cat-textarea.css +74 -0
- package/dist/collection/components/cat-textarea/cat-textarea.js +393 -0
- package/dist/collection/components/cat-textarea/cat-textarea.js.map +1 -0
- package/dist/collection/components/cat-toggle/cat-toggle.css +93 -0
- package/dist/collection/components/cat-toggle/cat-toggle.js +283 -0
- package/dist/collection/components/cat-toggle/cat-toggle.js.map +1 -0
- package/dist/collection/components/cat-tooltip/cat-tooltip.css +41 -0
- package/dist/collection/components/cat-tooltip/cat-tooltip.js +254 -0
- package/dist/collection/components/cat-tooltip/cat-tooltip.js.map +1 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/init.js +9 -1
- package/dist/collection/init.js.map +1 -1
- package/dist/collection/utils/first-tabbable.js +6 -0
- package/dist/collection/utils/first-tabbable.js.map +1 -0
- package/dist/collection/utils/is-touch-screen.js +3 -0
- package/dist/collection/utils/is-touch-screen.js.map +1 -0
- package/dist/components/cat-alert.js +15 -6
- package/dist/components/cat-alert.js.map +1 -1
- package/dist/components/cat-badge.js +7 -7
- package/dist/components/cat-badge.js.map +1 -1
- package/dist/components/cat-button.js +1 -647
- package/dist/components/cat-button.js.map +1 -1
- package/dist/components/cat-button2.js +346 -0
- package/dist/components/cat-button2.js.map +1 -0
- package/dist/components/cat-card.d.ts +11 -0
- package/dist/components/cat-card.js +35 -0
- package/dist/components/cat-card.js.map +1 -0
- package/dist/components/cat-checkbox.d.ts +11 -0
- package/dist/components/cat-checkbox.js +103 -0
- package/dist/components/cat-checkbox.js.map +1 -0
- package/dist/components/cat-i18n-registry.js +73 -0
- package/dist/components/cat-i18n-registry.js.map +1 -0
- package/dist/components/cat-icon-registry.js +15 -1
- package/dist/components/cat-icon-registry.js.map +1 -1
- package/dist/components/cat-icon2.js +3 -2
- package/dist/components/cat-icon2.js.map +1 -1
- package/dist/components/cat-input.d.ts +11 -0
- package/dist/components/cat-input.js +172 -0
- package/dist/components/cat-input.js.map +1 -0
- package/dist/components/cat-menu.js +12 -1520
- package/dist/components/cat-menu.js.map +1 -1
- package/dist/components/cat-radio.d.ts +11 -0
- package/dist/components/cat-radio.js +93 -0
- package/dist/components/cat-radio.js.map +1 -0
- package/dist/components/cat-scrollable.js +1 -2
- package/dist/components/cat-scrollable.js.map +1 -1
- package/dist/components/cat-skeleton.js +5 -5
- package/dist/components/cat-skeleton.js.map +1 -1
- package/dist/components/cat-spinner2.js +2 -2
- package/dist/components/cat-spinner2.js.map +1 -1
- package/dist/components/cat-textarea.d.ts +11 -0
- package/dist/components/cat-textarea.js +119 -0
- package/dist/components/cat-textarea.js.map +1 -0
- package/dist/components/cat-toggle.d.ts +11 -0
- package/dist/components/cat-toggle.js +93 -0
- package/dist/components/cat-toggle.js.map +1 -0
- package/dist/components/cat-tooltip.d.ts +11 -0
- package/dist/components/cat-tooltip.js +154 -0
- package/dist/components/cat-tooltip.js.map +1 -0
- package/dist/components/first-tabbable.js +1496 -0
- package/dist/components/first-tabbable.js.map +1 -0
- package/dist/components/index.js +9 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/loglevel.js +315 -0
- package/dist/components/loglevel.js.map +1 -0
- package/dist/esm/{app-globals-8af9b2cf.js → app-globals-6906ac5c.js} +9 -2
- package/dist/esm/app-globals-6906ac5c.js.map +1 -0
- package/dist/esm/{cat-alert_8.entry.js → cat-alert_15.entry.js} +594 -399
- package/dist/esm/cat-alert_15.entry.js.map +1 -0
- package/dist/esm/cat-icon-registry-77963c26.js +437 -0
- package/dist/esm/cat-icon-registry-77963c26.js.map +1 -0
- package/dist/esm/catalyst.js +4 -4
- package/dist/esm/{index-0ff35bca.js → index-1f3ca03b.js} +2 -2
- package/dist/esm/index-1f3ca03b.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +4 -4
- package/dist/types/components/cat-alert/cat-alert.d.ts +4 -2
- package/dist/types/components/cat-badge/cat-badge.d.ts +3 -2
- package/dist/types/components/cat-button/cat-button.d.ts +8 -3
- package/dist/types/components/cat-card/cat-card.d.ts +7 -0
- package/dist/types/components/cat-checkbox/cat-checkbox.d.ts +69 -0
- package/dist/types/components/cat-i18n/cat-i18n-registry.d.ts +18 -0
- package/dist/types/components/cat-icon/cat-icon-registry.d.ts +4 -4
- package/dist/types/components/cat-icon/cat-icon.d.ts +1 -1
- package/dist/types/components/cat-input/cat-input.d.ts +130 -0
- package/dist/types/components/cat-menu/cat-menu.d.ts +0 -1
- package/dist/types/components/cat-radio/cat-radio.d.ts +63 -0
- package/dist/types/components/cat-scrollable/cat-scrollable.d.ts +3 -1
- package/dist/types/components/cat-textarea/cat-textarea.d.ts +85 -0
- package/dist/types/components/cat-toggle/cat-toggle.d.ts +64 -0
- package/dist/types/components/cat-tooltip/cat-tooltip.d.ts +46 -0
- package/dist/types/components.d.ts +680 -4
- package/dist/types/index.d.ts +1 -0
- package/dist/types/utils/first-tabbable.d.ts +4 -0
- package/dist/types/utils/is-touch-screen.d.ts +2 -0
- package/package.json +9 -7
- package/dist/catalyst/p-31b500c7.entry.js +0 -10
- package/dist/catalyst/p-31b500c7.entry.js.map +0 -1
- package/dist/catalyst/p-ed826597.js.map +0 -1
- package/dist/catalyst/p-ef0a8ae9.js +0 -2
- package/dist/catalyst/p-ef0a8ae9.js.map +0 -1
- package/dist/catalyst/p-f151cb13.js +0 -2
- package/dist/catalyst/p-f151cb13.js.map +0 -1
- package/dist/cjs/app-globals-7f2b1f8e.js.map +0 -1
- package/dist/cjs/cat-alert_8.cjs.entry.js.map +0 -1
- package/dist/cjs/cat-icon-registry-850c538c.js +0 -47
- package/dist/cjs/cat-icon-registry-850c538c.js.map +0 -1
- package/dist/cjs/index-c0881ae0.js.map +0 -1
- package/dist/collection/utils/utils.js +0 -4
- package/dist/collection/utils/utils.js.map +0 -1
- package/dist/esm/app-globals-8af9b2cf.js.map +0 -1
- package/dist/esm/cat-alert_8.entry.js.map +0 -1
- package/dist/esm/cat-icon-registry-59da2e37.js +0 -45
- package/dist/esm/cat-icon-registry-59da2e37.js.map +0 -1
- package/dist/esm/index-0ff35bca.js.map +0 -1
- package/dist/types/utils/utils.d.ts +0 -1
|
@@ -0,0 +1,606 @@
|
|
|
1
|
+
import { Component, Event, h, Host, Method, Prop, State, Watch } from '@stencil/core';
|
|
2
|
+
import log from 'loglevel';
|
|
3
|
+
import { CatI18nRegistry } from '../cat-i18n/cat-i18n-registry';
|
|
4
|
+
let nextUniqueId = 0;
|
|
5
|
+
/**
|
|
6
|
+
* Inputs are used to allow users to provide text input when the expected input
|
|
7
|
+
* is short. As well as plain text, Input supports various types of text,
|
|
8
|
+
* including passwords and numbers.
|
|
9
|
+
*
|
|
10
|
+
* @part label - The label content.
|
|
11
|
+
* @part prefix - The text prefix.
|
|
12
|
+
* @part suffix - The text suffix.
|
|
13
|
+
*/
|
|
14
|
+
export class CatInput {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.i18n = CatI18nRegistry.getInstance();
|
|
17
|
+
this.id = `cat-input-${nextUniqueId++}`;
|
|
18
|
+
this.inputValue = '';
|
|
19
|
+
/**
|
|
20
|
+
* Whether the input should show a clear button.
|
|
21
|
+
*/
|
|
22
|
+
this.clearable = false;
|
|
23
|
+
/**
|
|
24
|
+
* Whether the input is disabled.
|
|
25
|
+
*/
|
|
26
|
+
this.disabled = false;
|
|
27
|
+
/**
|
|
28
|
+
* Display the icon on the right.
|
|
29
|
+
*/
|
|
30
|
+
this.iconRight = false;
|
|
31
|
+
/**
|
|
32
|
+
* The label for the input.
|
|
33
|
+
*/
|
|
34
|
+
this.label = '';
|
|
35
|
+
/**
|
|
36
|
+
* Visually hide the label, but still show it to assistive technologies like screen readers.
|
|
37
|
+
*/
|
|
38
|
+
this.labelHidden = false;
|
|
39
|
+
/**
|
|
40
|
+
* The name of the form control. Submitted with the form as part of a name/value pair.
|
|
41
|
+
*/
|
|
42
|
+
this.name = '';
|
|
43
|
+
/**
|
|
44
|
+
* The value is not editable.
|
|
45
|
+
*/
|
|
46
|
+
this.readonly = false;
|
|
47
|
+
/**
|
|
48
|
+
* A value is required or must be check for the form to be submittable.
|
|
49
|
+
*/
|
|
50
|
+
this.required = false;
|
|
51
|
+
/**
|
|
52
|
+
* Use round input edges.
|
|
53
|
+
*/
|
|
54
|
+
this.round = false;
|
|
55
|
+
/**
|
|
56
|
+
* Type of form control.
|
|
57
|
+
*/
|
|
58
|
+
this.type = 'text';
|
|
59
|
+
}
|
|
60
|
+
onValueChange(value) {
|
|
61
|
+
this.inputValue = '' + (value !== null && value !== void 0 ? value : '');
|
|
62
|
+
}
|
|
63
|
+
componentWillLoad() {
|
|
64
|
+
this.onValueChange(this.value);
|
|
65
|
+
}
|
|
66
|
+
componentWillRender() {
|
|
67
|
+
if (!this.label) {
|
|
68
|
+
log.error('[A11y] Missing ARIA label on input', this);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Sets focus on the input. Use this method instead of `input.focus()`.
|
|
73
|
+
*
|
|
74
|
+
* @param options An optional object providing options to control aspects of
|
|
75
|
+
* the focusing process.
|
|
76
|
+
*/
|
|
77
|
+
async setFocus(options) {
|
|
78
|
+
this.input.focus(options);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Clear the input.
|
|
82
|
+
*/
|
|
83
|
+
async clear() {
|
|
84
|
+
this.inputValue = '';
|
|
85
|
+
}
|
|
86
|
+
render() {
|
|
87
|
+
return (h(Host, null,
|
|
88
|
+
this.label && (h("label", { htmlFor: this.id, class: { hidden: this.labelHidden } },
|
|
89
|
+
h("span", { part: "label" },
|
|
90
|
+
this.label,
|
|
91
|
+
!this.required && (h("span", { class: "input-optional", "aria-hidden": "true" },
|
|
92
|
+
"(",
|
|
93
|
+
this.i18n.getMessage('input.optional'),
|
|
94
|
+
")"))))),
|
|
95
|
+
h("div", { class: {
|
|
96
|
+
'input-wrapper': true,
|
|
97
|
+
'input-round': this.round,
|
|
98
|
+
'input-disabled': this.disabled
|
|
99
|
+
}, onClick: () => this.input.focus() },
|
|
100
|
+
this.textPrefix && (h("span", { class: "text-prefix", part: "prefix" }, this.textPrefix)),
|
|
101
|
+
this.icon && !this.iconRight && h("cat-icon", { icon: this.icon, class: "icon-prefix" }),
|
|
102
|
+
h("div", { class: "input-inner-wrapper" },
|
|
103
|
+
h("input", { ref: el => (this.input = el), id: this.id, class: {
|
|
104
|
+
'has-clearable': this.clearable && !this.disabled
|
|
105
|
+
}, autocomplete: this.autoComplete, disabled: this.disabled, max: this.max, maxlength: this.maxLength, min: this.max, minlength: this.minLength, name: this.name, placeholder: this.placeholder, readonly: this.readonly, required: this.required, type: this.type, value: this.inputValue, onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }),
|
|
106
|
+
this.clearable && !this.disabled && this.inputValue && (h("cat-button", { class: "clearable", icon: "cross-circle-outlined", "icon-only": "true", size: "s", variant: "text", round: true, "a11y-label": "sdf", onClick: this.clear.bind(this) }, this.i18n.getMessage('input.clear')))),
|
|
107
|
+
this.icon && this.iconRight && h("cat-icon", { icon: this.icon, class: "icon-suffix" }),
|
|
108
|
+
this.textSuffix && (h("span", { class: "text-suffix", part: "suffix" }, this.textSuffix))),
|
|
109
|
+
this.hint && h("p", { class: "input-hint" }, this.hint)));
|
|
110
|
+
}
|
|
111
|
+
onInput(event) {
|
|
112
|
+
this.inputValue = this.input.value;
|
|
113
|
+
this.catChange.emit(event);
|
|
114
|
+
}
|
|
115
|
+
onFocus(event) {
|
|
116
|
+
this.catFocus.emit(event);
|
|
117
|
+
}
|
|
118
|
+
onBlur(event) {
|
|
119
|
+
this.catBlur.emit(event);
|
|
120
|
+
}
|
|
121
|
+
static get is() { return "cat-input"; }
|
|
122
|
+
static get encapsulation() { return "shadow"; }
|
|
123
|
+
static get originalStyleUrls() { return {
|
|
124
|
+
"$": ["cat-input.scss"]
|
|
125
|
+
}; }
|
|
126
|
+
static get styleUrls() { return {
|
|
127
|
+
"$": ["cat-input.css"]
|
|
128
|
+
}; }
|
|
129
|
+
static get properties() { return {
|
|
130
|
+
"autoComplete": {
|
|
131
|
+
"type": "string",
|
|
132
|
+
"mutable": false,
|
|
133
|
+
"complexType": {
|
|
134
|
+
"original": "string",
|
|
135
|
+
"resolved": "string | undefined",
|
|
136
|
+
"references": {}
|
|
137
|
+
},
|
|
138
|
+
"required": false,
|
|
139
|
+
"optional": true,
|
|
140
|
+
"docs": {
|
|
141
|
+
"tags": [],
|
|
142
|
+
"text": "Hint for form autofill feature."
|
|
143
|
+
},
|
|
144
|
+
"attribute": "auto-complete",
|
|
145
|
+
"reflect": false
|
|
146
|
+
},
|
|
147
|
+
"clearable": {
|
|
148
|
+
"type": "boolean",
|
|
149
|
+
"mutable": false,
|
|
150
|
+
"complexType": {
|
|
151
|
+
"original": "boolean",
|
|
152
|
+
"resolved": "boolean",
|
|
153
|
+
"references": {}
|
|
154
|
+
},
|
|
155
|
+
"required": false,
|
|
156
|
+
"optional": false,
|
|
157
|
+
"docs": {
|
|
158
|
+
"tags": [],
|
|
159
|
+
"text": "Whether the input should show a clear button."
|
|
160
|
+
},
|
|
161
|
+
"attribute": "clearable",
|
|
162
|
+
"reflect": false,
|
|
163
|
+
"defaultValue": "false"
|
|
164
|
+
},
|
|
165
|
+
"disabled": {
|
|
166
|
+
"type": "boolean",
|
|
167
|
+
"mutable": false,
|
|
168
|
+
"complexType": {
|
|
169
|
+
"original": "boolean",
|
|
170
|
+
"resolved": "boolean",
|
|
171
|
+
"references": {}
|
|
172
|
+
},
|
|
173
|
+
"required": false,
|
|
174
|
+
"optional": false,
|
|
175
|
+
"docs": {
|
|
176
|
+
"tags": [],
|
|
177
|
+
"text": "Whether the input is disabled."
|
|
178
|
+
},
|
|
179
|
+
"attribute": "disabled",
|
|
180
|
+
"reflect": false,
|
|
181
|
+
"defaultValue": "false"
|
|
182
|
+
},
|
|
183
|
+
"hint": {
|
|
184
|
+
"type": "string",
|
|
185
|
+
"mutable": false,
|
|
186
|
+
"complexType": {
|
|
187
|
+
"original": "string",
|
|
188
|
+
"resolved": "string | undefined",
|
|
189
|
+
"references": {}
|
|
190
|
+
},
|
|
191
|
+
"required": false,
|
|
192
|
+
"optional": true,
|
|
193
|
+
"docs": {
|
|
194
|
+
"tags": [],
|
|
195
|
+
"text": "Optional hint text to be displayed with the input."
|
|
196
|
+
},
|
|
197
|
+
"attribute": "hint",
|
|
198
|
+
"reflect": false
|
|
199
|
+
},
|
|
200
|
+
"icon": {
|
|
201
|
+
"type": "string",
|
|
202
|
+
"mutable": false,
|
|
203
|
+
"complexType": {
|
|
204
|
+
"original": "string",
|
|
205
|
+
"resolved": "string | undefined",
|
|
206
|
+
"references": {}
|
|
207
|
+
},
|
|
208
|
+
"required": false,
|
|
209
|
+
"optional": true,
|
|
210
|
+
"docs": {
|
|
211
|
+
"tags": [],
|
|
212
|
+
"text": "The name of an icon to be displayed in the input."
|
|
213
|
+
},
|
|
214
|
+
"attribute": "icon",
|
|
215
|
+
"reflect": false
|
|
216
|
+
},
|
|
217
|
+
"iconRight": {
|
|
218
|
+
"type": "boolean",
|
|
219
|
+
"mutable": false,
|
|
220
|
+
"complexType": {
|
|
221
|
+
"original": "boolean",
|
|
222
|
+
"resolved": "boolean",
|
|
223
|
+
"references": {}
|
|
224
|
+
},
|
|
225
|
+
"required": false,
|
|
226
|
+
"optional": false,
|
|
227
|
+
"docs": {
|
|
228
|
+
"tags": [],
|
|
229
|
+
"text": "Display the icon on the right."
|
|
230
|
+
},
|
|
231
|
+
"attribute": "icon-right",
|
|
232
|
+
"reflect": false,
|
|
233
|
+
"defaultValue": "false"
|
|
234
|
+
},
|
|
235
|
+
"label": {
|
|
236
|
+
"type": "string",
|
|
237
|
+
"mutable": false,
|
|
238
|
+
"complexType": {
|
|
239
|
+
"original": "string",
|
|
240
|
+
"resolved": "string",
|
|
241
|
+
"references": {}
|
|
242
|
+
},
|
|
243
|
+
"required": false,
|
|
244
|
+
"optional": false,
|
|
245
|
+
"docs": {
|
|
246
|
+
"tags": [],
|
|
247
|
+
"text": "The label for the input."
|
|
248
|
+
},
|
|
249
|
+
"attribute": "label",
|
|
250
|
+
"reflect": false,
|
|
251
|
+
"defaultValue": "''"
|
|
252
|
+
},
|
|
253
|
+
"labelHidden": {
|
|
254
|
+
"type": "boolean",
|
|
255
|
+
"mutable": false,
|
|
256
|
+
"complexType": {
|
|
257
|
+
"original": "boolean",
|
|
258
|
+
"resolved": "boolean",
|
|
259
|
+
"references": {}
|
|
260
|
+
},
|
|
261
|
+
"required": false,
|
|
262
|
+
"optional": false,
|
|
263
|
+
"docs": {
|
|
264
|
+
"tags": [],
|
|
265
|
+
"text": "Visually hide the label, but still show it to assistive technologies like screen readers."
|
|
266
|
+
},
|
|
267
|
+
"attribute": "label-hidden",
|
|
268
|
+
"reflect": false,
|
|
269
|
+
"defaultValue": "false"
|
|
270
|
+
},
|
|
271
|
+
"max": {
|
|
272
|
+
"type": "number",
|
|
273
|
+
"mutable": false,
|
|
274
|
+
"complexType": {
|
|
275
|
+
"original": "number",
|
|
276
|
+
"resolved": "number | undefined",
|
|
277
|
+
"references": {}
|
|
278
|
+
},
|
|
279
|
+
"required": false,
|
|
280
|
+
"optional": true,
|
|
281
|
+
"docs": {
|
|
282
|
+
"tags": [],
|
|
283
|
+
"text": "A maximum value for numeric values."
|
|
284
|
+
},
|
|
285
|
+
"attribute": "max",
|
|
286
|
+
"reflect": false
|
|
287
|
+
},
|
|
288
|
+
"maxLength": {
|
|
289
|
+
"type": "number",
|
|
290
|
+
"mutable": false,
|
|
291
|
+
"complexType": {
|
|
292
|
+
"original": "number",
|
|
293
|
+
"resolved": "number | undefined",
|
|
294
|
+
"references": {}
|
|
295
|
+
},
|
|
296
|
+
"required": false,
|
|
297
|
+
"optional": true,
|
|
298
|
+
"docs": {
|
|
299
|
+
"tags": [],
|
|
300
|
+
"text": "A maximum length (number of characters) for textual values."
|
|
301
|
+
},
|
|
302
|
+
"attribute": "max-length",
|
|
303
|
+
"reflect": false
|
|
304
|
+
},
|
|
305
|
+
"min": {
|
|
306
|
+
"type": "number",
|
|
307
|
+
"mutable": false,
|
|
308
|
+
"complexType": {
|
|
309
|
+
"original": "number",
|
|
310
|
+
"resolved": "number | undefined",
|
|
311
|
+
"references": {}
|
|
312
|
+
},
|
|
313
|
+
"required": false,
|
|
314
|
+
"optional": true,
|
|
315
|
+
"docs": {
|
|
316
|
+
"tags": [],
|
|
317
|
+
"text": "A minimum value for numeric values."
|
|
318
|
+
},
|
|
319
|
+
"attribute": "min",
|
|
320
|
+
"reflect": false
|
|
321
|
+
},
|
|
322
|
+
"minLength": {
|
|
323
|
+
"type": "number",
|
|
324
|
+
"mutable": false,
|
|
325
|
+
"complexType": {
|
|
326
|
+
"original": "number",
|
|
327
|
+
"resolved": "number | undefined",
|
|
328
|
+
"references": {}
|
|
329
|
+
},
|
|
330
|
+
"required": false,
|
|
331
|
+
"optional": true,
|
|
332
|
+
"docs": {
|
|
333
|
+
"tags": [],
|
|
334
|
+
"text": "A minimum length (number of characters) for textual values."
|
|
335
|
+
},
|
|
336
|
+
"attribute": "min-length",
|
|
337
|
+
"reflect": false
|
|
338
|
+
},
|
|
339
|
+
"name": {
|
|
340
|
+
"type": "string",
|
|
341
|
+
"mutable": false,
|
|
342
|
+
"complexType": {
|
|
343
|
+
"original": "string",
|
|
344
|
+
"resolved": "string",
|
|
345
|
+
"references": {}
|
|
346
|
+
},
|
|
347
|
+
"required": false,
|
|
348
|
+
"optional": false,
|
|
349
|
+
"docs": {
|
|
350
|
+
"tags": [],
|
|
351
|
+
"text": "The name of the form control. Submitted with the form as part of a name/value pair."
|
|
352
|
+
},
|
|
353
|
+
"attribute": "name",
|
|
354
|
+
"reflect": false,
|
|
355
|
+
"defaultValue": "''"
|
|
356
|
+
},
|
|
357
|
+
"placeholder": {
|
|
358
|
+
"type": "string",
|
|
359
|
+
"mutable": false,
|
|
360
|
+
"complexType": {
|
|
361
|
+
"original": "string",
|
|
362
|
+
"resolved": "string | undefined",
|
|
363
|
+
"references": {}
|
|
364
|
+
},
|
|
365
|
+
"required": false,
|
|
366
|
+
"optional": true,
|
|
367
|
+
"docs": {
|
|
368
|
+
"tags": [],
|
|
369
|
+
"text": "The placeholder text to display within the input."
|
|
370
|
+
},
|
|
371
|
+
"attribute": "placeholder",
|
|
372
|
+
"reflect": false
|
|
373
|
+
},
|
|
374
|
+
"textPrefix": {
|
|
375
|
+
"type": "string",
|
|
376
|
+
"mutable": false,
|
|
377
|
+
"complexType": {
|
|
378
|
+
"original": "string",
|
|
379
|
+
"resolved": "string | undefined",
|
|
380
|
+
"references": {}
|
|
381
|
+
},
|
|
382
|
+
"required": false,
|
|
383
|
+
"optional": true,
|
|
384
|
+
"docs": {
|
|
385
|
+
"tags": [],
|
|
386
|
+
"text": "A textual prefix to be displayed in the input."
|
|
387
|
+
},
|
|
388
|
+
"attribute": "text-prefix",
|
|
389
|
+
"reflect": false
|
|
390
|
+
},
|
|
391
|
+
"textSuffix": {
|
|
392
|
+
"type": "string",
|
|
393
|
+
"mutable": false,
|
|
394
|
+
"complexType": {
|
|
395
|
+
"original": "string",
|
|
396
|
+
"resolved": "string | undefined",
|
|
397
|
+
"references": {}
|
|
398
|
+
},
|
|
399
|
+
"required": false,
|
|
400
|
+
"optional": true,
|
|
401
|
+
"docs": {
|
|
402
|
+
"tags": [],
|
|
403
|
+
"text": "A textual suffix to be displayed in the input."
|
|
404
|
+
},
|
|
405
|
+
"attribute": "text-suffix",
|
|
406
|
+
"reflect": false
|
|
407
|
+
},
|
|
408
|
+
"readonly": {
|
|
409
|
+
"type": "boolean",
|
|
410
|
+
"mutable": false,
|
|
411
|
+
"complexType": {
|
|
412
|
+
"original": "boolean",
|
|
413
|
+
"resolved": "boolean",
|
|
414
|
+
"references": {}
|
|
415
|
+
},
|
|
416
|
+
"required": false,
|
|
417
|
+
"optional": false,
|
|
418
|
+
"docs": {
|
|
419
|
+
"tags": [],
|
|
420
|
+
"text": "The value is not editable."
|
|
421
|
+
},
|
|
422
|
+
"attribute": "readonly",
|
|
423
|
+
"reflect": false,
|
|
424
|
+
"defaultValue": "false"
|
|
425
|
+
},
|
|
426
|
+
"required": {
|
|
427
|
+
"type": "boolean",
|
|
428
|
+
"mutable": false,
|
|
429
|
+
"complexType": {
|
|
430
|
+
"original": "boolean",
|
|
431
|
+
"resolved": "boolean",
|
|
432
|
+
"references": {}
|
|
433
|
+
},
|
|
434
|
+
"required": false,
|
|
435
|
+
"optional": false,
|
|
436
|
+
"docs": {
|
|
437
|
+
"tags": [],
|
|
438
|
+
"text": "A value is required or must be check for the form to be submittable."
|
|
439
|
+
},
|
|
440
|
+
"attribute": "required",
|
|
441
|
+
"reflect": false,
|
|
442
|
+
"defaultValue": "false"
|
|
443
|
+
},
|
|
444
|
+
"round": {
|
|
445
|
+
"type": "boolean",
|
|
446
|
+
"mutable": false,
|
|
447
|
+
"complexType": {
|
|
448
|
+
"original": "boolean",
|
|
449
|
+
"resolved": "boolean",
|
|
450
|
+
"references": {}
|
|
451
|
+
},
|
|
452
|
+
"required": false,
|
|
453
|
+
"optional": false,
|
|
454
|
+
"docs": {
|
|
455
|
+
"tags": [],
|
|
456
|
+
"text": "Use round input edges."
|
|
457
|
+
},
|
|
458
|
+
"attribute": "round",
|
|
459
|
+
"reflect": false,
|
|
460
|
+
"defaultValue": "false"
|
|
461
|
+
},
|
|
462
|
+
"type": {
|
|
463
|
+
"type": "string",
|
|
464
|
+
"mutable": false,
|
|
465
|
+
"complexType": {
|
|
466
|
+
"original": "'text' | 'email' | 'password' | 'tel' | 'url' | 'search' | 'number'",
|
|
467
|
+
"resolved": "\"email\" | \"number\" | \"password\" | \"search\" | \"tel\" | \"text\" | \"url\"",
|
|
468
|
+
"references": {}
|
|
469
|
+
},
|
|
470
|
+
"required": false,
|
|
471
|
+
"optional": false,
|
|
472
|
+
"docs": {
|
|
473
|
+
"tags": [],
|
|
474
|
+
"text": "Type of form control."
|
|
475
|
+
},
|
|
476
|
+
"attribute": "type",
|
|
477
|
+
"reflect": false,
|
|
478
|
+
"defaultValue": "'text'"
|
|
479
|
+
},
|
|
480
|
+
"value": {
|
|
481
|
+
"type": "any",
|
|
482
|
+
"mutable": false,
|
|
483
|
+
"complexType": {
|
|
484
|
+
"original": "string | number",
|
|
485
|
+
"resolved": "number | string | undefined",
|
|
486
|
+
"references": {}
|
|
487
|
+
},
|
|
488
|
+
"required": false,
|
|
489
|
+
"optional": true,
|
|
490
|
+
"docs": {
|
|
491
|
+
"tags": [],
|
|
492
|
+
"text": "The initial value of the control."
|
|
493
|
+
},
|
|
494
|
+
"attribute": "value",
|
|
495
|
+
"reflect": false
|
|
496
|
+
}
|
|
497
|
+
}; }
|
|
498
|
+
static get states() { return {
|
|
499
|
+
"inputValue": {}
|
|
500
|
+
}; }
|
|
501
|
+
static get events() { return [{
|
|
502
|
+
"method": "catChange",
|
|
503
|
+
"name": "catChange",
|
|
504
|
+
"bubbles": true,
|
|
505
|
+
"cancelable": true,
|
|
506
|
+
"composed": true,
|
|
507
|
+
"docs": {
|
|
508
|
+
"tags": [],
|
|
509
|
+
"text": "Emitted when the value is changed."
|
|
510
|
+
},
|
|
511
|
+
"complexType": {
|
|
512
|
+
"original": "any",
|
|
513
|
+
"resolved": "any",
|
|
514
|
+
"references": {}
|
|
515
|
+
}
|
|
516
|
+
}, {
|
|
517
|
+
"method": "catFocus",
|
|
518
|
+
"name": "catFocus",
|
|
519
|
+
"bubbles": true,
|
|
520
|
+
"cancelable": true,
|
|
521
|
+
"composed": true,
|
|
522
|
+
"docs": {
|
|
523
|
+
"tags": [],
|
|
524
|
+
"text": "Emitted when the input received focus."
|
|
525
|
+
},
|
|
526
|
+
"complexType": {
|
|
527
|
+
"original": "FocusEvent",
|
|
528
|
+
"resolved": "FocusEvent",
|
|
529
|
+
"references": {
|
|
530
|
+
"FocusEvent": {
|
|
531
|
+
"location": "global"
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
}, {
|
|
536
|
+
"method": "catBlur",
|
|
537
|
+
"name": "catBlur",
|
|
538
|
+
"bubbles": true,
|
|
539
|
+
"cancelable": true,
|
|
540
|
+
"composed": true,
|
|
541
|
+
"docs": {
|
|
542
|
+
"tags": [],
|
|
543
|
+
"text": "Emitted when the input loses focus."
|
|
544
|
+
},
|
|
545
|
+
"complexType": {
|
|
546
|
+
"original": "FocusEvent",
|
|
547
|
+
"resolved": "FocusEvent",
|
|
548
|
+
"references": {
|
|
549
|
+
"FocusEvent": {
|
|
550
|
+
"location": "global"
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}]; }
|
|
555
|
+
static get methods() { return {
|
|
556
|
+
"setFocus": {
|
|
557
|
+
"complexType": {
|
|
558
|
+
"signature": "(options?: FocusOptions | undefined) => Promise<void>",
|
|
559
|
+
"parameters": [{
|
|
560
|
+
"tags": [{
|
|
561
|
+
"name": "param",
|
|
562
|
+
"text": "options An optional object providing options to control aspects of\nthe focusing process."
|
|
563
|
+
}],
|
|
564
|
+
"text": "An optional object providing options to control aspects of\nthe focusing process."
|
|
565
|
+
}],
|
|
566
|
+
"references": {
|
|
567
|
+
"Promise": {
|
|
568
|
+
"location": "global"
|
|
569
|
+
},
|
|
570
|
+
"FocusOptions": {
|
|
571
|
+
"location": "global"
|
|
572
|
+
}
|
|
573
|
+
},
|
|
574
|
+
"return": "Promise<void>"
|
|
575
|
+
},
|
|
576
|
+
"docs": {
|
|
577
|
+
"text": "Sets focus on the input. Use this method instead of `input.focus()`.",
|
|
578
|
+
"tags": [{
|
|
579
|
+
"name": "param",
|
|
580
|
+
"text": "options An optional object providing options to control aspects of\nthe focusing process."
|
|
581
|
+
}]
|
|
582
|
+
}
|
|
583
|
+
},
|
|
584
|
+
"clear": {
|
|
585
|
+
"complexType": {
|
|
586
|
+
"signature": "() => Promise<void>",
|
|
587
|
+
"parameters": [],
|
|
588
|
+
"references": {
|
|
589
|
+
"Promise": {
|
|
590
|
+
"location": "global"
|
|
591
|
+
}
|
|
592
|
+
},
|
|
593
|
+
"return": "Promise<void>"
|
|
594
|
+
},
|
|
595
|
+
"docs": {
|
|
596
|
+
"text": "Clear the input.",
|
|
597
|
+
"tags": []
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
}; }
|
|
601
|
+
static get watchers() { return [{
|
|
602
|
+
"propName": "value",
|
|
603
|
+
"methodName": "onValueChange"
|
|
604
|
+
}]; }
|
|
605
|
+
}
|
|
606
|
+
//# sourceMappingURL=cat-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cat-input.js","sourceRoot":"","sources":["../../../src/components/cat-input/cat-input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACpG,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,IAAI,YAAY,GAAG,CAAC,CAAC;AAErB;;;;;;;;GAQG;AAMH,MAAM,OAAO,QAAQ;EALrB;IAMmB,SAAI,GAAG,eAAe,CAAC,WAAW,EAAE,CAAC;IACrC,OAAE,GAAG,aAAa,YAAY,EAAE,EAAE,CAAC;IAGnC,eAAU,GAAG,EAAE,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,UAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, h, Host, Method, Prop, State, Watch } from '@stencil/core';\nimport log from 'loglevel';\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 * @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 @State() private inputValue = '';\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 to be displayed with the input.\n */\n @Prop() hint?: 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 initial value of the control.\n */\n @Prop() 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 @Watch('value')\n onValueChange(value?: string | number) {\n this.inputValue = '' + (value ?? '');\n }\n\n componentWillLoad() {\n this.onValueChange(this.value);\n }\n\n componentWillRender(): void {\n if (!this.label) {\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.inputValue = '';\n }\n\n render() {\n return (\n <Host>\n {this.label && (\n <label htmlFor={this.id} class={{ hidden: this.labelHidden }}>\n <span part=\"label\">\n {this.label}\n {!this.required && (\n <span class=\"input-optional\" aria-hidden=\"true\">\n ({this.i18n.getMessage('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\"></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.inputValue}\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.inputValue && (\n <cat-button\n class=\"clearable\"\n icon=\"cross-circle-outlined\"\n icon-only=\"true\"\n size=\"s\"\n variant=\"text\"\n round\n a11y-label=\"sdf\"\n onClick={this.clear.bind(this)}\n >\n {this.i18n.getMessage('input.clear')}\n </cat-button>\n )}\n </div>\n {this.icon && this.iconRight && <cat-icon icon={this.icon} class=\"icon-suffix\"></cat-icon>}\n {this.textSuffix && (\n <span class=\"text-suffix\" part=\"suffix\">\n {this.textSuffix}\n </span>\n )}\n </div>\n {this.hint && <p class=\"input-hint\">{this.hint}</p>}\n </Host>\n );\n }\n\n private onInput(event: Event) {\n this.inputValue = 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"]}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
/* stylelint-disable value-keyword-case */
|
|
10
10
|
/* stylelint-enable value-keyword-case */
|
|
11
11
|
:host {
|
|
12
|
-
display:
|
|
12
|
+
display: contents;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
:host([hidden]) {
|
|
@@ -30,4 +30,5 @@
|
|
|
30
30
|
max-height: calc(100vh - 48px);
|
|
31
31
|
box-shadow: 0 1px 4px 0 rgba(16, 29, 48, 0.2);
|
|
32
32
|
border-radius: 0.25rem;
|
|
33
|
+
z-index: 100;
|
|
33
34
|
}
|
|
@@ -2,6 +2,7 @@ import { autoUpdate, computePosition, flip, offset } from '@floating-ui/dom';
|
|
|
2
2
|
import { Component, Event, h, Host, Listen, Prop } from '@stencil/core';
|
|
3
3
|
import * as focusTrap from 'focus-trap';
|
|
4
4
|
import { tabbable } from 'tabbable';
|
|
5
|
+
import firstTabbable from '../../utils/first-tabbable';
|
|
5
6
|
let nextUniqueId = 0;
|
|
6
7
|
export class CatMenu {
|
|
7
8
|
constructor() {
|
|
@@ -21,7 +22,7 @@ export class CatMenu {
|
|
|
21
22
|
}
|
|
22
23
|
componentDidLoad() {
|
|
23
24
|
var _a, _b, _c, _d, _e;
|
|
24
|
-
this.trigger =
|
|
25
|
+
this.trigger = firstTabbable(this.triggerSlot);
|
|
25
26
|
(_a = this.trigger) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-haspopup', 'true');
|
|
26
27
|
(_b = this.trigger) === null || _b === void 0 ? void 0 : _b.setAttribute('aria-expanded', 'false');
|
|
27
28
|
(_c = this.trigger) === null || _c === void 0 ? void 0 : _c.setAttribute('aria-controls', this.contentId);
|
|
@@ -33,7 +34,7 @@ export class CatMenu {
|
|
|
33
34
|
this.keyListener = event => {
|
|
34
35
|
if (this.content && ['ArrowDown', 'ArrowUp'].includes(event.key)) {
|
|
35
36
|
const targetElements = tabbable(this.content, { includeContainer: false, getShadowRoot: true });
|
|
36
|
-
const activeElement =
|
|
37
|
+
const activeElement = firstTabbable(document.activeElement);
|
|
37
38
|
const activeIdx = activeElement ? targetElements.indexOf(activeElement) : -1;
|
|
38
39
|
const activeOff = event.key === 'ArrowDown' ? 1 : -1;
|
|
39
40
|
const targetIdx = activeIdx < 0 ? 0 : (activeIdx + activeOff + targetElements.length) % targetElements.length;
|
|
@@ -99,9 +100,6 @@ export class CatMenu {
|
|
|
99
100
|
});
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
|
-
firstTabbable(container) {
|
|
103
|
-
return (container ? tabbable(container, { includeContainer: true, getShadowRoot: true }) : []).shift();
|
|
104
|
-
}
|
|
105
103
|
static get is() { return "cat-menu"; }
|
|
106
104
|
static get encapsulation() { return "shadow"; }
|
|
107
105
|
static get originalStyleUrls() { return {
|