@ui5/webcomponents 2.25.0 → 2.26.0-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 +36 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/ComboBox.js +0 -6
- package/dist/ComboBox.js.map +1 -1
- package/dist/InputPopoverTemplate.js +1 -1
- package/dist/InputPopoverTemplate.js.map +1 -1
- package/dist/List.d.ts +31 -4
- package/dist/List.js +37 -4
- package/dist/List.js.map +1 -1
- package/dist/ListItemCustom.d.ts +22 -0
- package/dist/ListItemCustom.js +22 -0
- package/dist/ListItemCustom.js.map +1 -1
- package/dist/Menu.d.ts +1 -0
- package/dist/Menu.js +18 -0
- package/dist/Menu.js.map +1 -1
- package/dist/RangeSlider.d.ts +1 -0
- package/dist/RangeSlider.js +3 -0
- package/dist/RangeSlider.js.map +1 -1
- package/dist/RangeSliderTemplate.js +1 -1
- package/dist/RangeSliderTemplate.js.map +1 -1
- package/dist/RatingIndicator.d.ts +10 -0
- package/dist/RatingIndicator.js +21 -5
- package/dist/RatingIndicator.js.map +1 -1
- package/dist/RatingIndicatorTemplate.js +1 -1
- package/dist/RatingIndicatorTemplate.js.map +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/Select.d.ts +2 -0
- package/dist/Select.js +13 -2
- package/dist/Select.js.map +1 -1
- package/dist/SelectPopoverTemplate.js +2 -2
- package/dist/SelectPopoverTemplate.js.map +1 -1
- package/dist/SliderScale.d.ts +2 -1
- package/dist/SliderScale.js.map +1 -1
- package/dist/SliderScaleTemplate.js +1 -1
- package/dist/SliderScaleTemplate.js.map +1 -1
- package/dist/Tab.d.ts +1 -1
- package/dist/Table.d.ts +1 -1
- package/dist/Table.js +16 -8
- package/dist/Table.js.map +1 -1
- package/dist/TableRow.d.ts +1 -1
- package/dist/TableRow.js +4 -4
- package/dist/TableRow.js.map +1 -1
- package/dist/TableRowBase.d.ts +2 -1
- package/dist/TableRowBase.js +4 -1
- package/dist/TableRowBase.js.map +1 -1
- package/dist/TableRowTemplate.js +1 -1
- package/dist/TableRowTemplate.js.map +1 -1
- package/dist/TableUtils.d.ts +4 -3
- package/dist/TableUtils.js +40 -31
- package/dist/TableUtils.js.map +1 -1
- package/dist/Tokenizer.js +24 -9
- package/dist/Tokenizer.js.map +1 -1
- package/dist/css/themes/CheckBox.css +1 -1
- package/dist/css/themes/DatePicker.css +1 -1
- package/dist/css/themes/RatingIndicator.css +1 -1
- package/dist/css/themes/sap_fiori_3/parameters-bundle.css +1 -1
- package/dist/css/themes/sap_fiori_3_dark/parameters-bundle.css +1 -1
- package/dist/css/themes/sap_fiori_3_hcb/parameters-bundle.css +1 -1
- package/dist/css/themes/sap_fiori_3_hcw/parameters-bundle.css +1 -1
- package/dist/css/themes/sap_horizon/parameters-bundle.css +1 -1
- package/dist/css/themes/sap_horizon_auto/parameters-bundle.css +4 -5
- package/dist/css/themes/sap_horizon_dark/parameters-bundle.css +1 -1
- package/dist/css/themes/sap_horizon_hc_auto/parameters-bundle.css +4 -5
- package/dist/css/themes/sap_horizon_hcb/parameters-bundle.css +1 -1
- package/dist/css/themes/sap_horizon_hcw/parameters-bundle.css +1 -1
- package/dist/custom-elements-internal.json +26 -6
- package/dist/custom-elements.json +25 -6
- package/dist/generated/assets/themes/sap_fiori_3/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_fiori_3_dark/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_fiori_3_hcb/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_fiori_3_hcw/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_horizon/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_horizon_auto/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_horizon_dark/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_horizon_hc_auto/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_horizon_hcb/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_horizon_hcw/parameters-bundle.css.json +1 -1
- package/dist/generated/i18n/i18n-defaults.d.ts +4 -1
- package/dist/generated/i18n/i18n-defaults.js +4 -1
- package/dist/generated/i18n/i18n-defaults.js.map +1 -1
- package/dist/generated/themes/CheckBox.css.d.ts +1 -1
- package/dist/generated/themes/CheckBox.css.js +1 -1
- package/dist/generated/themes/CheckBox.css.js.map +1 -1
- package/dist/generated/themes/DatePicker.css.d.ts +1 -1
- package/dist/generated/themes/DatePicker.css.js +1 -1
- package/dist/generated/themes/DatePicker.css.js.map +1 -1
- package/dist/generated/themes/RatingIndicator.css.d.ts +1 -1
- package/dist/generated/themes/RatingIndicator.css.js +1 -1
- package/dist/generated/themes/RatingIndicator.css.js.map +1 -1
- package/dist/generated/themes/sap_fiori_3/parameters-bundle.css.d.ts +1 -1
- package/dist/generated/themes/sap_fiori_3/parameters-bundle.css.js +1 -1
- package/dist/generated/themes/sap_fiori_3/parameters-bundle.css.js.map +1 -1
- package/dist/generated/themes/sap_fiori_3_dark/parameters-bundle.css.d.ts +1 -1
- package/dist/generated/themes/sap_fiori_3_dark/parameters-bundle.css.js +1 -1
- package/dist/generated/themes/sap_fiori_3_dark/parameters-bundle.css.js.map +1 -1
- package/dist/generated/themes/sap_fiori_3_hcb/parameters-bundle.css.d.ts +1 -1
- package/dist/generated/themes/sap_fiori_3_hcb/parameters-bundle.css.js +1 -1
- package/dist/generated/themes/sap_fiori_3_hcb/parameters-bundle.css.js.map +1 -1
- package/dist/generated/themes/sap_fiori_3_hcw/parameters-bundle.css.d.ts +1 -1
- package/dist/generated/themes/sap_fiori_3_hcw/parameters-bundle.css.js +1 -1
- package/dist/generated/themes/sap_fiori_3_hcw/parameters-bundle.css.js.map +1 -1
- package/dist/generated/themes/sap_horizon/parameters-bundle.css.d.ts +1 -1
- package/dist/generated/themes/sap_horizon/parameters-bundle.css.js +1 -1
- package/dist/generated/themes/sap_horizon/parameters-bundle.css.js.map +1 -1
- package/dist/generated/themes/sap_horizon_auto/parameters-bundle.css.d.ts +1 -1
- package/dist/generated/themes/sap_horizon_auto/parameters-bundle.css.js +4 -5
- package/dist/generated/themes/sap_horizon_auto/parameters-bundle.css.js.map +1 -1
- package/dist/generated/themes/sap_horizon_dark/parameters-bundle.css.d.ts +1 -1
- package/dist/generated/themes/sap_horizon_dark/parameters-bundle.css.js +1 -1
- package/dist/generated/themes/sap_horizon_dark/parameters-bundle.css.js.map +1 -1
- package/dist/generated/themes/sap_horizon_hc_auto/parameters-bundle.css.d.ts +1 -1
- package/dist/generated/themes/sap_horizon_hc_auto/parameters-bundle.css.js +4 -5
- package/dist/generated/themes/sap_horizon_hc_auto/parameters-bundle.css.js.map +1 -1
- package/dist/generated/themes/sap_horizon_hcb/parameters-bundle.css.d.ts +1 -1
- package/dist/generated/themes/sap_horizon_hcb/parameters-bundle.css.js +1 -1
- package/dist/generated/themes/sap_horizon_hcb/parameters-bundle.css.js.map +1 -1
- package/dist/generated/themes/sap_horizon_hcw/parameters-bundle.css.d.ts +1 -1
- package/dist/generated/themes/sap_horizon_hcw/parameters-bundle.css.js +1 -1
- package/dist/generated/themes/sap_horizon_hcw/parameters-bundle.css.js.map +1 -1
- package/dist/vscode.html-custom-data.json +5 -0
- package/dist/web-types.json +11 -1
- package/package.json +9 -9
- package/src/InputPopoverTemplate.tsx +1 -0
- package/src/RangeSliderTemplate.tsx +1 -0
- package/src/RatingIndicatorTemplate.tsx +1 -1
- package/src/SegmentedButtonItemTemplate.tsx +0 -1
- package/src/SegmentedButtonTemplate.tsx +0 -1
- package/src/SelectPopoverTemplate.tsx +2 -1
- package/src/SliderScaleTemplate.tsx +8 -8
- package/src/TableRowTemplate.tsx +1 -0
- package/src/i18n/messagebundle.properties +8 -0
- package/src/themes/CheckBox.css +10 -10
- package/src/themes/DatePicker.css +5 -0
- package/src/themes/RatingIndicator.css +5 -3
- package/src/themes/base/CheckBox-parameters.css +2 -3
- package/src/themes/base/sizes-parameters.css +4 -5
- package/src/themes/sap_fiori_3/CheckBox-parameters.css +0 -1
- package/src/themes/sap_fiori_3_dark/CheckBox-parameters.css +0 -1
- package/src/themes/sap_horizon/CheckBox-parameters.css +1 -2
- package/src/themes/sap_horizon_dark/CheckBox-parameters.css +1 -2
- package/src/themes/sap_horizon_hcb/CheckBox-parameters.css +1 -2
- package/src/themes/sap_horizon_hcw/CheckBox-parameters.css +1 -2
|
@@ -89,6 +89,16 @@ declare class RatingIndicator extends UI5Element {
|
|
|
89
89
|
* @public
|
|
90
90
|
*/
|
|
91
91
|
readonly: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Defines whether the component is in display-only mode.
|
|
94
|
+
*
|
|
95
|
+
* **Note:** A display-only component is visually identical to read-only
|
|
96
|
+
* but cannot receive focus and is not announced by screen readers.
|
|
97
|
+
* @default false
|
|
98
|
+
* @public
|
|
99
|
+
* @since 2.26.0
|
|
100
|
+
*/
|
|
101
|
+
displayOnly: boolean;
|
|
92
102
|
/**
|
|
93
103
|
* Defines the accessible ARIA name of the component.
|
|
94
104
|
* @default undefined
|
package/dist/RatingIndicator.js
CHANGED
|
@@ -100,6 +100,16 @@ let RatingIndicator = RatingIndicator_1 = class RatingIndicator extends UI5Eleme
|
|
|
100
100
|
* @public
|
|
101
101
|
*/
|
|
102
102
|
this.readonly = false;
|
|
103
|
+
/**
|
|
104
|
+
* Defines whether the component is in display-only mode.
|
|
105
|
+
*
|
|
106
|
+
* **Note:** A display-only component is visually identical to read-only
|
|
107
|
+
* but cannot receive focus and is not announced by screen readers.
|
|
108
|
+
* @default false
|
|
109
|
+
* @public
|
|
110
|
+
* @since 2.26.0
|
|
111
|
+
*/
|
|
112
|
+
this.displayOnly = false;
|
|
103
113
|
/**
|
|
104
114
|
* Defines whether the component is required.
|
|
105
115
|
* @default false
|
|
@@ -157,7 +167,7 @@ let RatingIndicator = RatingIndicator_1 = class RatingIndicator extends UI5Eleme
|
|
|
157
167
|
}
|
|
158
168
|
_onclick(e) {
|
|
159
169
|
const target = e.target;
|
|
160
|
-
if (!(target instanceof HTMLElement) || this.disabled || this.readonly) {
|
|
170
|
+
if (!(target instanceof HTMLElement) || this.disabled || this.readonly || this.displayOnly) {
|
|
161
171
|
return;
|
|
162
172
|
}
|
|
163
173
|
const targetValue = target.getAttribute("data-ui5-value");
|
|
@@ -173,7 +183,7 @@ let RatingIndicator = RatingIndicator_1 = class RatingIndicator extends UI5Eleme
|
|
|
173
183
|
}
|
|
174
184
|
}
|
|
175
185
|
_onkeydown(e) {
|
|
176
|
-
if (this.disabled || this.readonly) {
|
|
186
|
+
if (this.disabled || this.readonly || this.displayOnly) {
|
|
177
187
|
// prevent page scrolling
|
|
178
188
|
if (isSpace(e)) {
|
|
179
189
|
e.preventDefault();
|
|
@@ -212,7 +222,7 @@ let RatingIndicator = RatingIndicator_1 = class RatingIndicator extends UI5Eleme
|
|
|
212
222
|
}
|
|
213
223
|
}
|
|
214
224
|
_onfocusin() {
|
|
215
|
-
if (this.disabled) {
|
|
225
|
+
if (this.disabled || this.displayOnly) {
|
|
216
226
|
return;
|
|
217
227
|
}
|
|
218
228
|
this._focused = true;
|
|
@@ -223,7 +233,7 @@ let RatingIndicator = RatingIndicator_1 = class RatingIndicator extends UI5Eleme
|
|
|
223
233
|
}
|
|
224
234
|
get effectiveTabIndex() {
|
|
225
235
|
const tabindex = this.getAttribute("tabindex");
|
|
226
|
-
if (this.disabled) {
|
|
236
|
+
if (this.disabled || this.displayOnly) {
|
|
227
237
|
return -1;
|
|
228
238
|
}
|
|
229
239
|
return tabindex ? parseInt(tabindex) : 0;
|
|
@@ -241,7 +251,7 @@ let RatingIndicator = RatingIndicator_1 = class RatingIndicator extends UI5Eleme
|
|
|
241
251
|
return RatingIndicator_1.i18nBundle.getText(RATING_INDICATOR_TEXT);
|
|
242
252
|
}
|
|
243
253
|
get _ariaDisabled() {
|
|
244
|
-
return this.disabled || undefined;
|
|
254
|
+
return this.disabled || this.displayOnly || undefined;
|
|
245
255
|
}
|
|
246
256
|
get _ariaLabel() {
|
|
247
257
|
return getEffectiveAriaLabelText(this);
|
|
@@ -250,6 +260,9 @@ let RatingIndicator = RatingIndicator_1 = class RatingIndicator extends UI5Eleme
|
|
|
250
260
|
return this.required ? RatingIndicator_1.i18nBundle.getText(RATING_INDICATOR_ARIA_DESCRIPTION) : undefined;
|
|
251
261
|
}
|
|
252
262
|
get ariaReadonly() {
|
|
263
|
+
if (this.displayOnly) {
|
|
264
|
+
return undefined;
|
|
265
|
+
}
|
|
253
266
|
return this.readonly ? "true" : undefined;
|
|
254
267
|
}
|
|
255
268
|
};
|
|
@@ -268,6 +281,9 @@ __decorate([
|
|
|
268
281
|
__decorate([
|
|
269
282
|
property({ type: Boolean })
|
|
270
283
|
], RatingIndicator.prototype, "readonly", void 0);
|
|
284
|
+
__decorate([
|
|
285
|
+
property({ type: Boolean })
|
|
286
|
+
], RatingIndicator.prototype, "displayOnly", void 0);
|
|
271
287
|
__decorate([
|
|
272
288
|
property()
|
|
273
289
|
], RatingIndicator.prototype, "accessibleName", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RatingIndicator.js","sourceRoot":"","sources":["../src/RatingIndicator.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,KAAK,MAAM,yDAAyD,CAAC;AAC5E,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,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AE,CAAC;AAEzB,eAAe,eAAe,CAAC","sourcesContent":["import customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport event from \"@ui5/webcomponents-base/dist/decorators/event-strict.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport { getEnableDefaultTooltips } from \"@ui5/webcomponents-base/dist/config/Tooltips.js\";\nimport UI5Element from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport jsxRenderer from \"@ui5/webcomponents-base/dist/renderer/JsxRenderer.js\";\nimport {\n\tisDown,\n\tisUp,\n\tisLeft,\n\tisRight,\n\tisSpace,\n\tisEnter,\n\tisHome,\n\tisEnd,\n} from \"@ui5/webcomponents-base/dist/Keys.js\";\nimport { getEffectiveAriaLabelText } from \"@ui5/webcomponents-base/dist/util/AccessibilityTextsHelper.js\";\nimport i18n from \"@ui5/webcomponents-base/dist/decorators/i18n.js\";\nimport type I18nBundle from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport \"@ui5/webcomponents-icons/dist/favorite.js\";\nimport \"@ui5/webcomponents-icons/dist/unfavorite.js\";\nimport {\n\tRATING_INDICATOR_TEXT,\n\tRATING_INDICATOR_TOOLTIP_TEXT,\n\tRATING_INDICATOR_ARIA_DESCRIPTION,\n} from \"./generated/i18n/i18n-defaults.js\";\nimport RatingIndicatorTemplate from \"./RatingIndicatorTemplate.js\";\n\n// Styles\nimport RatingIndicatorCss from \"./generated/themes/RatingIndicator.css.js\";\nimport type RatingIndicatorSize from \"./types/RatingIndicatorSize.js\";\n\ntype Star = {\n\tselected: boolean,\n\tindex: number,\n\thalfStar: boolean\n}\n\n/**\n * @class\n *\n * ### Overview\n * The Rating Indicator is used to display a specific number of icons that are used to rate an item.\n * Additionally, it is also used to display the average and overall ratings.\n *\n * ### Usage\n * The recommended number of icons is between 5 and 7.\n *\n * ### Responsive Behavior\n * You can change the size of the Rating Indicator by changing its `font-size` CSS property.\n *\n * Example: `<ui5-rating-indicator style=\"font-size: 3rem;\"></ui5-rating-indicator>`\n *\n * ### Keyboard Handling\n * When the `ui5-rating-indicator` is focused, the user can change the rating\n * with the following keyboard shortcuts:\n *\n * - [RIGHT/UP] - Increases the value of the rating by one step. If the highest value is reached, does nothing\n * - [LEFT/DOWN] - Decreases the value of the rating by one step. If the lowest value is reached, does nothing.\n * - [Home] - Sets the lowest value.\n * - [End] - Sets the highest value.\n * - [SPACE/ENTER/RETURN] - Increases the value of the rating by one step. If the highest value is reached, sets the rating to the lowest value.\n * - Any number - Changes value to the corresponding number. If typed number is larger than the number of values, sets the highest value.\n *\n * ### ES6 Module Import\n *\n * `import \"@ui5/webcomponents/dist/RatingIndicator.js\";`\n * @constructor\n * @extends UI5Element\n * @public\n * @since 1.0.0-rc.8\n */\n\n@customElement({\n\ttag: \"ui5-rating-indicator\",\n\tlanguageAware: true,\n\trenderer: jsxRenderer,\n\tstyles: RatingIndicatorCss,\n\ttemplate: RatingIndicatorTemplate,\n})\n/**\n * The event is fired when the value changes.\n * @public\n */\n@event(\"change\", {\n\tbubbles: true,\n})\n\nclass RatingIndicator extends UI5Element {\n\teventDetails!: {\n\t\tchange: void,\n\t}\n\t/**\n\t * The indicated value of the rating.\n\t *\n\t * **Note:** If you set a number which is not round, it would be shown as follows:\n\t *\n\t * - 1.0 - 1.2 -> 1\n\t * - 1.3 - 1.7 -> 1.5\n\t * - 1.8 - 1.9 -> 2\n\t * @default 0\n\t * @public\n\t */\n\t@property({ type: Number })\n\tvalue: number = 0;\n\n\t/**\n\t * The number of displayed rating symbols.\n\t * @default 5\n\t * @public\n\t * @since 1.0.0-rc.15\n\t */\n\t@property({ type: Number })\n\tmax: number = 5;\n\n\t/**\n\t * Defines the size of the component.\n\t * @default \"M\"\n\t * @public\n\t * @since 2.6.0\n\t */\n\t@property()\n\tsize: `${RatingIndicatorSize}` = \"M\";\n\n\t/**\n\t * Defines whether the component is disabled.\n\t *\n\t * **Note:** A disabled component is completely noninteractive.\n\t * @default false\n\t * @public\n\t */\n\t@property({ type: Boolean })\n\tdisabled = false;\n\n\t/**\n\t * Defines whether the component is read-only.\n\t *\n\t * **Note:** A read-only component is not editable,\n\t * but still provides visual feedback upon user interaction.\n\t * @default false\n\t * @public\n\t */\n\t@property({ type: Boolean })\n\treadonly = false;\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.15.0\n\t */\n\t @property()\n\t accessibleNameRef?: string;\n\n\t /**\n\t * Defines whether the component is required.\n\t * @default false\n\t * @public\n\t * @since 1.15.0\n\t */\n\t@property({ type: Boolean })\n\trequired = false;\n\n\t/**\n\t * Defines the tooltip of the component.\n\t * @default undefined\n\t * @public\n\t * @since 1.19.0\n\t */\n\t@property()\n\ttooltip?: string;\n\n\t/**\n\t * Defines the icon to be displayed for the selected (filled) rating symbol.\n\t *\n\t * @default \"favorite\"\n\t * @public\n\t * @since 2.20\n\t */\n\t@property()\n\tratedIcon = \"favorite\";\n\n\t/**\n\t * Defines the icon to be displayed for the unselected (empty) rating symbol.\n\t * @default \"unfavorite\"\n\t * @public\n\t * @since 2.20\n\t */\n\t@property()\n\tunratedIcon = \"unfavorite\";\n\n\t/**\n\t * @private\n\t */\n\t@property({ type: Array, noAttribute: true })\n\t_stars: Array<Star> = [];\n\n\t/**\n\t * @private\n\t */\n\t@property({ type: Boolean })\n\t_focused = false;\n\n\t_liveValue?: number;\n\n\t@i18n(\"@ui5/webcomponents\")\n\tstatic i18nBundle: I18nBundle;\n\n\tconstructor() {\n\t\tsuper();\n\t}\n\n\tonBeforeRendering() {\n\t\tthis.calcState();\n\t}\n\n\tcalcState() {\n\t\tthis._stars = [];\n\n\t\tfor (let i = 1; i < this.max + 1; i++) {\n\t\t\tconst remainder = Math.round((this.value - Math.floor(this.value)) * 10);\n\t\t\tlet halfStar = false,\n\t\t\t\ttempValue = this.value;\n\n\t\t\tif (Math.floor(this.value) + 1 === i && remainder > 2 && remainder < 8) {\n\t\t\t\thalfStar = true;\n\t\t\t} else if (remainder <= 2) {\n\t\t\t\ttempValue = Math.floor(this.value);\n\t\t\t} else if (remainder >= 8) {\n\t\t\t\ttempValue = Math.ceil(this.value);\n\t\t\t}\n\n\t\t\tthis._stars.push({\n\t\t\t\tselected: i <= tempValue,\n\t\t\t\tindex: i,\n\t\t\t\thalfStar,\n\t\t\t});\n\t\t}\n\t}\n\n\t_onclick(e: MouseEvent) {\n\t\tconst target = e.target as UI5Element;\n\n\t\tif (!(target instanceof HTMLElement) || this.disabled || this.readonly) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst targetValue = target.getAttribute(\"data-ui5-value\");\n\n\t\tif (targetValue !== null) {\n\t\t\tthis.value = parseInt(targetValue);\n\t\t\tif (this.value === this._liveValue) {\n\t\t\t\tthis.value = 0;\n\t\t\t}\n\n\t\t\tif (this._liveValue !== this.value) {\n\t\t\t\tthis.fireDecoratorEvent(\"change\");\n\t\t\t\tthis._liveValue = this.value;\n\t\t\t}\n\t\t}\n\t}\n\n\t_onkeydown(e: KeyboardEvent) {\n\t\tif (this.disabled || this.readonly) {\n\t\t\t// prevent page scrolling\n\t\t\tif (isSpace(e)) {\n\t\t\t\te.preventDefault();\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst isDecrease = isDown(e) || isLeft(e);\n\t\tconst isIncrease = isRight(e) || isUp(e);\n\t\tconst isIncreaseWithReset = isSpace(e) || isEnter(e);\n\t\tconst isMin = isHome(e);\n\t\tconst isMax = isEnd(e);\n\t\tconst isNumber = (e.keyCode >= 48 && e.keyCode <= 57) || (e.keyCode >= 96 && e.keyCode <= 105);\n\n\t\tif (isDecrease || isIncrease || isIncreaseWithReset || isMin || isMax || isNumber) {\n\t\t\te.preventDefault();\n\n\t\t\tif (isDecrease && this.value > 0) {\n\t\t\t\tthis.value = Math.round(this.value - 1);\n\t\t\t} else if (isIncrease && this.value < this.max) {\n\t\t\t\tthis.value = Math.round(this.value + 1);\n\t\t\t} else if (isIncreaseWithReset) {\n\t\t\t\tconst proposedValue = Math.round(this.value + 1);\n\t\t\t\tthis.value = proposedValue > this.max ? 0 : proposedValue;\n\t\t\t} else if (isMin) {\n\t\t\t\tthis.value = 0;\n\t\t\t} else if (isMax) {\n\t\t\t\tthis.value = this.max;\n\t\t\t} else if (isNumber) {\n\t\t\t\tconst pressedNumber = parseInt(e.key);\n\t\t\t\tthis.value = pressedNumber > this.max ? this.max : pressedNumber;\n\t\t\t}\n\n\t\t\tthis.fireDecoratorEvent(\"change\");\n\t\t}\n\t}\n\n\t_onfocusin() {\n\t\tif (this.disabled) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._focused = true;\n\t\tthis._liveValue = this.value;\n\t}\n\n\t_onfocusout() {\n\t\tthis._focused = false;\n\t}\n\n\tget effectiveTabIndex() {\n\t\tconst tabindex = this.getAttribute(\"tabindex\");\n\n\t\tif (this.disabled) {\n\t\t\treturn -1;\n\t\t}\n\n\t\treturn tabindex ? parseInt(tabindex) : 0;\n\t}\n\n\tget ratingTooltip(): string | undefined {\n\t\tif (this.tooltip) {\n\t\t\treturn this.tooltip;\n\t\t}\n\t\treturn getEnableDefaultTooltips() ? this.defaultTooltip : undefined;\n\t}\n\n\tget defaultTooltip() {\n\t\treturn RatingIndicator.i18nBundle.getText(RATING_INDICATOR_TOOLTIP_TEXT);\n\t}\n\n\tget _ariaRoleDescription() {\n\t\treturn RatingIndicator.i18nBundle.getText(RATING_INDICATOR_TEXT);\n\t}\n\n\tget _ariaDisabled() {\n\t\treturn this.disabled || undefined;\n\t}\n\n\tget _ariaLabel() {\n\t\treturn getEffectiveAriaLabelText(this);\n\t}\n\n\tget _ariaDescription() {\n\t\treturn this.required ? RatingIndicator.i18nBundle.getText(RATING_INDICATOR_ARIA_DESCRIPTION) : undefined;\n\t}\n\n\tget ariaReadonly() {\n\t\treturn this.readonly ? \"true\" : undefined;\n\t}\n}\n\nRatingIndicator.define();\n\nexport default RatingIndicator;\nexport type { Star };\n"]}
|
|
1
|
+
{"version":3,"file":"RatingIndicator.js","sourceRoot":"","sources":["../src/RatingIndicator.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,KAAK,MAAM,yDAAyD,CAAC;AAC5E,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AAC3F,OAAO,UAAU,MAAM,4CAA4C,CAAC;AACpE,OAAO,WAAW,MAAM,sDAAsD,CAAC;AAC/E,OAAO,EACN,MAAM,EACN,IAAI,EACJ,MAAM,EACN,OAAO,EACP,OAAO,EACP,OAAO,EACP,MAAM,EACN,KAAK,GACL,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,+DAA+D,CAAC;AAC1G,OAAO,IAAI,MAAM,iDAAiD,CAAC;AAEnE,OAAO,2CAA2C,CAAC;AACnD,OAAO,6CAA6C,CAAC;AACrD,OAAO,EACN,qBAAqB,EACrB,6BAA6B,EAC7B,iCAAiC,GACjC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AAEnE,SAAS;AACT,OAAO,kBAAkB,MAAM,2CAA2C,CAAC;AAS3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAiBH,IAAM,eAAe,uBAArB,MAAM,eAAgB,SAAQ,UAAU;IA6IvC;QACC,KAAK,EAAE,CAAC;QA1IT;;;;;;;;;;WAUG;QAEH,UAAK,GAAW,CAAC,CAAC;QAElB;;;;;WAKG;QAEH,QAAG,GAAW,CAAC,CAAC;QAEhB;;;;;WAKG;QAEH,SAAI,GAA6B,GAAG,CAAC;QAErC;;;;;;WAMG;QAEH,aAAQ,GAAG,KAAK,CAAC;QAEjB;;;;;;;WAOG;QAEH,aAAQ,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CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;iDACX;AASjB;IADC,QAAQ,EAAE;gDACM;AAUjB;IADC,QAAQ,EAAE;kDACY;AASvB;IADC,QAAQ,EAAE;oDACgB;AAM3B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;+CACpB;AAMzB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;iDACX;AAKV;IADN,IAAI,CAAC,oBAAoB,CAAC;yCACG;AA3IzB,eAAe;IAfpB,aAAa,CAAC;QACd,GAAG,EAAE,sBAAsB;QAC3B,aAAa,EAAE,IAAI;QACnB,QAAQ,EAAE,WAAW;QACrB,MAAM,EAAE,kBAAkB;QAC1B,QAAQ,EAAE,uBAAuB;KACjC,CAAC;IACF;;;OAGG;;IACF,KAAK,CAAC,QAAQ,EAAE;QAChB,OAAO,EAAE,IAAI;KACb,CAAC;GAEI,eAAe,CAmSpB;AAED,eAAe,CAAC,MAAM,EAAE,CAAC;AAEzB,eAAe,eAAe,CAAC","sourcesContent":["import customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport event from \"@ui5/webcomponents-base/dist/decorators/event-strict.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport { getEnableDefaultTooltips } from \"@ui5/webcomponents-base/dist/config/Tooltips.js\";\nimport UI5Element from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport jsxRenderer from \"@ui5/webcomponents-base/dist/renderer/JsxRenderer.js\";\nimport {\n\tisDown,\n\tisUp,\n\tisLeft,\n\tisRight,\n\tisSpace,\n\tisEnter,\n\tisHome,\n\tisEnd,\n} from \"@ui5/webcomponents-base/dist/Keys.js\";\nimport { getEffectiveAriaLabelText } from \"@ui5/webcomponents-base/dist/util/AccessibilityTextsHelper.js\";\nimport i18n from \"@ui5/webcomponents-base/dist/decorators/i18n.js\";\nimport type I18nBundle from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport \"@ui5/webcomponents-icons/dist/favorite.js\";\nimport \"@ui5/webcomponents-icons/dist/unfavorite.js\";\nimport {\n\tRATING_INDICATOR_TEXT,\n\tRATING_INDICATOR_TOOLTIP_TEXT,\n\tRATING_INDICATOR_ARIA_DESCRIPTION,\n} from \"./generated/i18n/i18n-defaults.js\";\nimport RatingIndicatorTemplate from \"./RatingIndicatorTemplate.js\";\n\n// Styles\nimport RatingIndicatorCss from \"./generated/themes/RatingIndicator.css.js\";\nimport type RatingIndicatorSize from \"./types/RatingIndicatorSize.js\";\n\ntype Star = {\n\tselected: boolean,\n\tindex: number,\n\thalfStar: boolean\n}\n\n/**\n * @class\n *\n * ### Overview\n * The Rating Indicator is used to display a specific number of icons that are used to rate an item.\n * Additionally, it is also used to display the average and overall ratings.\n *\n * ### Usage\n * The recommended number of icons is between 5 and 7.\n *\n * ### Responsive Behavior\n * You can change the size of the Rating Indicator by changing its `font-size` CSS property.\n *\n * Example: `<ui5-rating-indicator style=\"font-size: 3rem;\"></ui5-rating-indicator>`\n *\n * ### Keyboard Handling\n * When the `ui5-rating-indicator` is focused, the user can change the rating\n * with the following keyboard shortcuts:\n *\n * - [RIGHT/UP] - Increases the value of the rating by one step. If the highest value is reached, does nothing\n * - [LEFT/DOWN] - Decreases the value of the rating by one step. If the lowest value is reached, does nothing.\n * - [Home] - Sets the lowest value.\n * - [End] - Sets the highest value.\n * - [SPACE/ENTER/RETURN] - Increases the value of the rating by one step. If the highest value is reached, sets the rating to the lowest value.\n * - Any number - Changes value to the corresponding number. If typed number is larger than the number of values, sets the highest value.\n *\n * ### ES6 Module Import\n *\n * `import \"@ui5/webcomponents/dist/RatingIndicator.js\";`\n * @constructor\n * @extends UI5Element\n * @public\n * @since 1.0.0-rc.8\n */\n\n@customElement({\n\ttag: \"ui5-rating-indicator\",\n\tlanguageAware: true,\n\trenderer: jsxRenderer,\n\tstyles: RatingIndicatorCss,\n\ttemplate: RatingIndicatorTemplate,\n})\n/**\n * The event is fired when the value changes.\n * @public\n */\n@event(\"change\", {\n\tbubbles: true,\n})\n\nclass RatingIndicator extends UI5Element {\n\teventDetails!: {\n\t\tchange: void,\n\t}\n\t/**\n\t * The indicated value of the rating.\n\t *\n\t * **Note:** If you set a number which is not round, it would be shown as follows:\n\t *\n\t * - 1.0 - 1.2 -> 1\n\t * - 1.3 - 1.7 -> 1.5\n\t * - 1.8 - 1.9 -> 2\n\t * @default 0\n\t * @public\n\t */\n\t@property({ type: Number })\n\tvalue: number = 0;\n\n\t/**\n\t * The number of displayed rating symbols.\n\t * @default 5\n\t * @public\n\t * @since 1.0.0-rc.15\n\t */\n\t@property({ type: Number })\n\tmax: number = 5;\n\n\t/**\n\t * Defines the size of the component.\n\t * @default \"M\"\n\t * @public\n\t * @since 2.6.0\n\t */\n\t@property()\n\tsize: `${RatingIndicatorSize}` = \"M\";\n\n\t/**\n\t * Defines whether the component is disabled.\n\t *\n\t * **Note:** A disabled component is completely noninteractive.\n\t * @default false\n\t * @public\n\t */\n\t@property({ type: Boolean })\n\tdisabled = false;\n\n\t/**\n\t * Defines whether the component is read-only.\n\t *\n\t * **Note:** A read-only component is not editable,\n\t * but still provides visual feedback upon user interaction.\n\t * @default false\n\t * @public\n\t */\n\t@property({ type: Boolean })\n\treadonly = false;\n\n\t/**\n\t * Defines whether the component is in display-only mode.\n\t *\n\t * **Note:** A display-only component is visually identical to read-only\n\t * but cannot receive focus and is not announced by screen readers.\n\t * @default false\n\t * @public\n\t * @since 2.26.0\n\t */\n\t@property({ type: Boolean })\n\tdisplayOnly = false;\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.15.0\n\t */\n\t @property()\n\t accessibleNameRef?: string;\n\n\t /**\n\t * Defines whether the component is required.\n\t * @default false\n\t * @public\n\t * @since 1.15.0\n\t */\n\t@property({ type: Boolean })\n\trequired = false;\n\n\t/**\n\t * Defines the tooltip of the component.\n\t * @default undefined\n\t * @public\n\t * @since 1.19.0\n\t */\n\t@property()\n\ttooltip?: string;\n\n\t/**\n\t * Defines the icon to be displayed for the selected (filled) rating symbol.\n\t *\n\t * @default \"favorite\"\n\t * @public\n\t * @since 2.20\n\t */\n\t@property()\n\tratedIcon = \"favorite\";\n\n\t/**\n\t * Defines the icon to be displayed for the unselected (empty) rating symbol.\n\t * @default \"unfavorite\"\n\t * @public\n\t * @since 2.20\n\t */\n\t@property()\n\tunratedIcon = \"unfavorite\";\n\n\t/**\n\t * @private\n\t */\n\t@property({ type: Array, noAttribute: true })\n\t_stars: Array<Star> = [];\n\n\t/**\n\t * @private\n\t */\n\t@property({ type: Boolean })\n\t_focused = false;\n\n\t_liveValue?: number;\n\n\t@i18n(\"@ui5/webcomponents\")\n\tstatic i18nBundle: I18nBundle;\n\n\tconstructor() {\n\t\tsuper();\n\t}\n\n\tonBeforeRendering() {\n\t\tthis.calcState();\n\t}\n\n\tcalcState() {\n\t\tthis._stars = [];\n\n\t\tfor (let i = 1; i < this.max + 1; i++) {\n\t\t\tconst remainder = Math.round((this.value - Math.floor(this.value)) * 10);\n\t\t\tlet halfStar = false,\n\t\t\t\ttempValue = this.value;\n\n\t\t\tif (Math.floor(this.value) + 1 === i && remainder > 2 && remainder < 8) {\n\t\t\t\thalfStar = true;\n\t\t\t} else if (remainder <= 2) {\n\t\t\t\ttempValue = Math.floor(this.value);\n\t\t\t} else if (remainder >= 8) {\n\t\t\t\ttempValue = Math.ceil(this.value);\n\t\t\t}\n\n\t\t\tthis._stars.push({\n\t\t\t\tselected: i <= tempValue,\n\t\t\t\tindex: i,\n\t\t\t\thalfStar,\n\t\t\t});\n\t\t}\n\t}\n\n\t_onclick(e: MouseEvent) {\n\t\tconst target = e.target as UI5Element;\n\n\t\tif (!(target instanceof HTMLElement) || this.disabled || this.readonly || this.displayOnly) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst targetValue = target.getAttribute(\"data-ui5-value\");\n\n\t\tif (targetValue !== null) {\n\t\t\tthis.value = parseInt(targetValue);\n\t\t\tif (this.value === this._liveValue) {\n\t\t\t\tthis.value = 0;\n\t\t\t}\n\n\t\t\tif (this._liveValue !== this.value) {\n\t\t\t\tthis.fireDecoratorEvent(\"change\");\n\t\t\t\tthis._liveValue = this.value;\n\t\t\t}\n\t\t}\n\t}\n\n\t_onkeydown(e: KeyboardEvent) {\n\t\tif (this.disabled || this.readonly || this.displayOnly) {\n\t\t\t// prevent page scrolling\n\t\t\tif (isSpace(e)) {\n\t\t\t\te.preventDefault();\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst isDecrease = isDown(e) || isLeft(e);\n\t\tconst isIncrease = isRight(e) || isUp(e);\n\t\tconst isIncreaseWithReset = isSpace(e) || isEnter(e);\n\t\tconst isMin = isHome(e);\n\t\tconst isMax = isEnd(e);\n\t\tconst isNumber = (e.keyCode >= 48 && e.keyCode <= 57) || (e.keyCode >= 96 && e.keyCode <= 105);\n\n\t\tif (isDecrease || isIncrease || isIncreaseWithReset || isMin || isMax || isNumber) {\n\t\t\te.preventDefault();\n\n\t\t\tif (isDecrease && this.value > 0) {\n\t\t\t\tthis.value = Math.round(this.value - 1);\n\t\t\t} else if (isIncrease && this.value < this.max) {\n\t\t\t\tthis.value = Math.round(this.value + 1);\n\t\t\t} else if (isIncreaseWithReset) {\n\t\t\t\tconst proposedValue = Math.round(this.value + 1);\n\t\t\t\tthis.value = proposedValue > this.max ? 0 : proposedValue;\n\t\t\t} else if (isMin) {\n\t\t\t\tthis.value = 0;\n\t\t\t} else if (isMax) {\n\t\t\t\tthis.value = this.max;\n\t\t\t} else if (isNumber) {\n\t\t\t\tconst pressedNumber = parseInt(e.key);\n\t\t\t\tthis.value = pressedNumber > this.max ? this.max : pressedNumber;\n\t\t\t}\n\n\t\t\tthis.fireDecoratorEvent(\"change\");\n\t\t}\n\t}\n\n\t_onfocusin() {\n\t\tif (this.disabled || this.displayOnly) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._focused = true;\n\t\tthis._liveValue = this.value;\n\t}\n\n\t_onfocusout() {\n\t\tthis._focused = false;\n\t}\n\n\tget effectiveTabIndex() {\n\t\tconst tabindex = this.getAttribute(\"tabindex\");\n\n\t\tif (this.disabled || this.displayOnly) {\n\t\t\treturn -1;\n\t\t}\n\n\t\treturn tabindex ? parseInt(tabindex) : 0;\n\t}\n\n\tget ratingTooltip(): string | undefined {\n\t\tif (this.tooltip) {\n\t\t\treturn this.tooltip;\n\t\t}\n\t\treturn getEnableDefaultTooltips() ? this.defaultTooltip : undefined;\n\t}\n\n\tget defaultTooltip() {\n\t\treturn RatingIndicator.i18nBundle.getText(RATING_INDICATOR_TOOLTIP_TEXT);\n\t}\n\n\tget _ariaRoleDescription() {\n\t\treturn RatingIndicator.i18nBundle.getText(RATING_INDICATOR_TEXT);\n\t}\n\n\tget _ariaDisabled() {\n\t\treturn this.disabled || this.displayOnly || undefined;\n\t}\n\n\tget _ariaLabel() {\n\t\treturn getEffectiveAriaLabelText(this);\n\t}\n\n\tget _ariaDescription() {\n\t\treturn this.required ? RatingIndicator.i18nBundle.getText(RATING_INDICATOR_ARIA_DESCRIPTION) : undefined;\n\t}\n\n\tget ariaReadonly() {\n\t\tif (this.displayOnly) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this.readonly ? \"true\" : undefined;\n\t}\n}\n\nRatingIndicator.define();\n\nexport default RatingIndicator;\nexport type { Star };\n"]}
|
|
@@ -10,7 +10,7 @@ function starLi(star) {
|
|
|
10
10
|
if (star.halfStar) {
|
|
11
11
|
return (_jsxs("li", { class: "ui5-rating-indicator-item ui5-rating-indicator-item-half", children: [_jsx("div", { class: "ui5-rating-indicator-half-icon-wrapper ui5-rating-indicator-half-icon-left", children: _jsx(Icon, { "data-ui5-value": star.index, name: this.ratedIcon }) }), _jsx("div", { class: "ui5-rating-indicator-half-icon-wrapper ui5-rating-indicator-half-icon-right", children: _jsx(Icon, { "data-ui5-value": star.index, name: this.unratedIcon }) })] }));
|
|
12
12
|
}
|
|
13
|
-
if (this.readonly) {
|
|
13
|
+
if (this.readonly || this.displayOnly) {
|
|
14
14
|
return (_jsx("li", { class: "ui5-rating-indicator-item ui5-rating-indicator-item-unsel", children: _jsx(Icon, { "data-ui5-value": star.index, name: this.ratedIcon }) }));
|
|
15
15
|
}
|
|
16
16
|
if (this.disabled) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RatingIndicatorTemplate.js","sourceRoot":"","sources":["../src/RatingIndicatorTemplate.tsx"],"names":[],"mappings":";AAEA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,CAAC,OAAO,UAAU,uBAAuB;IAC9C,OAAO,CACN,cACC,KAAK,EAAC,2BAA2B,EACjC,IAAI,EAAC,QAAQ,0BACS,IAAI,CAAC,oBAAoB,mBAChC,CAAC,mBACD,IAAI,CAAC,KAAK,mBACV,IAAI,CAAC,GAAG,oBACP,GAAG,IAAI,CAAC,KAAK,OAAO,IAAI,CAAC,GAAG,EAAE,sBAC7B,YAAY,mBACd,IAAI,CAAC,aAAa,mBAClB,IAAI,CAAC,YAAY,sBACd,IAAI,CAAC,gBAAgB,EACvC,QAAQ,EAAE,IAAI,CAAC,iBAAiB,EAChC,SAAS,EAAE,IAAI,CAAC,UAAU,EAC1B,UAAU,EAAE,IAAI,CAAC,WAAW,EAC5B,OAAO,EAAE,IAAI,CAAC,QAAQ,EACtB,SAAS,EAAE,IAAI,CAAC,UAAU,EAC1B,KAAK,EAAE,IAAI,CAAC,aAAa,gBACb,IAAI,CAAC,UAAU,YAE3B,aAAI,KAAK,EAAC,2BAA2B,iBAAa,MAAM,YACrD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,G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H,CAAC;IAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QACrB,OAAO,CACN,aAAI,KAAK,EAAC,2DAA2D,YACpE,KAAC,IAAI,sBAAiB,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,GAAI,GACtD,CACL,CAAC;IACH,CAAC;IACD,OAAO,CACN,+BAAoB,IAAI,CAAC,KAAK,EAAE,KAAK,EAAC,2DAA2D,YAChG,KAAC,IAAI,sBAAiB,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,GAAG,GACvD,CACL,CAAC;AACH,CAAC","sourcesContent":["import type RatingIndicator from \"./RatingIndicator.js\";\nimport type { Star } from \"./RatingIndicator.js\";\nimport Icon from \"./Icon.js\";\n\nexport default function RatingIndicatorTemplate(this: RatingIndicator) {\n\treturn (\n\t\t<div\n\t\t\tclass=\"ui5-rating-indicator-root\"\n\t\t\trole=\"slider\"\n\t\t\taria-roledescription={this._ariaRoleDescription}\n\t\t\taria-valuemin={0}\n\t\t\taria-valuenow={this.value}\n\t\t\taria-valuemax={this.max}\n\t\t\taria-valuetext={`${this.value} of ${this.max}`}\n\t\t\taria-orientation=\"horizontal\"\n\t\t\taria-disabled={this._ariaDisabled}\n\t\t\taria-readonly={this.ariaReadonly}\n\t\t\taria-description={this._ariaDescription}\n\t\t\ttabindex={this.effectiveTabIndex}\n\t\t\tonFocusIn={this._onfocusin}\n\t\t\tonFocusOut={this._onfocusout}\n\t\t\tonClick={this._onclick}\n\t\t\tonKeyDown={this._onkeydown}\n\t\t\ttitle={this.ratingTooltip}\n\t\t\taria-label={this._ariaLabel}\n\t\t>\n\t\t\t<ul class=\"ui5-rating-indicator-list\" aria-hidden=\"true\">\n\t\t\t\t{ this._stars.map(star => starLi.call(this, star))}\n\t\t\t</ul>\n\t\t</div>\n\t);\n}\n\nfunction starLi(this: RatingIndicator, star: Star) {\n\tif (star.selected) {\n\t\treturn (\n\t\t\t<li data-ui5-value={star.index} class=\"ui5-rating-indicator-item ui5-rating-indicator-item-sel\">\n\t\t\t\t<Icon data-ui5-value={star.index} name={this.ratedIcon} />\n\t\t\t</li>\n\t\t);\n\t} if (star.halfStar) {\n\t\treturn (\n\t\t\t<li class=\"ui5-rating-indicator-item ui5-rating-indicator-item-half\">\n\t\t\t\t<div class=\"ui5-rating-indicator-half-icon-wrapper ui5-rating-indicator-half-icon-left\">\n\t\t\t\t\t<Icon data-ui5-value={star.index} name={this.ratedIcon} />\n\t\t\t\t</div>\n\t\t\t\t<div class=\"ui5-rating-indicator-half-icon-wrapper ui5-rating-indicator-half-icon-right\">\n\t\t\t\t\t<Icon data-ui5-value={star.index} name={this.unratedIcon} />\n\t\t\t\t</div>\n\t\t\t</li>\n\t\t);\n\t} if (this.readonly || this.displayOnly) {\n\t\treturn (\n\t\t\t<li class=\"ui5-rating-indicator-item ui5-rating-indicator-item-unsel\">\n\t\t\t\t<Icon data-ui5-value={star.index} name={this.ratedIcon} />\n\t\t\t</li>\n\t\t);\n\t} if (this.disabled) {\n\t\treturn (\n\t\t\t<li class=\"ui5-rating-indicator-item ui5-rating-indicator-item-unsel\">\n\t\t\t\t<Icon data-ui5-value={star.index} name={this.ratedIcon} />\n\t\t\t</li>\n\t\t);\n\t}\n\treturn (\n\t\t<li data-ui5-value={star.index} class=\"ui5-rating-indicator-item ui5-rating-indicator-item-unsel\">\n\t\t\t<Icon data-ui5-value={star.index} name={this.unratedIcon}/>\n\t\t</li>\n\t);\n}\n"]}
|
|
@@ -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,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,gCAAgC,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AACvH,OAAO,0BAA0B,CAAC;AAElC,OAAO,4BAA4B,MAAM,yCAAyC,CAAC;AAEnF,WAAW;AACX,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AAEnE,SAAS;AACT,OAAO,kBAAkB,MAAM,2CAA2C,CAAC;AAe3E;;;;;;;;;;;;;;;;;GAiBG;AAiBH,IAAM,eAAe,uBAArB,MAAM,eAAgB,SAAQ,UAAU;IAoFvC;QACC,KAAK,EAAE,CAAC;QA7CT;;;;;WAKG;QAEH,kBAAa,GAAsC,QAAQ,CAAC;QAE5D;;;;;;;;;UASE;QAEF,oBAAe,GAAY,KAAK,CAAC;QA2BhC,IAAI,CAAC,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B;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,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I,CAAC,IAAI,SAAS,CAAC;IAC3D,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 { 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,sDAA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esContent":["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;AACr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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,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/Select.d.ts
CHANGED
|
@@ -418,6 +418,8 @@ declare class Select extends UI5Element implements IFormInputElement {
|
|
|
418
418
|
};
|
|
419
419
|
};
|
|
420
420
|
get ariaLabelText(): string | undefined;
|
|
421
|
+
get _effectiveListAccessibleName(): string;
|
|
422
|
+
get _effectivePopoverAccessibleName(): string | undefined;
|
|
421
423
|
get shouldDisplayDefaultValueStateMessage(): boolean;
|
|
422
424
|
get hasValueStateText(): boolean;
|
|
423
425
|
get shouldOpenValueStateMessagePopover(): boolean;
|
package/dist/Select.js
CHANGED
|
@@ -24,7 +24,7 @@ import { isPhone } from "@ui5/webcomponents-base/dist/Device.js";
|
|
|
24
24
|
import i18n from "@ui5/webcomponents-base/dist/decorators/i18n.js";
|
|
25
25
|
import InvisibleMessageMode from "@ui5/webcomponents-base/dist/types/InvisibleMessageMode.js";
|
|
26
26
|
import List from "./List.js";
|
|
27
|
-
import { VALUE_STATE_SUCCESS, VALUE_STATE_INFORMATION, VALUE_STATE_ERROR, VALUE_STATE_WARNING, VALUE_STATE_TYPE_SUCCESS, VALUE_STATE_TYPE_INFORMATION, VALUE_STATE_TYPE_ERROR, VALUE_STATE_TYPE_WARNING,
|
|
27
|
+
import { VALUE_STATE_SUCCESS, VALUE_STATE_INFORMATION, VALUE_STATE_ERROR, VALUE_STATE_WARNING, VALUE_STATE_TYPE_SUCCESS, VALUE_STATE_TYPE_INFORMATION, VALUE_STATE_TYPE_ERROR, VALUE_STATE_TYPE_WARNING, LIST_ITEM_POSITION, SELECT_ROLE_DESCRIPTION, SELECT_POPOVER_ACCESSIBLE_NAME_PREFIX, SELECT_LISTBOX_LABEL, SELECT_DIALOG_CANCEL_BUTTON, FORM_SELECTABLE_REQUIRED, } from "./generated/i18n/i18n-defaults.js";
|
|
28
28
|
import Label from "./Label.js";
|
|
29
29
|
import ResponsivePopover from "./ResponsivePopover.js";
|
|
30
30
|
import Popover from "./Popover.js";
|
|
@@ -668,7 +668,7 @@ let Select = Select_1 = class Select extends UI5Element {
|
|
|
668
668
|
return this.disabled || undefined;
|
|
669
669
|
}
|
|
670
670
|
get _headerTitleText() {
|
|
671
|
-
return Select_1.i18nBundle.getText(
|
|
671
|
+
return Select_1.i18nBundle.getText(SELECT_LISTBOX_LABEL);
|
|
672
672
|
}
|
|
673
673
|
get _cancelButtonText() {
|
|
674
674
|
return Select_1.i18nBundle.getText(SELECT_DIALOG_CANCEL_BUTTON);
|
|
@@ -732,6 +732,17 @@ let Select = Select_1 = class Select extends UI5Element {
|
|
|
732
732
|
get ariaLabelText() {
|
|
733
733
|
return getEffectiveAriaLabelText(this) || getAssociatedLabelForTexts(this);
|
|
734
734
|
}
|
|
735
|
+
get _effectiveListAccessibleName() {
|
|
736
|
+
return this.ariaLabelText || this._headerTitleText;
|
|
737
|
+
}
|
|
738
|
+
get _effectivePopoverAccessibleName() {
|
|
739
|
+
const fieldName = this._effectiveListAccessibleName;
|
|
740
|
+
if (!fieldName) {
|
|
741
|
+
return undefined;
|
|
742
|
+
}
|
|
743
|
+
const prefix = Select_1.i18nBundle.getText(SELECT_POPOVER_ACCESSIBLE_NAME_PREFIX);
|
|
744
|
+
return `${prefix} ${fieldName}`;
|
|
745
|
+
}
|
|
735
746
|
get shouldDisplayDefaultValueStateMessage() {
|
|
736
747
|
return !this.valueStateMessage.length && this.hasValueStateText;
|
|
737
748
|
}
|