forked from mui/base-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
354b77a
commit ceef709
Showing
8 changed files
with
86 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "ToolbarSeparator", | ||
"description": "A separator element accessible to screen readers.\nRenders a `<div>` element.", | ||
"props": { | ||
"className": { | ||
"type": "string | (state) => string", | ||
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state." | ||
}, | ||
"render": { | ||
"type": "React.ReactElement | (props, state) => React.ReactElement", | ||
"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." | ||
} | ||
}, | ||
"dataAttributes": {}, | ||
"cssVariables": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
'use client'; | ||
import * as React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import type { BaseUIComponentProps, Orientation } from '../../utils/types'; | ||
import { Separator } from '../../separator'; | ||
import { useToolbarRootContext } from '../root/ToolbarRootContext'; | ||
/** | ||
* A separator element accessible to screen readers. | ||
* Renders a `<div>` element. | ||
* | ||
* Documentation: [Base UI Toolbar](https://base-ui.com/react/components/toolbar) | ||
*/ | ||
const ToolbarSeparator = React.forwardRef(function ToolbarSeparator( | ||
props: ToolbarSeparator.Props, | ||
forwardedRef: React.ForwardedRef<HTMLDivElement>, | ||
) { | ||
const context = useToolbarRootContext(); | ||
|
||
const orientation = ( | ||
{ | ||
vertical: 'horizontal', | ||
horizontal: 'vertical', | ||
} as Record<Orientation, Orientation> | ||
)[context.orientation]; | ||
|
||
return <Separator orientation={orientation} {...props} ref={forwardedRef} />; | ||
}); | ||
|
||
ToolbarSeparator.propTypes /* remove-proptypes */ = { | ||
// ┌────────────────────────────── Warning ──────────────────────────────┐ | ||
// │ These PropTypes are generated from the TypeScript type definitions. │ | ||
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │ | ||
// └─────────────────────────────────────────────────────────────────────┘ | ||
/** | ||
* @ignore | ||
*/ | ||
children: PropTypes.node, | ||
/** | ||
* CSS class applied to the element, or a function that | ||
* returns a class based on the component’s state. | ||
*/ | ||
className: PropTypes.oneOfType([PropTypes.func, PropTypes.string]), | ||
/** | ||
* Allows you to replace the component’s HTML element | ||
* with a different tag, or compose it with another component. | ||
* | ||
* Accepts a `ReactElement` or a function that returns the element to render. | ||
*/ | ||
render: PropTypes.oneOfType([PropTypes.element, PropTypes.func]), | ||
} as any; | ||
|
||
namespace ToolbarSeparator { | ||
export interface Props extends BaseUIComponentProps<'div', Separator.State>, Separator.Props {} | ||
} | ||
|
||
export { ToolbarSeparator }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters