Fix prettier and api report

Signed-off-by: AmbrishRamachandiran <ambrish.r@infosys.com>
This commit is contained in:
AmbrishRamachandiran
2026-03-09 23:11:33 +05:30
parent f1043f5514
commit bc19197570
6 changed files with 84 additions and 35 deletions
@@ -89,12 +89,7 @@ Mark a field as required to show a "Required" indicator in the label.
### Disabled
<Snippet
align="center"
py={4}
preview={<Disabled />}
code={disabledSnippet}
/>
<Snippet align="center" py={4} preview={<Disabled />} code={disabledSnippet} />
<Theming definition={RangeSliderDefinition} />
+47
View File
@@ -39,6 +39,7 @@ import { RowProps as RowProps_2 } from 'react-aria-components';
import type { SearchFieldProps as SearchFieldProps_2 } from 'react-aria-components';
import type { SelectProps as SelectProps_2 } from 'react-aria-components';
import type { SeparatorProps } from 'react-aria-components';
import type { SliderProps } from 'react-aria-components';
import type { SortDescriptor as SortDescriptor_2 } from 'react-stately';
import type { SubmenuTriggerProps as SubmenuTriggerProps_2 } from 'react-aria-components';
import type { SwitchProps as SwitchProps_2 } from 'react-aria-components';
@@ -1967,6 +1968,52 @@ export interface RadioProps
extends RadioOwnProps,
Omit<RadioProps_2, keyof RadioOwnProps> {}
// @public (undocumented)
export const RangeSlider: ForwardRefExoticComponent<
RangeSliderProps & RefAttributes<HTMLDivElement>
>;
// @public
export const RangeSliderDefinition: {
readonly styles: {
readonly [key: string]: string;
};
readonly classNames: {
readonly root: 'bui-RangeSlider';
readonly header: 'bui-RangeSliderHeader';
readonly track: 'bui-RangeSliderTrack';
readonly trackFill: 'bui-RangeSliderTrackFill';
readonly thumb: 'bui-RangeSliderThumb';
readonly output: 'bui-RangeSliderOutput';
};
readonly propDefs: {
readonly className: {};
};
};
// @public (undocumented)
export interface RangeSliderOwnProps {
// (undocumented)
className?: string;
}
// @public (undocumented)
export interface RangeSliderProps
extends Omit<SliderProps<[number, number]>, 'children'>,
Omit<
FieldLabelProps,
| 'htmlFor'
| 'id'
| 'className'
| 'defaultValue'
| 'onChange'
| 'slot'
| 'style'
> {
formatValue?: (value: number) => string;
showValueLabel?: boolean;
}
// @public (undocumented)
export type Responsive<T> = T | Partial<Record<Breakpoint, T>>;
@@ -92,9 +92,7 @@
border-radius: 50%;
background: var(--bui-bg-solid);
border: 2px solid var(--bui-bg-solid);
box-shadow:
0 1px 3px 0 rgb(0 0 0 / 0.1),
0 1px 2px -1px rgb(0 0 0 / 0.1);
box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
cursor: grab;
transition: all 200ms;
@@ -105,8 +103,7 @@
&[data-dragging] {
cursor: grabbing;
box-shadow:
0 4px 6px -1px rgb(0 0 0 / 0.1),
box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1),
0 2px 4px -2px rgb(0 0 0 / 0.1);
}
@@ -25,7 +25,7 @@ import clsx from 'clsx';
import { FieldLabel } from '../FieldLabel';
import { FieldError } from '../FieldError';
import type { RangeSliderProps } from './types';
import { useStyles } from '../../hooks/useStyles';
import { useDefinition } from '../../hooks/useDefinition';
import { RangeSliderDefinition } from './definition';
import styles from './RangeSlider.module.css';
@@ -107,7 +107,7 @@ export const RangeSlider = forwardRef<HTMLDivElement, RangeSliderProps>(
...propsWithoutDefault
} = props;
const { classNames, dataAttributes, style, cleanedProps } = useStyles(
const { ownProps, restProps, dataAttributes } = useDefinition(
RangeSliderDefinition,
{
minValue,
@@ -120,16 +120,16 @@ export const RangeSlider = forwardRef<HTMLDivElement, RangeSliderProps>(
...propsWithoutDefault,
},
);
const { classes, className } = ownProps;
const {
className,
label: _ignoredLabel,
description,
secondaryLabel,
showValueLabel = false,
formatValue = (val: number) => val.toString(),
...rest
} = cleanedProps;
} = restProps;
// If a secondary label is provided, use it. Otherwise, use 'Required' if the field is required.
const secondaryLabelText =
@@ -137,16 +137,15 @@ export const RangeSlider = forwardRef<HTMLDivElement, RangeSliderProps>(
return (
<AriaSlider
className={clsx(classNames.root, styles[classNames.root], className)}
className={clsx(classes.root, styles[classes.root], className)}
{...dataAttributes}
aria-label={ariaLabel}
aria-labelledby={ariaLabelledBy}
style={style}
{...rest}
ref={ref}
>
{(label || showValueLabel) && (
<div className={clsx(classNames.header, styles[classNames.header])}>
<div className={clsx(classes.header, styles[classes.header])}>
<FieldLabel
label={label}
secondaryLabel={secondaryLabelText}
@@ -154,7 +153,7 @@ export const RangeSlider = forwardRef<HTMLDivElement, RangeSliderProps>(
/>
{showValueLabel && (
<SliderOutput
className={clsx(classNames.output, styles[classNames.output])}
className={clsx(classes.output, styles[classes.output])}
>
{({ state }) => {
const values = state.values;
@@ -169,9 +168,7 @@ export const RangeSlider = forwardRef<HTMLDivElement, RangeSliderProps>(
)}
</div>
)}
<SliderTrack
className={clsx(classNames.track, styles[classNames.track])}
>
<SliderTrack className={clsx(classes.track, styles[classes.track])}>
{({ state }) => {
const start = state.getThumbPercent(0);
const end = state.getThumbPercent(1);
@@ -189,19 +186,16 @@ export const RangeSlider = forwardRef<HTMLDivElement, RangeSliderProps>(
return (
<>
<div
className={clsx(
classNames.trackFill,
styles[classNames.trackFill],
)}
className={clsx(classes.trackFill, styles[classes.trackFill])}
style={trackFillStyle}
/>
<SliderThumb
index={0}
className={clsx(classNames.thumb, styles[classNames.thumb])}
className={clsx(classes.thumb, styles[classes.thumb])}
/>
<SliderThumb
index={1}
className={clsx(classNames.thumb, styles[classNames.thumb])}
className={clsx(classes.thumb, styles[classes.thumb])}
/>
</>
);
@@ -14,13 +14,16 @@
* limitations under the License.
*/
import type { ComponentDefinition } from '../../types';
import { defineComponent } from '../../hooks/useDefinition';
import type { RangeSliderOwnProps } from './types';
import styles from './RangeSlider.module.css';
/**
* Component definition for RangeSlider
* @public
*/
export const RangeSliderDefinition = {
export const RangeSliderDefinition = defineComponent<RangeSliderOwnProps>()({
styles,
classNames: {
root: 'bui-RangeSlider',
header: 'bui-RangeSliderHeader',
@@ -29,8 +32,7 @@ export const RangeSliderDefinition = {
thumb: 'bui-RangeSliderThumb',
output: 'bui-RangeSliderOutput',
},
dataAttributes: {
disabled: [true, false] as const,
orientation: ['horizontal', 'vertical'] as const,
propDefs: {
className: {},
},
} as const satisfies ComponentDefinition;
});
@@ -17,10 +17,24 @@
import type { SliderProps as AriaSliderProps } from 'react-aria-components';
import type { FieldLabelProps } from '../FieldLabel/types';
/** @public */
export interface RangeSliderOwnProps {
className?: string;
}
/** @public */
export interface RangeSliderProps
extends Omit<AriaSliderProps<[number, number]>, 'children'>,
Omit<FieldLabelProps, 'htmlFor' | 'id' | 'className'> {
Omit<
FieldLabelProps,
| 'htmlFor'
| 'id'
| 'className'
| 'defaultValue'
| 'onChange'
| 'slot'
| 'style'
> {
/**
* Whether to show a value label in the header next to the field label
* @defaultValue false