@mintlify/components 0.3.10 → 0.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +11 -0
- package/.github/dependabot.yml +10 -0
- package/.github/workflows/code-style-checks.yaml +13 -0
- package/.github/workflows/sanity.yml +13 -0
- package/.husky/pre-commit +4 -0
- package/.prettierignore +49 -0
- package/.prettierrc +1 -0
- package/README.md +58 -3
- package/dist/Accordion/Accordion.d.ts +2 -2
- package/dist/Accordion/AccordionCover.d.ts +1 -1
- package/dist/Accordion/AccordionGroup.d.ts +1 -1
- package/dist/Accordion/index.d.ts +2 -2
- package/dist/Api/ApiPlayground.d.ts +2 -2
- package/dist/Api/RequestMethodBubble.d.ts +1 -1
- package/dist/Api/RequestPathHeader.d.ts +1 -1
- package/dist/Api/index.d.ts +3 -3
- package/dist/Api/inputs/ApiInput.d.ts +1 -1
- package/dist/Api/types.d.ts +1 -1
- package/dist/Button.d.ts +2 -2
- package/dist/Callouts.d.ts +1 -1
- package/dist/Card.d.ts +7 -3
- package/dist/CardGroup.d.ts +2 -2
- package/dist/Code/CodeBlock.d.ts +4 -4
- package/dist/Code/CodeGroup.d.ts +7 -6
- package/dist/Code/CopyToClipboardButton.d.ts +3 -3
- package/dist/Code/index.d.ts +3 -3
- package/dist/Expandable/index.d.ts +1 -1
- package/dist/Frame.d.ts +1 -1
- package/dist/Tabs/Tab.d.ts +1 -1
- package/dist/Tabs/Tabs.d.ts +1 -1
- package/dist/Tabs/index.d.ts +2 -2
- package/dist/Tooltip.d.ts +2 -2
- package/dist/index.d.ts +15 -15
- package/dist/index.js +1 -1
- package/dist/main.css +1 -1
- package/dist/utils/copyToClipboard.d.ts +1 -1
- package/dist/utils/delay.d.ts +1 -0
- package/package.json +35 -4
- package/build-storybook.log +0 -368
- package/dist/CodeBlock/CodeBlock.d.ts +0 -9
- package/dist/CodeBlock/CodeGroup.d.ts +0 -11
- package/dist/CodeBlock/CodeTabBar.d.ts +0 -6
- package/dist/CodeBlock/CopyToClipboard.d.ts +0 -2
- package/dist/CodeBlock/CopyToClipboardButton.d.ts +0 -5
- package/dist/CodeBlock/index.d.ts +0 -3
- package/dist/CodeGroup.d.ts +0 -12
- package/dist/LightDarkToggle.d.ts +0 -14
- package/dist/UserDefinedIcon.d.ts +0 -7
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
|
2
|
+
|
|
3
|
+
version: 2
|
|
4
|
+
updates:
|
|
5
|
+
- package-ecosystem: "npm" # See documentation for possible values
|
|
6
|
+
directory: "/" # Location of package manifests
|
|
7
|
+
schedule:
|
|
8
|
+
interval: "daily"
|
|
9
|
+
allow:
|
|
10
|
+
- dependency-name: "@mintlify/*"
|
package/.prettierignore
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# we are using yarn in this project
|
|
2
|
+
package.lock
|
|
3
|
+
|
|
4
|
+
# user editor preferences
|
|
5
|
+
/.vscode/
|
|
6
|
+
/.idea/
|
|
7
|
+
|
|
8
|
+
# dependencies
|
|
9
|
+
/node_modules
|
|
10
|
+
/.pnp
|
|
11
|
+
.pnp.js
|
|
12
|
+
|
|
13
|
+
# testing
|
|
14
|
+
/coverage
|
|
15
|
+
|
|
16
|
+
# next.js
|
|
17
|
+
/.next/
|
|
18
|
+
/out/
|
|
19
|
+
/public/feeds/
|
|
20
|
+
|
|
21
|
+
# production
|
|
22
|
+
/build
|
|
23
|
+
/dist
|
|
24
|
+
|
|
25
|
+
# generated files
|
|
26
|
+
/public/*
|
|
27
|
+
/src/pages/*
|
|
28
|
+
!/src/pages/api
|
|
29
|
+
/src/pages/api/*.mdx
|
|
30
|
+
!/src/pages/*.tsx
|
|
31
|
+
!/src/pages/*.ts
|
|
32
|
+
/src/config.json
|
|
33
|
+
/src/openapi.json
|
|
34
|
+
|
|
35
|
+
# misc
|
|
36
|
+
.DS_Store
|
|
37
|
+
|
|
38
|
+
# debug
|
|
39
|
+
npm-debug.log*
|
|
40
|
+
yarn-debug.log*
|
|
41
|
+
yarn-error.log*
|
|
42
|
+
build-storybook.log
|
|
43
|
+
|
|
44
|
+
# local env files
|
|
45
|
+
.env
|
|
46
|
+
.env.local
|
|
47
|
+
.env.development.local
|
|
48
|
+
.env.test.local
|
|
49
|
+
.env.production.local
|
package/.prettierrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"@mintlify/prettier-config/config.js"
|
package/README.md
CHANGED
|
@@ -48,7 +48,46 @@ This repo contains the components Mintlify uses in our open-source documentation
|
|
|
48
48
|
|
|
49
49
|
## Installation
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
## Add Dependencies
|
|
52
|
+
|
|
53
|
+
Install this package and peerDependencies of this package,
|
|
54
|
+
using [install-peerdeps](https://github.com/nathanhleung/install-peerdeps).
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
npx install-peerdeps @mintlify/components
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### React is already installed
|
|
61
|
+
|
|
62
|
+
You already have `react` installed or are using `preact` and just need `@headlessui/react` and `@mintlify/components`.
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
# yarn
|
|
66
|
+
yarn add @headlessui/react @mintlify/components
|
|
67
|
+
|
|
68
|
+
# npm
|
|
69
|
+
npm i @headlessui/react @mintlify/components
|
|
70
|
+
|
|
71
|
+
# pnpm
|
|
72
|
+
pnpm add @headlessui/react @mintlify/components
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### React and headlessui are already installed
|
|
76
|
+
|
|
77
|
+
You already have `react` and `@headlessui/react` installed and just need `@mintlify/components`.
|
|
78
|
+
|
|
79
|
+
```sh
|
|
80
|
+
# yarn
|
|
81
|
+
yarn add @mintlify/components
|
|
82
|
+
|
|
83
|
+
# npm
|
|
84
|
+
npm i @mintlify/components
|
|
85
|
+
|
|
86
|
+
# pnpm
|
|
87
|
+
pnpm add @mintlify/components
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## CSS import
|
|
52
91
|
|
|
53
92
|
Add the following at the start of your `main.css` file:
|
|
54
93
|
|
|
@@ -66,11 +105,27 @@ The project is designed for use with static side rendering where we don't have a
|
|
|
66
105
|
|
|
67
106
|
# Documentation
|
|
68
107
|
|
|
69
|
-
|
|
108
|
+
Go to [mintlify.com/docs/components](https://mintlify.com/docs/components) to see how to use the components in Mintlify's documentation platform.
|
|
70
109
|
|
|
71
110
|
[Storybook](https://main--63134bd5ae01f2a7717a0e47.chromatic.com/) has interactive demos.
|
|
72
111
|
|
|
73
|
-
|
|
112
|
+
## Contributing
|
|
113
|
+
|
|
114
|
+
Read the [Contributing guide](https://mintlify.com/docs/contributing) to learn about our development process, the standards and tools used, and how to propose fixes, bugs or open issues.
|
|
115
|
+
|
|
116
|
+
The [repo wiki](https://github.com/mintlify/components/wiki) explains how to contribute to this repo.
|
|
117
|
+
|
|
118
|
+
### Code Quality
|
|
119
|
+
|
|
120
|
+
Check out the [Contribution Tools](https://mintlify.com/docs/contributing#contribution-tools) section in our [Contributing guide](https://mintlify.com/docs/contributing).
|
|
121
|
+
|
|
122
|
+
#### Formatting
|
|
123
|
+
|
|
124
|
+
This project uses [prettier](https://prettier.io/) for code formatting. You can auto-format across the codebase by running `yarn format`.
|
|
125
|
+
|
|
126
|
+
#### Linting
|
|
127
|
+
|
|
128
|
+
This project uses [eslint](https://eslint.org/) for code linting. You can check linter warnings and errors by running `yarn lint`.
|
|
74
129
|
|
|
75
130
|
# Long Term Vision
|
|
76
131
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
declare function Accordion({ title, description, defaultOpen, icon, onChange, variant, children, }: {
|
|
3
3
|
/** The main text of the Accordion shown in bold */
|
|
4
4
|
title: string;
|
|
@@ -11,7 +11,7 @@ declare function Accordion({ title, description, defaultOpen, icon, onChange, va
|
|
|
11
11
|
/** Callback when the Accordion is clicked with the new open state */
|
|
12
12
|
onChange?: (open: boolean) => void;
|
|
13
13
|
/** The Accordion UI style */
|
|
14
|
-
variant?:
|
|
14
|
+
variant?: 'rounded' | 'minimalist';
|
|
15
15
|
/** The Accordion contents */
|
|
16
16
|
children: ReactNode;
|
|
17
17
|
}): JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import Accordion from
|
|
2
|
-
import AccordionGroup from
|
|
1
|
+
import Accordion from './Accordion';
|
|
2
|
+
import AccordionGroup from './AccordionGroup';
|
|
3
3
|
export { Accordion, AccordionGroup };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReactNode } from
|
|
2
|
-
import { ParamGroup, RequestMethods } from
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ParamGroup, RequestMethods } from './types';
|
|
3
3
|
export declare function ApiPlayground({ method, paramGroups, paramValues, isSendingRequest, onChangeParamValues, onSendRequest, header, response, }: {
|
|
4
4
|
/** Request method. */
|
|
5
5
|
method: RequestMethods;
|
package/dist/Api/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApiPlayground } from
|
|
2
|
-
import { RequestMethodBubble } from
|
|
3
|
-
import { RequestPathHeader } from
|
|
1
|
+
import { ApiPlayground } from './ApiPlayground';
|
|
2
|
+
import { RequestMethodBubble } from './RequestMethodBubble';
|
|
3
|
+
import { RequestPathHeader } from './RequestPathHeader';
|
|
4
4
|
export { ApiPlayground, RequestMethodBubble, RequestPathHeader };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ApiInputValue, Param } from
|
|
2
|
+
import { ApiInputValue, Param } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* ApiInput provides a UI to receive inputs from the user for API calls.
|
|
5
5
|
* The user is responsible for updating value when onChangeParam is called.
|
package/dist/Api/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type RequestMethods =
|
|
1
|
+
export type RequestMethods = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'COPY' | 'HEAD' | 'OPTIONS' | 'LINK' | 'UNLINK' | 'PURGE' | 'LOCK' | 'UNLOCK' | 'PROPFIND' | 'VIEW';
|
|
2
2
|
export type ParamGroup = {
|
|
3
3
|
name: string;
|
|
4
4
|
params: Param[];
|
package/dist/Button.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ElementType, ComponentPropsWithoutRef, Ref } from
|
|
1
|
+
import { ElementType, ComponentPropsWithoutRef, Ref } from 'react';
|
|
2
2
|
type ColorInterface = keyof typeof colors;
|
|
3
3
|
declare let colors: {
|
|
4
4
|
indigo: string[];
|
|
@@ -38,5 +38,5 @@ export interface ButtonPropsBase<T> {
|
|
|
38
38
|
* @typeParam T - Type of the Element rendered by the button.
|
|
39
39
|
*/
|
|
40
40
|
export type ButtonProps<T extends ElementType> = ButtonPropsBase<T> & Omit<ComponentPropsWithoutRef<T>, keyof ButtonPropsBase<T>>;
|
|
41
|
-
export declare function Button<T extends ElementType =
|
|
41
|
+
export declare function Button<T extends ElementType = 'button'>({ as, color, darkColor, reverse, children, className, mRef, ...props }: ButtonProps<T>): JSX.Element;
|
|
42
42
|
export {};
|
package/dist/Callouts.d.ts
CHANGED
package/dist/Card.d.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef, ElementType, ReactNode, Ref } from
|
|
1
|
+
import { ComponentPropsWithoutRef, ElementType, ReactNode, Ref } from 'react';
|
|
2
2
|
export interface CardPropsBase<T> {
|
|
3
3
|
/**
|
|
4
4
|
* Large title above children.
|
|
5
5
|
*/
|
|
6
6
|
title?: string;
|
|
7
7
|
/**
|
|
8
|
-
* Icon to the top-left of the title.
|
|
8
|
+
* Icon to the top-left of the title. Can be a ReactNode or a string equal to an image source.
|
|
9
9
|
*/
|
|
10
10
|
icon?: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* If provided, will render an image to the top of the card.
|
|
13
|
+
*/
|
|
14
|
+
image?: string;
|
|
11
15
|
/**
|
|
12
16
|
* Type of element to be rendered.
|
|
13
17
|
*/
|
|
@@ -26,4 +30,4 @@ export interface CardPropsBase<T> {
|
|
|
26
30
|
* @typeParam T - Type of the Element rendered by the card.
|
|
27
31
|
*/
|
|
28
32
|
export type CardProps<T extends ElementType> = CardPropsBase<T> & Omit<ComponentPropsWithoutRef<T>, keyof CardPropsBase<T>>;
|
|
29
|
-
export declare function Card<T extends ElementType =
|
|
33
|
+
export declare function Card<T extends ElementType = 'div'>({ title, icon, image, className, children, as, mRef, ...props }: CardProps<T>): JSX.Element;
|
package/dist/CardGroup.d.ts
CHANGED
package/dist/Code/CodeBlock.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef } from
|
|
2
|
-
import { CopyToClipboardResult } from
|
|
1
|
+
import React, { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import { CopyToClipboardResult } from '../utils/copyToClipboard';
|
|
3
3
|
export interface CodeBlockPropsBase {
|
|
4
4
|
filename?: string;
|
|
5
5
|
/**
|
|
@@ -15,5 +15,5 @@ export interface CodeBlockPropsBase {
|
|
|
15
15
|
*/
|
|
16
16
|
onCopied?: (result: CopyToClipboardResult, textToCopy?: string) => void;
|
|
17
17
|
}
|
|
18
|
-
export type CodeBlockProps = CodeBlockPropsBase & Omit<ComponentPropsWithoutRef<
|
|
19
|
-
export declare
|
|
18
|
+
export type CodeBlockProps = CodeBlockPropsBase & Omit<ComponentPropsWithoutRef<'div'>, keyof CodeBlockPropsBase>;
|
|
19
|
+
export declare const CodeBlock: React.ForwardRefExoticComponent<CodeBlockPropsBase & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof CodeBlockPropsBase> & React.RefAttributes<HTMLDivElement>>;
|
package/dist/Code/CodeGroup.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { ComponentPropsWithoutRef } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import React, { ComponentPropsWithoutRef, FormEventHandler, ReactElement } from 'react';
|
|
2
|
+
import { CopyToClipboardResult } from '../utils/copyToClipboard';
|
|
3
|
+
import { CodeBlockProps } from './CodeBlock';
|
|
4
4
|
export type CodeGroupPropsBase = {
|
|
5
5
|
/**
|
|
6
6
|
* Color of the filename text and the border underneath it when the content is being shown
|
|
@@ -15,9 +15,10 @@ export type CodeGroupPropsBase = {
|
|
|
15
15
|
*/
|
|
16
16
|
onCopied?: (result: CopyToClipboardResult, textToCopy?: string) => void;
|
|
17
17
|
isSmallText?: boolean;
|
|
18
|
-
children?:
|
|
18
|
+
children?: ReactElement<CodeBlockProps>[] | ReactElement<CodeBlockProps>;
|
|
19
|
+
onChange?: FormEventHandler<HTMLDivElement> & ((index: number) => void);
|
|
19
20
|
};
|
|
20
|
-
export type CodeGroupProps = CodeGroupPropsBase & Omit<ComponentPropsWithoutRef<
|
|
21
|
+
export type CodeGroupProps = CodeGroupPropsBase & Omit<ComponentPropsWithoutRef<'div'>, keyof CodeGroupPropsBase>;
|
|
21
22
|
/**
|
|
22
23
|
* Group multiple code blocks into a tabbed UI.
|
|
23
24
|
* Uses CodeBlocks as children but does not render them directly. Instead,
|
|
@@ -25,4 +26,4 @@ export type CodeGroupProps = CodeGroupPropsBase & Omit<ComponentPropsWithoutRef<
|
|
|
25
26
|
*
|
|
26
27
|
* @param {CodeBlock[]} - children
|
|
27
28
|
*/
|
|
28
|
-
export declare
|
|
29
|
+
export declare const CodeGroup: React.ForwardRefExoticComponent<CodeGroupPropsBase & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof CodeGroupPropsBase> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef } from
|
|
2
|
-
import { CopyToClipboardResult } from
|
|
1
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import { CopyToClipboardResult } from '../utils/copyToClipboard';
|
|
3
3
|
export declare function CopyToClipboardButton({ textToCopy, tooltipColor, onCopied, className, ...props }: {
|
|
4
4
|
textToCopy: string;
|
|
5
5
|
tooltipColor?: string;
|
|
6
6
|
onCopied?: (result: CopyToClipboardResult, textToCopy?: string) => void;
|
|
7
|
-
} & ComponentPropsWithoutRef<
|
|
7
|
+
} & ComponentPropsWithoutRef<'button'>): JSX.Element | null;
|
package/dist/Code/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CodeBlock, CodeBlockProps, CodeBlockPropsBase } from
|
|
2
|
-
import { CodeGroup, CodeGroupProps, CodeGroupPropsBase } from
|
|
3
|
-
export type { CodeGroupPropsBase, CodeBlockPropsBase, CodeGroupProps, CodeBlockProps
|
|
1
|
+
import { CodeBlock, CodeBlockProps, CodeBlockPropsBase } from './CodeBlock';
|
|
2
|
+
import { CodeGroup, CodeGroupProps, CodeGroupPropsBase } from './CodeGroup';
|
|
3
|
+
export type { CodeGroupPropsBase, CodeBlockPropsBase, CodeGroupProps, CodeBlockProps };
|
|
4
4
|
export { CodeBlock, CodeGroup };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import Expandable from
|
|
1
|
+
import Expandable from './Expandable';
|
|
2
2
|
export { Expandable };
|
package/dist/Frame.d.ts
CHANGED
package/dist/Tabs/Tab.d.ts
CHANGED
package/dist/Tabs/Tabs.d.ts
CHANGED
package/dist/Tabs/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import Tab from
|
|
2
|
-
import Tabs from
|
|
1
|
+
import Tab from './Tab';
|
|
2
|
+
import Tabs from './Tabs';
|
|
3
3
|
export { Tab, Tabs };
|
package/dist/Tooltip.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { Accordion, AccordionGroup } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { Button, ButtonProps, ButtonPropsBase } from
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
1
|
+
import { Accordion, AccordionGroup } from './Accordion';
|
|
2
|
+
import { ApiPlayground, RequestMethodBubble, RequestPathHeader } from './Api';
|
|
3
|
+
import { AppearFromTop } from './AppearFromTop';
|
|
4
|
+
import { Button, ButtonProps, ButtonPropsBase } from './Button';
|
|
5
|
+
import { Info, Warning, Note, Tip, Check } from './Callouts';
|
|
6
|
+
import { Card, CardProps, CardPropsBase } from './Card';
|
|
7
|
+
import { CardGroup } from './CardGroup';
|
|
8
|
+
import { CodeBlock, CodeBlockProps, CodeBlockPropsBase, CodeGroup, CodeGroupProps, CodeGroupPropsBase } from './Code';
|
|
9
|
+
import { Expandable } from './Expandable';
|
|
10
|
+
import { Frame } from './Frame';
|
|
11
|
+
import { Param } from './Param';
|
|
12
|
+
import { PillSelect } from './PillSelect';
|
|
13
|
+
import { Tab, Tabs } from './Tabs';
|
|
14
|
+
import { Tooltip } from './Tooltip';
|
|
15
|
+
import './css/globals.css';
|
|
16
16
|
export type { CardProps, ButtonProps, ButtonPropsBase, CardPropsBase, CodeGroupPropsBase, CodeBlockPropsBase, CodeGroupProps, CodeBlockProps, };
|
|
17
17
|
export { Accordion, AccordionGroup, AppearFromTop, ApiPlayground, Button, Card, CardGroup, CodeBlock, CodeGroup, Check, Expandable, Frame, Info, Warning, Note, Param, PillSelect, RequestMethodBubble, RequestPathHeader, Tabs, Tip, Tab, Tooltip, };
|