Skip to content

Commit a54a014

Browse files
committed
refactor(progress): prefer percent in value text
1 parent fa187da commit a54a014

File tree

9 files changed

+25
-11
lines changed

9 files changed

+25
-11
lines changed

packages/react/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ description: All notable changes will be documented in this file.
66

77
## [Unreleased]
88

9+
### Changed
10+
11+
- **Progress**: Update `Progress.ValueText` to render percentage as string.
12+
913
## [3.6.2] - 2024-07-28
1014

1115
### Changed

packages/react/src/components/progress/progress-value-text.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const ProgressValueText = forwardRef<HTMLSpanElement, ProgressValueTextPr
1414

1515
return (
1616
<ark.span {...mergedProps} ref={ref}>
17-
{children || progress.valueAsString}
17+
{children || progress.percentAsString}
1818
</ark.span>
1919
)
2020
},

packages/react/src/components/progress/tests/progress.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ describe('Progress', () => {
3535
it('should render', async () => {
3636
render(<ComponentUnderTest value={7} />)
3737

38-
screen.getByText('7 percent')
38+
screen.getByText('7%')
3939
})
4040

4141
it('should handle custom max range', async () => {
4242
render(<ComponentUnderTest value={30} max={30} />)
4343

44-
screen.getByText('100 percent')
44+
screen.getByText('100%')
4545
})
4646
})

packages/solid/CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ description: All notable changes will be documented in this file.
66

77
## [Unreleased]
88

9+
### Changed
10+
11+
- **Progress**: Update `Progress.ValueText` to render percentage as string.
12+
913
## [3.6.2] - 2024-07-28
1014

1115
### Changed
@@ -15,7 +19,8 @@ description: All notable changes will be documented in this file.
1519
### Fixed
1620

1721
- **DatePicker**:
18-
- Fixed issue where the selected date doesn't reflect in the input when clicking the trigger and then focusing the input.
22+
- Fixed issue where the selected date doesn't reflect in the input when clicking the trigger and
23+
then focusing the input.
1924
- Fixed SSR issue when using `getPresetTrigger`.
2025
- **Slider**: Fixed issue where `onValueChangeEnd` was called with an incorrect value.
2126
- Fixed an import issue with `@internationalized/date`.

packages/solid/src/components/progress/progress-value-text.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ export const ProgressValueText = (props: ProgressValueTextProps) => {
99
const api = useProgressContext()
1010
const mergedProps = mergeProps(() => api().getValueTextProps(), props)
1111

12-
return <ark.span {...mergedProps}>{props.children || api().valueAsString}</ark.span>
12+
return <ark.span {...mergedProps}>{props.children || api().percentAsString}</ark.span>
1313
}

packages/solid/src/components/progress/tests/progress.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ describe('Progress', () => {
1717
it('should handle default value', async () => {
1818
render(() => <ComponentUnderTest value={7} />)
1919

20-
screen.getByText('7 percent')
20+
screen.getByText('7%')
2121
})
2222

2323
it('should handle custom max range', async () => {
2424
render(() => <ComponentUnderTest value={30} max={30} />)
2525

26-
screen.getByText('100 percent')
26+
screen.getByText('100%')
2727
})
2828
})

packages/vue/CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ description: All notable changes will be documented in this file.
66

77
## [Unreleased]
88

9+
### Changed
10+
11+
- **Progress**: Update `Progress.ValueText` to render percentage as string.
12+
913
## [3.7.2] - 2024-07-28
1014

1115
### Changed
@@ -15,7 +19,8 @@ description: All notable changes will be documented in this file.
1519
### Fixed
1620

1721
- **DatePicker**:
18-
- Fixed issue where the selected date doesn't reflect in the input when clicking the trigger and then focusing the input.
22+
- Fixed issue where the selected date doesn't reflect in the input when clicking the trigger and
23+
then focusing the input.
1924
- Fixed SSR issue when using `getPresetTrigger`.
2025
- **Slider**: Fixed issue where `onValueChangeEnd` was called with an incorrect value.
2126
- Fixed an import issue with `@internationalized/date`.

packages/vue/src/components/progress/progress-value-text.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ const slots = useSlots()
2323

2424
<template>
2525
<ark.span v-bind="progress.getValueTextProps()" :as-child="asChild">
26-
<slot>{{ slots.default?.() || progress.valueAsString }}</slot>
26+
<slot>{{ slots.default?.() || progress.percentAsString }}</slot>
2727
</ark.span>
2828
</template>

packages/vue/src/components/progress/tests/progress.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('Progress', () => {
2121
},
2222
})
2323

24-
screen.getByText('7 percent')
24+
screen.getByText('7%')
2525
})
2626

2727
it('should handle custom max range', async () => {
@@ -32,6 +32,6 @@ describe('Progress', () => {
3232
},
3333
})
3434

35-
screen.getByText('100 percent')
35+
screen.getByText('100%')
3636
})
3737
})

0 commit comments

Comments
 (0)