@ui5/webcomponents 2.25.0 → 2.25.1-rc.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/CHANGELOG.md +11 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/SegmentedButton.d.ts +1 -2
- package/dist/SegmentedButton.js +7 -5
- package/dist/SegmentedButton.js.map +1 -1
- package/dist/SegmentedButtonItem.d.ts +1 -2
- package/dist/SegmentedButtonItem.js +2 -5
- package/dist/SegmentedButtonItem.js.map +1 -1
- package/dist/SegmentedButtonItemTemplate.js +1 -1
- package/dist/SegmentedButtonItemTemplate.js.map +1 -1
- package/dist/SegmentedButtonTemplate.js +1 -1
- package/dist/SegmentedButtonTemplate.js.map +1 -1
- package/dist/web-types.json +1 -1
- package/package.json +9 -9
- package/src/SegmentedButtonItemTemplate.tsx +0 -1
- package/src/SegmentedButtonTemplate.tsx +0 -1
|
@@ -120,8 +120,7 @@ declare class SegmentedButton extends UI5Element {
|
|
|
120
120
|
get selectedItems(): Array<ISegmentedButtonItem>;
|
|
121
121
|
get navigatableItems(): SegmentedButtonItem[];
|
|
122
122
|
get ariaLabelText(): string | undefined;
|
|
123
|
-
get ariaDescriptionText(): string;
|
|
124
|
-
get ariaRoleDescription(): string;
|
|
123
|
+
get ariaDescriptionText(): string | undefined;
|
|
125
124
|
}
|
|
126
125
|
export default SegmentedButton;
|
|
127
126
|
export type { SegmentedButtonSelectionChangeEventDetail, ISegmentedButtonItem, };
|
package/dist/SegmentedButton.js
CHANGED
|
@@ -15,7 +15,9 @@ import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
|
|
|
15
15
|
import ItemNavigation from "@ui5/webcomponents-base/dist/delegate/ItemNavigation.js";
|
|
16
16
|
import i18n from "@ui5/webcomponents-base/dist/decorators/i18n.js";
|
|
17
17
|
import { isSpace, isEnter, isShift, isEscape, isSpaceShift, } from "@ui5/webcomponents-base/dist/Keys.js";
|
|
18
|
-
import {
|
|
18
|
+
import { LIST_ITEM_SELECTED } from "./generated/i18n/i18n-defaults.js";
|
|
19
|
+
import announce from "@ui5/webcomponents-base/dist/util/InvisibleMessage.js";
|
|
20
|
+
import InvisibleMessageMode from "@ui5/webcomponents-base/dist/types/InvisibleMessageMode.js";
|
|
19
21
|
import "./SegmentedButtonItem.js";
|
|
20
22
|
import SegmentedButtonSelectionMode from "./types/SegmentedButtonSelectionMode.js";
|
|
21
23
|
// Template
|
|
@@ -122,6 +124,9 @@ let SegmentedButton = SegmentedButton_1 = class SegmentedButton extends UI5Eleme
|
|
|
122
124
|
this.fireDecoratorEvent("selection-change", {
|
|
123
125
|
selectedItems: this.selectedItems,
|
|
124
126
|
});
|
|
127
|
+
if (target.selected) {
|
|
128
|
+
announce(SegmentedButton_1.i18nBundle.getText(LIST_ITEM_SELECTED), InvisibleMessageMode.Assertive);
|
|
129
|
+
}
|
|
125
130
|
this._itemNavigation.setCurrentItem(target);
|
|
126
131
|
return this;
|
|
127
132
|
}
|
|
@@ -207,10 +212,7 @@ let SegmentedButton = SegmentedButton_1 = class SegmentedButton extends UI5Eleme
|
|
|
207
212
|
return getEffectiveAriaLabelText(this) || getAssociatedLabelForTexts(this) || undefined;
|
|
208
213
|
}
|
|
209
214
|
get ariaDescriptionText() {
|
|
210
|
-
return
|
|
211
|
-
}
|
|
212
|
-
get ariaRoleDescription() {
|
|
213
|
-
return SegmentedButton_1.i18nBundle.getText(SEGMENTEDBUTTON_ARIA_DESCRIPTION);
|
|
215
|
+
return getEffectiveAriaDescriptionText(this) || undefined;
|
|
214
216
|
}
|
|
215
217
|
};
|
|
216
218
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SegmentedButton.js","sourceRoot":"","sources":["../src/SegmentedButton.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,UAAU,MAAM,4CAA4C,CAAC;AAEpE,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MA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0B,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC;IACzF,CAAC;IAED,IAAI,mBAAmB;QACtB,OAAO,GAAG,CAAC,+BAA+B,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,iBAAe,CAAC,UAAU,CAAC,OAAO,CAAC,gCAAgC,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;IAC1I,CAAC;IAED,IAAI,mBAAmB;QACtB,OAAO,iBAAe,CAAC,UAAU,CAAC,OAAO,CAAC,gCAAgC,CAAC,CAAC;IAC7E,CAAC;CACD,CAAA;AA9PA;IADC,QAAQ,EAAE;uDACa;AASxB;IADC,QAAQ,EAAE;0DACgB;AAS3B;IADC,QAAQ,EAAE;8DACoB;AAS/B;IADC,QAAQ,EAAE;iEACuB;AASlC;IADC,QAAQ,EAAE;sDACiD;AAa5D;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wDACK;AAUjC;IADC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,uBAAuB,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;8CAClC;AAGnC;IADN,IAAI,CAAC,oBAAoB,CAAC;yCACG;AAzEzB,eAAe;IAhBpB,aAAa,CAAC;QACd,GAAG,EAAE,sBAAsB;QAC3B,aAAa,EAAE,IAAI;QACnB,QAAQ,EAAE,WAAW;QACrB,QAAQ,EAAE,uBAAuB;QACjC,MAAM,EAAE,kBAAkB;KAC1B,CAAC;IACF;;;;OAIG;;IACF,KAAK,CAAC,kBAAkB,EAAE;QAC1B,OAAO,EAAE,IAAI;KACb,CAAC;GAEI,eAAe,CAyQpB;AAED,eAAe,CAAC,MAAM,EAAE,CAAC;AAEzB,eAAe,eAAe,CAAC","sourcesContent":["import UI5Element from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport type { DefaultSlot } from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport event from \"@ui5/webcomponents-base/dist/decorators/event-strict.js\";\nimport slot from \"@ui5/webcomponents-base/dist/decorators/slot-strict.js\";\nimport {\n\tgetEffectiveAriaLabelText,\n\tgetAssociatedLabelForTexts,\n\tgetEffectiveAriaDescriptionText,\n} from \"@ui5/webcomponents-base/dist/util/AccessibilityTextsHelper.js\";\nimport jsxRenderer from \"@ui5/webcomponents-base/dist/renderer/JsxRenderer.js\";\nimport ItemNavigation from \"@ui5/webcomponents-base/dist/delegate/ItemNavigation.js\";\nimport type { ITabbable } from \"@ui5/webcomponents-base/dist/delegate/ItemNavigation.js\";\nimport type I18nBundle from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport i18n from \"@ui5/webcomponents-base/dist/decorators/i18n.js\";\nimport {\n\tisSpace,\n\tisEnter,\n\tisShift,\n\tisEscape,\n\tisSpaceShift,\n} from \"@ui5/webcomponents-base/dist/Keys.js\";\nimport { SEGMENTEDBUTTON_ARIA_DESCRIPTION, SEGMENTEDBUTTON_ARIA_DESCRIBEDBY } from \"./generated/i18n/i18n-defaults.js\";\nimport \"./SegmentedButtonItem.js\";\nimport type SegmentedButtonItem from \"./SegmentedButtonItem.js\";\nimport SegmentedButtonSelectionMode from \"./types/SegmentedButtonSelectionMode.js\";\n\n// Template\nimport SegmentedButtonTemplate from \"./SegmentedButtonTemplate.js\";\n\n// Styles\nimport SegmentedButtonCss from \"./generated/themes/SegmentedButton.css.js\";\n\n/**\n * Interface for components that may be slotted inside `ui5-segmented-button` as items\n * @public\n */\ninterface ISegmentedButtonItem extends UI5Element, ITabbable {\n\tdisabled: boolean,\n\tselected: boolean,\n}\n\ntype SegmentedButtonSelectionChangeEventDetail = {\n\tselectedItems: Array<ISegmentedButtonItem>,\n}\n\n/**\n * @class\n *\n * ### Overview\n *\n * The `ui5-segmented-button` shows a group of items. When the user clicks or taps\n * one of the items, it stays in a pressed state. It automatically resizes the items\n * to fit proportionally within the component. When no width is set, the component uses the available width.\n *\n *\n * ### ES6 Module Import\n *\n * `import \"@ui5/webcomponents/dist/SegmentedButton.js\";`\n * @constructor\n * @extends UI5Element\n * @since 1.0.0-rc.6\n * @public\n */\n@customElement({\n\ttag: \"ui5-segmented-button\",\n\tlanguageAware: true,\n\trenderer: jsxRenderer,\n\ttemplate: SegmentedButtonTemplate,\n\tstyles: SegmentedButtonCss,\n})\n/**\n * Fired when the selected item changes.\n * @param {Array<ISegmentedButtonItem>} selectedItems an array of selected items. Since: 1.14.0\n * @public\n */\n@event(\"selection-change\", {\n\tbubbles: true,\n})\n\nclass SegmentedButton extends UI5Element {\n\teventDetails!: {\n\t\t\"selection-change\": SegmentedButtonSelectionChangeEventDetail,\n\t}\n\t/**\n\t * Defines the accessible ARIA name of the component.\n\t * @default undefined\n\t * @public\n\t * @since 1.0.3\n\t */\n\t@property()\n\taccessibleName?: string;\n\n\t/**\n\t * Defines the IDs of the HTML Elements that label the component.\n\t * @default undefined\n\t * @public\n\t * @since 2.15.0\n\t */\n\t@property()\n\taccessibleNameRef?: string;\n\n\t/**\n\t * Defines the accessible description of the component.\n\t * @default undefined\n\t * @public\n\t * @since 2.15.0\n\t */\n\t@property()\n\taccessibleDescription?: string;\n\n\t/**\n\t * Defines the IDs of the HTML Elements that describe the component.\n\t * @default undefined\n\t * @public\n\t * @since 2.15.0\n\t */\n\t@property()\n\taccessibleDescriptionRef?: string;\n\n\t/**\n\t * Defines the component selection mode.\n\t * @default \"Single\"\n\t * @public\n\t * @since 1.14.0\n\t */\n\t@property()\n\tselectionMode: `${SegmentedButtonSelectionMode}` = \"Single\";\n\n\t/**\n\t * Determines whether the segmented button items should be sized to fit their content.\n\t *\n\t * If set to `true`, each item will be sized to fit its content, with any extra space distributed after the last item.\n\t * If set to `false` (the default), all items will be equally sized to fill the available space.\n\t *\n\t * @default false\n\t * @public\n\t * @since 2.16.0\n\t*/\n\t@property({ type: Boolean })\n\titemsFitContent: boolean = false;\n\t/**\n\t * Defines the items of `ui5-segmented-button`.\n\t *\n\t * **Note:** Multiple items are allowed.\n\t *\n\t * **Note:** Use the `ui5-segmented-button-item` for the intended design.\n\t * @public\n\t */\n\t@slot({ type: HTMLElement, invalidateOnChildChange: true, \"default\": true })\n\titems!: DefaultSlot<ISegmentedButtonItem>;\n\n\t@i18n(\"@ui5/webcomponents\")\n\tstatic i18nBundle: I18nBundle;\n\n\t_itemNavigation: ItemNavigation;\n\n\thasPreviouslyFocusedItem: boolean;\n\n\t_selectedItem?: ISegmentedButtonItem;\n\n\t_cancelAction: boolean;\n\t_isSpacePressed: boolean;\n\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis._itemNavigation = new ItemNavigation(this, {\n\t\t\tgetItemsCallback: () => this.navigatableItems,\n\t\t});\n\t\tthis.hasPreviouslyFocusedItem = false;\n\t\tthis._cancelAction = false;\n\t\tthis._isSpacePressed = false;\n\t}\n\n\tonBeforeRendering() {\n\t\tconst items = this.getSlottedNodes<SegmentedButtonItem>(\"items\");\n\t\tconst visibleItems = items.filter(item => !item.hidden);\n\t\tlet index = 1;\n\n\t\titems.forEach(item => {\n\t\t\titem.posInSet = item.hidden ? undefined : index++;\n\t\t\titem.sizeOfSet = item.hidden ? undefined : visibleItems.length;\n\t\t});\n\n\t\tthis.normalizeSelection();\n\n\t\tif (!this.itemsFitContent) {\n\t\t\tthis.style.setProperty(\"--_ui5_segmented_btn_items_count\", `${visibleItems.length}`);\n\t\t}\n\t}\n\n\tnormalizeSelection() {\n\t\tif (!this.items.length) {\n\t\t\treturn;\n\t\t}\n\n\t\tswitch (this.selectionMode) {\n\t\tcase SegmentedButtonSelectionMode.Single: {\n\t\t\tconst selectedItems = this.selectedItems;\n\t\t\tconst selectedItemIndex = this._selectedItem ? selectedItems.indexOf(this._selectedItem) : -1;\n\t\t\tif (this._selectedItem && selectedItems.length > 1) {\n\t\t\t\tselectedItems.splice(selectedItemIndex, 1);\n\t\t\t}\n\t\t\tconst selectedItem = selectedItems.pop() || this.items[0];\n\t\t\tthis._applySingleSelection(selectedItem);\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t}\n\t}\n\n\tgetFocusDomRef(): HTMLElement | undefined {\n\t\treturn this._itemNavigation._getCurrentItem();\n\t}\n\n\t_selectItem(e: MouseEvent | KeyboardEvent) {\n\t\tconst target = e.target as SegmentedButtonItem;\n\t\tconst isTargetSegmentedButtonItem = target.hasAttribute(\"ui5-segmented-button-item\");\n\n\t\tif (target.disabled || target === this.getDomRef() || !isTargetSegmentedButtonItem) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Check if preventDefault was called on the native event (e.g., by item's semantic click handler)\n\t\tif (e.defaultPrevented) {\n\t\t\treturn;\n\t\t}\n\n\t\tswitch (this.selectionMode) {\n\t\tcase SegmentedButtonSelectionMode.Multiple:\n\t\t\ttarget.selected = !target.selected;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthis._applySingleSelection(target as unknown as ISegmentedButtonItem);\n\t\t}\n\n\t\tthis.fireDecoratorEvent(\"selection-change\", {\n\t\t\tselectedItems: this.selectedItems,\n\t\t});\n\n\t\tthis._itemNavigation.setCurrentItem(target);\n\n\t\treturn this;\n\t}\n\n\t_applySingleSelection(item: ISegmentedButtonItem) {\n\t\tthis.items.forEach(currentItem => {\n\t\t\tcurrentItem.selected = false;\n\t\t});\n\t\titem.selected = true;\n\t\tthis._selectedItem = item;\n\t}\n\n\t_onclick(e: MouseEvent) {\n\t\tthis._selectItem(e);\n\t}\n\n\t_onkeydown(e: KeyboardEvent) {\n\t\tif (isEnter(e)) {\n\t\t\tthis._selectItem(e);\n\t\t} else if (isSpace(e)) {\n\t\t\te.preventDefault(); // Prevent scrolling\n\t\t\tthis._isSpacePressed = true;\n\t\t} else if (isShift(e) || isEscape(e)) {\n\t\t\tthis._cancelAction = true; // Set the flag to cancel the action\n\t\t}\n\t}\n\n\t_onkeyup(e: KeyboardEvent) {\n\t\tconst isSpaceKey = isSpace(e);\n\t\tconst isCancelKey = isShift(e) || isEscape(e);\n\n\t\tif (isSpaceKey || isSpaceShift(e)) {\n\t\t\tif (this._cancelAction) {\n\t\t\t\tthis._cancelAction = false;\n\t\t\t\tthis._isSpacePressed = false;\n\t\t\t\te.preventDefault();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._isSpacePressed = false;\n\t\t} else if (isCancelKey && !this._isSpacePressed) {\n\t\t\tthis._cancelAction = false;\n\t\t}\n\n\t\tif (isSpaceKey) {\n\t\t\tthis._selectItem(e);\n\t\t}\n\t}\n\n\t_onmousedown(e: MouseEvent) {\n\t\tconst eventTarget = e.target as SegmentedButtonItem;\n\t\tconst isTargetSegmentedButtonItem = eventTarget.hasAttribute(\"ui5-segmented-button-item\");\n\n\t\tif (isTargetSegmentedButtonItem) {\n\t\t\tthis._itemNavigation.setCurrentItem(eventTarget);\n\t\t\tthis.hasPreviouslyFocusedItem = true;\n\t\t}\n\t}\n\n\t_onfocusin(e: FocusEvent) {\n\t\t// If the component was previously focused,\n\t\t// update the ItemNavigation to sync the button's tabindex values\n\t\tif (this.hasPreviouslyFocusedItem) {\n\t\t\tthis._itemNavigation.setCurrentItem(e.target as SegmentedButtonItem);\n\t\t\treturn;\n\t\t}\n\n\t\t// If the component is focused for the first time\n\t\t// focus the selected item if such is present\n\t\tif (this.selectedItems.length) {\n\t\t\tthis._itemNavigation.setCurrentItem(this.selectedItems[0]);\n\t\t\tthis.selectedItems[0].focus();\n\t\t\tthis.hasPreviouslyFocusedItem = true;\n\t\t}\n\t}\n\n\t/**\n\t * Returns an array of the currently selected items.\n\t * @since 1.14.0\n\t * @public\n\t * @default []\n\t */\n\tget selectedItems(): Array<ISegmentedButtonItem> {\n\t\treturn this.items.filter(item => item.selected);\n\t}\n\n\tget navigatableItems() {\n\t\treturn this.getSlottedNodes<SegmentedButtonItem>(\"items\").filter(item => {\n\t\t\treturn !item.disabled;\n\t\t});\n\t}\n\n\tget ariaLabelText() {\n\t\treturn getEffectiveAriaLabelText(this) || getAssociatedLabelForTexts(this) || undefined;\n\t}\n\n\tget ariaDescriptionText() {\n\t\treturn `${(getEffectiveAriaDescriptionText(this) || \"\")} ${SegmentedButton.i18nBundle.getText(SEGMENTEDBUTTON_ARIA_DESCRIBEDBY)}`.trim();\n\t}\n\n\tget ariaRoleDescription() {\n\t\treturn SegmentedButton.i18nBundle.getText(SEGMENTEDBUTTON_ARIA_DESCRIPTION);\n\t}\n}\n\nSegmentedButton.define();\n\nexport default SegmentedButton;\nexport type {\n\tSegmentedButtonSelectionChangeEventDetail,\n\tISegmentedButtonItem,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"SegmentedButton.js","sourceRoot":"","sources":["../src/SegmentedButton.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,UAAU,MAAM,4CAA4C,CAAC;AAEpE,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,KAAK,MAAM,yDAAyD,CAAC;AAC5E,OAAO,IAAI,MAAM,wDAAwD,CAAC;AAC1E,OAAO,EACN,yBAAyB,EACzB,0BAA0B,EAC1B,+BAA+B,GAC/B,MAAM,+DAA+D,CAAC;AACvE,OAAO,WAAW,MAAM,sDAAsD,CAAC;AAC/E,OAAO,cAAc,MAAM,yDAAyD,CAAC;AAGrF,OAAO,IAAI,MAAM,iDAAiD,CAAC;AACnE,OAAO,EACN,OAAO,EACP,OAAO,EACP,OAAO,EACP,QAAQ,EACR,YAAY,GACZ,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,QAAQ,MAAM,uDAAuD,CAAC;AAC7E,OAAO,oBAAoB,MAAM,4DAA4D,CAAC;AAC9F,OAAO,0BAA0B,CAAC;AAElC,OAAO,4BAA4B,MAAM,yCAAyC,CAAC;AAEnF,WAAW;AACX,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AAEnE,SAAS;AACT,OAAO,kBAAkB,MAA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AE,SAAS,EAAE,IAAI,EAAE,CAAC;8CAClC;AAGnC;IADN,IAAI,CAAC,oBAAoB,CAAC;yCACG;AAzEzB,eAAe;IAhBpB,aAAa,CAAC;QACd,GAAG,EAAE,sBAAsB;QAC3B,aAAa,EAAE,IAAI;QACnB,QAAQ,EAAE,WAAW;QACrB,QAAQ,EAAE,uBAAuB;QACjC,MAAM,EAAE,kBAAkB;KAC1B,CAAC;IACF;;;;OAIG;;IACF,KAAK,CAAC,kBAAkB,EAAE;QAC1B,OAAO,EAAE,IAAI;KACb,CAAC;GAEI,eAAe,CAyQpB;AAED,eAAe,CAAC,MAAM,EAAE,CAAC;AAEzB,eAAe,eAAe,CAAC","sourcesContent":["import UI5Element from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport type { DefaultSlot } from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport event from \"@ui5/webcomponents-base/dist/decorators/event-strict.js\";\nimport slot from \"@ui5/webcomponents-base/dist/decorators/slot-strict.js\";\nimport {\n\tgetEffectiveAriaLabelText,\n\tgetAssociatedLabelForTexts,\n\tgetEffectiveAriaDescriptionText,\n} from \"@ui5/webcomponents-base/dist/util/AccessibilityTextsHelper.js\";\nimport jsxRenderer from \"@ui5/webcomponents-base/dist/renderer/JsxRenderer.js\";\nimport ItemNavigation from \"@ui5/webcomponents-base/dist/delegate/ItemNavigation.js\";\nimport type { ITabbable } from \"@ui5/webcomponents-base/dist/delegate/ItemNavigation.js\";\nimport type I18nBundle from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport i18n from \"@ui5/webcomponents-base/dist/decorators/i18n.js\";\nimport {\n\tisSpace,\n\tisEnter,\n\tisShift,\n\tisEscape,\n\tisSpaceShift,\n} from \"@ui5/webcomponents-base/dist/Keys.js\";\nimport { LIST_ITEM_SELECTED } from \"./generated/i18n/i18n-defaults.js\";\nimport announce from \"@ui5/webcomponents-base/dist/util/InvisibleMessage.js\";\nimport InvisibleMessageMode from \"@ui5/webcomponents-base/dist/types/InvisibleMessageMode.js\";\nimport \"./SegmentedButtonItem.js\";\nimport type SegmentedButtonItem from \"./SegmentedButtonItem.js\";\nimport SegmentedButtonSelectionMode from \"./types/SegmentedButtonSelectionMode.js\";\n\n// Template\nimport SegmentedButtonTemplate from \"./SegmentedButtonTemplate.js\";\n\n// Styles\nimport SegmentedButtonCss from \"./generated/themes/SegmentedButton.css.js\";\n\n/**\n * Interface for components that may be slotted inside `ui5-segmented-button` as items\n * @public\n */\ninterface ISegmentedButtonItem extends UI5Element, ITabbable {\n\tdisabled: boolean,\n\tselected: boolean,\n}\n\ntype SegmentedButtonSelectionChangeEventDetail = {\n\tselectedItems: Array<ISegmentedButtonItem>,\n}\n\n/**\n * @class\n *\n * ### Overview\n *\n * The `ui5-segmented-button` shows a group of items. When the user clicks or taps\n * one of the items, it stays in a pressed state. It automatically resizes the items\n * to fit proportionally within the component. When no width is set, the component uses the available width.\n *\n *\n * ### ES6 Module Import\n *\n * `import \"@ui5/webcomponents/dist/SegmentedButton.js\";`\n * @constructor\n * @extends UI5Element\n * @since 1.0.0-rc.6\n * @public\n */\n@customElement({\n\ttag: \"ui5-segmented-button\",\n\tlanguageAware: true,\n\trenderer: jsxRenderer,\n\ttemplate: SegmentedButtonTemplate,\n\tstyles: SegmentedButtonCss,\n})\n/**\n * Fired when the selected item changes.\n * @param {Array<ISegmentedButtonItem>} selectedItems an array of selected items. Since: 1.14.0\n * @public\n */\n@event(\"selection-change\", {\n\tbubbles: true,\n})\n\nclass SegmentedButton extends UI5Element {\n\teventDetails!: {\n\t\t\"selection-change\": SegmentedButtonSelectionChangeEventDetail,\n\t}\n\t/**\n\t * Defines the accessible ARIA name of the component.\n\t * @default undefined\n\t * @public\n\t * @since 1.0.3\n\t */\n\t@property()\n\taccessibleName?: string;\n\n\t/**\n\t * Defines the IDs of the HTML Elements that label the component.\n\t * @default undefined\n\t * @public\n\t * @since 2.15.0\n\t */\n\t@property()\n\taccessibleNameRef?: string;\n\n\t/**\n\t * Defines the accessible description of the component.\n\t * @default undefined\n\t * @public\n\t * @since 2.15.0\n\t */\n\t@property()\n\taccessibleDescription?: string;\n\n\t/**\n\t * Defines the IDs of the HTML Elements that describe the component.\n\t * @default undefined\n\t * @public\n\t * @since 2.15.0\n\t */\n\t@property()\n\taccessibleDescriptionRef?: string;\n\n\t/**\n\t * Defines the component selection mode.\n\t * @default \"Single\"\n\t * @public\n\t * @since 1.14.0\n\t */\n\t@property()\n\tselectionMode: `${SegmentedButtonSelectionMode}` = \"Single\";\n\n\t/**\n\t * Determines whether the segmented button items should be sized to fit their content.\n\t *\n\t * If set to `true`, each item will be sized to fit its content, with any extra space distributed after the last item.\n\t * If set to `false` (the default), all items will be equally sized to fill the available space.\n\t *\n\t * @default false\n\t * @public\n\t * @since 2.16.0\n\t*/\n\t@property({ type: Boolean })\n\titemsFitContent: boolean = false;\n\t/**\n\t * Defines the items of `ui5-segmented-button`.\n\t *\n\t * **Note:** Multiple items are allowed.\n\t *\n\t * **Note:** Use the `ui5-segmented-button-item` for the intended design.\n\t * @public\n\t */\n\t@slot({ type: HTMLElement, invalidateOnChildChange: true, \"default\": true })\n\titems!: DefaultSlot<ISegmentedButtonItem>;\n\n\t@i18n(\"@ui5/webcomponents\")\n\tstatic i18nBundle: I18nBundle;\n\n\t_itemNavigation: ItemNavigation;\n\n\thasPreviouslyFocusedItem: boolean;\n\n\t_selectedItem?: ISegmentedButtonItem;\n\n\t_cancelAction: boolean;\n\t_isSpacePressed: boolean;\n\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis._itemNavigation = new ItemNavigation(this, {\n\t\t\tgetItemsCallback: () => this.navigatableItems,\n\t\t});\n\t\tthis.hasPreviouslyFocusedItem = false;\n\t\tthis._cancelAction = false;\n\t\tthis._isSpacePressed = false;\n\t}\n\n\tonBeforeRendering() {\n\t\tconst items = this.getSlottedNodes<SegmentedButtonItem>(\"items\");\n\t\tconst visibleItems = items.filter(item => !item.hidden);\n\t\tlet index = 1;\n\n\t\titems.forEach(item => {\n\t\t\titem.posInSet = item.hidden ? undefined : index++;\n\t\t\titem.sizeOfSet = item.hidden ? undefined : visibleItems.length;\n\t\t});\n\n\t\tthis.normalizeSelection();\n\n\t\tif (!this.itemsFitContent) {\n\t\t\tthis.style.setProperty(\"--_ui5_segmented_btn_items_count\", `${visibleItems.length}`);\n\t\t}\n\t}\n\n\tnormalizeSelection() {\n\t\tif (!this.items.length) {\n\t\t\treturn;\n\t\t}\n\n\t\tswitch (this.selectionMode) {\n\t\tcase SegmentedButtonSelectionMode.Single: {\n\t\t\tconst selectedItems = this.selectedItems;\n\t\t\tconst selectedItemIndex = this._selectedItem ? selectedItems.indexOf(this._selectedItem) : -1;\n\t\t\tif (this._selectedItem && selectedItems.length > 1) {\n\t\t\t\tselectedItems.splice(selectedItemIndex, 1);\n\t\t\t}\n\t\t\tconst selectedItem = selectedItems.pop() || this.items[0];\n\t\t\tthis._applySingleSelection(selectedItem);\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t}\n\t}\n\n\tgetFocusDomRef(): HTMLElement | undefined {\n\t\treturn this._itemNavigation._getCurrentItem();\n\t}\n\n\t_selectItem(e: MouseEvent | KeyboardEvent) {\n\t\tconst target = e.target as SegmentedButtonItem;\n\t\tconst isTargetSegmentedButtonItem = target.hasAttribute(\"ui5-segmented-button-item\");\n\n\t\tif (target.disabled || target === this.getDomRef() || !isTargetSegmentedButtonItem) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Check if preventDefault was called on the native event (e.g., by item's semantic click handler)\n\t\tif (e.defaultPrevented) {\n\t\t\treturn;\n\t\t}\n\n\t\tswitch (this.selectionMode) {\n\t\tcase SegmentedButtonSelectionMode.Multiple:\n\t\t\ttarget.selected = !target.selected;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthis._applySingleSelection(target as unknown as ISegmentedButtonItem);\n\t\t}\n\n\t\tthis.fireDecoratorEvent(\"selection-change\", {\n\t\t\tselectedItems: this.selectedItems,\n\t\t});\n\n\t\tif (target.selected) {\n\t\t\tannounce(SegmentedButton.i18nBundle.getText(LIST_ITEM_SELECTED), InvisibleMessageMode.Assertive);\n\t\t}\n\n\t\tthis._itemNavigation.setCurrentItem(target);\n\n\t\treturn this;\n\t}\n\n\t_applySingleSelection(item: ISegmentedButtonItem) {\n\t\tthis.items.forEach(currentItem => {\n\t\t\tcurrentItem.selected = false;\n\t\t});\n\t\titem.selected = true;\n\t\tthis._selectedItem = item;\n\t}\n\n\t_onclick(e: MouseEvent) {\n\t\tthis._selectItem(e);\n\t}\n\n\t_onkeydown(e: KeyboardEvent) {\n\t\tif (isEnter(e)) {\n\t\t\tthis._selectItem(e);\n\t\t} else if (isSpace(e)) {\n\t\t\te.preventDefault(); // Prevent scrolling\n\t\t\tthis._isSpacePressed = true;\n\t\t} else if (isShift(e) || isEscape(e)) {\n\t\t\tthis._cancelAction = true; // Set the flag to cancel the action\n\t\t}\n\t}\n\n\t_onkeyup(e: KeyboardEvent) {\n\t\tconst isSpaceKey = isSpace(e);\n\t\tconst isCancelKey = isShift(e) || isEscape(e);\n\n\t\tif (isSpaceKey || isSpaceShift(e)) {\n\t\t\tif (this._cancelAction) {\n\t\t\t\tthis._cancelAction = false;\n\t\t\t\tthis._isSpacePressed = false;\n\t\t\t\te.preventDefault();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._isSpacePressed = false;\n\t\t} else if (isCancelKey && !this._isSpacePressed) {\n\t\t\tthis._cancelAction = false;\n\t\t}\n\n\t\tif (isSpaceKey) {\n\t\t\tthis._selectItem(e);\n\t\t}\n\t}\n\n\t_onmousedown(e: MouseEvent) {\n\t\tconst eventTarget = e.target as SegmentedButtonItem;\n\t\tconst isTargetSegmentedButtonItem = eventTarget.hasAttribute(\"ui5-segmented-button-item\");\n\n\t\tif (isTargetSegmentedButtonItem) {\n\t\t\tthis._itemNavigation.setCurrentItem(eventTarget);\n\t\t\tthis.hasPreviouslyFocusedItem = true;\n\t\t}\n\t}\n\n\t_onfocusin(e: FocusEvent) {\n\t\t// If the component was previously focused,\n\t\t// update the ItemNavigation to sync the button's tabindex values\n\t\tif (this.hasPreviouslyFocusedItem) {\n\t\t\tthis._itemNavigation.setCurrentItem(e.target as SegmentedButtonItem);\n\t\t\treturn;\n\t\t}\n\n\t\t// If the component is focused for the first time\n\t\t// focus the selected item if such is present\n\t\tif (this.selectedItems.length) {\n\t\t\tthis._itemNavigation.setCurrentItem(this.selectedItems[0]);\n\t\t\tthis.selectedItems[0].focus();\n\t\t\tthis.hasPreviouslyFocusedItem = true;\n\t\t}\n\t}\n\n\t/**\n\t * Returns an array of the currently selected items.\n\t * @since 1.14.0\n\t * @public\n\t * @default []\n\t */\n\tget selectedItems(): Array<ISegmentedButtonItem> {\n\t\treturn this.items.filter(item => item.selected);\n\t}\n\n\tget navigatableItems() {\n\t\treturn this.getSlottedNodes<SegmentedButtonItem>(\"items\").filter(item => {\n\t\t\treturn !item.disabled;\n\t\t});\n\t}\n\n\tget ariaLabelText() {\n\t\treturn getEffectiveAriaLabelText(this) || getAssociatedLabelForTexts(this) || undefined;\n\t}\n\n\tget ariaDescriptionText() {\n\t\treturn getEffectiveAriaDescriptionText(this) || undefined;\n\t}\n}\n\nSegmentedButton.define();\n\nexport default SegmentedButton;\nexport type {\n\tSegmentedButtonSelectionChangeEventDetail,\n\tISegmentedButtonItem,\n};\n"]}
|
|
@@ -131,7 +131,6 @@ declare class SegmentedButtonItem extends UI5Element implements IButton, ISegmen
|
|
|
131
131
|
*/
|
|
132
132
|
text: DefaultSlot<Node>;
|
|
133
133
|
static i18nBundle: I18nBundle;
|
|
134
|
-
get ariaDescription(): string;
|
|
135
134
|
constructor();
|
|
136
135
|
_onclick(e: MouseEvent): void;
|
|
137
136
|
onEnterDOM(): void;
|
|
@@ -139,7 +138,7 @@ declare class SegmentedButtonItem extends UI5Element implements IButton, ISegmen
|
|
|
139
138
|
_onkeyup(e: KeyboardEvent): void;
|
|
140
139
|
get tabIndexValue(): string | undefined;
|
|
141
140
|
get ariaLabelText(): string | undefined;
|
|
142
|
-
get ariaDescriptionText(): string
|
|
141
|
+
get ariaDescriptionText(): string;
|
|
143
142
|
get showIconTooltip(): boolean;
|
|
144
143
|
get slotTextContent(): string;
|
|
145
144
|
}
|
|
@@ -16,7 +16,7 @@ import { getEffectiveAriaLabelText, getAssociatedLabelForTexts, getEffectiveAria
|
|
|
16
16
|
import willShowContent from "@ui5/webcomponents-base/dist/util/willShowContent.js";
|
|
17
17
|
import slot from "@ui5/webcomponents-base/dist/decorators/slot-strict.js";
|
|
18
18
|
import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
|
|
19
|
-
import {
|
|
19
|
+
import { SEGMENTEDBUTTON_ARIA_DESCRIBEDBY } from "./generated/i18n/i18n-defaults.js";
|
|
20
20
|
import SegmentedButtonItemTemplate from "./SegmentedButtonItemTemplate.js";
|
|
21
21
|
import event from "@ui5/webcomponents-base/dist/decorators/event-strict.js";
|
|
22
22
|
import segmentedButtonItemCss from "./generated/themes/SegmentedButtonItem.css.js";
|
|
@@ -42,9 +42,6 @@ import segmentedButtonItemCss from "./generated/themes/SegmentedButtonItem.css.j
|
|
|
42
42
|
* @public
|
|
43
43
|
*/
|
|
44
44
|
let SegmentedButtonItem = SegmentedButtonItem_1 = class SegmentedButtonItem extends UI5Element {
|
|
45
|
-
get ariaDescription() {
|
|
46
|
-
return SegmentedButtonItem_1.i18nBundle.getText(SEGMENTEDBUTTONITEM_ARIA_DESCRIPTION);
|
|
47
|
-
}
|
|
48
45
|
constructor() {
|
|
49
46
|
super();
|
|
50
47
|
/**
|
|
@@ -131,7 +128,7 @@ let SegmentedButtonItem = SegmentedButtonItem_1 = class SegmentedButtonItem exte
|
|
|
131
128
|
return getEffectiveAriaLabelText(this) || getAssociatedLabelForTexts(this) || undefined;
|
|
132
129
|
}
|
|
133
130
|
get ariaDescriptionText() {
|
|
134
|
-
return getEffectiveAriaDescriptionText(this) ||
|
|
131
|
+
return `${(getEffectiveAriaDescriptionText(this) || "")} ${SegmentedButtonItem_1.i18nBundle.getText(SEGMENTEDBUTTON_ARIA_DESCRIBEDBY)}`.trim();
|
|
135
132
|
}
|
|
136
133
|
get showIconTooltip() {
|
|
137
134
|
return getEnableDefaultTooltips() && this.iconOnly && !this.tooltip;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SegmentedButtonItem.js","sourceRoot":"","sources":["../src/SegmentedButtonItem.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,UAAU,MAAM,4CAA4C,CAAC;AAGpE,OAAO,IAAI,MAAM,iDAAiD,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AAC3F,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EACN,yBAAyB,EACzB,0BAA0B,EAC1B,+BAA+B,GAC/B,MAAM,+DAA+D,CAAC;AACvE,OAAO,eAAe,MAAM,sDAAsD,CAAC;AACnF,OAAO,IAAI,MAAM,wDAAwD,CAAC;AAC1E,OAAO,WAAW,MAAM,sDAAsD,CAAC;AAC/E,OAAO,EAAE,oCAAoC,EAAE,MAAM,mCAAmC,CAAC;AAEzF,OAAO,2BAA2B,MAAM,kCAAkC,CAAC;AAG3E,OAAO,KAAK,MAAM,yDAAyD,CAAC;AAC5E,OAAO,sBAAsB,MAAM,+CAA+C,CAAC;AAMnF;;;;;;;;;;;;;;;;;;;;GAoBG;AAsBH,IAAM,mBAAmB,2BAAzB,MAAM,mBAAoB,SAAQ,UAAU;IAwI3C,IAAI,eAAe;QAClB,OAAO,qBAAmB,CAAC,UAAU,CAAC,OAAO,CAAC,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,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;qDACX;AAOjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2DACL;AAOvB;IADC,QAAQ,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;2DACR;AAQxB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDACb;AAQd;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDACZ;AAMf;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mDACb;AASf;IADC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;iDACb;AAGlB;IADN,IAAI,CAAC,oBAAoB,CAAC;6CACG;AAtIzB,mBAAmB;IArBxB,aAAa,CAAC;QACd,GAAG,EAAE,2BAA2B;QAChC,QAAQ,EAAE,WAAW;QACrB,QAAQ,EAAE,2BAA2B;QACrC,MAAM,EAAE,sBAAsB;KAC9B,CAAC;IAEF;;;;;;;;OAQG;;IACF,KAAK,CAAC,OAAO,EAAE;QACf,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,IAAI;KAChB,CAAC;GAEI,mBAAmB,CAqNxB;AAED,mBAAmB,CAAC,MAAM,EAAE,CAAC;AAE7B,eAAe,mBAAmB,CAAC","sourcesContent":["import customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport UI5Element from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport type { DefaultSlot } from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport type I18nBundle from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport i18n from \"@ui5/webcomponents-base/dist/decorators/i18n.js\";\nimport { getEnableDefaultTooltips } from \"@ui5/webcomponents-base/dist/config/Tooltips.js\";\nimport { isDesktop } from \"@ui5/webcomponents-base/dist/Device.js\";\nimport { isSpaceShift } from \"@ui5/webcomponents-base/dist/Keys.js\";\nimport {\n\tgetEffectiveAriaLabelText,\n\tgetAssociatedLabelForTexts,\n\tgetEffectiveAriaDescriptionText,\n} from \"@ui5/webcomponents-base/dist/util/AccessibilityTextsHelper.js\";\nimport willShowContent from \"@ui5/webcomponents-base/dist/util/willShowContent.js\";\nimport slot from \"@ui5/webcomponents-base/dist/decorators/slot-strict.js\";\nimport jsxRenderer from \"@ui5/webcomponents-base/dist/renderer/JsxRenderer.js\";\nimport { SEGMENTEDBUTTONITEM_ARIA_DESCRIPTION } from \"./generated/i18n/i18n-defaults.js\";\nimport type { ISegmentedButtonItem } from \"./SegmentedButton.js\";\nimport SegmentedButtonItemTemplate from \"./SegmentedButtonItemTemplate.js\";\n\nimport type { IButton } from \"./Button.js\";\nimport event from \"@ui5/webcomponents-base/dist/decorators/event-strict.js\";\nimport segmentedButtonItemCss from \"./generated/themes/SegmentedButtonItem.css.js\";\n\ntype SegmentedButtonItemClickEventDetail = {\n\toriginalEvent: Event,\n};\n\n/**\n * @class\n *\n * ### Overview\n *\n * Users can use the `ui5-segmented-button-item` as part of a `ui5-segmented-button`.\n *\n * Clicking or tapping on a `ui5-segmented-button-item` changes its state to `selected`.\n * The item returns to its initial state when the user clicks or taps on it again.\n * By applying additional custom CSS-styling classes, apps can give a different style to any\n * `ui5-segmented-button-item`.\n *\n * ### ES6 Module Import\n *\n * `import \"@ui5/webcomponents/dist/SegmentedButtonItem.js\";`\n * @constructor\n * @extends UI5Element\n * @implements { ISegmentedButtonItem }\n * @implements { IButton }\n * @public\n */\n@customElement({\n\ttag: \"ui5-segmented-button-item\",\n\trenderer: jsxRenderer,\n\ttemplate: SegmentedButtonItemTemplate,\n\tstyles: segmentedButtonItemCss,\n})\n\n/**\n * Fired when the component is activated either with a mouse/tap or by using the Enter or Space key.\n *\n * **Note:** The event will not be fired if the `disabled` property is set to `true`.\n *\n * @param {Event} originalEvent The original DOM event that triggered the click. Use this to access modifier keys (altKey, ctrlKey, metaKey, shiftKey) and other native event properties.\n * @since 2.22.0\n * @public\n */\n@event(\"click\", {\n\tbubbles: true,\n\tcancelable: true,\n})\n\nclass SegmentedButtonItem extends UI5Element implements IButton, ISegmentedButtonItem {\n\teventDetails!: {\n\t\t\"click\": SegmentedButtonItemClickEventDetail,\n\t}\n\t/**\n\t * Defines whether the component is disabled.\n\t * A disabled component can't be selected or\n\t * focused, and it is not in the tab chain.\n\t * @default false\n\t * @public\n\t */\n\t@property({ type: Boolean })\n\tdisabled = false;\n\n\t/**\n\t * Determines whether the component is displayed as selected.\n\t * @default false\n\t * @public\n\t */\n\t@property({ type: Boolean })\n\tselected = false;\n\n\t/**\n\t * Defines the tooltip of the component.\n\t *\n\t * **Note:** A tooltip attribute should be provided for icon-only buttons, in order to represent their exact meaning/function.\n\t * @default undefined\n\t * @public\n\t * @since 1.2.0\n\t */\n\t@property()\n\ttooltip?: string;\n\n\t/**\n\t * Defines the accessible ARIA name of the component.\n\t * @default undefined\n\t * @public\n\t * @since 1.0.0-rc.15\n\t */\n\t@property()\n\taccessibleName?: string;\n\n\t/**\n\t * Receives id(or many ids) of the elements that label the component.\n\t * @default undefined\n\t * @public\n\t * @since 1.1.0\n\t */\n\t@property()\n\taccessibleNameRef?: string;\n\n\t/**\n\t * Defines the accessible description of the component.\n\t * @default undefined\n\t * @public\n\t * @since 2.15.0\n\t */\n\t@property()\n\taccessibleDescription?: string;\n\n\t/**\n\t * Defines the IDs of the HTML Elements that describe the component.\n\t * @default undefined\n\t * @public\n\t * @since 2.15.0\n\t */\n\t@property()\n\taccessibleDescriptionRef?: string;\n\n\t/**\n\t * Defines the icon, displayed as graphical element within the component.\n\t * The SAP-icons font provides numerous options.\n\t *\n\t * Example:\n\t * See all the available icons within the [Icon Explorer](https://sdk.openui5.org/test-resources/sap/m/demokit/iconExplorer/webapp/index.html).\n\t * @default undefined\n\t * @public\n\t */\n\t@property()\n\ticon?: string;\n\n\t/**\n\t * Defines if the button has icon and no text.\n\t * @private\n\t */\n\t@property({ type: Boolean })\n\ticonOnly = false;\n\n\t/**\n\t * Indicates if the element is focusable\n\t * @private\n\t */\n\t@property({ type: Boolean })\n\tnonInteractive = false;\n\n\t/**\n\t * Defines the tabIndex of the component.\n\t * @private\n\t */\n\t@property({ noAttribute: true })\n\tforcedTabIndex?: string;\n\n\t/**\n\t * Defines the index of the item inside of the SegmentedButton.\n\t * @default 0\n\t * @private\n\t */\n\t@property({ type: Number })\n\tposInSet? = 0;\n\n\t/**\n\t * Defines how many items are inside of the SegmentedButton.\n\t * @default 0\n\t * @private\n\t */\n\t@property({ type: Number })\n\tsizeOfSet? = 0;\n\n\t/**\n\t * @private\n\t */\n\t@property({ type: Boolean })\n\thidden = false;\n\n\t/**\n\t * Defines the text of the component.\n\t *\n\t * **Note:** Although this slot accepts HTML Elements, it is strongly recommended that you only use text in order to preserve the intended design.\n\t * @public\n\t */\n\t@slot({ type: Node, \"default\": true })\n\ttext!: DefaultSlot<Node>;\n\n\t@i18n(\"@ui5/webcomponents\")\n\tstatic i18nBundle: I18nBundle;\n\n\tget ariaDescription() {\n\t\treturn SegmentedButtonItem.i18nBundle.getText(SEGMENTEDBUTTONITEM_ARIA_DESCRIPTION);\n\t}\n\n\tconstructor() {\n\t\tsuper();\n\t}\n\n\t_onclick(e: MouseEvent) {\n\t\tif (this.disabled) {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\treturn;\n\t\t}\n\n\t\te.stopImmediatePropagation();\n\n\t\t// Fire semantic click event (CustomEvent that bubbles)\n\t\tconst prevented = !this.fireDecoratorEvent(\"click\", {\n\t\t\toriginalEvent: e,\n\t\t});\n\n\t\tif (prevented) {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t}\n\t}\n\n\tonEnterDOM() {\n\t\tif (isDesktop()) {\n\t\t\tthis.setAttribute(\"desktop\", \"\");\n\t\t}\n\t}\n\n\tonBeforeRendering(): void {\n\t\tthis.iconOnly = !willShowContent(this.text);\n\t}\n\n\t_onkeyup(e: KeyboardEvent) {\n\t\tif (isSpaceShift(e)) {\n\t\t\te.preventDefault();\n\t\t}\n\t}\n\n\tget tabIndexValue() {\n\t\tif (this.disabled) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst tabindex = this.getAttribute(\"tabindex\");\n\n\t\tif (tabindex) {\n\t\t\treturn tabindex;\n\t\t}\n\n\t\treturn this.forcedTabIndex;\n\t}\n\n\tget ariaLabelText() {\n\t\treturn getEffectiveAriaLabelText(this) || getAssociatedLabelForTexts(this) || undefined;\n\t}\n\n\tget ariaDescriptionText() {\n\t\treturn getEffectiveAriaDescriptionText(this) || undefined;\n\t}\n\n\tget showIconTooltip() {\n\t\treturn getEnableDefaultTooltips() && this.iconOnly && !this.tooltip;\n\t}\n\n\tget slotTextContent(): string {\n\t\treturn this.text\n\t\t\t.filter(node => node.nodeType === Node.TEXT_NODE)\n\t\t\t.map(node => node.textContent?.trim() || \"\")\n\t\t\t.filter(Boolean)\n\t\t\t.join(\" \");\n\t}\n}\n\nSegmentedButtonItem.define();\n\nexport default SegmentedButtonItem;\nexport type { SegmentedButtonItemClickEventDetail };\n"]}
|
|
1
|
+
{"version":3,"file":"SegmentedButtonItem.js","sourceRoot":"","sources":["../src/SegmentedButtonItem.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,UAAU,MAAM,4CAA4C,CAAC;AAGpE,OAAO,IAAI,MAAM,iDAAiD,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AAC3F,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EACN,yBAAyB,EACzB,0BAA0B,EAC1B,+BAA+B,GAC/B,MAAM,+DAA+D,CAAC;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;KAChB,CAAC;GAEI,mBAAmB,CAiNxB;AAED,mBAAmB,CAAC,MAAM,EAAE,CAAC;AAE7B,eAAe,mBAAmB,CAAC","sourcesContent":["import customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport UI5Element from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport type { DefaultSlot } from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport type I18nBundle from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport i18n from \"@ui5/webcomponents-base/dist/decorators/i18n.js\";\nimport { getEnableDefaultTooltips } from \"@ui5/webcomponents-base/dist/config/Tooltips.js\";\nimport { isDesktop } from \"@ui5/webcomponents-base/dist/Device.js\";\nimport { isSpaceShift } from \"@ui5/webcomponents-base/dist/Keys.js\";\nimport {\n\tgetEffectiveAriaLabelText,\n\tgetAssociatedLabelForTexts,\n\tgetEffectiveAriaDescriptionText,\n} from \"@ui5/webcomponents-base/dist/util/AccessibilityTextsHelper.js\";\nimport willShowContent from \"@ui5/webcomponents-base/dist/util/willShowContent.js\";\nimport slot from \"@ui5/webcomponents-base/dist/decorators/slot-strict.js\";\nimport jsxRenderer from \"@ui5/webcomponents-base/dist/renderer/JsxRenderer.js\";\nimport { SEGMENTEDBUTTON_ARIA_DESCRIBEDBY } from \"./generated/i18n/i18n-defaults.js\";\nimport type { ISegmentedButtonItem } from \"./SegmentedButton.js\";\nimport SegmentedButtonItemTemplate from \"./SegmentedButtonItemTemplate.js\";\n\nimport type { IButton } from \"./Button.js\";\nimport event from \"@ui5/webcomponents-base/dist/decorators/event-strict.js\";\nimport segmentedButtonItemCss from \"./generated/themes/SegmentedButtonItem.css.js\";\n\ntype SegmentedButtonItemClickEventDetail = {\n\toriginalEvent: Event,\n};\n\n/**\n * @class\n *\n * ### Overview\n *\n * Users can use the `ui5-segmented-button-item` as part of a `ui5-segmented-button`.\n *\n * Clicking or tapping on a `ui5-segmented-button-item` changes its state to `selected`.\n * The item returns to its initial state when the user clicks or taps on it again.\n * By applying additional custom CSS-styling classes, apps can give a different style to any\n * `ui5-segmented-button-item`.\n *\n * ### ES6 Module Import\n *\n * `import \"@ui5/webcomponents/dist/SegmentedButtonItem.js\";`\n * @constructor\n * @extends UI5Element\n * @implements { ISegmentedButtonItem }\n * @implements { IButton }\n * @public\n */\n@customElement({\n\ttag: \"ui5-segmented-button-item\",\n\trenderer: jsxRenderer,\n\ttemplate: SegmentedButtonItemTemplate,\n\tstyles: segmentedButtonItemCss,\n})\n\n/**\n * Fired when the component is activated either with a mouse/tap or by using the Enter or Space key.\n *\n * **Note:** The event will not be fired if the `disabled` property is set to `true`.\n *\n * @param {Event} originalEvent The original DOM event that triggered the click. Use this to access modifier keys (altKey, ctrlKey, metaKey, shiftKey) and other native event properties.\n * @since 2.22.0\n * @public\n */\n@event(\"click\", {\n\tbubbles: true,\n\tcancelable: true,\n})\n\nclass SegmentedButtonItem extends UI5Element implements IButton, ISegmentedButtonItem {\n\teventDetails!: {\n\t\t\"click\": SegmentedButtonItemClickEventDetail,\n\t}\n\t/**\n\t * Defines whether the component is disabled.\n\t * A disabled component can't be selected or\n\t * focused, and it is not in the tab chain.\n\t * @default false\n\t * @public\n\t */\n\t@property({ type: Boolean })\n\tdisabled = false;\n\n\t/**\n\t * Determines whether the component is displayed as selected.\n\t * @default false\n\t * @public\n\t */\n\t@property({ type: Boolean })\n\tselected = false;\n\n\t/**\n\t * Defines the tooltip of the component.\n\t *\n\t * **Note:** A tooltip attribute should be provided for icon-only buttons, in order to represent their exact meaning/function.\n\t * @default undefined\n\t * @public\n\t * @since 1.2.0\n\t */\n\t@property()\n\ttooltip?: string;\n\n\t/**\n\t * Defines the accessible ARIA name of the component.\n\t * @default undefined\n\t * @public\n\t * @since 1.0.0-rc.15\n\t */\n\t@property()\n\taccessibleName?: string;\n\n\t/**\n\t * Receives id(or many ids) of the elements that label the component.\n\t * @default undefined\n\t * @public\n\t * @since 1.1.0\n\t */\n\t@property()\n\taccessibleNameRef?: string;\n\n\t/**\n\t * Defines the accessible description of the component.\n\t * @default undefined\n\t * @public\n\t * @since 2.15.0\n\t */\n\t@property()\n\taccessibleDescription?: string;\n\n\t/**\n\t * Defines the IDs of the HTML Elements that describe the component.\n\t * @default undefined\n\t * @public\n\t * @since 2.15.0\n\t */\n\t@property()\n\taccessibleDescriptionRef?: string;\n\n\t/**\n\t * Defines the icon, displayed as graphical element within the component.\n\t * The SAP-icons font provides numerous options.\n\t *\n\t * Example:\n\t * See all the available icons within the [Icon Explorer](https://sdk.openui5.org/test-resources/sap/m/demokit/iconExplorer/webapp/index.html).\n\t * @default undefined\n\t * @public\n\t */\n\t@property()\n\ticon?: string;\n\n\t/**\n\t * Defines if the button has icon and no text.\n\t * @private\n\t */\n\t@property({ type: Boolean })\n\ticonOnly = false;\n\n\t/**\n\t * Indicates if the element is focusable\n\t * @private\n\t */\n\t@property({ type: Boolean })\n\tnonInteractive = false;\n\n\t/**\n\t * Defines the tabIndex of the component.\n\t * @private\n\t */\n\t@property({ noAttribute: true })\n\tforcedTabIndex?: string;\n\n\t/**\n\t * Defines the index of the item inside of the SegmentedButton.\n\t * @default 0\n\t * @private\n\t */\n\t@property({ type: Number })\n\tposInSet? = 0;\n\n\t/**\n\t * Defines how many items are inside of the SegmentedButton.\n\t * @default 0\n\t * @private\n\t */\n\t@property({ type: Number })\n\tsizeOfSet? = 0;\n\n\t/**\n\t * @private\n\t */\n\t@property({ type: Boolean })\n\thidden = false;\n\n\t/**\n\t * Defines the text of the component.\n\t *\n\t * **Note:** Although this slot accepts HTML Elements, it is strongly recommended that you only use text in order to preserve the intended design.\n\t * @public\n\t */\n\t@slot({ type: Node, \"default\": true })\n\ttext!: DefaultSlot<Node>;\n\n\t@i18n(\"@ui5/webcomponents\")\n\tstatic i18nBundle: I18nBundle;\n\n\tconstructor() {\n\t\tsuper();\n\t}\n\n\t_onclick(e: MouseEvent) {\n\t\tif (this.disabled) {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\treturn;\n\t\t}\n\n\t\te.stopImmediatePropagation();\n\n\t\t// Fire semantic click event (CustomEvent that bubbles)\n\t\tconst prevented = !this.fireDecoratorEvent(\"click\", {\n\t\t\toriginalEvent: e,\n\t\t});\n\n\t\tif (prevented) {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t}\n\t}\n\n\tonEnterDOM() {\n\t\tif (isDesktop()) {\n\t\t\tthis.setAttribute(\"desktop\", \"\");\n\t\t}\n\t}\n\n\tonBeforeRendering(): void {\n\t\tthis.iconOnly = !willShowContent(this.text);\n\t}\n\n\t_onkeyup(e: KeyboardEvent) {\n\t\tif (isSpaceShift(e)) {\n\t\t\te.preventDefault();\n\t\t}\n\t}\n\n\tget tabIndexValue() {\n\t\tif (this.disabled) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst tabindex = this.getAttribute(\"tabindex\");\n\n\t\tif (tabindex) {\n\t\t\treturn tabindex;\n\t\t}\n\n\t\treturn this.forcedTabIndex;\n\t}\n\n\tget ariaLabelText() {\n\t\treturn getEffectiveAriaLabelText(this) || getAssociatedLabelForTexts(this) || undefined;\n\t}\n\n\tget ariaDescriptionText() {\n\t\treturn `${(getEffectiveAriaDescriptionText(this) || \"\")} ${SegmentedButtonItem.i18nBundle.getText(SEGMENTEDBUTTON_ARIA_DESCRIBEDBY)}`.trim();\n\t}\n\n\tget showIconTooltip() {\n\t\treturn getEnableDefaultTooltips() && this.iconOnly && !this.tooltip;\n\t}\n\n\tget slotTextContent(): string {\n\t\treturn this.text\n\t\t\t.filter(node => node.nodeType === Node.TEXT_NODE)\n\t\t\t.map(node => node.textContent?.trim() || \"\")\n\t\t\t.filter(Boolean)\n\t\t\t.join(\" \");\n\t}\n}\n\nSegmentedButtonItem.define();\n\nexport default SegmentedButtonItem;\nexport type { SegmentedButtonItemClickEventDetail };\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@ui5/webcomponents-base/jsx-runtime";
|
|
2
2
|
import Icon from "./Icon.js";
|
|
3
3
|
export default function SegmentedButtonItemTemplate() {
|
|
4
|
-
return (_jsxs("li", { role: "option", class: "ui5-segmented-button-item-root", "aria-posinset": this.posInSet, "aria-setsize": this.sizeOfSet, "aria-selected": this.selected, "aria-disabled": this.disabled, "
|
|
4
|
+
return (_jsxs("li", { role: "option", class: "ui5-segmented-button-item-root", "aria-posinset": this.posInSet, "aria-setsize": this.sizeOfSet, "aria-selected": this.selected, "aria-disabled": this.disabled, "data-sap-focus-ref": true, onClick: this._onclick, onKeyUp: this._onkeyup, tabindex: this.tabIndexValue ? parseInt(this.tabIndexValue) : undefined, "aria-label": this.ariaLabelText, "aria-description": this.ariaDescriptionText, title: this.tooltip || this.slotTextContent, children: [this.icon &&
|
|
5
5
|
_jsx(Icon, { part: "icon", class: "ui5-segmented-button-item-icon", name: this.icon, showTooltip: this.showIconTooltip }), _jsx("span", { id: `${this._id}-content`, class: "ui5-segmented-button-item-text", children: _jsx("bdi", { children: _jsx("slot", {}) }) })] }));
|
|
6
6
|
}
|
|
7
7
|
//# sourceMappingURL=SegmentedButtonItemTemplate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SegmentedButtonItemTemplate.js","sourceRoot":"","sources":["../src/SegmentedButtonItemTemplate.tsx"],"names":[],"mappings":";AACA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,CAAC,OAAO,UAAU,2BAA2B;IAClD,OAAO,CACN,cACC,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,gCAAgC,mBACvB,IAAI,CAAC,QAAQ,kBACd,IAAI,CAAC,SAAS,mBACb,IAAI,CAAC,QAAQ,mBACb,IAAI,CAAC,QAAQ,
|
|
1
|
+
{"version":3,"file":"SegmentedButtonItemTemplate.js","sourceRoot":"","sources":["../src/SegmentedButtonItemTemplate.tsx"],"names":[],"mappings":";AACA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,CAAC,OAAO,UAAU,2BAA2B;IAClD,OAAO,CACN,cACC,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,gCAAgC,mBACvB,IAAI,CAAC,QAAQ,kBACd,IAAI,CAAC,SAAS,mBACb,IAAI,CAAC,QAAQ,mBACb,IAAI,CAAC,QAAQ,8BAE5B,OAAO,EAAE,IAAI,CAAC,QAAQ,EACtB,OAAO,EAAE,IAAI,CAAC,QAAQ,EACtB,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS,gBAC3D,IAAI,CAAC,aAAa,sBACZ,IAAI,CAAC,mBAAmB,EAC1C,KAAK,EAAE,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,eAAe,aAE1C,IAAI,CAAC,IAAI;gBACT,KAAC,IAAI,IACJ,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,gCAAgC,EACtC,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,WAAW,EAAE,IAAI,CAAC,eAAe,GAChC,EAEH,eAAM,EAAE,EAAE,GAAG,IAAI,CAAC,GAAG,UAAU,EAAE,KAAK,EAAC,gCAAgC,YACtE,wBACC,gBAAa,GACR,GACA,IACH,CACL,CAAC;AACH,CAAC","sourcesContent":["import type SegmentedButtonItem from \"./SegmentedButtonItem.js\";\nimport Icon from \"./Icon.js\";\n\nexport default function SegmentedButtonItemTemplate(this: SegmentedButtonItem) {\n\treturn (\n\t\t<li\n\t\t\trole=\"option\"\n\t\t\tclass=\"ui5-segmented-button-item-root\"\n\t\t\taria-posinset={this.posInSet}\n\t\t\taria-setsize={this.sizeOfSet}\n\t\t\taria-selected={this.selected}\n\t\t\taria-disabled={this.disabled}\n\t\t\tdata-sap-focus-ref\n\t\t\tonClick={this._onclick}\n\t\t\tonKeyUp={this._onkeyup}\n\t\t\ttabindex={this.tabIndexValue ? parseInt(this.tabIndexValue) : undefined }\n\t\t\taria-label={this.ariaLabelText}\n\t\t\taria-description={this.ariaDescriptionText}\n\t\t\ttitle={this.tooltip || this.slotTextContent}\n\t\t>\n\t\t\t{this.icon &&\n\t\t\t\t<Icon\n\t\t\t\t\tpart=\"icon\"\n\t\t\t\t\tclass=\"ui5-segmented-button-item-icon\"\n\t\t\t\t\tname={this.icon}\n\t\t\t\t\tshowTooltip={this.showIconTooltip}\n\t\t\t\t/>\n\t\t\t}\n\t\t\t<span id={`${this._id}-content`} class=\"ui5-segmented-button-item-text\">\n\t\t\t\t<bdi>\n\t\t\t\t\t<slot></slot>\n\t\t\t\t</bdi>\n\t\t\t</span>\n\t\t</li>\n\t);\n}\n"]}
|
|
@@ -4,6 +4,6 @@ export default function SegmentedButtonTemplate() {
|
|
|
4
4
|
"ui5-segmented-button-root": true,
|
|
5
5
|
"ui5-segmented-button-root-equal-sized-items": !this.itemsFitContent,
|
|
6
6
|
"ui5-segmented-button-root-content-fit-items": this.itemsFitContent,
|
|
7
|
-
}, onClick: this._onclick, onMouseDown: this._onmousedown, onKeyDown: this._onkeydown, onKeyUp: this._onkeyup, onFocusIn: this._onfocusin, "aria-multiselectable": this.selectionMode === "Multiple" ? "true" : "false", "aria-orientation": "horizontal", "aria-description": this.ariaDescriptionText, "aria-label": this.ariaLabelText,
|
|
7
|
+
}, onClick: this._onclick, onMouseDown: this._onmousedown, onKeyDown: this._onkeydown, onKeyUp: this._onkeyup, onFocusIn: this._onfocusin, "aria-multiselectable": this.selectionMode === "Multiple" ? "true" : "false", "aria-orientation": "horizontal", "aria-description": this.ariaDescriptionText, "aria-label": this.ariaLabelText, children: _jsx("slot", {}) }));
|
|
8
8
|
}
|
|
9
9
|
//# sourceMappingURL=SegmentedButtonTemplate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SegmentedButtonTemplate.js","sourceRoot":"","sources":["../src/SegmentedButtonTemplate.tsx"],"names":[],"mappings":";AAEA,MAAM,CAAC,OAAO,UAAU,uBAAuB;IAC9C,OAAO,CACN,aACC,IAAI,EAAC,SAAS,EACd,KAAK,EAAE;YACN,2BAA2B,EAAE,IAAI;YACjC,6CAA6C,EAAE,CAAC,IAAI,CAAC,eAAe;YACpE,6CAA6C,EAAE,IAAI,CAAC,eAAe;SACnE,EACD,OAAO,EAAE,IAAI,CAAC,QAAQ,EACtB,WAAW,EAAE,IAAI,CAAC,YAAY,EAC9B,SAAS,EAAE,IAAI,CAAC,UAAU,EAC1B,OAAO,EAAE,IAAI,CAAC,QAAQ,EACtB,SAAS,EAAE,IAAI,CAAC,UAAU,0BACJ,IAAI,CAAC,aAAa,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,sBACzD,YAAY,sBACX,IAAI,CAAC,mBAAmB,gBAC9B,IAAI,CAAC,aAAa,
|
|
1
|
+
{"version":3,"file":"SegmentedButtonTemplate.js","sourceRoot":"","sources":["../src/SegmentedButtonTemplate.tsx"],"names":[],"mappings":";AAEA,MAAM,CAAC,OAAO,UAAU,uBAAuB;IAC9C,OAAO,CACN,aACC,IAAI,EAAC,SAAS,EACd,KAAK,EAAE;YACN,2BAA2B,EAAE,IAAI;YACjC,6CAA6C,EAAE,CAAC,IAAI,CAAC,eAAe;YACpE,6CAA6C,EAAE,IAAI,CAAC,eAAe;SACnE,EACD,OAAO,EAAE,IAAI,CAAC,QAAQ,EACtB,WAAW,EAAE,IAAI,CAAC,YAAY,EAC9B,SAAS,EAAE,IAAI,CAAC,UAAU,EAC1B,OAAO,EAAE,IAAI,CAAC,QAAQ,EACtB,SAAS,EAAE,IAAI,CAAC,UAAU,0BACJ,IAAI,CAAC,aAAa,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,sBACzD,YAAY,sBACX,IAAI,CAAC,mBAAmB,gBAC9B,IAAI,CAAC,aAAa,YAE9B,gBAAa,GACT,CACL,CAAC;AACH,CAAC","sourcesContent":["import type SegmentedButton from \"./SegmentedButton.js\";\n\nexport default function SegmentedButtonTemplate(this: SegmentedButton) {\n\treturn (\n\t\t<ul\n\t\t\trole=\"listbox\"\n\t\t\tclass={{\n\t\t\t\t\"ui5-segmented-button-root\": true,\n\t\t\t\t\"ui5-segmented-button-root-equal-sized-items\": !this.itemsFitContent,\n\t\t\t\t\"ui5-segmented-button-root-content-fit-items\": this.itemsFitContent,\n\t\t\t}}\n\t\t\tonClick={this._onclick}\n\t\t\tonMouseDown={this._onmousedown}\n\t\t\tonKeyDown={this._onkeydown}\n\t\t\tonKeyUp={this._onkeyup}\n\t\t\tonFocusIn={this._onfocusin}\n\t\t\taria-multiselectable={this.selectionMode === \"Multiple\" ? \"true\" : \"false\"}\n\t\t\taria-orientation=\"horizontal\"\n\t\t\taria-description={this.ariaDescriptionText}\n\t\t\taria-label={this.ariaLabelText}\n\t\t>\n\t\t\t<slot></slot>\n\t\t</ul>\n\t);\n}\n"]}
|
package/dist/web-types.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui5/webcomponents",
|
|
3
|
-
"version": "2.25.0",
|
|
3
|
+
"version": "2.25.1-rc.0",
|
|
4
4
|
"description": "UI5 Web Components: webcomponents.main",
|
|
5
5
|
"ui5": {
|
|
6
6
|
"webComponentsPackage": true
|
|
@@ -56,22 +56,22 @@
|
|
|
56
56
|
"directory": "packages/main"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@ui5/webcomponents-base": "2.25.0",
|
|
60
|
-
"@ui5/webcomponents-icons": "2.25.0",
|
|
61
|
-
"@ui5/webcomponents-icons-business-suite": "2.25.0",
|
|
62
|
-
"@ui5/webcomponents-icons-tnt": "2.25.0",
|
|
63
|
-
"@ui5/webcomponents-localization": "2.25.0",
|
|
64
|
-
"@ui5/webcomponents-theming": "2.25.0"
|
|
59
|
+
"@ui5/webcomponents-base": "2.25.1-rc.0",
|
|
60
|
+
"@ui5/webcomponents-icons": "2.25.1-rc.0",
|
|
61
|
+
"@ui5/webcomponents-icons-business-suite": "2.25.1-rc.0",
|
|
62
|
+
"@ui5/webcomponents-icons-tnt": "2.25.1-rc.0",
|
|
63
|
+
"@ui5/webcomponents-localization": "2.25.1-rc.0",
|
|
64
|
+
"@ui5/webcomponents-theming": "2.25.1-rc.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@custom-elements-manifest/analyzer": "^0.10.10",
|
|
68
68
|
"@ui5/cypress-internal": "0.1.0",
|
|
69
|
-
"@ui5/webcomponents-tools": "2.25.0",
|
|
69
|
+
"@ui5/webcomponents-tools": "2.25.1-rc.0",
|
|
70
70
|
"cypress": "15.18.1",
|
|
71
71
|
"jsdom": "^26.0.0",
|
|
72
72
|
"lit": "^2.0.0",
|
|
73
73
|
"vite": "5.4.21",
|
|
74
74
|
"vitest": "^3.2.7"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "72c54b253971e66f766404641b9fc2e5ffaf3344"
|
|
77
77
|
}
|
|
@@ -10,7 +10,6 @@ export default function SegmentedButtonItemTemplate(this: SegmentedButtonItem) {
|
|
|
10
10
|
aria-setsize={this.sizeOfSet}
|
|
11
11
|
aria-selected={this.selected}
|
|
12
12
|
aria-disabled={this.disabled}
|
|
13
|
-
aria-roledescription={this.ariaDescription}
|
|
14
13
|
data-sap-focus-ref
|
|
15
14
|
onClick={this._onclick}
|
|
16
15
|
onKeyUp={this._onkeyup}
|
|
@@ -18,7 +18,6 @@ export default function SegmentedButtonTemplate(this: SegmentedButton) {
|
|
|
18
18
|
aria-orientation="horizontal"
|
|
19
19
|
aria-description={this.ariaDescriptionText}
|
|
20
20
|
aria-label={this.ariaLabelText}
|
|
21
|
-
aria-roledescription={this.ariaRoleDescription}
|
|
22
21
|
>
|
|
23
22
|
<slot></slot>
|
|
24
23
|
</ul>
|