Skip to content

Commit 47f6ede

Browse files
committed
feat(progress): add display inline variant to ProgressCircular
1 parent 930dc3a commit 47f6ede

File tree

5 files changed

+51
-8
lines changed

5 files changed

+51
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
- `UserBlock`: fix fields wrapping in horizontal mode.
1313

14+
### Added
15+
16+
- `ProgressCircular`: add inline display variant
17+
1418
## [3.14.1][] - 2025-06-02
1519

1620
### Fixed

packages/lumx-core/src/scss/components/progress/_index.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
width: $lumx-progress-circular-size;
2020
height: $lumx-progress-circular-size;
2121

22+
&--display-inline {
23+
display: inline-block;
24+
}
25+
2226
&__double-bounce1,
2327
&__double-bounce2 {
2428
position: absolute;

packages/lumx-react/src/components/progress/ProgressCircular.stories.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { ProgressCircular, ProgressCircularSize, Size } from '@lumx/react';
1+
import React from 'react';
2+
import { ProgressCircular, ProgressCircularSize, Size, Text } from '@lumx/react';
23
import { getSelectArgType } from '@lumx/react/stories/controls/selectArgType';
34
import { withCombinations } from '@lumx/react/stories/decorators/withCombinations';
45

@@ -28,3 +29,16 @@ export const AllSizes = {
2829
}),
2930
],
3031
};
32+
33+
/**
34+
* Inline display variant to use inside text
35+
*/
36+
export const Inline = {
37+
render() {
38+
return (
39+
<Text as="p">
40+
Some text with <ProgressCircular display="inline" size="xxs" /> inline progress
41+
</Text>
42+
);
43+
},
44+
};

packages/lumx-react/src/components/progress/ProgressCircular.test.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,19 @@ describe(`<${ProgressCircular.displayName}>`, () => {
2121
it('should render default', () => {
2222
const { element } = setup();
2323
expect(element).toHaveClass(`${CLASSNAME}--size-m`);
24+
expect(element.tagName).toBe('DIV');
2425
});
2526

2627
it('should render size xs', () => {
2728
const { element } = setup({ size: 'xs' });
2829
expect(element).toHaveClass(`${CLASSNAME}--size-xs`);
2930
});
3031

32+
it('should render display inline', () => {
33+
const { element } = setup({ display: 'inline' });
34+
expect(element.tagName).toBe('SPAN');
35+
});
36+
3137
commonTestsSuiteRTL(setup, {
3238
baseClassName: CLASSNAME,
3339
forwardClassName: 'element',

packages/lumx-react/src/components/progress/ProgressCircular.tsx

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,15 @@ export type ProgressCircularSize = Extract<Size, 'xxs' | 'xs' | 's' | 'm'>;
1717
* Defines the props of the component.
1818
*/
1919
export interface ProgressCircularProps extends GenericProps, HasTheme {
20-
/** Progress circular size. */
20+
/**
21+
* Progress circular size.
22+
*/
2123
size?: ProgressCircularSize;
24+
/**
25+
* Progress display type (inline or block).
26+
* @default 'block'
27+
*/
28+
display?: 'inline' | 'block';
2229
}
2330

2431
/**
@@ -36,6 +43,7 @@ const CLASSNAME = getRootClassName(COMPONENT_NAME);
3643
*/
3744
const DEFAULT_PROPS: Partial<ProgressCircularProps> = {
3845
size: Size.m,
46+
display: 'block',
3947
};
4048

4149
/**
@@ -47,21 +55,28 @@ const DEFAULT_PROPS: Partial<ProgressCircularProps> = {
4755
*/
4856
export const ProgressCircular = forwardRef<ProgressCircularProps, HTMLDivElement>((props, ref) => {
4957
const defaultTheme = useTheme() || Theme.light;
50-
const { className, theme = defaultTheme, size, ...forwardedProps } = props;
58+
const {
59+
className,
60+
theme = defaultTheme,
61+
size = DEFAULT_PROPS.size,
62+
display = DEFAULT_PROPS.display,
63+
...forwardedProps
64+
} = props;
65+
const Element = display === 'block' ? 'div' : 'span';
5166

5267
return (
53-
<div
68+
<Element
5469
ref={ref}
5570
{...forwardedProps}
56-
className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, theme, size }))}
71+
className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, theme, size, display }))}
5772
>
58-
<div className="lumx-progress-circular__double-bounce1" />
59-
<div className="lumx-progress-circular__double-bounce2" />
73+
<Element className="lumx-progress-circular__double-bounce1" />
74+
<Element className="lumx-progress-circular__double-bounce2" />
6075

6176
<svg className="lumx-progress-circular__svg" viewBox="25 25 50 50">
6277
<circle className="lumx-progress-circular__path" cx="50" cy="50" r="20" fill="none" strokeWidth="5" />
6378
</svg>
64-
</div>
79+
</Element>
6580
);
6681
});
6782
ProgressCircular.displayName = COMPONENT_NAME;

0 commit comments

Comments
 (0)