@haiilo/catalyst 14.4.0 → 14.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/catalyst.css +15 -4
- package/dist/catalyst/catalyst.esm.js +1 -1
- package/dist/catalyst/{p-CFGROHMy.js → p-7uZgmxXB.js} +2 -2
- package/dist/catalyst/p-7uZgmxXB.js.map +1 -0
- package/dist/catalyst/p-fb92a2f1.entry.js +10 -0
- package/dist/catalyst/p-fb92a2f1.entry.js.map +1 -0
- package/dist/catalyst/scss/core/_nav.scss +2 -1
- package/dist/catalyst/scss/core/sanitize-overwrite.scss +3 -0
- package/dist/catalyst/scss/index.scss +1 -0
- package/dist/cjs/{cat-alert_30.cjs.entry.js → cat-alert_32.cjs.entry.js} +346 -103
- package/dist/cjs/catalyst.cjs.js +2 -2
- package/dist/cjs/{index-B8-TCsLD.js → index-Ddad39qn.js} +7 -4
- package/dist/cjs/index-Ddad39qn.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +3 -1
- package/dist/collection/components/cat-alert/cat-alert.js +1 -1
- package/dist/collection/components/cat-badge/cat-badge.js +1 -1
- package/dist/collection/components/cat-button/cat-button.css +9 -2
- package/dist/collection/components/cat-button/cat-button.js +26 -1
- package/dist/collection/components/cat-button/cat-button.js.map +1 -1
- package/dist/collection/components/cat-button-group/cat-button-group.js +1 -1
- package/dist/collection/components/cat-card/cat-card.js +1 -1
- package/dist/collection/components/cat-checkbox/cat-checkbox.js +2 -2
- package/dist/collection/components/cat-date/cat-date.js +2 -2
- package/dist/collection/components/cat-date-inline/cat-date-inline.js +4 -4
- package/dist/collection/components/cat-datepicker/cat-datepicker.js +3 -3
- package/dist/collection/components/cat-datepicker-inline/cat-datepicker-inline.js +2 -2
- package/dist/collection/components/cat-dropdown/cat-dropdown.js +116 -47
- package/dist/collection/components/cat-dropdown/cat-dropdown.js.map +1 -1
- package/dist/collection/components/cat-menu/cat-menu.css +9 -0
- package/dist/collection/components/cat-menu/cat-menu.js +652 -0
- package/dist/collection/components/cat-menu/cat-menu.js.map +1 -0
- package/dist/collection/components/cat-menu-item/cat-menu-item.js +387 -0
- package/dist/collection/components/cat-menu-item/cat-menu-item.js.map +1 -0
- package/dist/collection/components/cat-pagination/cat-pagination.js +2 -2
- package/dist/collection/components/cat-radio/cat-radio.js +2 -2
- package/dist/collection/components/cat-radio-group/cat-radio-group.js +1 -1
- package/dist/collection/components/cat-scrollable/cat-scrollable.js +3 -3
- package/dist/collection/components/cat-select/cat-select.js +14 -18
- package/dist/collection/components/cat-select/cat-select.js.map +1 -1
- package/dist/collection/components/cat-select-demo/cat-select-demo.js +1 -1
- package/dist/collection/components/cat-skeleton/cat-skeleton.js +1 -1
- package/dist/collection/components/cat-spinner/cat-spinner.js +2 -2
- package/dist/collection/components/cat-tab/cat-tab.js +1 -1
- package/dist/collection/components/cat-tabs/cat-tabs.js +1 -1
- package/dist/collection/components/cat-tag/cat-tag.js +1 -1
- package/dist/collection/components/cat-textarea/cat-textarea.js +3 -3
- package/dist/collection/components/cat-time/cat-time.css +0 -9
- package/dist/collection/components/cat-time/cat-time.js +4 -5
- package/dist/collection/components/cat-time/cat-time.js.map +1 -1
- package/dist/collection/components/cat-toggle/cat-toggle.js +2 -2
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/scss/core/_nav.scss +2 -1
- package/dist/collection/scss/core/sanitize-overwrite.scss +3 -0
- package/dist/collection/scss/index.scss +1 -0
- package/dist/components/cat-alert.js +1 -1
- package/dist/components/cat-badge.js +1 -1
- package/dist/components/cat-button-group.js +1 -1
- package/dist/components/cat-button2.js +8 -2
- package/dist/components/cat-button2.js.map +1 -1
- package/dist/components/cat-card.js +1 -1
- package/dist/components/cat-checkbox2.js +2 -2
- package/dist/components/cat-date-inline2.js +4 -4
- package/dist/components/cat-date.js +2 -2
- package/dist/components/cat-datepicker-inline.js +2 -2
- package/dist/components/cat-datepicker.js +3 -3
- package/dist/components/cat-dropdown2.js +69 -44
- package/dist/components/cat-dropdown2.js.map +1 -1
- package/dist/components/cat-menu-item.d.ts +11 -0
- package/dist/components/cat-menu-item.js +9 -0
- package/dist/components/cat-menu-item.js.map +1 -0
- package/dist/components/cat-menu-item2.js +111 -0
- package/dist/components/cat-menu-item2.js.map +1 -0
- package/dist/components/cat-menu.d.ts +11 -0
- package/dist/components/cat-menu.js +9 -0
- package/dist/components/cat-menu.js.map +1 -0
- package/dist/components/cat-menu2.js +227 -0
- package/dist/components/cat-menu2.js.map +1 -0
- package/dist/components/cat-pagination.js +2 -2
- package/dist/components/cat-radio-group.js +1 -1
- package/dist/components/cat-radio.js +2 -2
- package/dist/components/cat-scrollable2.js +3 -3
- package/dist/components/cat-select-demo.js +1 -1
- package/dist/components/cat-select2.js +5 -5
- package/dist/components/cat-select2.js.map +1 -1
- package/dist/components/cat-skeleton2.js +1 -1
- package/dist/components/cat-spinner2.js +2 -2
- package/dist/components/cat-tab.js +1 -1
- package/dist/components/cat-tabs.js +1 -1
- package/dist/components/cat-tag.js +1 -1
- package/dist/components/cat-textarea.js +3 -3
- package/dist/components/cat-time.js +25 -14
- package/dist/components/cat-time.js.map +1 -1
- package/dist/components/cat-toggle.js +2 -2
- package/dist/esm/{cat-alert_30.entry.js → cat-alert_32.entry.js} +345 -104
- package/dist/esm/catalyst.js +3 -3
- package/dist/esm/{index-CFGROHMy.js → index-7uZgmxXB.js} +7 -4
- package/dist/esm/index-7uZgmxXB.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/types/components/cat-button/cat-button.d.ts +4 -0
- package/dist/types/components/cat-dropdown/cat-dropdown.d.ts +14 -2
- package/dist/types/components/cat-menu/cat-menu.d.ts +124 -0
- package/dist/types/components/cat-menu-item/cat-menu-item.d.ts +80 -0
- package/dist/types/components/cat-select/cat-select.d.ts +3 -2
- package/dist/types/components.d.ts +426 -7
- package/dist/types/index.d.ts +2 -1
- package/package.json +2 -2
- package/dist/catalyst/p-76436f4e.entry.js +0 -10
- package/dist/catalyst/p-76436f4e.entry.js.map +0 -1
- package/dist/catalyst/p-CFGROHMy.js.map +0 -1
- package/dist/cjs/index-B8-TCsLD.js.map +0 -1
- package/dist/esm/index-CFGROHMy.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cat-menu.js","sourceRoot":"","sources":["../../../src/components/cat-menu/cat-menu.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAGvG;;;;;;GAMG;AAMH,MAAM,OAAO,OAAO;IALpB;QAOU,iBAAY,GAA6B,EAAE,CAAC;QAKpD;;WAEG;QACK,cAAS,GAAc,cAAc,CAAC;QAE9C;;WAEG;QACK,oBAAe,GAA8B,UAAU,CAAC;QAEhE;;WAEG;QACK,mBAAc,GAAmC,MAAM,CAAC;QAEhE;;WAEG;QACK,gBAAW,GAAkC,GAAG,CAAC;QAiBzD;;WAEG;QACK,iBAAY,GAAwE,WAAW,CAAC;QAsBxG;;WAEG;QACK,aAAQ,GAAG,KAAK,CAAC;QAEzB;;;;WAIG;QACK,YAAO,GAAG,KAAK,CAAC;QAExB;;;WAGG;QACK,aAAQ,GAAG,KAAK,CAAC;QAEzB;;WAEG;QACK,aAAQ,GAAG,KAAK,CAAC;QAEzB;;;WAGG;QACK,uBAAkB,GAAG,KAAK,CAAC;QA8G3B,mBAAc,GAAG,CAAC,KAA8B,EAAE,EAAE;YAC1D,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC1C,CAAC,CAAC;QAEM,eAAU,GAAG,CAAC,KAA8B,EAAE,EAAE;YACtD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAChC,4DAA4D;YAC5D,qBAAqB,CAAC,G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,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Placement } from '@floating-ui/dom';\nimport { Component, Element, Event, EventEmitter, h, Host, Listen, Method, Prop } from '@stencil/core';\nimport { Breakpoint } from '../../utils/breakpoints';\n\n/**\n * A menu component that provides a dropdown with a built-in configurable trigger button\n * and proper ARIA semantics and keyboard navigation for menu items.\n *\n * The trigger is always a cat-button with sensible defaults but fully configurable\n * through trigger-specific props.\n */\n@Component({\n tag: 'cat-menu',\n styleUrl: 'cat-menu.scss',\n shadow: true\n})\nexport class CatMenu {\n private dropdown?: HTMLCatDropdownElement;\n private catMenuItems: HTMLCatMenuItemElement[] = [];\n private mutationObserver?: MutationObserver;\n\n @Element() hostElement!: HTMLElement;\n\n /**\n * The placement of the dropdown.\n */\n @Prop() placement: Placement = 'bottom-start';\n\n /**\n * The arrow key navigation direction for menu items.\n */\n @Prop() arrowNavigation: 'horizontal' | 'vertical' = 'vertical';\n\n /**\n * The trigger button variant.\n */\n @Prop() triggerVariant: 'filled' | 'outlined' | 'text' = 'text';\n\n /**\n * The trigger button size.\n */\n @Prop() triggerSize: 'xs' | 's' | 'm' | 'l' | 'xl' = 'm';\n\n /**\n * The trigger button icon.\n */\n @Prop() triggerIcon?: string;\n\n /**\n * Show only the icon in the trigger button.\n */\n @Prop() triggerIconOnly?: boolean | Breakpoint;\n\n /**\n * The trigger button label.\n */\n @Prop() triggerLabel?: string;\n\n /**\n * The color palette of the trigger button.\n */\n @Prop() triggerColor: 'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'danger' = 'secondary';\n\n /**\n * The trigger button accessibility label. If not set, falls back to triggerLabel.\n */\n @Prop() triggerA11yLabel?: string;\n\n /**\n * Additional CSS class for the trigger button.\n */\n @Prop() triggerClass?: string;\n\n /**\n * Test ID for the trigger button.\n */\n @Prop() triggerTestId?: string;\n\n /**\n * Native attributes for the trigger button.\n */\n @Prop() triggerNativeAttributes?: { [key: string]: string };\n\n /**\n * Disable the menu.\n */\n @Prop() disabled = false;\n\n /**\n * Make the dropdown match the width of the reference regardless of its\n * contents. Note that this only applies to the minimum width of the\n * dropdown. The maximum width is still limited by the viewport.\n */\n @Prop() justify = false;\n\n /**\n * Do not change the size of the dropdown to ensure it isn’t too big to fit\n * in the viewport (or more specifically, its clipping context).\n */\n @Prop() noResize = false;\n\n /**\n * Allow overflow when dropdown is open.\n */\n @Prop() overflow = false;\n\n /**\n * Whether the dropdown trigger should be initialized only before first opening.\n * Can be useful when trigger is rendered dynamically.\n */\n @Prop() delayedTriggerInit = false;\n\n /**\n * Emitted when the dropdown is opened.\n */\n @Event() catOpen!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the dropdown is closed.\n */\n @Event() catClose!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the trigger button is clicked.\n */\n @Event() catTriggerClick!: EventEmitter<MouseEvent>;\n\n @Listen('focusout')\n onFocusOut(): void {\n if (!this.dropdown?.isOpen) {\n return;\n }\n\n requestAnimationFrame(() => {\n if (!this.isMenuItemInFocus()) {\n this.dropdown?.close(false);\n }\n });\n }\n\n private getDeepActiveElement(): Element | null {\n let active = document.activeElement;\n while (active?.shadowRoot?.activeElement && active.nodeName !== 'CAT-MENU-ITEM') {\n active = active.shadowRoot.activeElement;\n }\n return active;\n }\n\n @Listen('keydown', { target: 'document' })\n onDocumentKeydown(event: KeyboardEvent): void {\n const navigationKeys =\n this.arrowNavigation === 'horizontal'\n ? ['ArrowRight', 'ArrowLeft', 'Home', 'End']\n : ['ArrowDown', 'ArrowUp', 'Home', 'End'];\n\n if (!this.dropdown?.isOpen || !navigationKeys.includes(event.key)) {\n return;\n }\n\n const targetElements = this.catMenuItems.filter(item => !item.disabled);\n if (!targetElements.length) {\n return;\n }\n const activeIdx = targetElements.findIndex(item => this.getDeepActiveElement() === item);\n\n let targetIdx: number;\n if (event.key === 'Home') {\n targetIdx = 0;\n } else if (event.key === 'End') {\n targetIdx = targetElements.length - 1;\n } else {\n const forwardKey = this.arrowNavigation === 'horizontal' ? 'ArrowRight' : 'ArrowDown';\n const activeOff = event.key === forwardKey ? 1 : -1;\n targetIdx = activeIdx < 0 ? 0 : (activeIdx + activeOff + targetElements.length) % targetElements.length;\n }\n\n targetElements[targetIdx].doFocus();\n event.preventDefault();\n }\n\n componentDidLoad(): void {\n this.syncMenuItems();\n this.mutationObserver = new MutationObserver(\n mutations => mutations.some(value => value.target.nodeName === 'CAT-MENU-ITEM') && this.syncMenuItems()\n );\n this.mutationObserver?.observe(this.hostElement, {\n childList: true,\n attributes: true,\n subtree: true\n });\n }\n\n disconnectedCallback(): void {\n this.mutationObserver?.disconnect();\n }\n\n /**\n * Opens the menu.\n */\n @Method()\n async open(): Promise<void> {\n await this.dropdown?.open();\n }\n\n /**\n * Closes the menu.\n */\n @Method()\n async close(): Promise<void> {\n await this.dropdown?.close();\n }\n\n /**\n * Toggles the menu.\n */\n @Method()\n async toggle(): Promise<void> {\n await this.dropdown?.toggle();\n }\n\n private onTriggerClick = (event: CustomEvent<MouseEvent>) => {\n this.catTriggerClick.emit(event.detail);\n };\n\n private onMenuOpen = (event: CustomEvent<FocusEvent>) => {\n this.catOpen.emit(event.detail);\n // Set focus to first non-disabled menu item when menu opens\n requestAnimationFrame(() => {\n if (!this.isMenuItemInFocus()) {\n const firstEnabledItem = this.catMenuItems.find(item => !item.disabled);\n firstEnabledItem?.doFocus();\n }\n });\n };\n\n private isMenuItemInFocus(): boolean {\n const activeElement = this.getDeepActiveElement();\n const isInMenu = activeElement && this.catMenuItems.some(item => activeElement === item);\n\n return !!(activeElement && isInMenu);\n }\n\n private syncMenuItems() {\n this.catMenuItems = Array.from(this.hostElement.querySelectorAll('cat-menu-item'));\n }\n\n render() {\n return (\n <Host>\n <cat-dropdown\n ref={el => (this.dropdown = el)}\n focusTrap={false}\n placement={this.placement}\n justify={this.justify}\n arrowNavigation=\"none\"\n noResize={this.noResize}\n overflow={this.overflow}\n delayedTriggerInit={this.delayedTriggerInit}\n onCatOpen={this.onMenuOpen}\n onCatClose={() => this.catClose.emit()}\n >\n <cat-button\n slot=\"trigger\"\n part=\"trigger\"\n variant={this.triggerVariant}\n size={this.triggerSize}\n icon={this.triggerIcon ?? (this.triggerLabel === undefined ? 'more-horizontal-filled' : undefined)}\n iconOnly={this.triggerIconOnly ?? this.triggerLabel === undefined}\n color={this.triggerColor}\n a11yLabel={this.triggerA11yLabel ?? this.triggerLabel}\n class={this.triggerClass}\n testId={this.triggerTestId}\n nativeAttributes={{\n ...this.triggerNativeAttributes,\n 'aria-haspopup': 'menu'\n }}\n disabled={this.disabled}\n onCatClick={this.onTriggerClick}\n >\n {!this.triggerIconOnly && <slot name=\"trigger-label\">{this.triggerLabel}</slot>}\n </cat-button>\n <nav role=\"menu\" slot=\"content\" class=\"cat-menu-list\" aria-orientation={this.arrowNavigation}>\n <ul>\n <slot></slot>\n </ul>\n </nav>\n </cat-dropdown>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import { h, Host } from "@stencil/core";
|
|
2
|
+
let nextUniqueId = 0;
|
|
3
|
+
/**
|
|
4
|
+
* A menu item component that renders as a button with proper ARIA semantics.
|
|
5
|
+
*/
|
|
6
|
+
export class CatMenuItem {
|
|
7
|
+
constructor() {
|
|
8
|
+
this._id = `cat-menu-item-${++nextUniqueId}`;
|
|
9
|
+
/**
|
|
10
|
+
* Whether the menu item is active.
|
|
11
|
+
*/
|
|
12
|
+
this.active = false;
|
|
13
|
+
/**
|
|
14
|
+
* The variant of the menu item button.
|
|
15
|
+
*/
|
|
16
|
+
this.variant = 'text';
|
|
17
|
+
/**
|
|
18
|
+
* Hide the actual button content and only display the icon.
|
|
19
|
+
*/
|
|
20
|
+
this.iconOnly = false;
|
|
21
|
+
/**
|
|
22
|
+
* Display the icon on the right.
|
|
23
|
+
*/
|
|
24
|
+
this.iconRight = false;
|
|
25
|
+
/**
|
|
26
|
+
* Specifies that the menu item should be disabled.
|
|
27
|
+
*/
|
|
28
|
+
this.disabled = false;
|
|
29
|
+
}
|
|
30
|
+
get id() {
|
|
31
|
+
return this.identifier || this._id;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Programmatically move focus to the menu item.
|
|
35
|
+
*/
|
|
36
|
+
async doFocus(options) {
|
|
37
|
+
this.button?.doFocus(options);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Programmatically remove focus from the menu item.
|
|
41
|
+
*/
|
|
42
|
+
async doBlur() {
|
|
43
|
+
this.button?.doBlur();
|
|
44
|
+
}
|
|
45
|
+
render() {
|
|
46
|
+
return (h(Host, { key: '69db1c5c6d91ea31103639a5fe3cbb96da32aa40' }, h("li", { key: '88569a9541369cf5dbc7f79b562ef5b68c9905a3' }, h("cat-button", { key: '65b6e6c3ca873a07204f36b3cae69dfffbc51a0b', ref: el => (this.button = el), class: "cat-nav-item", buttonId: this.id, part: "menu-item", variant: this.variant, icon: this.icon, iconOnly: this.iconOnly, iconRight: this.iconRight, url: this.url, disabled: this.disabled, urlTarget: this.urlTarget, loading: this.loading, color: this.color, active: this.active, testId: this.testId, nativeAttributes: {
|
|
47
|
+
...this.nativeAttributes,
|
|
48
|
+
role: 'menuitem',
|
|
49
|
+
tabindex: '-1'
|
|
50
|
+
}, onCatClick: this.onCatClick }, h("slot", { key: 'c8036dabc3f0cb762d96bee7797ac50f871ac44d' })))));
|
|
51
|
+
}
|
|
52
|
+
onCatClick(event) {
|
|
53
|
+
this.catClick.emit(event.detail);
|
|
54
|
+
}
|
|
55
|
+
static get is() { return "cat-menu-item"; }
|
|
56
|
+
static get encapsulation() { return "shadow"; }
|
|
57
|
+
static get properties() {
|
|
58
|
+
return {
|
|
59
|
+
"identifier": {
|
|
60
|
+
"type": "string",
|
|
61
|
+
"mutable": false,
|
|
62
|
+
"complexType": {
|
|
63
|
+
"original": "string",
|
|
64
|
+
"resolved": "string | undefined",
|
|
65
|
+
"references": {}
|
|
66
|
+
},
|
|
67
|
+
"required": false,
|
|
68
|
+
"optional": true,
|
|
69
|
+
"docs": {
|
|
70
|
+
"tags": [],
|
|
71
|
+
"text": "A unique identifier for the menu item."
|
|
72
|
+
},
|
|
73
|
+
"getter": false,
|
|
74
|
+
"setter": false,
|
|
75
|
+
"reflect": false,
|
|
76
|
+
"attribute": "identifier"
|
|
77
|
+
},
|
|
78
|
+
"icon": {
|
|
79
|
+
"type": "string",
|
|
80
|
+
"mutable": false,
|
|
81
|
+
"complexType": {
|
|
82
|
+
"original": "string",
|
|
83
|
+
"resolved": "string | undefined",
|
|
84
|
+
"references": {}
|
|
85
|
+
},
|
|
86
|
+
"required": false,
|
|
87
|
+
"optional": true,
|
|
88
|
+
"docs": {
|
|
89
|
+
"tags": [],
|
|
90
|
+
"text": "The name of an icon to be displayed in the menu item."
|
|
91
|
+
},
|
|
92
|
+
"getter": false,
|
|
93
|
+
"setter": false,
|
|
94
|
+
"reflect": false,
|
|
95
|
+
"attribute": "icon"
|
|
96
|
+
},
|
|
97
|
+
"color": {
|
|
98
|
+
"type": "string",
|
|
99
|
+
"mutable": false,
|
|
100
|
+
"complexType": {
|
|
101
|
+
"original": "'primary' | 'secondary' | 'danger' | 'warning' | 'success' | 'info'",
|
|
102
|
+
"resolved": "\"danger\" | \"info\" | \"primary\" | \"secondary\" | \"success\" | \"warning\" | undefined",
|
|
103
|
+
"references": {}
|
|
104
|
+
},
|
|
105
|
+
"required": false,
|
|
106
|
+
"optional": true,
|
|
107
|
+
"docs": {
|
|
108
|
+
"tags": [],
|
|
109
|
+
"text": "The color of the menu item."
|
|
110
|
+
},
|
|
111
|
+
"getter": false,
|
|
112
|
+
"setter": false,
|
|
113
|
+
"reflect": false,
|
|
114
|
+
"attribute": "color"
|
|
115
|
+
},
|
|
116
|
+
"active": {
|
|
117
|
+
"type": "boolean",
|
|
118
|
+
"mutable": false,
|
|
119
|
+
"complexType": {
|
|
120
|
+
"original": "boolean",
|
|
121
|
+
"resolved": "boolean",
|
|
122
|
+
"references": {}
|
|
123
|
+
},
|
|
124
|
+
"required": false,
|
|
125
|
+
"optional": false,
|
|
126
|
+
"docs": {
|
|
127
|
+
"tags": [],
|
|
128
|
+
"text": "Whether the menu item is active."
|
|
129
|
+
},
|
|
130
|
+
"getter": false,
|
|
131
|
+
"setter": false,
|
|
132
|
+
"reflect": false,
|
|
133
|
+
"attribute": "active",
|
|
134
|
+
"defaultValue": "false"
|
|
135
|
+
},
|
|
136
|
+
"variant": {
|
|
137
|
+
"type": "string",
|
|
138
|
+
"mutable": false,
|
|
139
|
+
"complexType": {
|
|
140
|
+
"original": "'filled' | 'outlined' | 'text'",
|
|
141
|
+
"resolved": "\"filled\" | \"outlined\" | \"text\"",
|
|
142
|
+
"references": {}
|
|
143
|
+
},
|
|
144
|
+
"required": false,
|
|
145
|
+
"optional": false,
|
|
146
|
+
"docs": {
|
|
147
|
+
"tags": [],
|
|
148
|
+
"text": "The variant of the menu item button."
|
|
149
|
+
},
|
|
150
|
+
"getter": false,
|
|
151
|
+
"setter": false,
|
|
152
|
+
"reflect": false,
|
|
153
|
+
"attribute": "variant",
|
|
154
|
+
"defaultValue": "'text'"
|
|
155
|
+
},
|
|
156
|
+
"loading": {
|
|
157
|
+
"type": "boolean",
|
|
158
|
+
"mutable": false,
|
|
159
|
+
"complexType": {
|
|
160
|
+
"original": "boolean",
|
|
161
|
+
"resolved": "boolean | undefined",
|
|
162
|
+
"references": {}
|
|
163
|
+
},
|
|
164
|
+
"required": false,
|
|
165
|
+
"optional": true,
|
|
166
|
+
"docs": {
|
|
167
|
+
"tags": [],
|
|
168
|
+
"text": "The loading state of the menu item."
|
|
169
|
+
},
|
|
170
|
+
"getter": false,
|
|
171
|
+
"setter": false,
|
|
172
|
+
"reflect": false,
|
|
173
|
+
"attribute": "loading"
|
|
174
|
+
},
|
|
175
|
+
"iconOnly": {
|
|
176
|
+
"type": "any",
|
|
177
|
+
"mutable": false,
|
|
178
|
+
"complexType": {
|
|
179
|
+
"original": "boolean | Breakpoint",
|
|
180
|
+
"resolved": "\"l\" | \"m\" | \"s\" | \"xl\" | \"xs\" | boolean",
|
|
181
|
+
"references": {
|
|
182
|
+
"Breakpoint": {
|
|
183
|
+
"location": "import",
|
|
184
|
+
"path": "../../utils/breakpoints",
|
|
185
|
+
"id": "src/utils/breakpoints.ts::Breakpoint"
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
"required": false,
|
|
190
|
+
"optional": false,
|
|
191
|
+
"docs": {
|
|
192
|
+
"tags": [],
|
|
193
|
+
"text": "Hide the actual button content and only display the icon."
|
|
194
|
+
},
|
|
195
|
+
"getter": false,
|
|
196
|
+
"setter": false,
|
|
197
|
+
"reflect": false,
|
|
198
|
+
"attribute": "icon-only",
|
|
199
|
+
"defaultValue": "false"
|
|
200
|
+
},
|
|
201
|
+
"iconRight": {
|
|
202
|
+
"type": "boolean",
|
|
203
|
+
"mutable": false,
|
|
204
|
+
"complexType": {
|
|
205
|
+
"original": "boolean",
|
|
206
|
+
"resolved": "boolean",
|
|
207
|
+
"references": {}
|
|
208
|
+
},
|
|
209
|
+
"required": false,
|
|
210
|
+
"optional": false,
|
|
211
|
+
"docs": {
|
|
212
|
+
"tags": [],
|
|
213
|
+
"text": "Display the icon on the right."
|
|
214
|
+
},
|
|
215
|
+
"getter": false,
|
|
216
|
+
"setter": false,
|
|
217
|
+
"reflect": false,
|
|
218
|
+
"attribute": "icon-right",
|
|
219
|
+
"defaultValue": "false"
|
|
220
|
+
},
|
|
221
|
+
"url": {
|
|
222
|
+
"type": "string",
|
|
223
|
+
"mutable": false,
|
|
224
|
+
"complexType": {
|
|
225
|
+
"original": "string",
|
|
226
|
+
"resolved": "string | undefined",
|
|
227
|
+
"references": {}
|
|
228
|
+
},
|
|
229
|
+
"required": false,
|
|
230
|
+
"optional": true,
|
|
231
|
+
"docs": {
|
|
232
|
+
"tags": [],
|
|
233
|
+
"text": "A destination to link to, rendered in the href attribute of a link."
|
|
234
|
+
},
|
|
235
|
+
"getter": false,
|
|
236
|
+
"setter": false,
|
|
237
|
+
"reflect": false,
|
|
238
|
+
"attribute": "url"
|
|
239
|
+
},
|
|
240
|
+
"urlTarget": {
|
|
241
|
+
"type": "string",
|
|
242
|
+
"mutable": false,
|
|
243
|
+
"complexType": {
|
|
244
|
+
"original": "'_blank' | '_self'",
|
|
245
|
+
"resolved": "\"_blank\" | \"_self\" | undefined",
|
|
246
|
+
"references": {}
|
|
247
|
+
},
|
|
248
|
+
"required": false,
|
|
249
|
+
"optional": true,
|
|
250
|
+
"docs": {
|
|
251
|
+
"tags": [],
|
|
252
|
+
"text": "Specifies where to open the linked document."
|
|
253
|
+
},
|
|
254
|
+
"getter": false,
|
|
255
|
+
"setter": false,
|
|
256
|
+
"reflect": false,
|
|
257
|
+
"attribute": "url-target"
|
|
258
|
+
},
|
|
259
|
+
"disabled": {
|
|
260
|
+
"type": "boolean",
|
|
261
|
+
"mutable": false,
|
|
262
|
+
"complexType": {
|
|
263
|
+
"original": "boolean",
|
|
264
|
+
"resolved": "boolean",
|
|
265
|
+
"references": {}
|
|
266
|
+
},
|
|
267
|
+
"required": false,
|
|
268
|
+
"optional": false,
|
|
269
|
+
"docs": {
|
|
270
|
+
"tags": [],
|
|
271
|
+
"text": "Specifies that the menu item should be disabled."
|
|
272
|
+
},
|
|
273
|
+
"getter": false,
|
|
274
|
+
"setter": false,
|
|
275
|
+
"reflect": false,
|
|
276
|
+
"attribute": "disabled",
|
|
277
|
+
"defaultValue": "false"
|
|
278
|
+
},
|
|
279
|
+
"nativeAttributes": {
|
|
280
|
+
"type": "unknown",
|
|
281
|
+
"mutable": false,
|
|
282
|
+
"complexType": {
|
|
283
|
+
"original": "{ [key: string]: string }",
|
|
284
|
+
"resolved": "undefined | { [key: string]: string; }",
|
|
285
|
+
"references": {}
|
|
286
|
+
},
|
|
287
|
+
"required": false,
|
|
288
|
+
"optional": true,
|
|
289
|
+
"docs": {
|
|
290
|
+
"tags": [],
|
|
291
|
+
"text": "Attributes that will be added to the native HTML button element"
|
|
292
|
+
},
|
|
293
|
+
"getter": false,
|
|
294
|
+
"setter": false
|
|
295
|
+
},
|
|
296
|
+
"testId": {
|
|
297
|
+
"type": "string",
|
|
298
|
+
"mutable": false,
|
|
299
|
+
"complexType": {
|
|
300
|
+
"original": "string",
|
|
301
|
+
"resolved": "string | undefined",
|
|
302
|
+
"references": {}
|
|
303
|
+
},
|
|
304
|
+
"required": false,
|
|
305
|
+
"optional": true,
|
|
306
|
+
"docs": {
|
|
307
|
+
"tags": [],
|
|
308
|
+
"text": "A unique identifier for the underlying native element that is used for\ntesting purposes. The attribute is added as `data-test` attribute and acts\nas a shorthand for `nativeAttributes={ 'data-test': 'test-Id' }`."
|
|
309
|
+
},
|
|
310
|
+
"getter": false,
|
|
311
|
+
"setter": false,
|
|
312
|
+
"reflect": false,
|
|
313
|
+
"attribute": "test-id"
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
static get events() {
|
|
318
|
+
return [{
|
|
319
|
+
"method": "catClick",
|
|
320
|
+
"name": "catClick",
|
|
321
|
+
"bubbles": true,
|
|
322
|
+
"cancelable": true,
|
|
323
|
+
"composed": true,
|
|
324
|
+
"docs": {
|
|
325
|
+
"tags": [],
|
|
326
|
+
"text": "Emitted when the trigger button is clicked."
|
|
327
|
+
},
|
|
328
|
+
"complexType": {
|
|
329
|
+
"original": "MouseEvent",
|
|
330
|
+
"resolved": "MouseEvent",
|
|
331
|
+
"references": {
|
|
332
|
+
"MouseEvent": {
|
|
333
|
+
"location": "global",
|
|
334
|
+
"id": "global::MouseEvent"
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}];
|
|
339
|
+
}
|
|
340
|
+
static get methods() {
|
|
341
|
+
return {
|
|
342
|
+
"doFocus": {
|
|
343
|
+
"complexType": {
|
|
344
|
+
"signature": "(options?: FocusOptions) => Promise<void>",
|
|
345
|
+
"parameters": [{
|
|
346
|
+
"name": "options",
|
|
347
|
+
"type": "FocusOptions | undefined",
|
|
348
|
+
"docs": ""
|
|
349
|
+
}],
|
|
350
|
+
"references": {
|
|
351
|
+
"Promise": {
|
|
352
|
+
"location": "global",
|
|
353
|
+
"id": "global::Promise"
|
|
354
|
+
},
|
|
355
|
+
"FocusOptions": {
|
|
356
|
+
"location": "global",
|
|
357
|
+
"id": "global::FocusOptions"
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
"return": "Promise<void>"
|
|
361
|
+
},
|
|
362
|
+
"docs": {
|
|
363
|
+
"text": "Programmatically move focus to the menu item.",
|
|
364
|
+
"tags": []
|
|
365
|
+
}
|
|
366
|
+
},
|
|
367
|
+
"doBlur": {
|
|
368
|
+
"complexType": {
|
|
369
|
+
"signature": "() => Promise<void>",
|
|
370
|
+
"parameters": [],
|
|
371
|
+
"references": {
|
|
372
|
+
"Promise": {
|
|
373
|
+
"location": "global",
|
|
374
|
+
"id": "global::Promise"
|
|
375
|
+
}
|
|
376
|
+
},
|
|
377
|
+
"return": "Promise<void>"
|
|
378
|
+
},
|
|
379
|
+
"docs": {
|
|
380
|
+
"text": "Programmatically remove focus from the menu item.",
|
|
381
|
+
"tags": []
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
//# sourceMappingURL=cat-menu-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cat-menu-item.js","sourceRoot":"","sources":["../../../src/components/cat-menu-item/cat-menu-item.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AAGtF,IAAI,YAAY,GAAG,CAAC,CAAC;AAErB;;GAEG;AAKH,MAAM,OAAO,WAAW;IAJxB;QAKmB,QAAG,GAAG,iBAAiB,EAAE,YAAY,EAAE,CAAC;QAoBzD;;WAEG;QACK,WAAM,GAAG,KAAK,CAAC;QAEvB;;WAEG;QACK,YAAO,GAAmC,MAAM,CAAC;QAOzD;;WAEG;QACK,aAAQ,GAAyB,KAAK,CAAC;QAE/C;;WAEG;QACK,cAAS,GAAG,KAAK,CAAC;QAY1B;;WAEG;QACK,aAAQ,GAAG,KAAK,CAAC;KAwE1B;IAjIC,IAAY,EAAE;QACZ,OAAO,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,GAAG,CAAC;IACrC,CAAC;IA0ED;;OAEG;IAEH,KAAK,CAAC,OAAO,CAAC,OAAsB;QAClC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAED;;OAEG;IAEH,KAAK,CAAC,MAAM;QACV,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;IACxB,CAAC;IAED,MAAM;QACJ,OAAO,CACL,EAAC,IAAI;YACH;gBACE,mEACE,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,EAC7B,KAAK,EAAC,cAAc,EACpB,QAAQ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/breakpoints';\n\nlet nextUniqueId = 0;\n\n/**\n * A menu item component that renders as a button with proper ARIA semantics.\n */\n@Component({\n tag: 'cat-menu-item',\n shadow: true\n})\nexport class CatMenuItem {\n private readonly _id = `cat-menu-item-${++nextUniqueId}`;\n private get id() {\n return this.identifier || this._id;\n }\n private button?: HTMLCatButtonElement;\n\n /**\n * A unique identifier for the menu item.\n */\n @Prop() identifier?: string;\n /**\n * The name of an icon to be displayed in the menu item.\n */\n @Prop() icon?: string;\n\n /**\n * The color of the menu item.\n */\n @Prop() color?: 'primary' | 'secondary' | 'danger' | 'warning' | 'success' | 'info';\n\n /**\n * Whether the menu item is active.\n */\n @Prop() active = false;\n\n /**\n * The variant of the menu item button.\n */\n @Prop() variant: 'filled' | 'outlined' | 'text' = 'text';\n\n /**\n * The loading state of the menu item.\n */\n @Prop() loading?: boolean;\n\n /**\n * Hide the actual button content and only display the icon.\n */\n @Prop() iconOnly: boolean | Breakpoint = false;\n\n /**\n * Display the icon on the right.\n */\n @Prop() iconRight = false;\n\n /**\n * A destination to link to, rendered in the href attribute of a link.\n */\n @Prop() url?: string;\n\n /**\n * Specifies where to open the linked document.\n */\n @Prop() urlTarget?: '_blank' | '_self';\n\n /**\n * Specifies that the menu item should be disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Attributes that will be added to the native HTML button element\n */\n @Prop() nativeAttributes?: { [key: string]: string };\n\n /**\n * A unique identifier for the underlying native element that is used for\n * testing purposes. The attribute is added as `data-test` attribute and acts\n * as a shorthand for `nativeAttributes={ 'data-test': 'test-Id' }`.\n */\n @Prop() testId?: string;\n\n /**\n * Emitted when the trigger button is clicked.\n */\n @Event() catClick!: EventEmitter<MouseEvent>;\n\n /**\n * Programmatically move focus to the menu item.\n */\n @Method()\n async doFocus(options?: FocusOptions): Promise<void> {\n this.button?.doFocus(options);\n }\n\n /**\n * Programmatically remove focus from the menu item.\n */\n @Method()\n async doBlur(): Promise<void> {\n this.button?.doBlur();\n }\n\n render() {\n return (\n <Host>\n <li>\n <cat-button\n ref={el => (this.button = el)}\n class=\"cat-nav-item\"\n buttonId={this.id}\n part=\"menu-item\"\n variant={this.variant}\n icon={this.icon}\n iconOnly={this.iconOnly}\n iconRight={this.iconRight}\n url={this.url}\n disabled={this.disabled}\n urlTarget={this.urlTarget}\n loading={this.loading}\n color={this.color}\n active={this.active}\n testId={this.testId}\n nativeAttributes={{\n ...this.nativeAttributes,\n role: 'menuitem',\n tabindex: '-1'\n }}\n onCatClick={this.onCatClick}\n >\n <slot></slot>\n </cat-button>\n </li>\n </Host>\n );\n }\n\n private onCatClick(event: CustomEvent<MouseEvent>) {\n this.catClick.emit(event.detail);\n }\n}\n"]}
|
|
@@ -52,9 +52,9 @@ export class CatPagination {
|
|
|
52
52
|
}
|
|
53
53
|
render() {
|
|
54
54
|
this.hostElement.tabIndex = Number(this.hostElement.getAttribute('tabindex')) || 0;
|
|
55
|
-
return (h("nav", { key: '
|
|
55
|
+
return (h("nav", { key: 'ad282454abdbfd0fbc50097b0d635cbb933bb752', "aria-label": i18n.t('pagination.ariaLabel') }, h("ol", { key: '8007380dc28cce2c6149e7eece49ec5f5fe0965b', class: {
|
|
56
56
|
[`cat-pagination-${this.size}`]: Boolean(this.size)
|
|
57
|
-
} }, h("li", { key: '
|
|
57
|
+
} }, h("li", { key: 'fc6b7bd088fdfd80480e92201912ac38502b0a82' }, h("cat-button", { key: 'eff8810da8b950897f7f161186eb129f9817f4d9', variant: this.variant, size: this.size, round: this.round, disabled: this.isFirst, a11yLabel: i18n.t('pagination.prev'), icon: this.iconPrev, iconOnly: true, onClick: () => this.setPage(this.page - 1) })), this.content, h("li", { key: 'f974b12f22475beb32fe5a314743fd0adec08133' }, h("cat-button", { key: '08ca8508120395e559da76b04b7375c1f1cead68', variant: this.variant, size: this.size, round: this.round, disabled: this.isLast, a11yLabel: i18n.t('pagination.next'), icon: this.iconNext, iconOnly: true, onClick: () => this.setPage(this.page + 1) })))));
|
|
58
58
|
}
|
|
59
59
|
get isFirst() {
|
|
60
60
|
return this.page === 0;
|
|
@@ -75,13 +75,13 @@ export class CatRadio {
|
|
|
75
75
|
}
|
|
76
76
|
render() {
|
|
77
77
|
this.hostElement.tabIndex = Number(this.hostElement.getAttribute('tabindex')) || 0;
|
|
78
|
-
return (h(Host, { key: '
|
|
78
|
+
return (h(Host, { key: '0049b858f753639137fc5f1868300be789583fc5' }, h("label", { key: 'd4a67cf145780cec29e6c8148bca5b9f2e4d862f', htmlFor: this.id, class: {
|
|
79
79
|
'is-hidden': this.labelHidden,
|
|
80
80
|
'is-disabled': this.disabled,
|
|
81
81
|
'label-left': this.labelLeft,
|
|
82
82
|
'align-center': this.alignment === 'center',
|
|
83
83
|
'align-end': this.alignment === 'bottom'
|
|
84
|
-
}, role: "radio", "aria-checked": this.checked ? 'true' : 'false' }, h("span", { key: '
|
|
84
|
+
}, role: "radio", "aria-checked": this.checked ? 'true' : 'false' }, h("span", { key: 'ee81c40a3fe2e10d4fc4ed1deb1f81816936a8fd', class: "radio" }, h("input", { key: 'd5c5b924ec1cffa7c7f02d8bf4faf689876802fa', "data-test": this.testId, ...this.nativeAttributes, part: "input", ref: el => (this.input = el), id: this.identifier || this.id, type: "radio", name: this.name, value: this.value, checked: this.checked, required: this.required, disabled: this.disabled, onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this), "aria-describedby": this.hasHint ? this.id + '-hint' : undefined }), h("span", { key: 'efa28acc6827dbc2aeeae01ead830e40d5372493', class: "circle" })), h("span", { key: 'beaaf1b38e100b636e0496dda1123dff7cf93a33', class: "label", part: "label" }, (this.hasSlottedLabel && h("slot", { key: 'ada26a86266f139f09353d4275b9d4b13755ad67', name: "label" })) || this.label)), this.hasHint && (h("div", { key: 'bb3fe9a5dbefc66d6a3075cefbb64deaab153f23', class: { 'hint-wrapper': true, 'label-left': this.labelLeft } }, h("div", { key: '130db3e44b1102561d69538ebac20289de598183', class: "circle-placeholder" }), h(CatFormHint, { key: 'b914b9b25c658700abcc9ea932b95861f10d966d', id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && h("slot", { name: "hint" }) })))));
|
|
85
85
|
}
|
|
86
86
|
get hasHint() {
|
|
87
87
|
return !!this.hint || !!this.hasSlottedHint;
|
|
@@ -70,7 +70,7 @@ export class CatRadioGroup {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
render() {
|
|
73
|
-
return (h("div", { key: '
|
|
73
|
+
return (h("div", { key: '092e314344de49819b981fc58295c4e6985bf03e', role: "radiogroup", "aria-label": this.a11yLabel }, h("slot", { key: '10740a5816e614c5e3f046110b84728de398cdc4' })));
|
|
74
74
|
}
|
|
75
75
|
init() {
|
|
76
76
|
this.catRadioGroup = Array.from(this.hostElement.querySelectorAll(`cat-radio`));
|
|
@@ -69,13 +69,13 @@ export class CatScrollable {
|
|
|
69
69
|
}
|
|
70
70
|
render() {
|
|
71
71
|
return [
|
|
72
|
-
h("div", { key: '
|
|
73
|
-
h("div", { key: '
|
|
72
|
+
h("div", { key: '01170df73b6535997e71f3a35cce5edcc864969f', class: "scrollable-wrapper", ref: el => (this.scrollWrapperElement = el) }, !this.noShadowY && h("div", { key: '26bcf225d5416926be598ada1a533119db191fb8', class: "shadow-top" }), !this.noShadowX && h("div", { key: '2809cafcf67edf778e3508907fd4500d46da185e', class: "shadow-left" }), !this.noShadowX && h("div", { key: '78d1b9d3768be4af4af9e87c04428ec59e5ffc1e', class: "shadow-right" }), !this.noShadowY && h("div", { key: '81084c2ed0a43a136d5ec46a1a2307410036cede', class: "shadow-bottom" })),
|
|
73
|
+
h("div", { key: '7ec4056d8752be30c4e97f75ff3aa905dd7ac96a', ref: el => (this.scrollElement = el), class: {
|
|
74
74
|
'scrollable-content': true,
|
|
75
75
|
'scroll-x': !this.noOverflowX,
|
|
76
76
|
'scroll-y': !this.noOverflowY,
|
|
77
77
|
'no-overscroll': this.noOverscroll
|
|
78
|
-
} }, h("slot", { key: '
|
|
78
|
+
} }, h("slot", { key: '1a4d1d317fc7e92160ff21fb743db8b3edad28a5' }))
|
|
79
79
|
];
|
|
80
80
|
}
|
|
81
81
|
attachEmitter(from, emitter) {
|
|
@@ -147,7 +147,7 @@ export class CatSelect {
|
|
|
147
147
|
if (!oldState.isResolving) {
|
|
148
148
|
this.valueChangedBySelection = true;
|
|
149
149
|
this.value = newValue;
|
|
150
|
-
this.catChange.emit();
|
|
150
|
+
this.catChange.emit(newValue);
|
|
151
151
|
}
|
|
152
152
|
this.showErrorsIfTimeout();
|
|
153
153
|
}
|
|
@@ -352,18 +352,18 @@ export class CatSelect {
|
|
|
352
352
|
}
|
|
353
353
|
render() {
|
|
354
354
|
this.hostElement.tabIndex = Number(this.hostElement.getAttribute('tabindex')) || 0;
|
|
355
|
-
return (h(Host, { key: '
|
|
355
|
+
return (h(Host, { key: 'efdb83ec9f52b391d279ece98996723fa558a87a' }, h("div", { key: 'eceeb2c9d577a78e5e0e52b1bde30706c8bb36ea', class: {
|
|
356
356
|
'select-field': true,
|
|
357
357
|
'select-horizontal': this.horizontal ?? this.fallbackHorizontal ?? false,
|
|
358
358
|
'select-multiple': this.multiple
|
|
359
|
-
} }, h("div", { key: '
|
|
359
|
+
} }, h("div", { key: 'a5803daa82570587270e53b640f098f2cdb0a3e5', class: { 'label-container': true, hidden: this.labelHidden } }, (this.hasSlottedLabel || this.label) && (h("label", { key: '28cd43343dd2a806f612f5691bc7a1cdf0d6df72', htmlFor: `select-${this.id}-input`, part: "label" }, h("span", { key: '0c80bc9e92fc6090231eb04ff574198da6119639', class: "label-wrapper" }, (this.hasSlottedLabel && h("slot", { key: '596fc3bceee736805d4047f879b28464ac12981e', name: "label" })) || this.label, h("div", { key: '02cbb3685b1b4d40566f67b20374309859d134e2', class: "label-metadata" }, !this.required && (this.requiredMarker ?? 'optional').startsWith('optional') && (h("span", { key: 'c14d1a9ca86d4693c095fdf14fea202843ce6dab', class: "label-optional", "aria-hidden": "true" }, "(", i18n.t('input.optional'), ")")), this.required && this.requiredMarker?.startsWith('required') && (h("span", { key: '44678be1c8667215a4fbaba68510f8f40cd5ef1e', class: "label-optional", "aria-hidden": "true" }, "(", i18n.t('input.required'), ")"))))))), h("div", { key: 'e899d7810102e93836309d644cf842a366c368a1', class: "select-container" }, h("div", { key: '2c3707ee5070ac8a9d4a40a3eb3325a93a5664b5', class: { 'select-wrapper': true, 'select-disabled': this.disabled, 'select-invalid': this.invalid }, ref: el => (this.trigger = el), id: this.id, role: "combobox", "aria-expanded": this.state.isOpen || this.isPillboxActive(), "aria-controls": this.isPillboxActive() ? `select-pillbox-${this.id}` : `select-listbox-${this.id}`, "aria-required": this.required ? 'true' : false, "aria-activedescendant": this.activeDescendant, onClick: e => this.onClick(e) }, h("div", { key: 'b35e65763cd13120de56eb8592dc39d459aae199', class: "select-wrapper-inner" }, this.multiple && this.state.selection.length ? (h("div", { id: `select-pillbox-${this.id}`, role: "listbox", "aria-orientation": "horizontal", class: "select-pills" }, this.state.selection.map((item, i) => (h("span", { class: {
|
|
360
360
|
pill: true,
|
|
361
361
|
'select-no-open': true,
|
|
362
362
|
'select-option-active': this.state.activeSelectionIndex === i
|
|
363
|
-
}, role: "option", "aria-selected": "true", id: `select-${this.id}-selection-${i}` }, item.render.avatar ? (h("cat-avatar", { label: item.render.label, round: item.render.avatar.round, src: item.render.avatar.src, icon: item.render.avatar.icon, initials: item.render.avatar.initials ?? '' })) : null, h("span", null, item.render.label), !this.disabled && (h("cat-button", { size: "xs", variant: "text", icon: "$cat:select-clear", iconOnly: true, a11yLabel: i18n.t('select.deselect'), onClick: () => this.deselect(item.item.id), tabIndex: -1, "data-dropdown-no-close": true }))))))) : this.state.selection.length && this.state.selection[0].render.avatar ? (h("cat-avatar", { label: this.state.selection[0].render.label, round: this.state.selection[0].render.avatar.round, src: this.state.selection[0].render.avatar.src, icon: this.state.selection[0].render.avatar.icon, initials: this.state.selection[0].render.avatar.initials ?? '' })) : null, h("input", { key: '
|
|
363
|
+
}, role: "option", "aria-selected": "true", id: `select-${this.id}-selection-${i}` }, item.render.avatar ? (h("cat-avatar", { label: item.render.label, round: item.render.avatar.round, src: item.render.avatar.src, icon: item.render.avatar.icon, initials: item.render.avatar.initials ?? '' })) : null, h("span", null, item.render.label), !this.disabled && (h("cat-button", { size: "xs", variant: "text", icon: "$cat:select-clear", iconOnly: true, a11yLabel: i18n.t('select.deselect'), onClick: () => this.deselect(item.item.id), tabIndex: -1, "data-dropdown-no-close": true }))))))) : this.state.selection.length && this.state.selection[0].render.avatar ? (h("cat-avatar", { label: this.state.selection[0].render.label, round: this.state.selection[0].render.avatar.round, src: this.state.selection[0].render.avatar.src, icon: this.state.selection[0].render.avatar.icon, initials: this.state.selection[0].render.avatar.initials ?? '' })) : null, h("input", { key: 'c7eb2d1f582c83ef1f257652f302ba6cf10e8d3c', "data-test": this.testId, ...this.nativeAttributes, part: "input", id: `select-${this.id}-input`, class: "select-input", role: "combobox", ref: el => (this.input = el), "aria-controls": this.isPillboxActive() ? `select-pillbox-${this.id}` : `select-listbox-${this.id}`, "aria-activedescendant": this.activeDescendant, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.hasHint ? this.id + '-hint' : undefined, "aria-autocomplete": "list", onInput: this.onInput.bind(this), value: !this.multiple ? this.state.term : undefined, placeholder: this.placeholder, disabled: this.disabled || this.state.isResolving })), this.state.isResolving && h("cat-spinner", { key: 'e3d92ddd13d486940dbc35743be8bd65c841160e' }), this.invalid && (h("cat-icon", { key: '943a586107b4e449cea8006819442e78a8e84c6c', icon: "$cat:input-error", class: "icon-suffix cat-text-danger", size: "l" })), (this.state.selection.length || this.state.term.length) &&
|
|
364
364
|
!this.disabled &&
|
|
365
365
|
!this.state.isResolving &&
|
|
366
|
-
this.clearable ? (h("cat-button", { id: `select-clear-btn-${this.id}`, iconOnly: true, icon: "$cat:input-close", variant: "text", size: "s", a11yLabel: i18n.t('input.clear'), onCatClick: () => this.clearInput(), "data-dropdown-no-close": true })) : null, !this.state.isResolving && (h("cat-button", { key: '
|
|
366
|
+
this.clearable ? (h("cat-button", { id: `select-clear-btn-${this.id}`, iconOnly: true, icon: "$cat:input-close", variant: "text", size: "s", a11yLabel: i18n.t('input.clear'), onCatClick: () => this.clearInput(), "data-dropdown-no-close": true })) : null, !this.state.isResolving && (h("cat-button", { key: '1cb61ffc8c383f964672479d710d7ffaad5c6081', iconOnly: true, icon: "$cat:select-open", class: { 'select-btn': true, 'select-btn-open': this.state.isOpen }, variant: "text", size: "s", a11yLabel: this.state.isOpen ? i18n.t('select.close') : i18n.t('select.open'), "aria-controls": `select-listbox-${this.id}`, "aria-expanded": this.state.isOpen, tabIndex: -1, disabled: this.disabled || this.state.isResolving, "data-dropdown-no-close": true }))), this.hasHint && (h(CatFormHint, { key: 'c231a520a632a58aec59ef56ee97f9d7e4ec5f40', id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && h("slot", { name: "hint" }), errorMap: this.errorMap })))), h("div", { key: 'd53fc5dd1b2a86a2f69d56e270e660aade45bd98', class: "select-dropdown", ref: el => (this.dropdown = el), style: { display: this.state.isOpen ? 'block' : undefined } }, this.state.isOpen && (h("cat-scrollable", { key: '979bffc2506e09806c4f0e6c467efad884254a8c', class: "select-options-wrapper", scrolledBuffer: 56, noOverflowX: true, noOverscroll: true, noScrolledInit: true, onScrolledBottom: () => this.more$.next() }, h("ul", { key: '8b5ceec249c36079ebbebb3fde24aa2bf340f040', class: "select-options", role: "listbox", "aria-multiselectable": this.multiple, "aria-setsize": this.state.totalElements, id: `select-listbox-${this.id}` }, this.optionsList, this.state.isFirstLoading
|
|
367
367
|
? Array.from(Array(CatSelect.SKELETON_COUNT)).map(() => (h("li", { class: "select-option-loading" }, h("cat-skeleton", { variant: "body", lines: 1 }), h("cat-skeleton", { variant: "body", lines: 1 }))))
|
|
368
368
|
: !this.state.options.length &&
|
|
369
369
|
!this.tags && (h("li", { class: "select-option-empty" }, this.noItems ? this.noItems : i18n.t('select.empty')))))))));
|
|
@@ -859,18 +859,13 @@ export class CatSelect {
|
|
|
859
859
|
"type": "string",
|
|
860
860
|
"mutable": true,
|
|
861
861
|
"complexType": {
|
|
862
|
-
"original": "
|
|
862
|
+
"original": "CatSelectValue",
|
|
863
863
|
"resolved": "CatSelectMultipleTaggingValue | CatSelectTaggingValue | string | string[] | undefined",
|
|
864
864
|
"references": {
|
|
865
|
-
"
|
|
865
|
+
"CatSelectValue": {
|
|
866
866
|
"location": "local",
|
|
867
867
|
"path": "/home/runner/work/catalyst/catalyst/core/src/components/cat-select/cat-select.tsx",
|
|
868
|
-
"id": "src/components/cat-select/cat-select.tsx::
|
|
869
|
-
},
|
|
870
|
-
"CatSelectMultipleTaggingValue": {
|
|
871
|
-
"location": "local",
|
|
872
|
-
"path": "/home/runner/work/catalyst/catalyst/core/src/components/cat-select/cat-select.tsx",
|
|
873
|
-
"id": "src/components/cat-select/cat-select.tsx::CatSelectMultipleTaggingValue"
|
|
868
|
+
"id": "src/components/cat-select/cat-select.tsx::CatSelectValue"
|
|
874
869
|
}
|
|
875
870
|
}
|
|
876
871
|
},
|
|
@@ -1263,12 +1258,13 @@ export class CatSelect {
|
|
|
1263
1258
|
"text": "Emitted when the value is changed."
|
|
1264
1259
|
},
|
|
1265
1260
|
"complexType": {
|
|
1266
|
-
"original": "
|
|
1267
|
-
"resolved": "
|
|
1261
|
+
"original": "CatSelectValue",
|
|
1262
|
+
"resolved": "CatSelectMultipleTaggingValue | CatSelectTaggingValue | string | string[]",
|
|
1268
1263
|
"references": {
|
|
1269
|
-
"
|
|
1270
|
-
"location": "
|
|
1271
|
-
"
|
|
1264
|
+
"CatSelectValue": {
|
|
1265
|
+
"location": "local",
|
|
1266
|
+
"path": "/home/runner/work/catalyst/catalyst/core/src/components/cat-select/cat-select.tsx",
|
|
1267
|
+
"id": "src/components/cat-select/cat-select.tsx::CatSelectValue"
|
|
1272
1268
|
}
|
|
1273
1269
|
}
|
|
1274
1270
|
}
|