Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fifty-times-look.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@vygruppen/spor-react": patch
---

replace RefObject with Ref for ref prop type
6 changes: 3 additions & 3 deletions packages/spor-react/src/accordion/Accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const Accordion = ({
ref,
...props
}: AccordionProps & {
ref?: React.RefObject<HTMLDivElement>;
ref?: React.Ref<HTMLDivElement>;
}) => {
const { variant = "core", children, gap = 2, css, ...rest } = props;
const recipe = useSlotRecipe({ key: "accordion" });
Expand All @@ -77,7 +77,7 @@ export const AccordionItemTrigger = function AccordionItemTrigger({
ref,
...props
}: AccordionItemTriggerProps & {
ref?: React.RefObject<HTMLButtonElement>;
ref?: React.Ref<HTMLButtonElement>;
}) {
const {
startElement,
Expand Down Expand Up @@ -115,7 +115,7 @@ export const AccordionItemContent = function AccordionItemContent({
ref,
...props
}: AccordionItemContentProps & {
ref?: React.RefObject<HTMLDivElement>;
ref?: React.Ref<HTMLDivElement>;
}) {
const {
children,
Expand Down
2 changes: 1 addition & 1 deletion packages/spor-react/src/accordion/Expandable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const Expandable = ({
ref,
...props
}: ExpandableProps & {
ref?: React.RefObject<HTMLDivElement>;
ref?: React.Ref<HTMLDivElement>;
}) => {
const { title, children, headingLevel, startElement, ...rest } = props;
return (
Expand Down
2 changes: 1 addition & 1 deletion packages/spor-react/src/alert/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const Alert = ({
ref,
...props
}: AlertProps & {
ref?: React.RefObject<HTMLDivElement>;
ref?: React.Ref<HTMLDivElement>;
}) => {
const {
title,
Expand Down
2 changes: 1 addition & 1 deletion packages/spor-react/src/alert/AlertIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const AlertIcon = ({
variant,
customIcon: CustomAlertIcon,
}: AlertIconProps & {
ref?: React.RefObject<SVGSVGElement>;
ref?: React.Ref<SVGSVGElement>;
}) => {
const { t } = useTranslation();

Expand Down
2 changes: 1 addition & 1 deletion packages/spor-react/src/alert/ExpandableAlert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const ExpandableAlert = ({
ref,
...props
}: ExpandableAlertProps & {
ref?: React.RefObject<HTMLDivElement>;
ref?: React.Ref<HTMLDivElement>;
}) => {
const {
variant = "info",
Expand Down
2 changes: 1 addition & 1 deletion packages/spor-react/src/alert/ServiceAlert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const ServiceAlert = ({
ref,
...props
}: ServiceAlertProps & {
ref?: React.RefObject<HTMLDivElement>;
ref?: React.Ref<HTMLDivElement>;
}) => {
const {
variant = "service",
Expand Down
2 changes: 1 addition & 1 deletion packages/spor-react/src/breadcrumb/Breadcrumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const Breadcrumb = ({
css,
...props
}: BreadcrumbRootProps & {
ref?: React.RefObject<HTMLDivElement>;
ref?: React.Ref<HTMLDivElement>;
}) => {
const validChildren = React.Children.toArray(children).filter((element) =>
React.isValidElement(element),
Expand Down
2 changes: 1 addition & 1 deletion packages/spor-react/src/button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export const Button = ({
children,
...rest
}: ButtonProps & {
ref?: React.RefObject<HTMLButtonElement>;
ref?: React.Ref<HTMLButtonElement>;
}) => {
const { t } = useTranslation();

Expand Down
2 changes: 1 addition & 1 deletion packages/spor-react/src/button/ButtonGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const ButtonGroup = ({
ref,
...props
}: ButtonGroupProps & {
ref?: React.RefObject<HTMLDivElement>;
ref?: React.Ref<HTMLDivElement>;
}) => {
const recipe = useRecipe({ key: "buttonGroup" });
const [recipeProps, restProps] = recipe.splitVariantProps(props);
Expand Down
6 changes: 3 additions & 3 deletions packages/spor-react/src/button/Clipboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const ClipboardIcon = ({
ref,
...props
}: ChakraClipboard.IndicatorProps & {
ref?: React.RefObject<HTMLDivElement>;
ref?: React.Ref<HTMLDivElement>;
}) => {
return (
<ChakraClipboard.Indicator
Expand All @@ -41,7 +41,7 @@ const ClipboardCopyText = ({
ref,
...props
}: ChakraClipboard.IndicatorProps & {
ref?: React.RefObject<HTMLDivElement>;
ref?: React.Ref<HTMLDivElement>;
}) => {
const { t } = useTranslation();
return (
Expand All @@ -61,7 +61,7 @@ export const ClipboardButton = ({
ref,
...props
}: ClipboardButtonProps & {
ref?: React.RefObject<HTMLButtonElement>;
ref?: React.Ref<HTMLButtonElement>;
}) => {
return (
<ChakraClipboard.Trigger asChild>
Expand Down
2 changes: 1 addition & 1 deletion packages/spor-react/src/button/CloseButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const CloseButton = ({
size = "sm",
...props
}: CloseButtonProps & {
ref?: React.RefObject<HTMLButtonElement | null>;
ref?: React.Ref<HTMLButtonElement | null>;
}) => {
const { t } = useTranslation();
return (
Expand Down
2 changes: 1 addition & 1 deletion packages/spor-react/src/button/FloatingActionButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const FloatingActionButton = ({
placement = "bottom right",
...props
}: FloatingActionButtonProps & {
ref?: React.RefObject<HTMLButtonElement>;
ref?: React.Ref<HTMLButtonElement>;
}) => {
const scrollDirection = useScrollDirection();

Expand Down
2 changes: 1 addition & 1 deletion packages/spor-react/src/button/IconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const IconButton = ({
ref,
...props
}: IconButtonProps & {
ref?: React.RefObject<HTMLButtonElement | null>;
ref?: React.Ref<HTMLButtonElement | null>;
}) => {
const { icon, size = "sm", loading = false, ...rest } = props;
return (
Expand Down
2 changes: 1 addition & 1 deletion packages/spor-react/src/calendar/CalendarContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type BaseCalendarState = {
prevButtonProps: AriaButtonProps<"button">;
startValue: CalendarDate | null;
isSelectingRange: boolean;
ref?: React.RefObject<HTMLDivElement | null>;
ref?: React.Ref<HTMLDivElement | null>;
};

type SingleCalendarState = BaseCalendarState & {
Expand Down
2 changes: 1 addition & 1 deletion packages/spor-react/src/color-mode/color-mode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const ColorModeButton = function ColorModeButton({
ref,
...props
}: ColorModeButtonProps & {
ref?: React.RefObject<HTMLButtonElement>;
ref?: React.Ref<HTMLButtonElement>;
}) {
const { toggleColorMode } = useColorMode();
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const CalendarTriggerButton = ({
onPress: _,
...buttonProps
}: CalendarTriggerButtonProps & {
ref?: React.RefObject<HTMLDivElement | null>;
ref?: React.Ref<HTMLDivElement | null>;
}) => {
const { t } = useTranslation();

Expand Down
2 changes: 1 addition & 1 deletion packages/spor-react/src/datepicker/DateField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const DateField = ({
ref: externalRef,
...props
}: DateFieldProps & {
ref?: React.RefObject<HTMLDivElement>;
ref?: React.Ref<HTMLDivElement>;
}) => {
const locale = useCurrentLocale();

Expand Down
2 changes: 1 addition & 1 deletion packages/spor-react/src/datepicker/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const DatePicker = ({
css,
...props
}: DatePickerProps & {
ref?: React.RefObject<HTMLDivElement>;
ref?: React.Ref<HTMLDivElement>;
}) => {
const chakraFieldProps = useFieldContext();
const state = useDatePickerState({
Expand Down
2 changes: 1 addition & 1 deletion packages/spor-react/src/datepicker/DateTimeSegment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const DateTimeSegment = ({
ariaDescription,
variant,
}: DateTimeSegmentProps & {
ref?: React.RefObject<HTMLDivElement>;
ref?: React.Ref<HTMLDivElement>;
}) => {
const internalRef = useRef(null);
const ref = externalRef ?? internalRef;
Expand Down
2 changes: 1 addition & 1 deletion packages/spor-react/src/datepicker/StyledField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const StyledField = function StyledField({
ref,
...props
}: StyledFieldProps & {
ref?: React.RefObject<HTMLDivElement>;
ref?: React.Ref<HTMLDivElement>;
}) {
const {
children,
Expand Down
4 changes: 2 additions & 2 deletions packages/spor-react/src/dialog/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const DialogContent = ({
ref,
...props
}: DialogContentProps & {
ref?: React.RefObject<HTMLDivElement>;
ref?: React.Ref<HTMLDivElement>;
}) => {
const {
children,
Expand All @@ -41,7 +41,7 @@ export const DialogCloseTrigger = function DialogCloseTrigger({
ref,
...props
}: ChakraDialog.CloseTriggerProps & {
ref?: React.RefObject<HTMLButtonElement>;
ref?: React.Ref<HTMLButtonElement>;
}) {
return (
<ChakraDialog.CloseTrigger ref={ref} position="absolute" {...props} asChild>
Expand Down
8 changes: 4 additions & 4 deletions packages/spor-react/src/dialog/Drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const DrawerContent = ({
ref,
...props
}: DrawerContentProps & {
ref?: React.RefObject<HTMLDivElement>;
ref?: React.Ref<HTMLDivElement>;
}) => {
const {
children,
Expand Down Expand Up @@ -127,7 +127,7 @@ export const DrawerCloseTrigger = function DrawerCloseTrigger({
ref,
...props
}: DrawerCloseTriggerProps & {
ref?: React.RefObject<HTMLButtonElement>;
ref?: React.Ref<HTMLButtonElement>;
}) {
const { showText = false, ...rest } = props;
const { size } = useRootDrawerProps();
Expand All @@ -151,7 +151,7 @@ export const DrawerBackTrigger = ({
ref,
...props
}: ChakraDrawer.CloseTriggerProps & {
ref?: React.RefObject<HTMLButtonElement>;
ref?: React.Ref<HTMLButtonElement>;
}) => {
const { t } = useTranslation();
return (
Expand All @@ -169,7 +169,7 @@ export const DrawerFullScreenHeader = ({
ref,
...props
}: DrawerFullScreenHeaderProps & {
ref?: React.RefObject<HTMLDivElement>;
ref?: React.Ref<HTMLDivElement>;
}) => {
const { backTrigger = true, closeTrigger = true, children } = props;
return (
Expand Down
2 changes: 1 addition & 1 deletion packages/spor-react/src/input/AttachedInputs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const AttachedInputs = ({
ref,
...props
}: AttachedInputsProps & {
ref?: React.RefObject<HTMLDivElement>;
ref?: React.Ref<HTMLDivElement>;
}) => {
const recipe = useRecipe({ key: "attachedInputs" });
const [recipeProps, { onFlip, flipAriaLabel, ...restProps }] =
Expand Down
2 changes: 1 addition & 1 deletion packages/spor-react/src/input/Autocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type Props = {
loading?: boolean;
emptyLabel?: React.ReactNode;
openOnFocus?: boolean;
ref?: React.RefObject<HTMLInputElement | null>;
ref?: React.Ref<HTMLInputElement | null>;
} & Omit<ComboboxRootProps, "collection"> &
FieldProps;

Expand Down
4 changes: 2 additions & 2 deletions packages/spor-react/src/input/CardSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const CardSelectContent = ({
children,
...props
}: StaticCardProps & {
ref?: React.RefObject<HTMLDivElement>;
ref?: React.Ref<HTMLDivElement>;
}) => {
return (
<Portal>
Expand Down Expand Up @@ -75,7 +75,7 @@ export const CardSelectTrigger = ({
children,
...props
}: CardSelectTriggerProps & {
ref?: React.RefObject<HTMLButtonElement>;
ref?: React.Ref<HTMLButtonElement>;
}) => {
const ChevronIcon =
size === "sm" ? DropdownDownFill18Icon : DropdownDownFill24Icon;
Expand Down
2 changes: 1 addition & 1 deletion packages/spor-react/src/input/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const Checkbox = ({
ref,
...props
}: CheckboxProps & {
ref?: React.RefObject<HTMLInputElement>;
ref?: React.Ref<HTMLInputElement>;
}) => {
const { children, inputProps, rootRef, ...rest } = props;
return (
Expand Down
2 changes: 1 addition & 1 deletion packages/spor-react/src/input/ChoiceChip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const ChoiceChip = ({
onCheckedChange,
...rootProps
}: ChoiceChipProps & {
ref?: React.RefObject<HTMLInputElement>;
ref?: React.Ref<HTMLInputElement>;
}) => {
return (
<CheckboxCard.Root
Expand Down
2 changes: 1 addition & 1 deletion packages/spor-react/src/input/CountryCodeSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const CountryCodeSelect = ({
ref,
...props
}: CountryCodeSelectProps & {
ref?: React.RefObject<HTMLDivElement>;
ref?: React.Ref<HTMLDivElement>;
}) => {
const { t } = useTranslation();

Expand Down
4 changes: 2 additions & 2 deletions packages/spor-react/src/input/Field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const Field = ({
ref,
...props
}: FieldProps & {
ref?: React.RefObject<HTMLDivElement>;
ref?: React.Ref<HTMLDivElement>;
}) => {
const {
label,
Expand Down Expand Up @@ -152,7 +152,7 @@ export const FieldErrorText = ({
ref,
...props
}: ChakraField.ErrorTextProps & {
ref?: React.RefObject<HTMLDivElement>;
ref?: React.Ref<HTMLDivElement>;
}) => {
return (
<ChakraField.ErrorText ref={ref}>{props.children}</ChakraField.ErrorText>
Expand Down
2 changes: 1 addition & 1 deletion packages/spor-react/src/input/FloatingLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const FloatingLabel = ({
ref,
...props
}: FieldLabelProps & {
ref?: React.RefObject<HTMLLabelElement | null>;
ref?: React.Ref<HTMLLabelElement | null>;
}) => <Field.Label ref={ref} {...props} css={floatingLabelStyles} />;

const floatingLabelStyles = defineStyle({
Expand Down
2 changes: 1 addition & 1 deletion packages/spor-react/src/input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const Input = ({
labelAsChild,
...props
}: InputProps & {
ref?: React.RefObject<HTMLInputElement | null>;
ref?: React.Ref<HTMLInputElement | null>;
}) => {
const recipe = useRecipe({ key: "input" });
const [recipeProps, restProps] = recipe.splitVariantProps(props);
Expand Down
2 changes: 1 addition & 1 deletion packages/spor-react/src/input/NativeSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const NativeSelect = function NativeSelect({
ref,
...props
}: NativeSelectdProps & {
ref?: React.RefObject<HTMLDivElement>;
ref?: React.Ref<HTMLDivElement>;
}) {
const {
children,
Expand Down
Loading
Loading