Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into remove-use-client
Browse files Browse the repository at this point in the history
  • Loading branch information
michaldudak committed Sep 18, 2024
2 parents 13197b9 + 94749a3 commit 0a30801
Show file tree
Hide file tree
Showing 187 changed files with 3,538 additions and 3,050 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/.git
/.yarn
/coverage
/docs/export
/docs/pages/playground/
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/closed-issue-message.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Add closing message to issue

on:
issues:
types:
- closed

permissions: {}

jobs:
add-comment:
name: Add closing message
uses: mui/mui-public/.github/workflows/issues_add-closing-message.yml@master
permissions:
contents: read
issues: write
52 changes: 0 additions & 52 deletions .github/workflows/issue-cleanup.yml

This file was deleted.

15 changes: 15 additions & 0 deletions .github/workflows/new-issue-triage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: New issue triage
on:
issues:
types:
- opened

permissions: {}

jobs:
issue_cleanup:
name: Clean issue body
uses: mui/mui-public/.github/workflows/issues_body-cleanup.yml@master
permissions:
contents: read
issues: write
2 changes: 1 addition & 1 deletion docs/app/(content)/components/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Description } from 'docs-base/src/components/content/Description';
import { TableOfContents } from 'docs-base/src/components/TableOfContents';
import routes, { getSlugs } from 'docs-base/data/pages';
import { SiblingPageLinks } from 'docs-base/src/components/SiblingPageLinks';
import { EditPageGithubLink } from 'docs-base/src/components/EditPageGithhubLink';
import { EditPageGithubLink } from 'docs-base/src/components/EditPageGithubLink';
import {
ApiReference,
getApiReferenceTableOfContents,
Expand Down
2 changes: 1 addition & 1 deletion docs/app/(content)/getting-started/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { TableOfContents } from 'docs-base/src/components/TableOfContents';
import routes, { getSlugs } from 'docs-base/data/pages';
import { Description } from 'docs-base/src/components/content/Description';
import { SiblingPageLinks } from 'docs-base/src/components/SiblingPageLinks';
import { EditPageGithubLink } from 'docs-base/src/components/EditPageGithhubLink';
import { EditPageGithubLink } from 'docs-base/src/components/EditPageGithubLink';
import classes from '../../styles.module.css';

const CATEGORY_SEGMENT = 'getting-started';
Expand Down
2 changes: 1 addition & 1 deletion docs/app/(content)/guides/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { TableOfContents } from 'docs-base/src/components/TableOfContents';
import routes, { getSlugs } from 'docs-base/data/pages';
import { Description } from 'docs-base/src/components/content/Description';
import { SiblingPageLinks } from 'docs-base/src/components/SiblingPageLinks';
import { EditPageGithubLink } from 'docs-base/src/components/EditPageGithhubLink';
import { EditPageGithubLink } from 'docs-base/src/components/EditPageGithubLink';
import classes from '../../styles.module.css';

const CATEGORY_SEGMENT = 'guides';
Expand Down
14 changes: 12 additions & 2 deletions docs/app/experiments/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import * as React from 'react';
import { type Metadata } from 'next';
import { notFound } from 'next/navigation';
import { type Dirent } from 'node:fs';
import { basename, extname } from 'node:path';
import { readdir } from 'node:fs/promises';
import * as React from 'react';

interface Props {
params: {
Expand Down Expand Up @@ -31,5 +33,13 @@ export async function generateStaticParams() {
entry.name !== 'layout.tsx' &&
entry.isFile(),
)
.map((entry: Dirent) => ({ slug: entry.name }));
.map((entry: Dirent) => ({ slug: basename(entry.name, extname(entry.name)) }));
}

export async function generateMetadata({ params }: Props): Promise<Metadata> {
const { slug } = params;

return {
title: `${slug} - Experiments`,
};
}
33 changes: 33 additions & 0 deletions docs/app/experiments/menu-anchor-el.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
'use client';

import * as React from 'react';
import * as Menu from '@base_ui/react/Menu';

export default function Page() {
const [anchorEl, setAnchor] = React.useState<HTMLDivElement | null>(null);
const handleRef = React.useCallback((element: HTMLDivElement | null) => {
setAnchor(element);
}, []);

return (
<div>
<h1>Element passed to anchor</h1>
<Menu.Root animated={false}>
<Menu.Trigger>Trigger</Menu.Trigger>
<Menu.Positioner side="bottom" alignment="start" arrowPadding={0} anchor={anchorEl}>
<Menu.Popup>
<Menu.Item style={{ background: 'lightgray', padding: '5px' }}>One</Menu.Item>
<Menu.Item style={{ background: 'lightgray', padding: '5px' }}>Two</Menu.Item>
</Menu.Popup>
</Menu.Positioner>
</Menu.Root>
<div
data-testid="anchor"
style={{ margin: '100px', background: 'yellowgreen', height: '50px', width: '200px' }}
ref={handleRef}
>
Anchor
</div>
</div>
);
}
30 changes: 30 additions & 0 deletions docs/app/experiments/menu-anchor-ref.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'use client';

import * as React from 'react';
import * as Menu from '@base_ui/react/Menu';

export default function Page() {
const anchor = React.useRef<HTMLDivElement>(null);

return (
<div>
<h1>Ref passed to anchor</h1>
<Menu.Root animated={false}>
<Menu.Trigger>Trigger</Menu.Trigger>
<Menu.Positioner side="bottom" alignment="start" arrowPadding={0} anchor={anchor}>
<Menu.Popup>
<Menu.Item style={{ background: 'lightgray', padding: '5px' }}>One</Menu.Item>
<Menu.Item style={{ background: 'lightgray', padding: '5px' }}>Two</Menu.Item>
</Menu.Popup>
</Menu.Positioner>
</Menu.Root>
<div
data-testid="anchor"
style={{ margin: '100px', background: 'yellowgreen', height: '50px', width: '200px' }}
ref={anchor}
>
Anchor
</div>
</div>
);
}
66 changes: 66 additions & 0 deletions docs/app/experiments/scroll-lock.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
'use client';
import * as React from 'react';
import { useScrollLock } from '../../../packages/mui-base/src/utils/useScrollLock';

export default function ScrollLock() {
const [enabled, setEnabled] = React.useState(false);
const [bodyScrollY, setBodyScrollY] = React.useState(false);
const [longContent, setLongContent] = React.useState(true);

useScrollLock(enabled);

React.useEffect(() => {
document.body.style.overflowY = bodyScrollY ? 'scroll' : '';
}, [bodyScrollY]);

return (
<div>
<h1>useScrollLock</h1>
<p>On macOS, enable `Show scroll bars: Always` in `Appearance` Settings.</p>
<div
style={{
position: 'fixed',
top: 15,
display: 'flex',
gap: 10,
background: 'white',
padding: 20,
}}
>
<div>
<label>
<input
type="checkbox"
checked={enabled}
onChange={(e) => setEnabled(e.target.checked)}
/>
Scroll lock
</label>
</div>
<div>
<label>
<input
type="checkbox"
checked={bodyScrollY}
onChange={(e) => setBodyScrollY(e.target.checked)}
/>
body `overflow`
</label>
</div>
<div>
<label>
<input
type="checkbox"
checked={longContent}
onChange={(e) => setLongContent(e.target.checked)}
/>
Long content
</label>
</div>
</div>
{[...Array(longContent ? 100 : 10)].map((_, i) => (
<p key={i}>Scroll locking text content</p>
))}
</div>
);
}
2 changes: 1 addition & 1 deletion docs/data/api/checkbox-indicator.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"props": {
"className": { "type": { "name": "union", "description": "func<br>&#124;&nbsp;string" } },
"keepMounted": { "type": { "name": "bool" }, "default": "false" },
"keepMounted": { "type": { "name": "bool" }, "default": "true" },
"render": { "type": { "name": "union", "description": "element<br>&#124;&nbsp;func" } }
},
"name": "CheckboxIndicator",
Expand Down
2 changes: 0 additions & 2 deletions docs/data/api/checkbox-root.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
{
"props": {
"autoFocus": { "type": { "name": "bool" }, "default": "false" },
"checked": { "type": { "name": "bool" }, "default": "undefined" },
"className": { "type": { "name": "union", "description": "func<br>&#124;&nbsp;string" } },
"defaultChecked": { "type": { "name": "bool" }, "default": "false" },
"disabled": { "type": { "name": "bool" }, "default": "false" },
"id": { "type": { "name": "string" } },
"indeterminate": { "type": { "name": "bool" }, "default": "false" },
"inputRef": {
"type": { "name": "union", "description": "func<br>&#124;&nbsp;{ current?: object }" }
Expand Down
1 change: 1 addition & 0 deletions docs/data/api/field-control.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"props": {
"className": { "type": { "name": "union", "description": "func<br>&#124;&nbsp;string" } },
"onValueChange": { "type": { "name": "func" } },
"render": { "type": { "name": "union", "description": "element<br>&#124;&nbsp;func" } }
},
"name": "FieldControl",
Expand Down
2 changes: 2 additions & 0 deletions docs/data/api/field-root.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"props": {
"className": { "type": { "name": "union", "description": "func<br>&#124;&nbsp;string" } },
"disabled": { "type": { "name": "bool" }, "default": "false" },
"invalid": { "type": { "name": "bool" } },
"name": { "type": { "name": "string" } },
"render": { "type": { "name": "union", "description": "element<br>&#124;&nbsp;func" } },
"validate": { "type": { "name": "func" } },
"validateDebounceTime": { "type": { "name": "number" }, "default": "0" },
Expand Down
19 changes: 19 additions & 0 deletions docs/data/api/form-root.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"props": {
"className": { "type": { "name": "union", "description": "func<br>&#124;&nbsp;string" } },
"errors": { "type": { "name": "object" } },
"onClearErrors": { "type": { "name": "func" } },
"render": { "type": { "name": "union", "description": "element<br>&#124;&nbsp;func" } }
},
"name": "FormRoot",
"imports": ["import * as Form from '@base_ui/react/Form';\nconst FormRoot = Form.Root;"],
"classes": [],
"spread": true,
"themeDefaultProps": true,
"muiName": "FormRoot",
"forwardsRefTo": "HTMLFormElement",
"filename": "/packages/mui-base/src/Form/Root/FormRoot.tsx",
"inheritance": null,
"demos": "<ul><li><a href=\"/components/react-form/\">Form</a></li></ul>",
"cssComponent": false
}
12 changes: 6 additions & 6 deletions docs/data/api/tooltip-root.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
"props": {
"animated": { "type": { "name": "bool" }, "default": "true" },
"closeDelay": { "type": { "name": "number" }, "default": "0" },
"defaultOpen": { "type": { "name": "bool" } },
"defaultOpen": { "type": { "name": "bool" }, "default": "false" },
"delay": { "type": { "name": "number" }, "default": "600" },
"delayType": {
"type": { "name": "enum", "description": "'hover'<br>&#124;&nbsp;'rest'" },
"default": "'rest'"
},
"followCursorAxis": {
"hoverable": { "type": { "name": "bool" }, "default": "true" },
"onOpenChange": { "type": { "name": "func" } },
"open": { "type": { "name": "bool" }, "default": "false" },
"trackCursorAxis": {
"type": {
"name": "enum",
"description": "'both'<br>&#124;&nbsp;'none'<br>&#124;&nbsp;'x'<br>&#124;&nbsp;'y'"
},
"default": "'none'"
},
"hoverable": { "type": { "name": "bool" }, "default": "true" },
"onOpenChange": { "type": { "name": "func" } },
"open": { "type": { "name": "bool" } }
}
},
"name": "TooltipRoot",
"imports": [
Expand Down
Loading

0 comments on commit 0a30801

Please sign in to comment.