Skip to content

Commit

Permalink
yarn docs:api
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeeshanTamboli committed Sep 5, 2023
1 parent 1dc7154 commit 3d89466
Show file tree
Hide file tree
Showing 9 changed files with 306 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/data/joy/pagesApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ module.exports = [
{ pathname: '/joy-ui/api/sheet' },
{ pathname: '/joy-ui/api/skeleton' },
{ pathname: '/joy-ui/api/slider' },
{ pathname: '/joy-ui/api/snackbar' },
{ pathname: '/joy-ui/api/stack' },
{ pathname: '/joy-ui/api/svg-icon' },
{ pathname: '/joy-ui/api/switch' },
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/base-ui/api/snackbar.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@
"forwardsRefTo": "HTMLDivElement",
"filename": "/packages/mui-base/src/Snackbar/Snackbar.tsx",
"inheritance": null,
"demos": "<ul><li><a href=\"/base-ui/react-snackbar/\">Snackbar</a></li>\n<li><a href=\"/material-ui/react-snackbar/\">Snackbar</a></li></ul>",
"demos": "<ul><li><a href=\"/base-ui/react-snackbar/\">Snackbar</a></li>\n<li><a href=\"/joy-ui/react-snackbar/\">Snackbar</a></li>\n<li><a href=\"/material-ui/react-snackbar/\">Snackbar</a></li></ul>",
"cssComponent": false
}
19 changes: 19 additions & 0 deletions docs/pages/joy-ui/api/snackbar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import * as React from 'react';
import ApiPage from 'docs/src/modules/components/ApiPage';
import mapApiPageTranslations from 'docs/src/modules/utils/mapApiPageTranslations';
import jsonPageContent from './snackbar.json';

export default function Page(props) {
const { descriptions, pageContent } = props;
return <ApiPage descriptions={descriptions} pageContent={pageContent} />;
}

