@carbon/web-components 2.25.2 → 2.26.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/custom-elements.json +859 -39
- package/dist/16-10c4fb8b.js +8 -2
- package/dist/16-4855278a.js +8 -2
- package/dist/16-4be295f9.js +8 -2
- package/dist/16-65aac4b2.js +81 -0
- package/dist/16-6a577b04.js +8 -2
- package/dist/16-8449b4fa.js +8 -2
- package/dist/16-87933b87.js +8 -2
- package/dist/16-b826e67b.js +8 -2
- package/dist/16-e32fa89f.js +8 -2
- package/dist/16-eeb178ee.js +81 -0
- package/dist/16-f4420493.js +8 -2
- package/dist/16-fbe09c57.js +8 -2
- package/dist/20-68c1a445.js +8 -2
- package/dist/20-a9fc419f.js +8 -2
- package/dist/accordion.min.js +8 -2
- package/dist/ai-label.min.js +9 -3
- package/dist/ai-skeleton.min.js +8 -2
- package/dist/badge-indicator.min.js +8 -2
- package/dist/breadcrumb.min.js +18 -12
- package/dist/{button-882e4021.js → button-74696aa8.js} +9 -3
- package/dist/{button-set-470bff4f.js → button-set-6c836da5.js} +11 -5
- package/dist/{button-skeleton-c0570c01.js → button-skeleton-97434162.js} +20 -14
- package/dist/button.min.js +9 -3
- package/dist/carbon-element-017b212d.js +8 -2
- package/dist/chat-button.min.js +10 -4
- package/dist/checkbox-88e7237c.js +8 -2
- package/dist/checkbox-skeleton-d396e413.js +8 -2
- package/dist/checkbox.min.js +8 -2
- package/dist/class-map-e4ba9e2b.js +8 -2
- package/dist/code-snippet.min.js +9 -3
- package/dist/collection-helpers-8b117611.js +8 -2
- package/dist/combo-box.min.js +9 -3
- package/dist/content-switcher-item-787ef698.js +8 -2
- package/dist/content-switcher.min.js +8 -2
- package/dist/{copy-button-17009e29.js → copy-button-6ae3beb9.js} +9 -3
- package/dist/copy-button.min.js +9 -3
- package/dist/data-table.min.js +8 -2
- package/dist/date-picker.min.js +8 -2
- package/dist/defs-eaf95cbc.js +8 -2
- package/dist/directive-e2d48b9c.js +8 -2
- package/dist/{dropdown-item-6995171a.js → dropdown-item-c76d25fb.js} +36 -31
- package/dist/dropdown.min.js +9 -3
- package/dist/file-uploader.min.js +9 -3
- package/dist/floating-menu-381b1978.js +8 -2
- package/dist/floating-menu.min.js +8 -2
- package/dist/focus-969beaed.js +8 -2
- package/dist/form-a750a2ac.js +8 -2
- package/dist/form-group.min.js +8 -2
- package/dist/form.min.js +8 -2
- package/dist/heading.min.js +8 -2
- package/dist/host-listener-69c546a1.js +8 -2
- package/dist/{icon-button-8b63f6e9.js → icon-button-83bfdd07.js} +10 -4
- package/dist/icon-button.min.js +9 -3
- package/dist/icon-indicator.min.js +8 -2
- package/dist/if-defined-446d5754.js +8 -2
- package/dist/if-non-empty-0ab1b89b.js +8 -2
- package/dist/inline-loading.min.js +8 -2
- package/dist/{layer-f3ead524.js → layer-955eb55a.js} +9 -3
- package/dist/layer.min.js +9 -3
- package/dist/link-95fb4386.js +8 -2
- package/dist/link.min.js +8 -2
- package/dist/list.min.js +17 -15
- package/dist/loading-8f238aae.js +8 -2
- package/dist/loading-icon-502d6837.js +8 -2
- package/dist/loading.min.js +8 -2
- package/dist/menu.min.js +240 -0
- package/dist/{modal-label-54f55140.js → modal-label-fc9d6962.js} +13 -7
- package/dist/modal.min.js +9 -3
- package/dist/multi-select.min.js +9 -3
- package/dist/notification.min.js +9 -3
- package/dist/number-input.min.js +8 -2
- package/dist/on-8707857f.js +8 -2
- package/dist/overflow-menu.min.js +17 -9
- package/dist/pagination.min.js +39 -33
- package/dist/popover-content-d4ec4412.js +8 -2
- package/dist/popover-controller-97c2d68e.js +8 -2
- package/dist/popover.min.js +8 -2
- package/dist/progress-bar.min.js +8 -2
- package/dist/progress-indicator.min.js +8 -2
- package/dist/property-4de26c93.js +8 -2
- package/dist/query-602de8af.js +8 -2
- package/dist/query-assigned-elements-1bd68a6e.js +8 -2
- package/dist/radio-button-skeleton-67c6a836.js +8 -2
- package/dist/radio-button.min.js +8 -2
- package/dist/radio-group-manager-9b128b9b.js +8 -2
- package/dist/search-7f28fde3.js +8 -2
- package/dist/search.min.js +8 -2
- package/dist/select-01725ae4.js +8 -2
- package/dist/select.min.js +8 -2
- package/dist/settings-a9cb5e4b.js +8 -2
- package/dist/shape-indicator.min.js +8 -2
- package/dist/shared-enums-562e6b51.js +8 -2
- package/dist/side-panel.min.js +9 -3
- package/dist/skeleton-icon-60c9d437.js +8 -2
- package/dist/skeleton-icon.min.js +8 -2
- package/dist/skeleton-placeholder-3f62f258.js +8 -2
- package/dist/skeleton-placeholder.min.js +8 -2
- package/dist/skeleton-text-a37622a0.js +8 -2
- package/dist/skeleton-text.min.js +8 -2
- package/dist/skip-to-content.min.js +8 -2
- package/dist/slider.min.js +8 -2
- package/dist/slug.min.js +9 -3
- package/dist/spread-279bf949.js +8 -2
- package/dist/stack.min.js +8 -2
- package/dist/state-225ff428.js +8 -2
- package/dist/structured-list.min.js +8 -2
- package/dist/tabs.min.js +8 -2
- package/dist/tag.min.js +8 -2
- package/dist/tearsheet.min.js +11 -5
- package/dist/text-input-a7541a8d.js +8 -2
- package/dist/text-input.min.js +8 -2
- package/dist/textarea.min.js +8 -2
- package/dist/tile.min.js +8 -2
- package/dist/time-picker.min.js +158 -0
- package/dist/toggle-tip.min.js +8 -2
- package/dist/toggle.min.js +8 -2
- package/dist/toggletip-383477dd.js +8 -2
- package/dist/tooltip-content-3e3b3f8c.js +8 -2
- package/dist/tooltip.min.js +8 -2
- package/dist/ui-shell.min.js +9 -3
- package/dist/validity-45b7794a.js +8 -2
- package/es/components/breadcrumb/breadcrumb-item.d.ts +4 -0
- package/es/components/breadcrumb/breadcrumb-item.js +16 -1
- package/es/components/breadcrumb/breadcrumb-item.js.map +1 -1
- package/es/components/breadcrumb/breadcrumb.scss.js +1 -1
- package/es/components/button/button-set.d.ts +4 -0
- package/es/components/button/button-set.js +18 -1
- package/es/components/button/button-set.js.map +1 -1
- package/es/components/button/button.scss.js +1 -1
- package/es/components/chat-button/chat-button.scss.js +1 -1
- package/es/components/icon-button/icon-button.scss.js +1 -1
- package/es/components/layer/layer.d.ts +7 -0
- package/es/components/layer/layer.js +9 -2
- package/es/components/layer/layer.js.map +1 -1
- package/es/components/list/list-item.d.ts +0 -11
- package/es/components/list/list-item.js +1 -21
- package/es/components/list/list-item.js.map +1 -1
- package/es/components/list/list.scss.js +1 -1
- package/es/components/list/ordered-list.js +1 -1
- package/es/components/list/ordered-list.js.map +1 -1
- package/es/components/list/unordered-list.d.ts +5 -1
- package/es/components/list/unordered-list.js +11 -4
- package/es/components/list/unordered-list.js.map +1 -1
- package/es/components/menu/defs.d.ts +42 -0
- package/es/components/menu/defs.js +54 -0
- package/es/components/menu/defs.js.map +1 -0
- package/es/components/menu/index.d.ts +14 -0
- package/es/components/menu/index.js +14 -0
- package/es/components/menu/index.js.map +1 -0
- package/es/components/menu/menu-context.d.ts +18 -0
- package/es/components/menu/menu-context.js +27 -0
- package/es/components/menu/menu-context.js.map +1 -0
- package/es/components/menu/menu-item-divider.d.ts +19 -0
- package/es/components/menu/menu-item-divider.js +42 -0
- package/es/components/menu/menu-item-divider.js.map +1 -0
- package/es/components/menu/menu-item-group.d.ts +23 -0
- package/es/components/menu/menu-item-group.js +48 -0
- package/es/components/menu/menu-item-group.js.map +1 -0
- package/es/components/menu/menu-item-radio-group.d.ts +42 -0
- package/es/components/menu/menu-item-radio-group.js +104 -0
- package/es/components/menu/menu-item-radio-group.js.map +1 -0
- package/es/components/menu/menu-item-selectable.d.ts +39 -0
- package/es/components/menu/menu-item-selectable.js +98 -0
- package/es/components/menu/menu-item-selectable.js.map +1 -0
- package/es/components/menu/menu-item.d.ts +771 -0
- package/es/components/menu/menu-item.js +309 -0
- package/es/components/menu/menu-item.js.map +1 -0
- package/es/components/menu/menu-item.scss.js +13 -0
- package/es/components/menu/menu-item.scss.js.map +1 -0
- package/es/components/menu/menu.d.ts +471 -0
- package/es/components/menu/menu.js +469 -0
- package/es/components/menu/menu.js.map +1 -0
- package/es/components/menu/menu.scss.js +13 -0
- package/es/components/menu/menu.scss.js.map +1 -0
- package/es/components/overflow-menu/overflow-menu-item.d.ts +9 -0
- package/es/components/overflow-menu/overflow-menu-item.js +24 -2
- package/es/components/overflow-menu/overflow-menu-item.js.map +1 -1
- package/es/components/overflow-menu/overflow-menu.scss.js +1 -1
- package/es/components/tag/tag.d.ts +1 -1
- package/es/components/tag/tag.js +1 -1
- package/es/components/time-picker/defs.d.ts +26 -0
- package/es/components/time-picker/defs.js +38 -0
- package/es/components/time-picker/defs.js.map +1 -0
- package/es/components/time-picker/index.d.ts +10 -0
- package/es/components/time-picker/index.js +10 -0
- package/es/components/time-picker/index.js.map +1 -0
- package/es/components/time-picker/time-picker-select.d.ts +426 -0
- package/es/components/time-picker/time-picker-select.js +218 -0
- package/es/components/time-picker/time-picker-select.js.map +1 -0
- package/es/components/time-picker/time-picker.d.ts +802 -0
- package/es/components/time-picker/time-picker.js +288 -0
- package/es/components/time-picker/time-picker.js.map +1 -0
- package/es/components/time-picker/time-picker.scss.js +13 -0
- package/es/components/time-picker/time-picker.scss.js.map +1 -0
- package/es/index.d.ts +2 -0
- package/es/index.js +2 -0
- package/es/index.js.map +1 -1
- package/es-custom/components/breadcrumb/breadcrumb-item.d.ts +4 -0
- package/es-custom/components/breadcrumb/breadcrumb-item.js +16 -1
- package/es-custom/components/breadcrumb/breadcrumb-item.js.map +1 -1
- package/es-custom/components/breadcrumb/breadcrumb.scss.js +1 -1
- package/es-custom/components/button/button-set.d.ts +4 -0
- package/es-custom/components/button/button-set.js +18 -1
- package/es-custom/components/button/button-set.js.map +1 -1
- package/es-custom/components/button/button.scss.js +1 -1
- package/es-custom/components/chat-button/chat-button.scss.js +1 -1
- package/es-custom/components/icon-button/icon-button.scss.js +1 -1
- package/es-custom/components/layer/layer.d.ts +7 -0
- package/es-custom/components/layer/layer.js +9 -2
- package/es-custom/components/layer/layer.js.map +1 -1
- package/es-custom/components/list/list-item.d.ts +0 -11
- package/es-custom/components/list/list-item.js +1 -21
- package/es-custom/components/list/list-item.js.map +1 -1
- package/es-custom/components/list/list.scss.js +1 -1
- package/es-custom/components/list/ordered-list.js +1 -1
- package/es-custom/components/list/ordered-list.js.map +1 -1
- package/es-custom/components/list/unordered-list.d.ts +5 -1
- package/es-custom/components/list/unordered-list.js +11 -4
- package/es-custom/components/list/unordered-list.js.map +1 -1
- package/es-custom/components/menu/defs.d.ts +42 -0
- package/es-custom/components/menu/defs.js +54 -0
- package/es-custom/components/menu/defs.js.map +1 -0
- package/es-custom/components/menu/index.d.ts +14 -0
- package/es-custom/components/menu/index.js +14 -0
- package/es-custom/components/menu/index.js.map +1 -0
- package/es-custom/components/menu/menu-context.d.ts +18 -0
- package/es-custom/components/menu/menu-context.js +27 -0
- package/es-custom/components/menu/menu-context.js.map +1 -0
- package/es-custom/components/menu/menu-item-divider.d.ts +19 -0
- package/es-custom/components/menu/menu-item-divider.js +42 -0
- package/es-custom/components/menu/menu-item-divider.js.map +1 -0
- package/es-custom/components/menu/menu-item-group.d.ts +23 -0
- package/es-custom/components/menu/menu-item-group.js +48 -0
- package/es-custom/components/menu/menu-item-group.js.map +1 -0
- package/es-custom/components/menu/menu-item-radio-group.d.ts +42 -0
- package/es-custom/components/menu/menu-item-radio-group.js +104 -0
- package/es-custom/components/menu/menu-item-radio-group.js.map +1 -0
- package/es-custom/components/menu/menu-item-selectable.d.ts +39 -0
- package/es-custom/components/menu/menu-item-selectable.js +98 -0
- package/es-custom/components/menu/menu-item-selectable.js.map +1 -0
- package/es-custom/components/menu/menu-item.d.ts +771 -0
- package/es-custom/components/menu/menu-item.js +309 -0
- package/es-custom/components/menu/menu-item.js.map +1 -0
- package/es-custom/components/menu/menu-item.scss.js +13 -0
- package/es-custom/components/menu/menu-item.scss.js.map +1 -0
- package/es-custom/components/menu/menu.d.ts +471 -0
- package/es-custom/components/menu/menu.js +469 -0
- package/es-custom/components/menu/menu.js.map +1 -0
- package/es-custom/components/menu/menu.scss.js +13 -0
- package/es-custom/components/menu/menu.scss.js.map +1 -0
- package/es-custom/components/overflow-menu/overflow-menu-item.d.ts +9 -0
- package/es-custom/components/overflow-menu/overflow-menu-item.js +24 -2
- package/es-custom/components/overflow-menu/overflow-menu-item.js.map +1 -1
- package/es-custom/components/overflow-menu/overflow-menu.scss.js +1 -1
- package/es-custom/components/tag/tag.d.ts +1 -1
- package/es-custom/components/tag/tag.js +1 -1
- package/es-custom/components/time-picker/defs.d.ts +26 -0
- package/es-custom/components/time-picker/defs.js +38 -0
- package/es-custom/components/time-picker/defs.js.map +1 -0
- package/es-custom/components/time-picker/index.d.ts +10 -0
- package/es-custom/components/time-picker/index.js +10 -0
- package/es-custom/components/time-picker/index.js.map +1 -0
- package/es-custom/components/time-picker/time-picker-select.d.ts +426 -0
- package/es-custom/components/time-picker/time-picker-select.js +218 -0
- package/es-custom/components/time-picker/time-picker-select.js.map +1 -0
- package/es-custom/components/time-picker/time-picker.d.ts +802 -0
- package/es-custom/components/time-picker/time-picker.js +288 -0
- package/es-custom/components/time-picker/time-picker.js.map +1 -0
- package/es-custom/components/time-picker/time-picker.scss.js +13 -0
- package/es-custom/components/time-picker/time-picker.scss.js.map +1 -0
- package/es-custom/index.d.ts +2 -0
- package/es-custom/index.js +2 -0
- package/es-custom/index.js.map +1 -1
- package/lib/components/breadcrumb/breadcrumb-item.d.ts +4 -0
- package/lib/components/button/button-set.d.ts +4 -0
- package/lib/components/layer/layer.d.ts +7 -0
- package/lib/components/list/list-item.d.ts +0 -11
- package/lib/components/list/unordered-list.d.ts +5 -1
- package/lib/components/menu/defs.d.ts +42 -0
- package/lib/components/menu/defs.js +56 -0
- package/lib/components/menu/defs.js.map +1 -0
- package/lib/components/menu/index.d.ts +14 -0
- package/lib/components/menu/menu-context.d.ts +18 -0
- package/lib/components/menu/menu-item-divider.d.ts +19 -0
- package/lib/components/menu/menu-item-group.d.ts +23 -0
- package/lib/components/menu/menu-item-radio-group.d.ts +42 -0
- package/lib/components/menu/menu-item-selectable.d.ts +39 -0
- package/lib/components/menu/menu-item.d.ts +771 -0
- package/lib/components/menu/menu.d.ts +471 -0
- package/lib/components/overflow-menu/overflow-menu-item.d.ts +9 -0
- package/lib/components/tag/tag.d.ts +1 -1
- package/lib/components/time-picker/defs.d.ts +26 -0
- package/lib/components/time-picker/defs.js +45 -0
- package/lib/components/time-picker/defs.js.map +1 -0
- package/lib/components/time-picker/index.d.ts +10 -0
- package/lib/components/time-picker/time-picker-select.d.ts +426 -0
- package/lib/components/time-picker/time-picker.d.ts +802 -0
- package/lib/index.d.ts +2 -0
- package/package.json +5 -4
- package/scss/components/breadcrumb/breadcrumb.scss +5 -0
- package/scss/components/button/button.scss +4 -0
- package/scss/components/list/list.scss +7 -5
- package/scss/components/menu/menu-item.scss +109 -0
- package/scss/components/menu/menu-variables.scss +15 -0
- package/scss/components/menu/menu.scss +72 -0
- package/scss/components/overflow-menu/overflow-menu.scss +69 -14
- package/scss/components/time-picker/time-picker.scss +50 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2024
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { __decorate } from 'tslib';
|
|
9
|
+
import { LitElement, html } from 'lit';
|
|
10
|
+
import { property } from 'lit/decorators.js';
|
|
11
|
+
import { prefix } from '../../globals/settings.js';
|
|
12
|
+
import styles from './menu-item.scss.js';
|
|
13
|
+
import { carbonElement } from '../../globals/decorators/carbon-element.js';
|
|
14
|
+
import { consume } from '@lit/context';
|
|
15
|
+
import { MenuContext } from './menu-context.js';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @license
|
|
19
|
+
*
|
|
20
|
+
* Copyright IBM Corp. 2024
|
|
21
|
+
*
|
|
22
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
23
|
+
* LICENSE file in the root directory of this source tree.
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Menu Item.
|
|
27
|
+
*
|
|
28
|
+
* @element cds-custom-menu-item-radio-group
|
|
29
|
+
*/
|
|
30
|
+
let CDSmenuItemRadioGroup = class CDSmenuItemRadioGroup extends LitElement {
|
|
31
|
+
constructor() {
|
|
32
|
+
super(...arguments);
|
|
33
|
+
/**
|
|
34
|
+
* List of items in the radio group.
|
|
35
|
+
*/
|
|
36
|
+
this.items = [];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The name of the custom event fired when the selection state changes.
|
|
40
|
+
*/
|
|
41
|
+
static get eventOnChange() {
|
|
42
|
+
return `${prefix}-item-changed`;
|
|
43
|
+
}
|
|
44
|
+
firstUpdated() {
|
|
45
|
+
this.context.updateFromChild({ hasSelectableItems: true });
|
|
46
|
+
this.addEventListener(`click`, (e) => {
|
|
47
|
+
this.selectedItem = e.target;
|
|
48
|
+
const init = {
|
|
49
|
+
bubbles: true,
|
|
50
|
+
cancelable: true,
|
|
51
|
+
composed: true,
|
|
52
|
+
detail: {
|
|
53
|
+
triggeredBy: e.target,
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
if (this.dispatchEvent(new CustomEvent(this.constructor.eventOnChange, init))) {
|
|
57
|
+
this.dispatchEvent(new CustomEvent(this.constructor.eventOnChange, init));
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
updated(_changedProperties) {
|
|
62
|
+
if (_changedProperties.has('selectedItem')) {
|
|
63
|
+
this.querySelectorAll(`${prefix}-menu-item`).forEach((item) => {
|
|
64
|
+
if (item === this.selectedItem) {
|
|
65
|
+
item.setAttribute('aria-checked', 'true');
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
item.setAttribute('aria-checked', 'false');
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
render() {
|
|
74
|
+
const { label } = this;
|
|
75
|
+
return html `
|
|
76
|
+
<ul role="group" aria-label="${label}">
|
|
77
|
+
<slot></slot>
|
|
78
|
+
</ul>
|
|
79
|
+
`;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
CDSmenuItemRadioGroup.styles = styles; // `styles` here is a `CSSResult` generated by custom Vite loader
|
|
83
|
+
__decorate([
|
|
84
|
+
consume({ context: MenuContext })
|
|
85
|
+
], CDSmenuItemRadioGroup.prototype, "context", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
property({ type: String })
|
|
88
|
+
], CDSmenuItemRadioGroup.prototype, "label", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
property({ type: Array })
|
|
91
|
+
], CDSmenuItemRadioGroup.prototype, "items", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
property({ type: String, attribute: true })
|
|
94
|
+
], CDSmenuItemRadioGroup.prototype, "selectedItem", void 0);
|
|
95
|
+
__decorate([
|
|
96
|
+
property()
|
|
97
|
+
], CDSmenuItemRadioGroup.prototype, "itemToString", void 0);
|
|
98
|
+
CDSmenuItemRadioGroup = __decorate([
|
|
99
|
+
carbonElement(`${prefix}-menu-item-radio-group`)
|
|
100
|
+
], CDSmenuItemRadioGroup);
|
|
101
|
+
var CDSmenuItemRadioGroup$1 = CDSmenuItemRadioGroup;
|
|
102
|
+
|
|
103
|
+
export { CDSmenuItemRadioGroup$1 as default };
|
|
104
|
+
//# sourceMappingURL=menu-item-radio-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu-item-radio-group.js","sources":["../../../src/components/menu/menu-item-radio-group.ts"],"sourcesContent":[null],"names":["customElement"],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;AAUH;;;;AAIG;AAEH,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,UAAU,CAAA;AAA9C,IAAA,WAAA,GAAA;;AASE;;AAEG;QAEH,IAAK,CAAA,KAAA,GAAG,EAAE,CAAC;KAwEZ;AA3DC;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
* @license
|
|
3
|
+
*
|
|
4
|
+
* Copyright IBM Corp. 2019, 2023
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
import { LitElement } from 'lit';
|
|
10
|
+
/**
|
|
11
|
+
* Menu Item.
|
|
12
|
+
*
|
|
13
|
+
* @element cds-custom-menu-item
|
|
14
|
+
*/
|
|
15
|
+
declare class CDSmenuItemSelectable extends LitElement {
|
|
16
|
+
context: any;
|
|
17
|
+
/**
|
|
18
|
+
* Label for the menu item selectable.
|
|
19
|
+
*/
|
|
20
|
+
label: any;
|
|
21
|
+
/**
|
|
22
|
+
* Whether the menu item is selected or not.
|
|
23
|
+
*/
|
|
24
|
+
selected: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* The name of the custom event fired when the selection state changes.
|
|
27
|
+
*/
|
|
28
|
+
static get eventOnChange(): string;
|
|
29
|
+
/**
|
|
30
|
+
* Sets the menu item's icon.
|
|
31
|
+
*/
|
|
32
|
+
renderIcon?: () => void;
|
|
33
|
+
shortcut: any;
|
|
34
|
+
_handleClick: (e: any) => void;
|
|
35
|
+
firstUpdated(): void;
|
|
36
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
37
|
+
static styles: any;
|
|
38
|
+
}
|
|
39
|
+
export default CDSmenuItemSelectable;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2024
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { __decorate } from 'tslib';
|
|
9
|
+
import { LitElement, html } from 'lit';
|
|
10
|
+
import { property } from 'lit/decorators.js';
|
|
11
|
+
import { prefix } from '../../globals/settings.js';
|
|
12
|
+
import styles from './menu-item.scss.js';
|
|
13
|
+
import { carbonElement } from '../../globals/decorators/carbon-element.js';
|
|
14
|
+
import { consume } from '@lit/context';
|
|
15
|
+
import { MenuContext } from './menu-context.js';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @license
|
|
19
|
+
*
|
|
20
|
+
* Copyright IBM Corp. 2019, 2023
|
|
21
|
+
*
|
|
22
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
23
|
+
* LICENSE file in the root directory of this source tree.
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Menu Item.
|
|
27
|
+
*
|
|
28
|
+
* @element cds-custom-menu-item
|
|
29
|
+
*/
|
|
30
|
+
let CDSmenuItemSelectable = class CDSmenuItemSelectable extends LitElement {
|
|
31
|
+
constructor() {
|
|
32
|
+
super(...arguments);
|
|
33
|
+
/**
|
|
34
|
+
* Whether the menu item is selected or not.
|
|
35
|
+
*/
|
|
36
|
+
this.selected = false;
|
|
37
|
+
this._handleClick = (e) => {
|
|
38
|
+
this.selected = !this.selected;
|
|
39
|
+
const init = {
|
|
40
|
+
bubbles: true,
|
|
41
|
+
cancelable: true,
|
|
42
|
+
composed: true,
|
|
43
|
+
detail: {
|
|
44
|
+
triggeredBy: e.target,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
if (this.dispatchEvent(new CustomEvent(this.constructor.eventOnChange, init))) {
|
|
48
|
+
this.dispatchEvent(new CustomEvent(this.constructor.eventOnChange, init));
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The name of the custom event fired when the selection state changes.
|
|
54
|
+
*/
|
|
55
|
+
static get eventOnChange() {
|
|
56
|
+
return `${prefix}-item-changed`;
|
|
57
|
+
}
|
|
58
|
+
firstUpdated() {
|
|
59
|
+
this.context.updateFromChild({ hasSelectableItems: true });
|
|
60
|
+
}
|
|
61
|
+
render() {
|
|
62
|
+
const { label, selected, _handleClick: handleClick } = this;
|
|
63
|
+
return html `
|
|
64
|
+
<cds-custom-menu-item
|
|
65
|
+
label="${label}"
|
|
66
|
+
class="${prefix}--menu-item-selectable--selected"
|
|
67
|
+
role="menuitemcheckbox"
|
|
68
|
+
shortcut=${this.shortcut}
|
|
69
|
+
aria-checked="${selected}"
|
|
70
|
+
@click="${handleClick}">
|
|
71
|
+
<slot slot="render-icon" name="render-icon"></slot>
|
|
72
|
+
</cds-custom-menu-item>
|
|
73
|
+
`;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
CDSmenuItemSelectable.styles = styles; // `styles` here is a `CSSResult` generated by custom Vite loader
|
|
77
|
+
__decorate([
|
|
78
|
+
consume({ context: MenuContext })
|
|
79
|
+
], CDSmenuItemSelectable.prototype, "context", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
property({ type: String })
|
|
82
|
+
], CDSmenuItemSelectable.prototype, "label", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
property({ type: Boolean })
|
|
85
|
+
], CDSmenuItemSelectable.prototype, "selected", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
property()
|
|
88
|
+
], CDSmenuItemSelectable.prototype, "renderIcon", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
property()
|
|
91
|
+
], CDSmenuItemSelectable.prototype, "shortcut", void 0);
|
|
92
|
+
CDSmenuItemSelectable = __decorate([
|
|
93
|
+
carbonElement(`${prefix}-menu-item-selectable`)
|
|
94
|
+
], CDSmenuItemSelectable);
|
|
95
|
+
var CDSmenuItemSelectable$1 = CDSmenuItemSelectable;
|
|
96
|
+
|
|
97
|
+
export { CDSmenuItemSelectable$1 as default };
|
|
98
|
+
//# sourceMappingURL=menu-item-selectable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu-item-selectable.js","sources":["../../../src/components/menu/menu-item-selectable.ts"],"sourcesContent":[null],"names":["customElement"],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;AASH;;;;AAIG;AAEH,IAAM,qBAAqB,GAA3B,MA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