@haiilo/catalyst 0.13.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-4ced6c7c.entry.js → p-5f9b3485.entry.js} +3 -3
- package/dist/catalyst/p-5f9b3485.entry.js.map +1 -0
- package/dist/catalyst/{p-f88f8914.js → p-933b6a7a.js} +2 -2
- 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/_toast.scss +22 -12
- package/dist/cjs/cat-alert_22.cjs.entry.js +45 -7
- package/dist/cjs/cat-alert_22.cjs.entry.js.map +1 -1
- package/dist/cjs/{cat-notification-444c9ea0.js → cat-notification-6a438ad1.js} +44 -45
- 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 -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-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-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-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/scss/core/_toast.scss +22 -12
- package/dist/components/cat-alert.js +23 -4
- package/dist/components/cat-alert.js.map +1 -1
- package/dist/components/cat-input.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-toast-demo.js +55 -45
- package/dist/components/cat-toast-demo.js.map +1 -1
- package/dist/esm/cat-alert_22.entry.js +45 -7
- package/dist/esm/cat-alert_22.entry.js.map +1 -1
- package/dist/esm/{cat-notification-953c785d.js → cat-notification-5b6a2cd9.js} +44 -45
- 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 -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-tabs/cat-tabs.d.ts +5 -1
- package/dist/types/components.d.ts +19 -2
- package/package.json +4 -4
- package/dist/catalyst/p-4ced6c7c.entry.js.map +0 -1
- package/dist/catalyst/p-659073b5.js.map +0 -1
- package/dist/catalyst/p-f88f8914.js.map +0 -1
- package/dist/cjs/cat-notification-444c9ea0.js.map +0 -1
- package/dist/cjs/index-936b777e.js.map +0 -1
- package/dist/esm/cat-notification-953c785d.js.map +0 -1
- package/dist/esm/index-41ceb7da.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"]}
|
|
@@ -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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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;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,CAAC;IAEtB;;OAEG;IACK,SAAI,GAAc,MAAM,CAAC;GAiJlC;EA3HC,mBAAmB;IACjB,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,gBAAgB,CAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cat-notification.js","sourceRoot":"","sources":["../../../src/components/cat-notification/cat-notification.tsx"],"names":[],"mappings":"AAAA,OAAO,QAAqB,MAAM,aAAa,CAAC;AAEhD,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"cat-notification.js","sourceRoot":"","sources":["../../../src/components/cat-notification/cat-notification.tsx"],"names":[],"mappings":"AAAA,OAAO,QAAqB,MAAM,aAAa,CAAC;AAEhD,MAAM,CAAN,IAAY,SAMX;AAND,WAAY,SAAS;EACnB,4CAAiC,CAAA;EACjC,0CAA+B,CAAA;EAC/B,mCAAwB,CAAA;EACxB,2CAAgC,CAAA;EAChC,6CAAkC,CAAA;AACpC,CAAC,EANW,SAAS,KAAT,SAAS,QAMpB;AAED,MAAM,CAAC,MAAM,cAAc,GAA4F;EACrH,UAAU,EAAE;IACV,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,MAAM;GACjB;EACD,YAAY,EAAE;IACZ,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,QAAQ;GACnB;EACD,WAAW,EAAE;IACX,OAAO,E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AQ,CAAC,QAAQ,GAAG,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;MAC9D,QAAQ,CAAC,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC;KAC7D;IACD,OAAO,QAAQ,CAAC;EAClB,CAAC;EAEO,cAAc,CAAC,KAAa,EAAE,OAAO,GAAG,GAAG,EAAE,OAA+B;IAClF,MAAM,QAAQ,GAAkB,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC1D,OAAO;MACL,IAAI,EAAE,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,EAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC;MAC1F,QAAQ,EAAE,sBAAsB,CAAC,QAAQ;MACzC,KAAK,EAAE,IAAI;MACX,SAAS,EAAE,cAAc;MACzB,OAAO,EAAE,QAAQ,CAAC,OAAO;MACzB,QAAQ,EAAE,QAAQ,CAAC,QAAQ;MAC3B,WAAW,EAAE,IAAI;MACjB,MAAM,EAAE;QACN,CAAC,EAAE,QAAQ;QACX,CAAC,EAAE,QAAQ;OACZ;KACF,CAAC;EACJ,CAAC;;AAxEc,+BAAQ,GAAG,KAAK,CAAC;AA2ElC,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,sBAAsB,EAAE,CAAC","sourcesContent":["import Toastify, { Options } from 'toastify-js';\n\nexport enum TypeIcons {\n 'success' = 'check-circle-filled',\n 'error' = 'cross-circle-filled',\n 'info' = 'danger-filled',\n 'primary' = 'star-circle-filled',\n 'secondary' = 'info-circle-filled'\n}\n\nexport const ToastPositions: { [key: string]: { gravity: 'top' | 'bottom'; position: 'left' | 'center' | 'right' } } = {\n 'top-left': {\n gravity: 'top',\n position: 'left'\n },\n 'top-center': {\n gravity: 'top',\n position: 'center'\n },\n 'top-right': {\n gravity: 'top',\n position: 'right'\n },\n 'bottom-left': {\n gravity: 'bottom',\n position: 'left'\n },\n 'bottom-center': {\n gravity: 'bottom',\n position: 'center'\n },\n 'bottom-right': {\n gravity: 'bottom',\n position: 'right'\n }\n};\n\nexport interface ToastPosition {\n gravity: 'top' | 'bottom';\n position: 'left' | 'center' | 'right';\n}\n\nexport interface ToastOptions {\n /**\n * HTML content of the toast\n */\n content: Node;\n /**\n * Show close button\n */\n close: boolean;\n /**\n * Toast position\n */\n position: 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';\n /**\n * Type of toast\n */\n type: 'success' | 'info' | 'error' | 'primary' | 'secondary';\n /**\n * Invoked when the toast is clicked\n */\n onClick: () => void;\n /**\n * Toggle the default behavior of escaping HTML markup\n */\n escapeMarkup: boolean;\n}\n\nclass CatNotificationService {\n private static DURATION = 80000;\n\n error(title: string, message = ' ', options?: Partial<ToastOptions>): void {\n const toastOptions: Options = this.extractOptions(title, message, options);\n Toastify(toastOptions).showToast();\n }\n\n success(title: string, message = ' ', options?: Partial<ToastOptions>): void {\n const toastOptions: Options = this.extractOptions(title, message, options);\n Toastify(toastOptions).showToast();\n }\n\n info(title: string, message = ' ', options?: Partial<ToastOptions>): void {\n const toastOptions: Options = this.extractOptions(title, message, options);\n Toastify(toastOptions).showToast();\n }\n\n primary(title: string, message = ' ', options?: Partial<ToastOptions>): void {\n const toastOptions: Options = this.extractOptions(title, message, options);\n Toastify(toastOptions).showToast();\n }\n\n secondary(title: string, message = ' ', options?: Partial<ToastOptions>): void {\n const toastOptions: Options = this.extractOptions(title, message, options);\n Toastify(toastOptions).showToast();\n }\n\n private toastHTMLTemplate(title: string, message = ' ', options?: Partial<ToastOptions>): HTMLElement {\n const template = document.createElement('template');\n const typeIcon = options?.type ? TypeIcons[options.type] : TypeIcons.secondary;\n title = title.trim();\n message = message.trim();\n const hasMessage = message && message !== '';\n const hasMessageClass = hasMessage ? 'has-message' : '';\n template.innerHTML = `<div class=\"cat-toastify-wrapper\">\n <div class=\"cat-toastify-icon-wrapper ${options?.type ?? 'secondary'}\">\n <cat-icon icon=\"${typeIcon}\"></cat-icon>\n </div>\n <div class=\"cat-toastify-title-wrapper ${hasMessageClass}\">\n <div class=\"cat-toastify-title\">${title}</div></div>\n ${hasMessage ? `<div class=\"cat-toastify-message\">${message}</div>` : ''}\n </div>`;\n return template.content.firstChild as HTMLElement;\n }\n\n private getPosition(options?: Partial<ToastOptions>): ToastPosition {\n const position: ToastPosition = {\n gravity: 'bottom',\n position: 'left'\n };\n if (options?.position && ToastPositions[options.position]) {\n position.position = ToastPositions[options.position].position;\n position.gravity = ToastPositions[options.position].gravity;\n }\n return position;\n }\n\n private extractOptions(title: string, message = ' ', options?: Partial<ToastOptions>): Options {\n const position: ToastPosition = this.getPosition(options);\n return {\n node: options?.content ? options.content : this.toastHTMLTemplate(title, message, options),\n duration: CatNotificationService.DURATION,\n close: true,\n className: 'cat-toastify',\n gravity: position.gravity,\n position: position.position,\n stopOnFocus: true,\n offset: {\n x: '1.5rem',\n y: '1.5rem'\n }\n };\n }\n}\n\nexport const NotificationsService = new CatNotificationService();\n"]}
|
|
@@ -57,7 +57,7 @@ export class CatTab {
|
|
|
57
57
|
"text": "The label of the tab."
|
|
58
58
|
},
|
|
59
59
|
"attribute": "label",
|
|
60
|
-
"reflect":
|
|
60
|
+
"reflect": true,
|
|
61
61
|
"defaultValue": "''"
|
|
62
62
|
},
|
|
63
63
|
"icon": {
|
|
@@ -75,7 +75,7 @@ export class CatTab {
|
|
|
75
75
|
"text": "The name of an icon to be displayed in the tab."
|
|
76
76
|
},
|
|
77
77
|
"attribute": "icon",
|
|
78
|
-
"reflect":
|
|
78
|
+
"reflect": true
|
|
79
79
|
},
|
|
80
80
|
"iconOnly": {
|
|
81
81
|
"type": "any",
|
|
@@ -97,7 +97,7 @@ export class CatTab {
|
|
|
97
97
|
"text": "Hide the actual button content and only display the tab."
|
|
98
98
|
},
|
|
99
99
|
"attribute": "icon-only",
|
|
100
|
-
"reflect":
|
|
100
|
+
"reflect": true,
|
|
101
101
|
"defaultValue": "false"
|
|
102
102
|
},
|
|
103
103
|
"iconRight": {
|
|
@@ -115,7 +115,7 @@ export class CatTab {
|
|
|
115
115
|
"text": "Display the icon on the right."
|
|
116
116
|
},
|
|
117
117
|
"attribute": "icon-right",
|
|
118
|
-
"reflect":
|
|
118
|
+
"reflect": true,
|
|
119
119
|
"defaultValue": "false"
|
|
120
120
|
},
|
|
121
121
|
"url": {
|
|
@@ -133,7 +133,7 @@ export class CatTab {
|
|
|
133
133
|
"text": "A destination to link to, rendered in the href attribute of a link."
|
|
134
134
|
},
|
|
135
135
|
"attribute": "url",
|
|
136
|
-
"reflect":
|
|
136
|
+
"reflect": true
|
|
137
137
|
},
|
|
138
138
|
"urlTarget": {
|
|
139
139
|
"type": "string",
|
|
@@ -150,7 +150,7 @@ export class CatTab {
|
|
|
150
150
|
"text": "Specifies where to open the linked document."
|
|
151
151
|
},
|
|
152
152
|
"attribute": "url-target",
|
|
153
|
-
"reflect":
|
|
153
|
+
"reflect": true
|
|
154
154
|
},
|
|
155
155
|
"deactivated": {
|
|
156
156
|
"type": "boolean",
|
|
@@ -167,7 +167,7 @@ export class CatTab {
|
|
|
167
167
|
"text": "Specifies that the tab should be deactivated."
|
|
168
168
|
},
|
|
169
169
|
"attribute": "deactivated",
|
|
170
|
-
"reflect":
|
|
170
|
+
"reflect": true,
|
|
171
171
|
"defaultValue": "false"
|
|
172
172
|
}
|
|
173
173
|
}; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cat-tab.js","sourceRoot":"","sources":["../../../src/components/cat-tab/cat-tab.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAgB,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAG/F,IAAI,YAAY,GAAG,CAAC,CAAC;AAErB;;GAEG;AAMH,MAAM,OAAO,MAAM;EALnB;IAQE;;OAEG;
|
|
1
|
+
{"version":3,"file":"cat-tab.js","sourceRoot":"","sources":["../../../src/components/cat-tab/cat-tab.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAgB,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAG/F,IAAI,YAAY,GAAG,CAAC,CAAC;AAErB;;GAEG;AAMH,MAAM,OAAO,MAAM;EALnB;IAQE;;OAEG;IACsB,UAAK,GAAG,EAAE,CAAC;IAOpC;;OAEG;IACsB,aAAQ,GAAyB,KAAK,CAAC;IAEhE;;OAEG;IACsB,cAAS,GAAG,KAAK,CAAC;IAY3C;;OAEG;IACsB,gBAAW,GAAG,KAAK,CAAC;GAqB9C;EAdC,iBAAiB;IACf,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE;MACxB,IAAI,CAAC,WAAW,CAAC,EAAE,GAAG,WAAW,YAAY,EAAE,EAAE,CAAC;KACnD;EACH,CAAC;EAGD,OAAO,CAAC,KAAiB;IACvB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;EAC5B,CAAC;EAED,MAAM;IACJ,OAAO,EAAC,IAAI,OAAQ,CAAC;EACvB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, Event, EventEmitter, Listen, Host, Element } from '@stencil/core';\nimport { Breakpoint } from '../../utils/breakpoints';\n\nlet nextUniqueId = 0;\n\n/**\n * A single tab inside a tabs component.\n */\n@Component({\n tag: 'cat-tab',\n styleUrl: 'cat-tab.scss',\n shadow: true\n})\nexport class CatTab {\n @Element() hostElement!: HTMLElement;\n\n /**\n * The label of the tab.\n */\n @Prop({ reflect: true }) label = '';\n\n /**\n * The name of an icon to be displayed in the tab.\n */\n @Prop({ reflect: true }) icon?: string;\n\n /**\n * Hide the actual button content and only display the tab.\n */\n @Prop({ reflect: true }) iconOnly: boolean | Breakpoint = false;\n\n /**\n * Display the icon on the right.\n */\n @Prop({ reflect: true }) iconRight = false;\n\n /**\n * A destination to link to, rendered in the href attribute of a link.\n */\n @Prop({ reflect: true }) url?: string;\n\n /**\n * Specifies where to open the linked document.\n */\n @Prop({ reflect: true }) urlTarget?: '_blank' | '_self';\n\n /**\n * Specifies that the tab should be deactivated.\n */\n @Prop({ reflect: true }) deactivated = false;\n\n /**\n * Emitted when tab is clicked.\n */\n @Event() tabClick!: EventEmitter<MouseEvent>;\n\n connectedCallback() {\n if (!this.hostElement.id) {\n this.hostElement.id = `cat-tab-${nextUniqueId++}`;\n }\n }\n\n @Listen('click')\n onClick(event: MouseEvent) {\n this.tabClick.emit(event);\n }\n\n render() {\n return <Host></Host>;\n }\n}\n"]}
|
|
@@ -7,8 +7,8 @@ import { Component, h, Element, State, Watch, Listen, Host, Prop } from '@stenci
|
|
|
7
7
|
*/
|
|
8
8
|
export class CatTabs {
|
|
9
9
|
constructor() {
|
|
10
|
-
this.tabs = [];
|
|
11
10
|
this.buttons = [];
|
|
11
|
+
this.tabs = [];
|
|
12
12
|
/**
|
|
13
13
|
* The ID of the active tab.
|
|
14
14
|
*/
|
|
@@ -23,11 +23,24 @@ export class CatTabs {
|
|
|
23
23
|
activeTab === null || activeTab === void 0 ? void 0 : activeTab.click();
|
|
24
24
|
}
|
|
25
25
|
componentWillLoad() {
|
|
26
|
-
this.
|
|
26
|
+
this.syncTabs();
|
|
27
27
|
if (this.tabs.length) {
|
|
28
28
|
this.activeTabId = this.activeTab;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
+
componentDidLoad() {
|
|
32
|
+
var _a;
|
|
33
|
+
this.mutationObserver = new MutationObserver(mutations => mutations.some(value => value.target.nodeName === 'CAT-TAB') && this.syncTabs());
|
|
34
|
+
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.hostElement, {
|
|
35
|
+
childList: true,
|
|
36
|
+
attributes: true,
|
|
37
|
+
subtree: true
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
disconnectedCallback() {
|
|
41
|
+
var _a;
|
|
42
|
+
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
43
|
+
}
|
|
31
44
|
onKeydown(event) {
|
|
32
45
|
var _a;
|
|
33
46
|
if (['ArrowDown', 'ArrowUp', 'ArrowRight', 'ArrowLeft'].includes(event.key)) {
|
|
@@ -57,6 +70,9 @@ export class CatTabs {
|
|
|
57
70
|
this.buttons.push(button);
|
|
58
71
|
}
|
|
59
72
|
}
|
|
73
|
+
syncTabs() {
|
|
74
|
+
this.tabs = Array.from(this.hostElement.querySelectorAll('cat-tab'));
|
|
75
|
+
}
|
|
60
76
|
static get is() { return "cat-tabs"; }
|
|
61
77
|
static get encapsulation() { return "shadow"; }
|
|
62
78
|
static get originalStyleUrls() { return {
|
|
@@ -104,6 +120,7 @@ export class CatTabs {
|
|
|
104
120
|
}
|
|
105
121
|
}; }
|
|
106
122
|
static get states() { return {
|
|
123
|
+
"tabs": {},
|
|
107
124
|
"activeTabId": {}
|
|
108
125
|
}; }
|
|
109
126
|
static get elementRef() { return "hostElement"; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cat-tabs.js","sourceRoot":"","sources":["../../../src/components/cat-tabs/cat-tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAExF;;;;;GAKG;AAMH,MAAM,OAAO,OAAO;EALpB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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Element, State, Watch, Listen, Host, Prop } from '@stencil/core';\n\n/**\n * Tabs are used to display multiple panels to be contained within a single\n * window, using tabs as a navigational element.\n *\n * @part tab - The header of the tab.\n */\n@Component({\n tag: 'cat-tabs',\n styleUrl: 'cat-tabs.scss',\n shadow: true\n})\nexport class CatTabs {\n private buttons: HTMLCatButtonElement[] = [];\n private mutationObserver?: MutationObserver;\n\n @Element() hostElement!: HTMLElement;\n\n @State() tabs: HTMLCatTabElement[] = [];\n\n @State() activeTabId?: string;\n\n /**\n * The ID of the active tab.\n */\n @Prop() activeTab = '';\n\n /**\n * The alignment of the tabs.\n */\n @Prop() tabsAlign: 'left' | 'center' | 'right' | 'justify' = 'left';\n\n @Watch('activeTabId')\n onActiveTabChanged(newActiveTab: string): void {\n const activeTab = this.tabs.find(value => value.id === newActiveTab);\n activeTab?.click();\n }\n\n componentWillLoad(): void {\n this.syncTabs();\n if (this.tabs.length) {\n this.activeTabId = this.activeTab;\n }\n }\n\n componentDidLoad() {\n this.mutationObserver = new MutationObserver(\n mutations => mutations.some(value => value.target.nodeName === 'CAT-TAB') && this.syncTabs()\n );\n\n this.mutationObserver?.observe(this.hostElement, {\n childList: true,\n attributes: true,\n subtree: true\n });\n }\n\n disconnectedCallback() {\n this.mutationObserver?.disconnect();\n }\n\n @Listen('keydown')\n onKeydown(event: KeyboardEvent): void {\n if (['ArrowDown', 'ArrowUp', 'ArrowRight', 'ArrowLeft'].includes(event.key)) {\n const targetElements = this.buttons.filter(button => !button.disabled);\n const activeElement = this.hostElement.shadowRoot?.activeElement as HTMLCatButtonElement;\n const activeIdx = activeElement ? targetElements.indexOf(activeElement) : -1;\n const activeOff = ['ArrowDown', 'ArrowRight'].includes(event.key) ? 1 : -1;\n const targetIdx = activeIdx < 0 ? 0 : (activeIdx + activeOff + targetElements.length) % targetElements.length;\n targetElements[targetIdx].setFocus();\n event.preventDefault();\n }\n }\n\n render() {\n return (\n <Host>\n {this.tabs.map((tab: HTMLCatTabElement) => {\n return (\n <cat-button\n ref={el => el && this.updateButtonsRef(el)}\n buttonId={tab.id}\n role=\"tab\"\n part=\"tab\"\n class={{\n tab: true,\n 'tab-active': Boolean(this.activeTabId && tab.id === this.activeTabId)\n }}\n color={this.activeTabId && tab.id === this.activeTabId ? 'primary' : 'secondary'}\n variant=\"text\"\n icon={tab.icon}\n iconOnly={tab.iconOnly}\n iconRight={tab.iconRight}\n url={tab.url}\n disabled={tab.deactivated}\n urlTarget={tab.urlTarget}\n onCatClick={() => (this.activeTabId = tab.id)}\n >\n {tab.label}\n </cat-button>\n );\n })}\n </Host>\n );\n }\n\n private updateButtonsRef(button: HTMLCatButtonElement) {\n const indexOf = this.buttons.indexOf(button);\n\n if (indexOf >= 0) {\n this.buttons[indexOf] = button;\n } else {\n this.buttons.push(button);\n }\n }\n\n private syncTabs() {\n this.tabs = Array.from(this.hostElement.querySelectorAll('cat-tab'));\n }\n}\n"]}
|
|
@@ -11,7 +11,8 @@ export class CatToastDemo {
|
|
|
11
11
|
}
|
|
12
12
|
onClick() {
|
|
13
13
|
const infoOptions = {
|
|
14
|
-
position: 'top-left'
|
|
14
|
+
position: 'top-left',
|
|
15
|
+
type: 'info'
|
|
15
16
|
};
|
|
16
17
|
const errorOptions = {
|
|
17
18
|
position: 'top-center',
|
|
@@ -32,6 +33,16 @@ export class CatToastDemo {
|
|
|
32
33
|
type: 'success',
|
|
33
34
|
content: template.content.firstChild
|
|
34
35
|
};
|
|
36
|
+
const primaryOptions = {
|
|
37
|
+
position: 'bottom-right',
|
|
38
|
+
type: 'primary'
|
|
39
|
+
};
|
|
40
|
+
const secondaryOptions = {
|
|
41
|
+
position: 'bottom-right',
|
|
42
|
+
type: 'secondary'
|
|
43
|
+
};
|
|
44
|
+
NotificationsService.secondary('Secondary Click', 'secondary info', secondaryOptions);
|
|
45
|
+
NotificationsService.primary('primary Click', 'secondary info', primaryOptions);
|
|
35
46
|
NotificationsService.error('Default Click');
|
|
36
47
|
NotificationsService.error('Long default title, long default title, long default title, long default title');
|
|
37
48
|
NotificationsService.info('Info Click', 'Info message', infoOptions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cat-toast-demo.js","sourceRoot":"","sources":["../../../src/components/cat-toast-demo/cat-toast-demo.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAgB,MAAM,sCAAsC,CAAC;AAE1F;;;;GAIG;AAKH,MAAM,OAAO,YAAY;EACvB,MAAM;IACJ,OAAO,kBAAY,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,yBAAiC,CAAC;EACvF,CAAC;EAEO,OAAO;IACb,MAAM,WAAW,GAA0B;MACzC,QAAQ,EAAE,UAAU;
|
|
1
|
+
{"version":3,"file":"cat-toast-demo.js","sourceRoot":"","sources":["../../../src/components/cat-toast-demo/cat-toast-demo.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAgB,MAAM,sCAAsC,CAAC;AAE1F;;;;GAIG;AAKH,MAAM,OAAO,YAAY;EACvB,MAAM;IACJ,OAAO,kBAAY,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,yBAAiC,CAAC;EACvF,CAAC;EAEO,OAAO;IACb,MAAM,WAAW,GAA0B;MACzC,QAAQ,EAAE,UAAU;MACpB,IAAI,EAAE,MAAM;KACb,CAAC;IACF,MAAM,YAAY,GAA0B;MAC1C,QAAQ,EAAE,YAAY;MACtB,IAAI,EAAE,OAAO;KACd,CAAC;IACF,MAAM,aAAa,GAA0B;MAC3C,QAAQ,EAAE,aAAa;MACvB,IAAI,EAAE,OAAO;KACd,CAAC;IACF,MAAM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ification/cat-notification';\n\n/**\n * Toast Component Demo\n *\n * @part toast - The content of the toast.\n */\n@Component({\n tag: 'cat-toast-demo',\n styleUrl: 'cat-toast-demo.scss'\n})\nexport class CatToastDemo {\n render() {\n return <cat-button onClick={this.onClick.bind(this)}>Show Notifications</cat-button>;\n }\n\n private onClick() {\n const infoOptions: Partial<ToastOptions> = {\n position: 'top-left',\n type: 'info'\n };\n const errorOptions: Partial<ToastOptions> = {\n position: 'top-center',\n type: 'error'\n };\n const errorOptions2: Partial<ToastOptions> = {\n position: 'bottom-left',\n type: 'error'\n };\n const successOptions3: Partial<ToastOptions> = {\n position: 'bottom-right',\n type: 'success'\n };\n const template = document.createElement('template');\n template.innerHTML = `<div style=\"padding: 7px 30px 7px 10px\">Custom HTML Node Content</div>`;\n const successOptions4: Partial<ToastOptions> = {\n position: 'bottom-right',\n type: 'success',\n content: template.content.firstChild as HTMLElement\n };\n const primaryOptions: Partial<ToastOptions> = {\n position: 'bottom-right',\n type: 'primary'\n };\n\n const secondaryOptions: Partial<ToastOptions> = {\n position: 'bottom-right',\n type: 'secondary'\n };\n\n NotificationsService.secondary('Secondary Click', 'secondary info', secondaryOptions);\n NotificationsService.primary('primary Click', 'secondary info', primaryOptions);\n NotificationsService.error('Default Click');\n NotificationsService.error('Long default title, long default title, long default title, long default title');\n NotificationsService.info('Info Click', 'Info message', infoOptions);\n NotificationsService.success('', ' ', successOptions4);\n NotificationsService.error('Error Title', ' ', errorOptions);\n NotificationsService.error(\n 'Error 2 Title',\n 'Very long message, Very long message, Very long message, Very long message, Very long message, Very long message, Very long message, Very long message, Very long message, Very long message,Very long message, Very long message, Very long message, Very long message, Very long message, ',\n errorOptions2\n );\n NotificationsService.success('Success Title - very long title without message', ' ', successOptions3);\n }\n}\n"]}
|