Page.getInitialProps = () => {
const req = require.context('docs/translations/api-docs-joy/snackbar', false, /snackbar.*.json$/);
const descriptions = mapApiPageTranslations(req);

return {
descriptions,
pageContent: jsonPageContent,
};
};
120 changes: 120 additions & 0 deletions docs/pages/joy-ui/api/snackbar.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
{
"props": {
"anchorOrigin": {
"type": {
"name": "shape",
"description": "{ horizontal: 'center'<br>&#124;&nbsp;'left'<br>&#124;&nbsp;'right', vertical: 'bottom'<br>&#124;&nbsp;'top' }"
},
"default": "{ vertical: 'bottom', horizontal: 'left' }"
},
"autoHideDuration": { "type": { "name": "number" }, "default": "null" },
"ClickAwayListenerProps": { "type": { "name": "object" } },
"color": {
"type": {
"name": "enum",
"description": "'danger'<br>&#124;&nbsp;'neutral'<br>&#124;&nbsp;'primary'<br>&#124;&nbsp;'success'<br>&#124;&nbsp;'warning'"
},
"default": "'neutral'",
"additionalInfo": { "joy-color": true }
},
"component": { "type": { "name": "elementType" } },
"disableWindowBlurListener": { "type": { "name": "bool" }, "default": "false" },
"onClose": {
"type": { "name": "func" },
"signature": {
"type": "function(event: React.SyntheticEvent<any> | Event, reason: string) => void",
"describedArgs": ["event", "reason"]
}
},
"open": { "type": { "name": "bool" } },
"resumeHideDuration": { "type": { "name": "number" } },
"size": {
"type": { "name": "enum", "description": "'sm'<br>&#124;&nbsp;'md'<br>&#124;&nbsp;'lg'" },
"default": "'md'",
"additionalInfo": { "joy-size": true }
},
"slotProps": {
"type": {
"name": "shape",
"description": "{ endDecorator?: func<br>&#124;&nbsp;object, root?: func<br>&#124;&nbsp;object, startDecorator?: func<br>&#124;&nbsp;object }"
},
"default": "{}"
},
"slots": {
"type": {
"name": "shape",
"description": "{ endDecorator?: elementType, root?: elementType, startDecorator?: elementType }"
},
"default": "{}",
"additionalInfo": { "slotsApi": true }
},
"sx": {
"type": {
"name": "union",
"description": "Array&lt;func<br>&#124;&nbsp;object<br>&#124;&nbsp;bool&gt;<br>&#124;&nbsp;func<br>&#124;&nbsp;object"
},
"additionalInfo": { "sx": true }
},
"variant": {
"type": {
"name": "enum",
"description": "'outlined'<br>&#124;&nbsp;'plain'<br>&#124;&nbsp;'soft'<br>&#124;&nbsp;'solid'"
},
"default": "'outlined'",
"additionalInfo": { "joy-variant": true }
}
},
"name": "Snackbar",
"imports": ["import Snackbar from '@mui/joy/Snackbar';", "import { Snackbar } from '@mui/joy';"],
"styles": { "classes": [], "globalClasses": {}, "name": "MuiSnackbar" },
"slots": [
{
"name": "root",
"description": "The component that renders the root.",
"default": "'div'",
"class": ".MuiSnackbar-root"
},
{
"name": "startDecorator",
"description": "The component that renders the start decorator.",
"default": "'span'",
"class": ".MuiSnackbar-startDecorator"
},
{
"name": "endDecorator",
"description": "The component that renders the end decorator.",
"default": "'span'",
"class": ".MuiSnackbar-endDecorator"
}
],
"classes": {
"classes": [
"anchorOriginBottomCenter",
"anchorOriginBottomLeft",
"anchorOriginBottomRight",
"anchorOriginTopCenter",
"anchorOriginTopLeft",
"anchorOriginTopRight",
"colorDanger",
"colorNeutral",
"colorPrimary",
"colorSuccess",
"colorWarning",
"sizeLg",
"sizeMd",
"sizeSm",
"variantOutlined",
"variantPlain",
"variantSoft",
"variantSolid"
],
"globalClasses": {}
},
"spread": true,
"themeDefaultProps": null,
"muiName": "JoySnackbar",
"filename": "/packages/mui-joy/src/Snackbar/Snackbar.tsx",
"inheritance": null,
"demos": "<ul><li><a href=\"/joy-ui/react-snackbar/\">Snackbar</a></li></ul>",
"cssComponent": false
}
151 changes: 151 additions & 0 deletions docs/translations/api-docs-joy/snackbar/snackbar.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
{
"componentDescription": "",
"propDescriptions": {
"anchorOrigin": {
"description": "The anchor of the <code>Snackbar</code>. On smaller screens, the component grows to occupy all the available width, the horizontal alignment is ignored."
},
"autoHideDuration": {
"description": "The number of milliseconds to wait before automatically calling the <code>onClose</code> function. <code>onClose</code> should then set the state of the <code>open</code> prop to hide the Snackbar. This behavior is disabled by default with the <code>null</code> value."
},
"ClickAwayListenerProps": {
"description": "Props applied to the <code>ClickAwayListener</code> element."
},
"color": {
"description": "The color of the component. It supports those theme colors that make sense for this component."
},
"component": {
"description": "The component used for the root node. Either a string to use a HTML element or a component."
},
"disableWindowBlurListener": {
"description": "If <code>true</code>, the <code>autoHideDuration</code> timer will expire even if the window is not focused."
},
"onClose": {
"description": "Callback fired when the component requests to be closed. Typically <code>onClose</code> is used to set state in the parent component, which is used to control the <code>Snackbar</code> <code>open</code> prop. The <code>reason</code> parameter can optionally be used to control the response to <code>onClose</code>, for example ignoring <code>clickaway</code>.",
"typeDescriptions": {
"event": "The event source of the callback.",
"reason": "Can be: <code>&quot;timeout&quot;</code> (<code>autoHideDuration</code> expired), <code>&quot;clickaway&quot;</code>, or <code>&quot;escapeKeyDown&quot;</code>."
}
},
"open": { "description": "If <code>true</code>, the component is shown." },
"resumeHideDuration": {
"description": "The number of milliseconds to wait before dismissing after user interaction. If <code>autoHideDuration</code> prop isn&#39;t specified, it does nothing. If <code>autoHideDuration</code> prop is specified but <code>resumeHideDuration</code> isn&#39;t, we default to <code>autoHideDuration / 2</code> ms."
},
"size": { "description": "The size of the component." },
"slotProps": { "description": "The props used for each slot inside." },
"slots": { "description": "The components used for each slot inside." },
"sx": {
"description": "The system prop that allows defining system overrides as well as additional CSS styles."
},
"variant": {
"description": "The <a href=\"https://mui.com/joy-ui/main-features/global-variants/\">global variant</a> to use."
}
},
"classDescriptions": {
"root": { "description": "Class name applied to the root element." },
"anchorOriginTopCenter": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "<code>anchorOrigin={{ 'top', 'center' }}</code>"
},
"anchorOriginBottomCenter": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "<code>anchorOrigin={{ 'bottom', 'center' }}</code>"
},
"anchorOriginTopRight": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "<code>anchorOrigin={{ 'top', 'right' }}</code>"
},
"anchorOriginBottomRight": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "<code>anchorOrigin={{ 'bottom', 'right' }}</code>"
},
"anchorOriginTopLeft": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "<code>anchorOrigin={{ 'top', 'left' }}</code>"
},
"anchorOriginBottomLeft": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "<code>anchorOrigin={{ 'bottom', 'left' }}</code>"
},
"colorPrimary": {
"description": "Class name applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "<code>color=\"primary\"</code>"
},
"colorDanger": {
"description": "Class name applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "<code>color=\"danger\"</code>"
},
"colorNeutral": {
"description": "Class name applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "<code>color=\"neutral\"</code>"
},
"colorSuccess": {
"description": "Class name applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "<code>color=\"success\"</code>"
},
"colorWarning": {
"description": "Class name applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "<code>color=\"warning\"</code>"
},
"endDecorator": {
"description": "Class name applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the endDecorator element",
"conditions": "supplied"
},
"sizeSm": {
"description": "Class name applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "<code>size=\"sm\"</code>"
},
"sizeMd": {
"description": "Class name applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "<code>size=\"md\"</code>"
},
"sizeLg": {
"description": "Class name applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "<code>size=\"lg\"</code>"
},
"startDecorator": {
"description": "Class name applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the startDecorator element",
"conditions": "supplied"
},
"variantPlain": {
"description": "Class name applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "<code>variant=\"plain\"</code>"
},
"variantOutlined": {
"description": "Class name applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "<code>variant=\"outlined\"</code>"
},
"variantSoft": {
"description": "Class name applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "<code>variant=\"soft\"</code>"
},
"variantSolid": {
"description": "Class name applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "<code>variant=\"solid\"</code>"
}
},
"slotDescriptions": {
"root": "The component that renders the root.",
"startDecorator": "The component that renders the start decorator.",
"endDecorator": "The component that renders the end decorator."
}
}
1 change: 1 addition & 0 deletions packages/mui-base/src/Snackbar/Snackbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const useUtilityClasses = () => {
* Demos:
*
* - [Snackbar](https://mui.com/base-ui/react-snackbar/)
* - [Snackbar](https://mui.com/joy-ui/react-snackbar/)
* - [Snackbar](https://mui.com/material-ui/react-snackbar/)
*
* API:
Expand Down
Empty file.
11 changes: 10 additions & 1 deletion packages/mui-joy/src/Snackbar/Snackbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,16 @@ const SnackbarEndDecorator = styled('span', {
flex: 'none',
marginLeft: 'auto',
});

/**
*
* Demos:
*
* - [Snackbar](https://mui.com/joy-ui/react-snackbar/)
*
* API:
*
* - [Snackbar API](https://mui.com/joy-ui/api/snackbar/)
*/
const Snackbar = React.forwardRef(function Snackbar(inProps, ref) {
const props = useThemeProps<typeof inProps & SnackbarProps>({
props: inProps,
Expand Down
3 changes: 3 additions & 0 deletions packages/mui-joy/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ export * from './Skeleton';
export { default as Slider } from './Slider';
export * from './Slider';

export { default as Snackbar } from './Snackbar';
export * from './Snackbar';

export { default as Stack } from './Stack';
export * from './Stack';

Expand Down

0 comments on commit 3d89466

Please sign in to comment.