@broxus/react-uikit 0.4.7 → 0.5.0
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/dist/cjs/components/Article/Article.d.ts +4 -1
- package/dist/cjs/components/Article/Article.js +11 -5
- package/dist/cjs/components/Article/Meta.d.ts +6 -1
- package/dist/cjs/components/Article/Meta.js +7 -6
- package/dist/cjs/components/Article/Title.d.ts +6 -1
- package/dist/cjs/components/Article/Title.js +7 -6
- package/dist/cjs/components/Article/context.d.ts +5 -0
- package/dist/cjs/components/Article/context.js +32 -0
- package/dist/cjs/components/Article/index.d.ts +1 -1
- package/dist/cjs/components/Card/Badge.d.ts +6 -1
- package/dist/cjs/components/Card/Badge.js +6 -5
- package/dist/cjs/components/Card/Body.d.ts +6 -1
- package/dist/cjs/components/Card/Body.js +7 -6
- package/dist/cjs/components/Card/Card.js +7 -2
- package/dist/cjs/components/Card/Footer.d.ts +6 -1
- package/dist/cjs/components/Card/Footer.js +7 -6
- package/dist/cjs/components/Card/Header.d.ts +6 -1
- package/dist/cjs/components/Card/Header.js +7 -6
- package/dist/cjs/components/Card/Media.d.ts +6 -1
- package/dist/cjs/components/Card/Media.js +6 -5
- package/dist/cjs/components/Card/Title.d.ts +6 -1
- package/dist/cjs/components/Card/Title.js +7 -6
- package/dist/cjs/components/Card/context.d.ts +5 -0
- package/dist/cjs/components/Card/context.js +32 -0
- package/dist/cjs/components/Flex/Flex.js +7 -2
- package/dist/cjs/components/Flex/Item.js +2 -2
- package/dist/cjs/components/Flex/context.d.ts +5 -0
- package/dist/cjs/components/Flex/context.js +32 -0
- package/dist/cjs/components/Form/Controls.js +2 -2
- package/dist/cjs/components/Form/ControlsText.js +2 -2
- package/dist/cjs/components/Form/Form.d.ts +3 -1
- package/dist/cjs/components/Form/Form.js +10 -4
- package/dist/cjs/components/Form/context.d.ts +5 -0
- package/dist/cjs/components/Form/context.js +32 -0
- package/dist/cjs/components/Form/index.d.ts +1 -1
- package/dist/cjs/components/List/List.d.ts +1 -1
- package/dist/cjs/components/List/List.js +3 -2
- package/dist/cjs/components/List/index.d.ts +1 -1
- package/dist/cjs/components/Subnav/Item.d.ts +7 -0
- package/dist/cjs/components/Subnav/Item.js +34 -0
- package/dist/cjs/components/Subnav/Subnav.d.ts +6 -0
- package/dist/cjs/components/{ComponentProvider/index.js → Subnav/Subnav.js} +12 -20
- package/dist/cjs/components/Subnav/index.d.ts +9 -0
- package/dist/cjs/components/Subnav/index.js +8 -0
- package/dist/cjs/components/Subnav/index.scss +278 -0
- package/dist/cjs/index.d.ts +0 -1
- package/dist/cjs/index.js +0 -1
- package/dist/cjs/styles/margin.scss +1 -0
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/components/Article/Article.d.ts +4 -1
- package/dist/esm/components/Article/Article.js +9 -4
- package/dist/esm/components/Article/Meta.d.ts +6 -1
- package/dist/esm/components/Article/Meta.js +5 -5
- package/dist/esm/components/Article/Title.d.ts +6 -1
- package/dist/esm/components/Article/Title.js +5 -5
- package/dist/esm/components/Article/context.d.ts +5 -0
- package/dist/esm/components/Article/context.js +6 -0
- package/dist/esm/components/Article/index.d.ts +1 -1
- package/dist/esm/components/Card/Badge.d.ts +6 -1
- package/dist/esm/components/Card/Badge.js +4 -4
- package/dist/esm/components/Card/Body.d.ts +6 -1
- package/dist/esm/components/Card/Body.js +5 -5
- package/dist/esm/components/Card/Card.js +7 -2
- package/dist/esm/components/Card/Footer.d.ts +6 -1
- package/dist/esm/components/Card/Footer.js +5 -5
- package/dist/esm/components/Card/Header.d.ts +6 -1
- package/dist/esm/components/Card/Header.js +5 -5
- package/dist/esm/components/Card/Media.d.ts +6 -1
- package/dist/esm/components/Card/Media.js +4 -4
- package/dist/esm/components/Card/Title.d.ts +6 -1
- package/dist/esm/components/Card/Title.js +5 -5
- package/dist/esm/components/Card/context.d.ts +5 -0
- package/dist/esm/components/Card/context.js +6 -0
- package/dist/esm/components/Flex/Flex.js +7 -2
- package/dist/esm/components/Flex/Item.js +2 -2
- package/dist/esm/components/Flex/context.d.ts +5 -0
- package/dist/esm/components/Flex/context.js +6 -0
- package/dist/esm/components/Form/Controls.js +2 -2
- package/dist/esm/components/Form/ControlsText.js +2 -2
- package/dist/esm/components/Form/Form.d.ts +3 -1
- package/dist/esm/components/Form/Form.js +9 -4
- package/dist/esm/components/Form/context.d.ts +5 -0
- package/dist/esm/components/Form/context.js +6 -0
- package/dist/esm/components/Form/index.d.ts +1 -1
- package/dist/esm/components/List/List.d.ts +1 -1
- package/dist/esm/components/List/List.js +2 -2
- package/dist/esm/components/List/index.d.ts +1 -1
- package/dist/esm/components/Subnav/Item.d.ts +7 -0
- package/dist/esm/components/Subnav/Item.js +7 -0
- package/dist/esm/components/Subnav/Subnav.d.ts +6 -0
- package/dist/esm/components/Subnav/Subnav.js +11 -0
- package/dist/esm/components/Subnav/index.d.ts +9 -0
- package/dist/esm/components/Subnav/index.js +5 -0
- package/dist/esm/components/Subnav/index.scss +278 -0
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/index.js +0 -1
- package/dist/esm/styles/margin.scss +1 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/dist/cjs/components/ComponentProvider/index.d.ts +0 -11
- package/dist/esm/components/ComponentProvider/index.d.ts +0 -11
- package/dist/esm/components/ComponentProvider/index.js +0 -21
|
@@ -2,4 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
export interface ArticleProps extends React.HTMLAttributes<HTMLElement> {
|
|
3
3
|
prefixCls?: string;
|
|
4
4
|
}
|
|
5
|
-
export declare
|
|
5
|
+
export declare function Article(props: ArticleProps): React.JSX.Element;
|
|
6
|
+
export declare namespace Article {
|
|
7
|
+
var displayName: string;
|
|
8
|
+
}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { ArticleContext } from '../../components/Article/context';
|
|
4
4
|
import { useConfig } from '../../components/ConfigProvider';
|
|
5
|
-
export
|
|
5
|
+
export function Article(props) {
|
|
6
6
|
const config = useConfig();
|
|
7
7
|
const { className, prefixCls = config.prefixCls, ...restProps } = props;
|
|
8
8
|
const rootCls = React.useMemo(() => config.getRootPrefixCls(prefixCls || config.prefixCls, 'article'), [config, prefixCls]);
|
|
9
|
-
|
|
9
|
+
const context = React.useMemo(() => ({
|
|
10
|
+
getRootCls() {
|
|
11
|
+
return rootCls;
|
|
12
|
+
},
|
|
13
|
+
}), [rootCls]);
|
|
14
|
+
return (React.createElement(ArticleContext.Provider, { value: context },
|
|
10
15
|
React.createElement("article", { className: classNames(rootCls, className), ...restProps })));
|
|
11
|
-
}
|
|
16
|
+
}
|
|
12
17
|
if (process.env.NODE_ENV !== 'production') {
|
|
13
18
|
Article.displayName = 'Article';
|
|
14
19
|
}
|
|
@@ -4,4 +4,9 @@ export type ArticleMetaOwnProps = {
|
|
|
4
4
|
prefixCls?: string;
|
|
5
5
|
};
|
|
6
6
|
export type ArticleMetaProps<E extends React.ElementType> = React.PropsWithChildren<ArticleMetaOwnProps & PolymorphicProps<E>> & PolymorphicProps<E, ArticleMetaOwnProps>;
|
|
7
|
-
|
|
7
|
+
declare const defaultElement: React.ElementType;
|
|
8
|
+
export declare function Meta<E extends React.ElementType = typeof defaultElement>(props: ArticleMetaProps<E>): React.JSX.Element;
|
|
9
|
+
export declare namespace Meta {
|
|
10
|
+
var displayName: string;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import { ArticleContext } from '../../components/Article/context';
|
|
3
4
|
import { Component } from '../../components/Component';
|
|
4
|
-
import { useComponentContext } from '../../components/ComponentProvider';
|
|
5
5
|
import { useConfig } from '../../components/ConfigProvider';
|
|
6
6
|
const defaultElement = 'p';
|
|
7
|
-
export
|
|
7
|
+
export function Meta(props) {
|
|
8
8
|
const config = useConfig();
|
|
9
|
-
const { getRootCls } =
|
|
9
|
+
const { getRootCls } = React.useContext(ArticleContext);
|
|
10
10
|
const { className, prefixCls = getRootCls(), ...restProps } = props;
|
|
11
11
|
const rootCls = React.useMemo(() => config.getRootPrefixCls(prefixCls || config.prefixCls, 'meta'), [config, prefixCls]);
|
|
12
|
-
return
|
|
13
|
-
}
|
|
12
|
+
return React.createElement(Component, { className: classNames(rootCls, className), component: defaultElement, ...restProps });
|
|
13
|
+
}
|
|
14
14
|
if (process.env.NODE_ENV !== 'production') {
|
|
15
15
|
Meta.displayName = 'Article.Meta';
|
|
16
16
|
}
|
|
@@ -4,4 +4,9 @@ export type ArticleTitleOwnProps = {
|
|
|
4
4
|
prefixCls?: string;
|
|
5
5
|
};
|
|
6
6
|
export type ArticleTitleProps<E extends React.ElementType> = React.PropsWithChildren<ArticleTitleOwnProps & PolymorphicProps<E>> & PolymorphicProps<E, ArticleTitleOwnProps>;
|
|
7
|
-
|
|
7
|
+
declare const defaultElement: React.ElementType;
|
|
8
|
+
export declare function Title<E extends React.ElementType = typeof defaultElement>(props: ArticleTitleProps<E>): React.JSX.Element;
|
|
9
|
+
export declare namespace Title {
|
|
10
|
+
var displayName: string;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import { ArticleContext } from '../../components/Article/context';
|
|
3
4
|
import { Component } from '../../components/Component';
|
|
4
|
-
import { useComponentContext } from '../../components/ComponentProvider';
|
|
5
5
|
import { useConfig } from '../../components/ConfigProvider';
|
|
6
6
|
const defaultElement = 'h1';
|
|
7
|
-
export
|
|
7
|
+
export function Title(props) {
|
|
8
8
|
const config = useConfig();
|
|
9
|
-
const { getRootCls } =
|
|
9
|
+
const { getRootCls } = React.useContext(ArticleContext);
|
|
10
10
|
const { className, prefixCls = getRootCls(), ...restProps } = props;
|
|
11
11
|
const rootCls = React.useMemo(() => config.getRootPrefixCls(prefixCls || config.prefixCls, 'title'), [config, prefixCls]);
|
|
12
|
-
return
|
|
13
|
-
}
|
|
12
|
+
return React.createElement(Component, { className: classNames(rootCls, className), component: defaultElement, ...restProps });
|
|
13
|
+
}
|
|
14
14
|
if (process.env.NODE_ENV !== 'production') {
|
|
15
15
|
Title.displayName = 'Article.Title';
|
|
16
16
|
}
|
|
@@ -4,7 +4,7 @@ import { type ArticleMetaProps, Meta } from '../../components/Article/Meta';
|
|
|
4
4
|
import { type ArticleTitleProps, Title } from '../../components/Article/Title';
|
|
5
5
|
import './index.scss';
|
|
6
6
|
export type { ArticleMetaProps, ArticleProps, ArticleTitleProps };
|
|
7
|
-
export interface Article extends React.
|
|
7
|
+
export interface Article extends React.FunctionComponent<ArticleProps> {
|
|
8
8
|
Meta: typeof Meta;
|
|
9
9
|
Title: typeof Title;
|
|
10
10
|
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type BadgeProps } from '../../components/Badge';
|
|
3
3
|
export type CardBadgeProps<E extends React.ElementType> = BadgeProps<E>;
|
|
4
|
-
|
|
4
|
+
declare const defaultElement: React.ElementType;
|
|
5
|
+
export declare function Badge<E extends React.ElementType = typeof defaultElement>(props: CardBadgeProps<E>): React.JSX.Element;
|
|
6
|
+
export declare namespace Badge {
|
|
7
|
+
var displayName: string;
|
|
8
|
+
}
|
|
9
|
+
export {};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { Badge as BaseBadge } from '../../components/Badge';
|
|
4
|
-
import {
|
|
4
|
+
import { CardContext } from '../../components/Card/context';
|
|
5
5
|
import { useConfig } from '../../components/ConfigProvider';
|
|
6
6
|
const defaultElement = 'span';
|
|
7
|
-
export
|
|
7
|
+
export function Badge(props) {
|
|
8
8
|
const config = useConfig();
|
|
9
|
-
const { getRootCls } =
|
|
9
|
+
const { getRootCls } = React.useContext(CardContext);
|
|
10
10
|
const { className, prefixCls = getRootCls(), ...restProps } = props;
|
|
11
11
|
const rootCls = React.useMemo(() => config.getRootPrefixCls(prefixCls, 'badge'), [config, prefixCls]);
|
|
12
12
|
return React.createElement(BaseBadge, { className: classNames(rootCls, className), ...restProps });
|
|
13
|
-
}
|
|
13
|
+
}
|
|
14
14
|
if (process.env.NODE_ENV !== 'production') {
|
|
15
15
|
Badge.displayName = 'Card.Badge';
|
|
16
16
|
}
|
|
@@ -4,4 +4,9 @@ export type CardBodyOwnProps = {
|
|
|
4
4
|
prefixCls?: string;
|
|
5
5
|
};
|
|
6
6
|
export type CardBodyProps<E extends React.ElementType> = React.PropsWithChildren<CardBodyOwnProps & PolymorphicProps<E>> & PolymorphicProps<E, CardBodyOwnProps>;
|
|
7
|
-
|
|
7
|
+
declare const defaultElement: React.ElementType;
|
|
8
|
+
export declare function Body<E extends React.ElementType = typeof defaultElement>(props: CardBodyProps<E>): React.JSX.Element;
|
|
9
|
+
export declare namespace Body {
|
|
10
|
+
var displayName: string;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import { CardContext } from '../../components/Card/context';
|
|
3
4
|
import { Component } from '../../components/Component';
|
|
4
|
-
import { useComponentContext } from '../../components/ComponentProvider';
|
|
5
5
|
import { useConfig } from '../../components/ConfigProvider';
|
|
6
6
|
const defaultElement = 'div';
|
|
7
|
-
export
|
|
7
|
+
export function Body(props) {
|
|
8
8
|
const config = useConfig();
|
|
9
|
-
const { getRootCls } =
|
|
9
|
+
const { getRootCls } = React.useContext(CardContext);
|
|
10
10
|
const { className, prefixCls = getRootCls(), ...restProps } = props;
|
|
11
|
-
const rootCls = React.useMemo(() => config.getRootPrefixCls(prefixCls, 'body'), [config, prefixCls]);
|
|
11
|
+
const rootCls = React.useMemo(() => config.getRootPrefixCls(prefixCls || config.prefixCls, 'body'), [config, prefixCls]);
|
|
12
12
|
return (React.createElement(Component, { className: classNames(rootCls, className), component: defaultElement, ...restProps }));
|
|
13
|
-
}
|
|
13
|
+
}
|
|
14
14
|
if (process.env.NODE_ENV !== 'production') {
|
|
15
15
|
Body.displayName = 'Card.Body';
|
|
16
16
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { capitalizeFirstLetter } from '@broxus/js-utils';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
+
import { CardContext } from '../../components/Card/context';
|
|
4
5
|
import { Component } from '../../components/Component';
|
|
5
|
-
import { ComponentProvider } from '../../components/ComponentProvider';
|
|
6
6
|
import { useConfig } from '../../components/ConfigProvider';
|
|
7
7
|
const defaultElement = 'div';
|
|
8
8
|
export function Card(props) {
|
|
@@ -12,7 +12,12 @@ export function Card(props) {
|
|
|
12
12
|
? config[`card${capitalizeFirstLetter(color)}ColorMode`]
|
|
13
13
|
: undefined, hoverable, prefixCls = config.prefixCls, size, ...restProps } = props;
|
|
14
14
|
const rootCls = React.useMemo(() => config.getRootPrefixCls(prefixCls, 'card'), [config, prefixCls]);
|
|
15
|
-
|
|
15
|
+
const context = React.useMemo(() => ({
|
|
16
|
+
getRootCls() {
|
|
17
|
+
return rootCls;
|
|
18
|
+
},
|
|
19
|
+
}), [rootCls]);
|
|
20
|
+
return (React.createElement(CardContext.Provider, { value: context },
|
|
16
21
|
React.createElement(Component, { className: classNames(rootCls, {
|
|
17
22
|
[`${rootCls}-${color}`]: color !== undefined,
|
|
18
23
|
[`${rootCls}-${size}`]: size !== undefined,
|
|
@@ -4,4 +4,9 @@ export type CardFooterOwnProps = {
|
|
|
4
4
|
prefixCls?: string;
|
|
5
5
|
};
|
|
6
6
|
export type CardFooterProps<E extends React.ElementType> = React.PropsWithChildren<CardFooterOwnProps & PolymorphicProps<E>> & PolymorphicProps<E, CardFooterOwnProps>;
|
|
7
|
-
|
|
7
|
+
declare const defaultElement: React.ElementType;
|
|
8
|
+
export declare function Footer<E extends React.ElementType = typeof defaultElement>(props: CardFooterProps<E>): React.JSX.Element;
|
|
9
|
+
export declare namespace Footer {
|
|
10
|
+
var displayName: string;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import { CardContext } from '../../components/Card/context';
|
|
3
4
|
import { Component } from '../../components/Component';
|
|
4
|
-
import { useComponentContext } from '../../components/ComponentProvider';
|
|
5
5
|
import { useConfig } from '../../components/ConfigProvider';
|
|
6
6
|
const defaultElement = 'footer';
|
|
7
|
-
export
|
|
7
|
+
export function Footer(props) {
|
|
8
8
|
const config = useConfig();
|
|
9
|
-
const { getRootCls } =
|
|
9
|
+
const { getRootCls } = React.useContext(CardContext);
|
|
10
10
|
const { className, prefixCls = getRootCls(), ...restProps } = props;
|
|
11
|
-
const rootCls = React.useMemo(() => config.getRootPrefixCls(prefixCls, 'footer'), [config, prefixCls]);
|
|
11
|
+
const rootCls = React.useMemo(() => config.getRootPrefixCls(prefixCls || config.prefixCls, 'footer'), [config, prefixCls]);
|
|
12
12
|
return React.createElement(Component, { className: classNames(rootCls, className), component: defaultElement, ...restProps });
|
|
13
|
-
}
|
|
13
|
+
}
|
|
14
14
|
if (process.env.NODE_ENV !== 'production') {
|
|
15
15
|
Footer.displayName = 'Card.Footer';
|
|
16
16
|
}
|
|
@@ -4,4 +4,9 @@ export type CardHeaderOwnProps = {
|
|
|
4
4
|
prefixCls?: string;
|
|
5
5
|
};
|
|
6
6
|
export type CardHeaderProps<E extends React.ElementType> = React.PropsWithChildren<CardHeaderOwnProps & PolymorphicProps<E>> & PolymorphicProps<E, CardHeaderOwnProps>;
|
|
7
|
-
|
|
7
|
+
declare const defaultElement: React.ElementType;
|
|
8
|
+
export declare function Header<E extends React.ElementType = typeof defaultElement>(props: CardHeaderProps<E>): React.JSX.Element;
|
|
9
|
+
export declare namespace Header {
|
|
10
|
+
var displayName: string;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import { CardContext } from '../../components/Card/context';
|
|
3
4
|
import { Component } from '../../components/Component';
|
|
4
|
-
import { useComponentContext } from '../../components/ComponentProvider';
|
|
5
5
|
import { useConfig } from '../../components/ConfigProvider';
|
|
6
6
|
const defaultElement = 'header';
|
|
7
|
-
export
|
|
7
|
+
export function Header(props) {
|
|
8
8
|
const config = useConfig();
|
|
9
|
-
const { getRootCls } =
|
|
9
|
+
const { getRootCls } = React.useContext(CardContext);
|
|
10
10
|
const { className, prefixCls = getRootCls(), ...restProps } = props;
|
|
11
|
-
const rootCls = React.useMemo(() => config.getRootPrefixCls(prefixCls, 'header'), [config, prefixCls]);
|
|
11
|
+
const rootCls = React.useMemo(() => config.getRootPrefixCls(prefixCls || config.prefixCls, 'header'), [config, prefixCls]);
|
|
12
12
|
return React.createElement(Component, { className: classNames(rootCls, className), component: defaultElement, ...restProps });
|
|
13
|
-
}
|
|
13
|
+
}
|
|
14
14
|
if (process.env.NODE_ENV !== 'production') {
|
|
15
15
|
Header.displayName = 'Card.Header';
|
|
16
16
|
}
|
|
@@ -5,4 +5,9 @@ export type CardMediaOwnProps = {
|
|
|
5
5
|
prefixCls?: string;
|
|
6
6
|
};
|
|
7
7
|
export type CardMediaProps<E extends React.ElementType> = React.PropsWithChildren<CardMediaOwnProps & PolymorphicProps<E>> & PolymorphicProps<E, CardMediaOwnProps>;
|
|
8
|
-
|
|
8
|
+
declare const defaultElement: React.ElementType;
|
|
9
|
+
export declare function Media<E extends React.ElementType = typeof defaultElement>(props: CardMediaProps<E>): React.JSX.Element;
|
|
10
|
+
export declare namespace Media {
|
|
11
|
+
var displayName: string;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import { CardContext } from '../../components/Card/context';
|
|
3
4
|
import { Component } from '../../components/Component';
|
|
4
|
-
import { useComponentContext } from '../../components/ComponentProvider';
|
|
5
5
|
import { useConfig } from '../../components/ConfigProvider';
|
|
6
6
|
const defaultElement = 'div';
|
|
7
|
-
export
|
|
7
|
+
export function Media(props) {
|
|
8
8
|
const config = useConfig();
|
|
9
|
-
const { getRootCls } =
|
|
9
|
+
const { getRootCls } = React.useContext(CardContext);
|
|
10
10
|
const { className, position, prefixCls = getRootCls(), ...restProps } = props;
|
|
11
11
|
const rootCls = React.useMemo(() => config.getRootPrefixCls(prefixCls || config.prefixCls, 'media'), [config, prefixCls]);
|
|
12
12
|
return (React.createElement(Component, { className: classNames({
|
|
13
13
|
[`${rootCls}-${position}`]: position !== undefined,
|
|
14
14
|
}, className), component: defaultElement, ...restProps }));
|
|
15
|
-
}
|
|
15
|
+
}
|
|
16
16
|
if (process.env.NODE_ENV !== 'production') {
|
|
17
17
|
Media.displayName = 'Card.Media';
|
|
18
18
|
}
|
|
@@ -4,4 +4,9 @@ export type CardTitleOwnProps = {
|
|
|
4
4
|
prefixCls?: string;
|
|
5
5
|
};
|
|
6
6
|
export type CardTitleProps<E extends React.ElementType> = React.PropsWithChildren<CardTitleOwnProps & PolymorphicProps<E>> & PolymorphicProps<E, CardTitleOwnProps>;
|
|
7
|
-
|
|
7
|
+
declare const defaultElement: React.ElementType;
|
|
8
|
+
export declare function Title<E extends React.ElementType = typeof defaultElement>(props: CardTitleProps<E>): React.JSX.Element;
|
|
9
|
+
export declare namespace Title {
|
|
10
|
+
var displayName: string;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import { CardContext } from '../../components/Card/context';
|
|
3
4
|
import { Component } from '../../components/Component';
|
|
4
|
-
import { useComponentContext } from '../../components/ComponentProvider';
|
|
5
5
|
import { useConfig } from '../../components/ConfigProvider';
|
|
6
6
|
const defaultElement = 'h3';
|
|
7
|
-
export
|
|
7
|
+
export function Title(props) {
|
|
8
8
|
const config = useConfig();
|
|
9
|
-
const { getRootCls } =
|
|
9
|
+
const { getRootCls } = React.useContext(CardContext);
|
|
10
10
|
const { className, prefixCls = getRootCls(), ...restProps } = props;
|
|
11
|
-
const rootCls = React.useMemo(() => config.getRootPrefixCls(prefixCls, 'title'), [config, prefixCls]);
|
|
11
|
+
const rootCls = React.useMemo(() => config.getRootPrefixCls(prefixCls || config.prefixCls, 'title'), [config, prefixCls]);
|
|
12
12
|
return React.createElement(Component, { className: classNames(rootCls, className), component: defaultElement, ...restProps });
|
|
13
|
-
}
|
|
13
|
+
}
|
|
14
14
|
if (process.env.NODE_ENV !== 'production') {
|
|
15
15
|
Title.displayName = 'Card.Title';
|
|
16
16
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { Component } from '../../components/Component';
|
|
4
|
-
import { ComponentProvider } from '../../components/ComponentProvider';
|
|
5
4
|
import { useConfig } from '../../components/ConfigProvider';
|
|
5
|
+
import { FlexContext } from '../../components/Flex/context';
|
|
6
6
|
import { getBreakpointsConfigClasses } from '../../utils';
|
|
7
7
|
const defaultElement = 'div';
|
|
8
8
|
export function Flex(props) {
|
|
@@ -12,7 +12,12 @@ export function Flex(props) {
|
|
|
12
12
|
const justifyContentCls = React.useMemo(() => (typeof justifyContent === 'string'
|
|
13
13
|
? `${rootCls}-${justifyContent}`
|
|
14
14
|
: getBreakpointsConfigClasses(prefixCls || config.prefixCls, 'flex', justifyContent)), [config.prefixCls, justifyContent, prefixCls, rootCls]);
|
|
15
|
-
|
|
15
|
+
const context = React.useMemo(() => ({
|
|
16
|
+
getRootCls() {
|
|
17
|
+
return rootCls;
|
|
18
|
+
},
|
|
19
|
+
}), [rootCls]);
|
|
20
|
+
return (React.createElement(FlexContext.Provider, { value: context },
|
|
16
21
|
React.createElement(Component, { className: classNames({
|
|
17
22
|
[rootCls]: !inline,
|
|
18
23
|
[`${rootCls}-inline`]: inline,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { Component } from '../../components/Component';
|
|
4
|
-
import { useComponentContext } from '../../components/ComponentProvider';
|
|
5
4
|
import { useConfig } from '../../components/ConfigProvider';
|
|
5
|
+
import { FlexContext } from '../../components/Flex/context';
|
|
6
6
|
import { getBreakpointsConfigClasses } from '../../utils';
|
|
7
7
|
const defaultElement = 'div';
|
|
8
8
|
export function Item(props) {
|
|
9
9
|
const config = useConfig();
|
|
10
|
-
const { getRootCls } =
|
|
10
|
+
const { getRootCls } = React.useContext(FlexContext);
|
|
11
11
|
const { className, itemDimensions, order, prefixCls = getRootCls(), ...restProps } = props;
|
|
12
12
|
const orderCls = React.useMemo(() => (typeof order === 'string'
|
|
13
13
|
? `${prefixCls}-${order}`
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { useComponentContext } from '../../components/ComponentProvider';
|
|
4
3
|
import { useConfig } from '../../components/ConfigProvider';
|
|
4
|
+
import { FormContext } from '../../components/Form/context';
|
|
5
5
|
export const Controls = React.memo((props) => {
|
|
6
6
|
const config = useConfig();
|
|
7
|
-
const { getRootCls } =
|
|
7
|
+
const { getRootCls } = React.useContext(FormContext);
|
|
8
8
|
const { className, prefixCls = getRootCls(), ...restProps } = props;
|
|
9
9
|
const rootCls = React.useMemo(() => config.getRootPrefixCls(prefixCls || config.prefixCls, 'controls'), [config, prefixCls]);
|
|
10
10
|
return React.createElement("div", { className: classNames(rootCls, className), ...restProps });
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { useComponentContext } from '../../components/ComponentProvider';
|
|
4
3
|
import { useConfig } from '../../components/ConfigProvider';
|
|
4
|
+
import { FormContext } from '../../components/Form/context';
|
|
5
5
|
export const ControlsText = React.memo((props) => {
|
|
6
6
|
const config = useConfig();
|
|
7
|
-
const { getRootCls } =
|
|
7
|
+
const { getRootCls } = React.useContext(FormContext);
|
|
8
8
|
const { className, prefixCls = getRootCls(), ...restProps } = props;
|
|
9
9
|
const rootCls = React.useMemo(() => config.getRootPrefixCls(prefixCls || config.prefixCls, 'controls-text'), [config, prefixCls]);
|
|
10
10
|
return React.createElement("div", { className: classNames(rootCls, className), ...restProps });
|
|
@@ -5,4 +5,6 @@ export interface FormOwnProps {
|
|
|
5
5
|
prefixCls?: string;
|
|
6
6
|
}
|
|
7
7
|
export type FormProps<E extends React.ElementType = React.ElementType> = React.PropsWithChildren<FormOwnProps & PolymorphicProps<E>> & PolymorphicProps<E, FormOwnProps>;
|
|
8
|
-
|
|
8
|
+
declare const defaultElement: React.ElementType;
|
|
9
|
+
export declare function Form<E extends React.ElementType = typeof defaultElement>(props: FormProps<E>): React.JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { Component } from '../../components/Component';
|
|
4
|
-
import { ComponentProvider } from '../../components/ComponentProvider';
|
|
5
4
|
import { useConfig } from '../../components/ConfigProvider';
|
|
5
|
+
import { FormContext } from '../../components/Form/context';
|
|
6
6
|
const defaultElement = 'form';
|
|
7
|
-
export
|
|
7
|
+
export function Form(props) {
|
|
8
8
|
const config = useConfig();
|
|
9
9
|
const { className, layout, prefixCls = config.prefixCls, ...restProps } = props;
|
|
10
10
|
const rootCls = React.useMemo(() => config.getRootPrefixCls(prefixCls || config.prefixCls, 'form'), [config, prefixCls]);
|
|
11
|
-
|
|
11
|
+
const context = React.useMemo(() => ({
|
|
12
|
+
getRootCls() {
|
|
13
|
+
return rootCls;
|
|
14
|
+
},
|
|
15
|
+
}), [rootCls]);
|
|
16
|
+
return (React.createElement(FormContext.Provider, { value: context },
|
|
12
17
|
React.createElement(Component, { className: classNames(rootCls, {
|
|
13
18
|
[`${rootCls}-${layout}`]: layout !== undefined,
|
|
14
19
|
}, className), component: defaultElement, ...restProps })));
|
|
15
|
-
}
|
|
20
|
+
}
|
|
@@ -7,7 +7,7 @@ import { Label } from '../../components/Form/Label';
|
|
|
7
7
|
import { Legend } from '../../components/Form/Legend';
|
|
8
8
|
import './index.scss';
|
|
9
9
|
export type { FormProps };
|
|
10
|
-
export interface Form extends React.
|
|
10
|
+
export interface Form extends React.FunctionComponent<FormProps> {
|
|
11
11
|
Controls: typeof Controls;
|
|
12
12
|
ControlsText: typeof ControlsText;
|
|
13
13
|
Fieldset: typeof Fieldset;
|
|
@@ -5,4 +5,4 @@ export interface ListProps extends React.HTMLAttributes<HTMLUListElement> {
|
|
|
5
5
|
size?: 'large' | 'collapse';
|
|
6
6
|
type?: 'bullet' | 'disc' | 'divider' | 'striped' | 'circle' | 'square' | 'decimal' | 'hyphen';
|
|
7
7
|
}
|
|
8
|
-
export declare
|
|
8
|
+
export declare function List(props: ListProps): React.JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useConfig } from '../../components/ConfigProvider';
|
|
4
|
-
export
|
|
4
|
+
export function List(props) {
|
|
5
5
|
const config = useConfig();
|
|
6
6
|
const { className, color, prefixCls = config.prefixCls, size, type, ...restProps } = props;
|
|
7
7
|
const rootCls = React.useMemo(() => config.getRootPrefixCls(prefixCls || config.prefixCls, 'list'), [config, prefixCls]);
|
|
@@ -10,4 +10,4 @@ export const List = React.memo((props) => {
|
|
|
10
10
|
[`${rootCls}-${size}`]: size !== undefined,
|
|
11
11
|
[`${rootCls}-${type}`]: type !== undefined,
|
|
12
12
|
}, className), ...restProps }));
|
|
13
|
-
}
|
|
13
|
+
}
|
|
@@ -3,7 +3,7 @@ import { Item } from '../../components/List/Item';
|
|
|
3
3
|
import { type ListProps } from '../../components/List/List';
|
|
4
4
|
import './index.scss';
|
|
5
5
|
export type { ListProps };
|
|
6
|
-
export interface List extends React.
|
|
6
|
+
export interface List extends React.FunctionComponent<ListProps> {
|
|
7
7
|
Item: typeof Item;
|
|
8
8
|
}
|
|
9
9
|
export declare const List: List;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useConfig } from '../../components/ConfigProvider';
|
|
4
|
+
export function Subnav(props) {
|
|
5
|
+
const config = useConfig();
|
|
6
|
+
const { className, prefixCls = config.prefixCls, type, ...restProps } = props;
|
|
7
|
+
const rootCls = React.useMemo(() => config.getRootPrefixCls(prefixCls || config.prefixCls, 'subnav'), [config, prefixCls]);
|
|
8
|
+
return (React.createElement("ul", { className: classNames(rootCls, {
|
|
9
|
+
[`${rootCls}-${type}`]: type !== undefined,
|
|
10
|
+
}, className), ...restProps, "data-uk-margin": "" }));
|
|
11
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import { Item } from '../../components/Subnav/Item';
|
|
3
|
+
import { type SubnavProps } from '../../components/Subnav/Subnav';
|
|
4
|
+
import './index.scss';
|
|
5
|
+
export type { SubnavProps };
|
|
6
|
+
export interface Subnav extends React.FunctionComponent<SubnavProps> {
|
|
7
|
+
Item: typeof Item;
|
|
8
|
+
}
|
|
9
|
+
export declare const Subnav: Subnav;
|