feat(segment, segment-button): update segment value property to accept numbers (#27222)

Issue number: resolves #27221

---------

## What is the current behavior?

The value property of the segment component in Ionic Framework currently
only accepts string values.

## What is the new behavior?

This pull request updates the "value" property of the segment component
to accept a union of string and number types. This allows for more
versatile data input in the segment component, particularly for users
who work with numerical data.

## Does this introduce a breaking change?

- [ ] Yes
- [X] No

## Other information

N/A
This commit is contained in:
Morritz
2023-05-24 16:07:57 +02:00
committed by GitHub
parent e80f0b2409
commit ec95ae5cd3
8 changed files with 20 additions and 14 deletions

View File

@ -6,6 +6,7 @@ import { addEventListener, removeEventListener, inheritAttributes } from '@utils
import { hostContext } from '@utils/theme';
import { getIonMode } from '../../global/ionic-global';
import type { SegmentValue } from '../segment/segment-interface';
import type { SegmentButtonLayout } from './segment-button-interface';
@ -53,7 +54,7 @@ export class SegmentButton implements ComponentInterface, ButtonInterface {
/**
* The value of the segment button.
*/
@Prop() value: string = 'ion-sb-' + ids++;
@Prop() value: SegmentValue = 'ion-sb-' + ids++;
@Watch('value')
valueChanged() {
this.updateState();