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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"db:seed": "dotenv -- cross-env node ./run-jiti ./prisma/seed/index.ts"
},
"dependencies": {
"@base-ui-components/react": "1.0.0-beta.1",
"@base-ui/react": "1.0.0",
"@bearstudio/ui-state": "1.0.2",
"@better-auth/expo": "1.3.27",
"@fontsource-variable/inter": "5.2.8",
Expand Down
59 changes: 47 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions src/components/form/field-number/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ export const FieldNumber = <
>
<NumberInput
id={ctx.id}
invalid={fieldState.error ? true : undefined}
aria-describedby={
!fieldState.error
? `${ctx.descriptionId}`
Expand All @@ -85,9 +84,9 @@ export const FieldNumber = <
{...rest}
{...fieldProps}
value={formatValue(value, 'from-cents')}
onValueChange={(value) => {
onValueChange={(value, event) => {
onChange(formatValue(value, 'to-cents'));
rest.onValueChange?.(value);
rest.onValueChange?.(value, event);
}}
onBlur={(e) => {
field.onBlur();
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/checkbox-group.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CheckboxGroup as CheckboxGroupPrimitive } from '@base-ui-components/react/checkbox-group';
import { CheckboxGroup as CheckboxGroupPrimitive } from '@base-ui/react/checkbox-group';

import { cn } from '@/lib/tailwind/utils';

Expand Down
8 changes: 6 additions & 2 deletions src/components/ui/checkbox.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Checkbox as CheckboxPrimitive } from '@base-ui-components/react/checkbox';
import { Checkbox as CheckboxPrimitive } from '@base-ui/react/checkbox';
import { cva } from 'class-variance-authority';
import { CheckIcon, MinusIcon } from 'lucide-react';
import React from 'react';
import React, { useId } from 'react';

import { cn } from '@/lib/tailwind/utils';

Expand Down Expand Up @@ -53,10 +53,13 @@ export function Checkbox({
}: CheckboxProps) {
const Comp = noLabel ? React.Fragment : 'label';

const _compId = useId();
const id = labelProps?.id ?? _compId;
const compProps = noLabel
? {}
: {
...labelProps,
id,
className: cn(labelVariants({ size }), labelProps?.className),
};

Expand All @@ -65,6 +68,7 @@ export function Checkbox({
<CheckboxPrimitive.Root
className={cn(checkboxVariants({ size }), className)}
{...props}
aria-labelledby={id}
>
<CheckboxPrimitive.Indicator
keepMounted={true}
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/number-input.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const Placeholder = () => {
};

export const Invalid = () => {
return <NumberInput invalid />;
return <NumberInput aria-invalid={true} data-invalid />;
};

export const Disabled = () => {
Expand Down
6 changes: 3 additions & 3 deletions src/components/ui/number-input.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NumberField } from '@base-ui-components/react';
import { NumberField } from '@base-ui/react/number-field';
import { ChevronDown, ChevronUp, Minus, Plus } from 'lucide-react';
import { ComponentProps, useRef } from 'react';
import { useTranslation } from 'react-i18next';
Expand All @@ -25,13 +25,13 @@ type NumberInputProps = ComponentProps<typeof NumberField.Root> &
export const NumberInput = ({
inputProps,
size,
invalid,
placeholder,
locale,
buttons,
className,
onKeyDown,
ref,
'aria-invalid': invalid,
...props
}: NumberInputProps) => {
const inputRef = useRef<HTMLInputElement>(null);
Expand Down Expand Up @@ -75,8 +75,8 @@ export const NumberInput = ({
<NumberField.Input
render={
<Input
aria-invalid={invalid}
ref={mergeRefs([ref, inputRef])}
aria-invalid={invalid ? true : undefined}
endElement={
buttons === 'classic' && (
<NumberField.Group className="flex flex-col">
Expand Down
13 changes: 8 additions & 5 deletions src/components/ui/radio-group.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Radio as RadioPrimitive } from '@base-ui-components/react/radio';
import { RadioGroup as RadioGroupPrimitive } from '@base-ui-components/react/radio-group';
import { Radio as RadioPrimitive } from '@base-ui/react/radio';
import { RadioGroup as RadioGroupPrimitive } from '@base-ui/react/radio-group';
import { cva } from 'class-variance-authority';
import { Circle } from 'lucide-react';
import * as React from 'react';
import { Fragment, useId } from 'react';

import { cn } from '@/lib/tailwind/utils';

Expand Down Expand Up @@ -63,19 +63,22 @@ export function Radio({
size,
...rest
}: RadioProps) {
const Comp = noLabel ? React.Fragment : 'label';

const Comp = noLabel ? Fragment : 'label';
const _compId = useId();
const id = labelProps?.id ?? _compId;
const compProps = noLabel
? {}
: {
...labelProps,
id,
className: cn(labelVariants({ size }), labelProps?.className),
};

return (
<Comp {...compProps}>
<RadioPrimitive.Root
className={cn(radioVariants({ size }), className)}
aria-labelledby={id}
{...rest}
>
<RadioPrimitive.Indicator
Expand Down
Loading