Skip to content

Commit 0ef18d4

Browse files
authored
Merge branch 'master' into useRender/default-value
2 parents 123e96a + 47c636f commit 0ef18d4

File tree

25 files changed

+386
-309
lines changed

25 files changed

+386
-309
lines changed

docs/reference/generated/collapsible-panel.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
"detailedType": "boolean | undefined"
1010
},
1111
"className": {
12-
"type": "string | ((state: Collapsible.Root.State) => string)",
12+
"type": "string | ((state: Collapsible.Panel.State) => string)",
1313
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state.",
14-
"detailedType": "| string\n| ((state: Collapsible.Root.State) => string)"
14+
"detailedType": "| string\n| ((state: Collapsible.Panel.State) => string)"
1515
},
1616
"keepMounted": {
1717
"type": "boolean",
@@ -20,9 +20,9 @@
2020
"detailedType": "boolean | undefined"
2121
},
2222
"render": {
23-
"type": "ReactElement | ((props: HTMLProps, state: Collapsible.Root.State) => ReactElement)",
23+
"type": "ReactElement | ((props: HTMLProps, state: Collapsible.Panel.State) => ReactElement)",
2424
"description": "Allows you to replace the component’s HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render.",
25-
"detailedType": "| ReactElement\n| ((\n props: HTMLProps,\n state: Collapsible.Root.State,\n ) => ReactElement)"
25+
"detailedType": "| ReactElement\n| ((\n props: HTMLProps,\n state: Collapsible.Panel.State,\n ) => ReactElement)"
2626
}
2727
},
2828
"dataAttributes": {

docs/reference/generated/slider-root.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,6 @@
8383
"description": "The component orientation.",
8484
"detailedType": "'horizontal' | 'vertical' | undefined"
8585
},
86-
"inputRef": {
87-
"type": "Ref<HTMLInputElement>",
88-
"description": "A ref to access the hidden input element.",
89-
"detailedType": "React.Ref<HTMLInputElement> | undefined"
90-
},
9186
"className": {
9287
"type": "string | ((state: Slider.Root.State) => string)",
9388
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state."

docs/reference/generated/slider-thumb.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@
3939
"description": "Whether the thumb should ignore user interaction.",
4040
"detailedType": "boolean | undefined"
4141
},
42+
"inputRef": {
43+
"type": "Ref<HTMLInputElement>",
44+
"description": "A ref to access the nested input element.",
45+
"detailedType": "React.Ref<HTMLInputElement> | undefined"
46+
},
4247
"className": {
4348
"type": "string | ((state: Slider.Thumb.State) => string)",
4449
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state."

docs/scripts/generateLlmTxt/__snapshots__/mdxToMarkdown.test.mjs.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ export default function ExampleDirectionProvider() {
409409
<Slider.Control className="flex w-56 items-center py-3">
410410
<Slider.Track className="relative h-1 w-full rounded bg-gray-200 shadow-[inset_0_0_0_1px] shadow-gray-200">
411411
<Slider.Indicator className="rounded bg-gray-700" />
412-
<Slider.Thumb className="size-4 rounded-full bg-white outline outline-1 outline-gray-300 focus-visible:outline focus-visible:outline-2 focus-visible:outline-blue-800" />
412+
<Slider.Thumb className="size-4 rounded-full bg-white outline outline-1 outline-gray-300 has-[:focus-visible]:outline has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-blue-800" />
413413
</Slider.Track>
414414
</Slider.Control>
415415
</Slider.Root>
@@ -455,7 +455,7 @@ This example shows how to implement the component using CSS Modules.
455455
background-color: white;
456456
outline: 1px solid var(--color-gray-300);
457457
458-
&:focus-visible {
458+
&:has(:focus-visible) {
459459
outline: 2px solid var(--color-blue);
460460
}
461461
}

docs/src/app/(private)/experiments/forms/form.tsx

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const schema = z.object({
3232
input: z.string().min(1, 'This field is required'),
3333
checkbox: z.enum(['on']),
3434
switch: z.enum(['on']),
35-
slider: z.number().min(40),
35+
slider: z.number().max(90, 'Too loud'),
3636
'range-slider': z.array(z.number()),
3737
'number-field': z.number().min(0).max(100),
3838
select: z.enum(['sans', 'serif', 'mono', 'cursive']),
@@ -58,7 +58,11 @@ export const settingsMetadata: SettingsMetadata<Settings> = {
5858
},
5959
};
6060

61-
async function submitForm(event: React.FormEvent<HTMLFormElement>, values: Values) {
61+
async function submitForm(
62+
event: React.FormEvent<HTMLFormElement>,
63+
values: Values,
64+
native: boolean,
65+
) {
6266
event.preventDefault();
6367

6468
const formData = new FormData(event.currentTarget);
@@ -70,6 +74,12 @@ async function submitForm(event: React.FormEvent<HTMLFormElement>, values: Value
7074
entries['range-slider'] = formData.getAll('range-slider').map((v) => parseFloat(v as string));
7175
entries['multi-select'] = formData.getAll('multi-select');
7276

77+
if (native) {
78+
return {
79+
errors: {},
80+
};
81+
}
82+
7383
const result = schema.safeParse(entries);
7484

7585
if (!result.success) {
@@ -102,9 +112,13 @@ export default function Page() {
102112
errors={errors}
103113
onClearErrors={setErrors}
104114
onSubmit={async (event) => {
105-
const response = await submitForm(event, {
106-
numberField: numberFieldValueRef.current,
107-
});
115+
const response = await submitForm(
116+
event,
117+
{
118+
numberField: numberFieldValueRef.current,
119+
},
120+
native,
121+
);
108122
setErrors(response.errors);
109123
}}
110124
>

docs/src/app/(private)/experiments/forms/rhf.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,16 @@ export default function ExampleForm() {
224224
<Slider.Root
225225
value={field.value}
226226
onValueChange={field.onChange}
227-
inputRef={field.ref}
228227
className={styles.Slider}
229228
>
230229
<Slider.Control className={styles.SliderControl}>
231230
<Slider.Track className={styles.SliderTrack}>
232231
<Slider.Indicator className={styles.SliderIndicator} />
233-
<Slider.Thumb onBlur={field.onBlur} className={styles.SliderThumb} />
232+
<Slider.Thumb
233+
inputRef={field.ref}
234+
onBlur={field.onBlur}
235+
className={styles.SliderThumb}
236+
/>
234237
</Slider.Track>
235238
</Slider.Control>
236239
</Slider.Root>

docs/src/app/(public)/(content)/react/components/preview-card/page.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
Import the component and assemble its parts:
2121

2222
```jsx title="Anatomy"
23-
import { PreviewCard } from '@base-ui-components/react/previewCard';
23+
import { PreviewCard } from '@base-ui-components/react/preview-card';
2424

2525
<PreviewCard.Root>
2626
<PreviewCard.Trigger />

docs/src/app/(public)/(content)/react/utils/direction-provider/demos/hero/css-modules/index.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
background-color: white;
2828
outline: 1px solid var(--color-gray-300);
2929

30-
&:focus-visible {
30+
&:has(:focus-visible) {
3131
outline: 2px solid var(--color-blue);
3232
}
3333
}

docs/src/app/(public)/(content)/react/utils/direction-provider/demos/hero/tailwind/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default function ExampleDirectionProvider() {
1010
<Slider.Control className="flex w-56 items-center py-3">
1111
<Slider.Track className="relative h-1 w-full rounded bg-gray-200 shadow-[inset_0_0_0_1px] shadow-gray-200">
1212
<Slider.Indicator className="rounded bg-gray-700" />
13-
<Slider.Thumb className="size-4 rounded-full bg-white outline outline-1 outline-gray-300 focus-visible:outline focus-visible:outline-2 focus-visible:outline-blue-800" />
13+
<Slider.Thumb className="size-4 rounded-full bg-white outline outline-1 outline-gray-300 has-[:focus-visible]:outline has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-blue-800" />
1414
</Slider.Track>
1515
</Slider.Control>
1616
</Slider.Root>

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export default defineConfig(
148148
files: [`test/**/*.${EXTENSION_TS}`],
149149
rules: {
150150
'guard-for-in': 'off',
151-
'testing-library/no-dom-import': 'off', // We use `screen` in tests, so we need to import `@testing-library/dom`.
151+
'testing-library/prefer-screen-queries': 'off', // Enable usage of playwright queries
152152
'testing-library/render-result-naming-convention': 'off', // inconsequential in regression tests
153153
},
154154
},

0 commit comments

Comments
 (0)