@broxus/react-uikit 0.4.6 → 0.4.8
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/Accordion/Accordion.d.ts +4 -1
- package/dist/cjs/components/Accordion/Accordion.js +4 -3
- package/dist/cjs/components/Accordion/Item.d.ts +4 -1
- package/dist/cjs/components/Accordion/Item.js +4 -3
- package/dist/cjs/components/Button/Button.d.ts +1 -1
- package/dist/cjs/components/Button/Button.js +2 -4
- package/dist/cjs/components/Button/Group.d.ts +4 -1
- package/dist/cjs/components/Button/Group.js +4 -3
- package/dist/cjs/components/Button/index.d.ts +1 -1
- package/dist/cjs/components/Button/index.scss +107 -2
- package/dist/cjs/components/Card/Card.d.ts +6 -1
- package/dist/cjs/components/Card/Card.js +4 -3
- package/dist/cjs/components/Card/index.d.ts +1 -1
- package/dist/cjs/components/Component/index.d.ts +1 -1
- package/dist/cjs/components/ComponentProvider/index.d.ts +1 -1
- package/dist/cjs/components/ConfigProvider/index.d.ts +4 -1
- package/dist/cjs/components/ConfigProvider/index.js +3 -2
- package/dist/cjs/components/Flex/Flex.d.ts +3 -1
- package/dist/cjs/components/Flex/Flex.js +3 -2
- package/dist/cjs/components/Flex/Item.d.ts +2 -1
- package/dist/cjs/components/Flex/Item.js +3 -2
- package/dist/cjs/components/Flex/index.d.ts +1 -1
- package/dist/cjs/components/Grid/index.d.ts +3 -1
- package/dist/cjs/components/Grid/index.js +3 -2
- package/dist/cjs/components/Nav/Nav.d.ts +1 -1
- package/dist/cjs/components/Nav/Nav.js +2 -2
- package/dist/cjs/components/Tabs/hooks/useLegacyItems.d.ts +1 -1
- package/dist/cjs/components/Tabs/hooks/useLegacyItems.js +2 -1
- package/dist/cjs/components/Tabs/index.d.ts +1 -1
- package/dist/cjs/components/Tabs/index.js +4 -4
- package/dist/cjs/styles/margin.scss +1 -0
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/components/Accordion/Accordion.d.ts +4 -1
- package/dist/esm/components/Accordion/Accordion.js +2 -2
- package/dist/esm/components/Accordion/Item.d.ts +4 -1
- package/dist/esm/components/Accordion/Item.js +2 -2
- package/dist/esm/components/Button/Button.d.ts +1 -1
- package/dist/esm/components/Button/Button.js +2 -4
- package/dist/esm/components/Button/Group.d.ts +4 -1
- package/dist/esm/components/Button/Group.js +2 -2
- package/dist/esm/components/Button/index.d.ts +1 -1
- package/dist/esm/components/Button/index.scss +107 -2
- package/dist/esm/components/Card/Card.d.ts +6 -1
- package/dist/esm/components/Card/Card.js +2 -2
- package/dist/esm/components/Card/index.d.ts +1 -1
- package/dist/esm/components/Component/index.d.ts +1 -1
- package/dist/esm/components/ComponentProvider/index.d.ts +1 -1
- package/dist/esm/components/ConfigProvider/index.d.ts +4 -1
- package/dist/esm/components/ConfigProvider/index.js +2 -2
- package/dist/esm/components/Flex/Flex.d.ts +3 -1
- package/dist/esm/components/Flex/Flex.js +2 -2
- package/dist/esm/components/Flex/Item.d.ts +2 -1
- package/dist/esm/components/Flex/Item.js +2 -2
- package/dist/esm/components/Flex/index.d.ts +1 -1
- package/dist/esm/components/Grid/index.d.ts +3 -1
- package/dist/esm/components/Grid/index.js +2 -2
- package/dist/esm/components/Nav/Nav.d.ts +1 -1
- package/dist/esm/components/Nav/Nav.js +2 -2
- package/dist/esm/components/Tabs/hooks/useLegacyItems.d.ts +1 -1
- package/dist/esm/components/Tabs/hooks/useLegacyItems.js +1 -1
- package/dist/esm/components/Tabs/index.d.ts +1 -1
- package/dist/esm/components/Tabs/index.js +3 -4
- package/dist/esm/styles/margin.scss +1 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +2 -1
|
@@ -3,4 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
export interface AccordionProps extends CollapseProps {
|
|
4
4
|
direction?: string;
|
|
5
5
|
}
|
|
6
|
-
export declare
|
|
6
|
+
export declare function Accordion(props: AccordionProps): React.JSX.Element;
|
|
7
|
+
export declare namespace Accordion {
|
|
8
|
+
var displayName: string;
|
|
9
|
+
}
|
|
@@ -3,14 +3,14 @@ import Collapse from 'rc-collapse';
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { useConfig } from '../../components/ConfigProvider';
|
|
5
5
|
import { getCollapseMotion } from '../../utils';
|
|
6
|
-
export
|
|
6
|
+
export function Accordion(props) {
|
|
7
7
|
const config = useConfig();
|
|
8
8
|
const { className, direction, prefixCls = config.prefixCls, ...restProps } = props;
|
|
9
9
|
const rootCls = React.useMemo(() => config.getRootPrefixCls(prefixCls || config.prefixCls, 'accordion'), [config, prefixCls]);
|
|
10
10
|
return (React.createElement(Collapse, { className: classNames({
|
|
11
11
|
[`${rootCls}-rtl`]: direction === 'rtl',
|
|
12
12
|
}, className), openMotion: getCollapseMotion(prefixCls || config.prefixCls), prefixCls: rootCls, ...restProps }));
|
|
13
|
-
}
|
|
13
|
+
}
|
|
14
14
|
if (process.env.NODE_ENV !== 'production') {
|
|
15
15
|
Accordion.displayName = 'Accordion';
|
|
16
16
|
}
|
|
@@ -5,4 +5,7 @@ export type AccordionItemProps = React.PropsWithChildren<Omit<CollapsePanelProps
|
|
|
5
5
|
* Use Accordion items props instead
|
|
6
6
|
* @deprecated
|
|
7
7
|
*/
|
|
8
|
-
export declare
|
|
8
|
+
export declare function Item(props: AccordionItemProps): React.JSX.Element;
|
|
9
|
+
export declare namespace Item {
|
|
10
|
+
var displayName: string;
|
|
11
|
+
}
|
|
@@ -5,12 +5,12 @@ import { Icon } from '../../components/Icon';
|
|
|
5
5
|
* Use Accordion items props instead
|
|
6
6
|
* @deprecated
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export function Item(props) {
|
|
9
9
|
const { expandIcon, ...restProps } = props;
|
|
10
10
|
const mergedExpandIcon = React.useMemo(() => expandIcon
|
|
11
11
|
|| (({ isActive }) => (React.createElement(Icon, { icon: isActive ? 'expand_more' : 'chevron_right' }))), [expandIcon]);
|
|
12
12
|
return React.createElement(Panel, { expandIcon: mergedExpandIcon, ...restProps });
|
|
13
|
-
}
|
|
13
|
+
}
|
|
14
14
|
if (process.env.NODE_ENV !== 'production') {
|
|
15
15
|
Item.displayName = 'Accordion.Item';
|
|
16
16
|
}
|
|
@@ -17,4 +17,4 @@ export interface ButtonOwnProps extends Partial<AnchorButtonProps>, Partial<Nati
|
|
|
17
17
|
type?: 'default' | 'primary' | 'secondary' | 'tertiary' | 'danger' | 'link' | 'text';
|
|
18
18
|
}
|
|
19
19
|
export type ButtonProps<E extends React.ElementType = any> = React.PropsWithChildren<ButtonOwnProps & PolymorphicProps<E>> & PolymorphicProps<E, ButtonOwnProps>;
|
|
20
|
-
export declare const Button: React.
|
|
20
|
+
export declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps<any>, "ref"> & React.RefAttributes<any>>;
|
|
@@ -4,9 +4,9 @@ import { Component } from '../../components/Component';
|
|
|
4
4
|
import { useConfig } from '../../components/ConfigProvider';
|
|
5
5
|
import { Link } from '../../components/Link';
|
|
6
6
|
const defaultElement = 'button';
|
|
7
|
-
const
|
|
7
|
+
export const Button = React.forwardRef((props, ref) => {
|
|
8
8
|
const config = useConfig();
|
|
9
|
-
const { children, ghost, htmlType = 'button', prefixCls = config.prefixCls, shape, size, type, ...restProps } = props;
|
|
9
|
+
const { children, ghost, htmlType = 'button', prefixCls = config.prefixCls, shape = config.buttonShape, size = config.buttonSize, type, ...restProps } = props;
|
|
10
10
|
const buttonRef = React.useRef(null);
|
|
11
11
|
const onClick = React.useCallback(event => {
|
|
12
12
|
if (restProps.disabled) {
|
|
@@ -27,8 +27,6 @@ const ForwardedButton = React.forwardRef((props, ref) => {
|
|
|
27
27
|
}
|
|
28
28
|
return (React.createElement(Component, { ref: ref || buttonRef, component: defaultElement, type: htmlType, ...restProps, className: className, onClick: onClick }, children));
|
|
29
29
|
});
|
|
30
|
-
export const Button = React.memo(ForwardedButton);
|
|
31
30
|
if (process.env.NODE_ENV !== 'production') {
|
|
32
|
-
ForwardedButton.displayName = 'Button.Forwarded';
|
|
33
31
|
Button.displayName = 'Button';
|
|
34
32
|
}
|
|
@@ -2,4 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
export interface ButtonGroupProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
3
|
prefixCls?: string;
|
|
4
4
|
}
|
|
5
|
-
export declare
|
|
5
|
+
export declare function Group(props: ButtonGroupProps): React.JSX.Element;
|
|
6
|
+
export declare namespace Group {
|
|
7
|
+
var displayName: string;
|
|
8
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
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 Group(props) {
|
|
5
5
|
const config = useConfig();
|
|
6
6
|
const { className, prefixCls = config.prefixCls, ...restProps } = props;
|
|
7
7
|
const rootCls = React.useMemo(() => config.getRootPrefixCls(prefixCls || config.prefixCls, 'button-group'), [config, prefixCls]);
|
|
8
8
|
return React.createElement("div", { className: classNames(rootCls, className), ...restProps });
|
|
9
|
-
}
|
|
9
|
+
}
|
|
10
10
|
if (process.env.NODE_ENV !== 'production') {
|
|
11
11
|
Group.displayName = 'Button.Group';
|
|
12
12
|
}
|
|
@@ -3,7 +3,7 @@ import { type ButtonProps } from '../../components/Button/Button';
|
|
|
3
3
|
import { Group } from '../../components/Button/Group';
|
|
4
4
|
import './index.scss';
|
|
5
5
|
export type { ButtonProps };
|
|
6
|
-
export interface Button extends React.
|
|
6
|
+
export interface Button extends React.ForwardRefExoticComponent<ButtonProps> {
|
|
7
7
|
Group: typeof Group;
|
|
8
8
|
}
|
|
9
9
|
export declare const Button: Button;
|
|
@@ -19,8 +19,7 @@
|
|
|
19
19
|
// `uk-button-xlarge`
|
|
20
20
|
// `uk-button-circle`
|
|
21
21
|
// `uk-button-round`
|
|
22
|
-
//
|
|
23
|
-
// TODO: Add `ghost` and `dashed` modifiers
|
|
22
|
+
// `uk-button-ghost`
|
|
24
23
|
//
|
|
25
24
|
// States: `uk-active`
|
|
26
25
|
//
|
|
@@ -410,6 +409,90 @@
|
|
|
410
409
|
}
|
|
411
410
|
|
|
412
411
|
|
|
412
|
+
/* Ghost modifiers
|
|
413
|
+
========================================================================== */
|
|
414
|
+
|
|
415
|
+
.uk-button-ghost {
|
|
416
|
+
background-color: transparent;
|
|
417
|
+
border: var(--button-ghost-border-width) var(--button-ghost-border-style);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
.uk-button-default.uk-button-ghost {
|
|
421
|
+
border-color: var(--button-ghost-default-border);
|
|
422
|
+
color: var(--button-ghost-default-color);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
.uk-button-default.uk-button-ghost:hover,
|
|
426
|
+
.uk-button-default.uk-button-ghost:focus {
|
|
427
|
+
border-color: var(--button-ghost-default-hover-border);
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
.uk-button-default.uk-button-ghost:active,
|
|
431
|
+
.uk-button-default.uk-button-ghost.active {
|
|
432
|
+
border-color: var(--button-ghost-default-active-border);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
.uk-button-primary.uk-button-ghost {
|
|
436
|
+
border-color: var(--button-ghost-primary-border);
|
|
437
|
+
color: var(--button-ghost-primary-color);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
.uk-button-primary.uk-button-ghost:hover,
|
|
441
|
+
.uk-button-primary.uk-button-ghost:focus {
|
|
442
|
+
border-color: var(--button-ghost-primary-hover-border);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
.uk-button-primary.uk-button-ghost:active,
|
|
446
|
+
.uk-button-primary.uk-button-ghost.active {
|
|
447
|
+
border-color: var(--button-ghost-primary-active-border);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
.uk-button-secondary.uk-button-ghost {
|
|
451
|
+
border-color: var(--button-ghost-secondary-border);
|
|
452
|
+
color: var(--button-ghost-secondary-color);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
.uk-button-secondary.uk-button-ghost:hover,
|
|
456
|
+
.uk-button-secondary.uk-button-ghost:focus {
|
|
457
|
+
border-color: var(--button-ghost-secondary-hover-border);
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
.uk-button-secondary.uk-button-ghost:active,
|
|
461
|
+
.uk-button-secondary.uk-button-ghost.active {
|
|
462
|
+
border-color: var(--button-ghost-secondary-active-border);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
.uk-button-tertiary.uk-button-ghost {
|
|
466
|
+
border-color: var(--button-ghost-tertiary-border);
|
|
467
|
+
color: var(--button-ghost-tertiary-color);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
.uk-button-tertiary.uk-button-ghost:hover,
|
|
471
|
+
.uk-button-tertiary.uk-button-ghost:focus {
|
|
472
|
+
border-color: var(--button-ghost-tertiary-hover-border);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
.uk-button-tertiary.uk-button-ghost:active,
|
|
476
|
+
.uk-button-tertiary.uk-button-ghost.active {
|
|
477
|
+
border-color: var(--button-ghost-tertiary-active-border);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
.uk-button-danger.uk-button-ghost {
|
|
481
|
+
border-color: var(--button-ghost-danger-border);
|
|
482
|
+
color: var(--button-ghost-danger-color);
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
.uk-button-danger.uk-button-ghost:hover,
|
|
486
|
+
.uk-button-danger.uk-button-ghost:focus {
|
|
487
|
+
border-color: var(--button-ghost-danger-hover-border);
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
.uk-button-danger.uk-button-ghost:active,
|
|
491
|
+
.uk-button-danger.uk-button-ghost.active {
|
|
492
|
+
border-color: var(--button-ghost-danger-active-border);
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
|
|
413
496
|
/* Shape modifiers
|
|
414
497
|
========================================================================== */
|
|
415
498
|
|
|
@@ -498,6 +581,28 @@
|
|
|
498
581
|
--button-danger-hover-color: var(--global-inverse-color);
|
|
499
582
|
--button-danger-active-background: #{$button-danger-active-background};
|
|
500
583
|
--button-danger-active-color: var(--global-inverse-color);
|
|
584
|
+
--button-ghost-border-width: var(--global-border-width);
|
|
585
|
+
--button-ghost-border-style: var(--global-border-style);
|
|
586
|
+
--button-ghost-default-color: var(--button-default-background);
|
|
587
|
+
--button-ghost-default-border: var(--button-default-background);
|
|
588
|
+
--button-ghost-default-hover-border: var(--button-default-hover-background);
|
|
589
|
+
--button-ghost-default-active-border: var(--button-default-active-background);
|
|
590
|
+
--button-ghost-primary-color: var(--button-primary-background);
|
|
591
|
+
--button-ghost-primary-border: var(--button-primary-background);
|
|
592
|
+
--button-ghost-primary-hover-border: var(--button-primary-hover-background);
|
|
593
|
+
--button-ghost-primary-active-border: var(--button-primary-active-background);
|
|
594
|
+
--button-ghost-secondary-color: var(--button-secondary-background);
|
|
595
|
+
--button-ghost-secondary-border: var(--button-secondary-background);
|
|
596
|
+
--button-ghost-secondary-hover-border: var(--button-secondary-hover-background);
|
|
597
|
+
--button-ghost-secondary-active-border: var(--button-secondary-active-background);
|
|
598
|
+
--button-ghost-tertiary-color: var(--button-tertiary-background);
|
|
599
|
+
--button-ghost-tertiary-border: var(--button-tertiary-background);
|
|
600
|
+
--button-ghost-tertiary-hover-border: var(--button-tertiary-hover-background);
|
|
601
|
+
--button-ghost-tertiary-active-border: var(--button-tertiary-active-background);
|
|
602
|
+
--button-ghost-danger-color: var(--button-danger-background);
|
|
603
|
+
--button-ghost-danger-border: var(--button-danger-background);
|
|
604
|
+
--button-ghost-danger-hover-border: var(--button-danger-hover-background);
|
|
605
|
+
--button-ghost-danger-active-border: var(--button-danger-active-background);
|
|
501
606
|
--button-circle-border-radius: #{$button-circle-border-radius};
|
|
502
607
|
--button-round-border-radius: #{$button-round-border-radius};
|
|
503
608
|
--button-disabled-background: var(--global-muted-background);
|
|
@@ -10,4 +10,9 @@ export type CardOwnProps = {
|
|
|
10
10
|
size?: 'small' | 'large';
|
|
11
11
|
};
|
|
12
12
|
export type CardProps<E extends React.ElementType = React.ElementType> = React.PropsWithChildren<CardOwnProps & PolymorphicProps<E>> & PolymorphicProps<E, CardOwnProps>;
|
|
13
|
-
|
|
13
|
+
declare const defaultElement: React.ElementType;
|
|
14
|
+
export declare function Card<E extends React.ElementType = typeof defaultElement>(props: CardProps<E>): React.JSX.Element;
|
|
15
|
+
export declare namespace Card {
|
|
16
|
+
var displayName: string;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -5,7 +5,7 @@ import { Component } from '../../components/Component';
|
|
|
5
5
|
import { ComponentProvider } from '../../components/ComponentProvider';
|
|
6
6
|
import { useConfig } from '../../components/ConfigProvider';
|
|
7
7
|
const defaultElement = 'div';
|
|
8
|
-
export
|
|
8
|
+
export function Card(props) {
|
|
9
9
|
const config = useConfig();
|
|
10
10
|
const { asBody, className, color, colorMode = color !== 'default' && color !== undefined
|
|
11
11
|
// @ts-ignore
|
|
@@ -20,7 +20,7 @@ export const Card = React.memo((props) => {
|
|
|
20
20
|
[`${rootCls}-hover`]: hoverable,
|
|
21
21
|
[`${config.prefixCls}-${colorMode}`]: colorMode !== undefined,
|
|
22
22
|
}, className), component: defaultElement, ...restProps })));
|
|
23
|
-
}
|
|
23
|
+
}
|
|
24
24
|
if (process.env.NODE_ENV !== 'production') {
|
|
25
25
|
Card.displayName = 'Card';
|
|
26
26
|
}
|
|
@@ -8,7 +8,7 @@ import { Media } from '../../components/Card/Media';
|
|
|
8
8
|
import { Title } from '../../components/Card/Title';
|
|
9
9
|
import './index.scss';
|
|
10
10
|
export type { CardProps };
|
|
11
|
-
export interface Card extends React.
|
|
11
|
+
export interface Card extends React.FunctionComponent<CardProps> {
|
|
12
12
|
Badge: typeof Badge;
|
|
13
13
|
Body: typeof Body;
|
|
14
14
|
Footer: typeof Footer;
|
|
@@ -5,7 +5,7 @@ type ComponentOwnProp<T extends React.ElementType = React.ElementType> = React.C
|
|
|
5
5
|
type PropsToOmit<E extends React.ElementType = React.ElementType, Props extends object = {}> = Omit<React.ComponentPropsWithoutRef<E>, keyof Props>;
|
|
6
6
|
export type PolymorphicProps<E extends React.ElementType = React.ElementType, Props extends object = {}> = ComponentOwnProp<E> & PropsToOmit<E, Props>;
|
|
7
7
|
export interface PolymorphicComponent<Component extends React.ElementType = React.ElementType, Props extends object = {}> {
|
|
8
|
-
<E extends React.ElementType = Component>(props: PolymorphicProps<E, Props>): JSX.Element;
|
|
8
|
+
<E extends React.ElementType = Component>(props: PolymorphicProps<E, Props>): React.JSX.Element;
|
|
9
9
|
displayName?: string;
|
|
10
10
|
propTypes?: React.WeakValidationMap<any>;
|
|
11
11
|
contextTypes?: React.ValidationMap<any>;
|
|
@@ -8,4 +8,4 @@ export interface ComponentContextProviderProps extends React.PropsWithChildren<P
|
|
|
8
8
|
}
|
|
9
9
|
export declare const ComponentContext: React.Context<ComponentContextConsumerProps>;
|
|
10
10
|
export declare function useComponentContext(): ComponentContextConsumerProps;
|
|
11
|
-
export declare function ComponentProvider(props: ComponentContextProviderProps): JSX.Element;
|
|
11
|
+
export declare function ComponentProvider(props: ComponentContextProviderProps): React.JSX.Element;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type BreakpointsConfig, type TooltipOptions } from '../../types';
|
|
3
|
+
import { ButtonProps } from "../../components/Button";
|
|
3
4
|
export type ColorMode = 'light' | 'dark';
|
|
4
5
|
export type ConfigContextConsumerProps = {
|
|
5
6
|
breakpoints?: Exclude<BreakpointsConfig<number>, 'default'>;
|
|
7
|
+
buttonShape?: ButtonProps['shape'];
|
|
8
|
+
buttonSize?: ButtonProps['size'];
|
|
6
9
|
cardPrimaryColorMode?: ColorMode;
|
|
7
10
|
cardSecondaryColorMode?: ColorMode;
|
|
8
11
|
cardTertiaryColorMode?: ColorMode;
|
|
@@ -24,4 +27,4 @@ export type ConfigContextConsumerProps = {
|
|
|
24
27
|
export type ConfigContextProviderProps = React.PropsWithChildren<ConfigContextConsumerProps>;
|
|
25
28
|
export declare const ConfigContext: React.Context<ConfigContextConsumerProps>;
|
|
26
29
|
export declare function useConfig(): ConfigContextConsumerProps;
|
|
27
|
-
export declare
|
|
30
|
+
export declare function ConfigContextProvider(props: Partial<ConfigContextProviderProps>): React.JSX.Element;
|
|
@@ -45,7 +45,7 @@ export const ConfigContext = React.createContext({
|
|
|
45
45
|
export function useConfig() {
|
|
46
46
|
return React.useContext(ConfigContext);
|
|
47
47
|
}
|
|
48
|
-
export
|
|
48
|
+
export function ConfigContextProvider(props) {
|
|
49
49
|
const initialContext = useConfig();
|
|
50
50
|
const { children, ...restProps } = props;
|
|
51
51
|
const context = React.useMemo(() => {
|
|
@@ -59,7 +59,7 @@ export const ConfigContextProvider = React.memo((props) => {
|
|
|
59
59
|
return { ...initialContext, direction, ...restProps };
|
|
60
60
|
}, [initialContext, restProps]);
|
|
61
61
|
return React.createElement(ConfigContext.Provider, { value: context }, children);
|
|
62
|
-
}
|
|
62
|
+
}
|
|
63
63
|
if (process.env.NODE_ENV !== 'production') {
|
|
64
64
|
ConfigContext.displayName = 'ConfigContext';
|
|
65
65
|
}
|
|
@@ -19,4 +19,6 @@ export interface FlexOwnProps extends FlexBreakpoint, FlexBreakpointsConfig {
|
|
|
19
19
|
prefixCls?: string;
|
|
20
20
|
}
|
|
21
21
|
export type FlexProps<E extends React.ElementType = React.ElementType> = React.PropsWithChildren<FlexOwnProps & PolymorphicProps<E>> & PolymorphicProps<E, FlexOwnProps>;
|
|
22
|
-
|
|
22
|
+
declare const defaultElement: React.ElementType;
|
|
23
|
+
export declare function Flex<E extends React.ElementType = typeof defaultElement>(props: FlexProps<E>): React.JSX.Element;
|
|
24
|
+
export {};
|
|
@@ -5,7 +5,7 @@ import { ComponentProvider } from '../../components/ComponentProvider';
|
|
|
5
5
|
import { useConfig } from '../../components/ConfigProvider';
|
|
6
6
|
import { getBreakpointsConfigClasses } from '../../utils';
|
|
7
7
|
const defaultElement = 'div';
|
|
8
|
-
export
|
|
8
|
+
export function Flex(props) {
|
|
9
9
|
const config = useConfig();
|
|
10
10
|
const { alignContent, alignItems, className, flexDirection, flexWrap, inline, justifyContent, prefixCls = config.prefixCls, ...restProps } = props;
|
|
11
11
|
const rootCls = React.useMemo(() => config.getRootPrefixCls(prefixCls || config.prefixCls, 'flex'), [config, prefixCls]);
|
|
@@ -21,4 +21,4 @@ export const Flex = React.memo((props) => {
|
|
|
21
21
|
[`${rootCls}-${flexWrap}`]: flexWrap !== undefined,
|
|
22
22
|
[`${rootCls}-wrap-${alignContent}`]: alignContent !== undefined,
|
|
23
23
|
}, justifyContentCls, className), component: defaultElement, ...restProps })));
|
|
24
|
-
}
|
|
24
|
+
}
|
|
@@ -9,5 +9,6 @@ export interface ItemOwnItem {
|
|
|
9
9
|
prefixCls?: string;
|
|
10
10
|
}
|
|
11
11
|
export type ItemProps<E extends React.ElementType = React.ElementType> = React.PropsWithChildren<ItemOwnItem & PolymorphicProps<E>> & PolymorphicProps<E, ItemOwnItem>;
|
|
12
|
-
|
|
12
|
+
declare const defaultElement: React.ElementType;
|
|
13
|
+
export declare function Item<E extends React.ElementType = typeof defaultElement>(props: ItemProps<E>): React.JSX.Element;
|
|
13
14
|
export {};
|
|
@@ -5,7 +5,7 @@ import { useComponentContext } from '../../components/ComponentProvider';
|
|
|
5
5
|
import { useConfig } from '../../components/ConfigProvider';
|
|
6
6
|
import { getBreakpointsConfigClasses } from '../../utils';
|
|
7
7
|
const defaultElement = 'div';
|
|
8
|
-
export
|
|
8
|
+
export function Item(props) {
|
|
9
9
|
const config = useConfig();
|
|
10
10
|
const { getRootCls } = useComponentContext();
|
|
11
11
|
const { className, itemDimensions, order, prefixCls = getRootCls(), ...restProps } = props;
|
|
@@ -15,4 +15,4 @@ export const Item = React.memo((props) => {
|
|
|
15
15
|
return (React.createElement(Component, { className: classNames({
|
|
16
16
|
[`${prefixCls}-${itemDimensions}`]: itemDimensions !== undefined,
|
|
17
17
|
}, orderCls, className), component: defaultElement, ...restProps }));
|
|
18
|
-
}
|
|
18
|
+
}
|
|
@@ -3,7 +3,7 @@ import { type FlexAlignContent, type FlexAlignItems, type FlexDirection, type Fl
|
|
|
3
3
|
import { type ItemProps as FlexItemProps, Item } from '../../components/Flex/Item';
|
|
4
4
|
import './index.scss';
|
|
5
5
|
export type { FlexAlignContent, FlexAlignItems, FlexDirection, FlexJustifyContent, FlexItemProps, FlexProps, FlexWrap };
|
|
6
|
-
export interface Flex extends React.
|
|
6
|
+
export interface Flex extends React.FunctionComponent<FlexProps> {
|
|
7
7
|
Item: typeof Item;
|
|
8
8
|
}
|
|
9
9
|
export declare const Flex: Flex;
|
|
@@ -14,4 +14,6 @@ export type GridOwnProps = {
|
|
|
14
14
|
rowGap?: GridGap;
|
|
15
15
|
};
|
|
16
16
|
export type GridProps<E extends React.ElementType = React.ElementType> = React.PropsWithChildren<GridOwnProps & PolymorphicProps<E>> & PolymorphicProps<E, GridOwnProps>;
|
|
17
|
-
|
|
17
|
+
declare const defaultElement: React.ElementType;
|
|
18
|
+
export declare function Grid<E extends React.ElementType = typeof defaultElement>(props: GridProps<E>): React.JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -5,7 +5,7 @@ import { useConfig } from '../../components/ConfigProvider';
|
|
|
5
5
|
import { getChildWidthClassname } from '../../components/Width';
|
|
6
6
|
import './index.scss';
|
|
7
7
|
const defaultElement = 'div';
|
|
8
|
-
export
|
|
8
|
+
export function Grid(props) {
|
|
9
9
|
const config = useConfig();
|
|
10
10
|
const { childWidth, className, columnGap, divider, gap, margin, match, prefixCls = config.prefixCls, rowGap, ...restProps } = props;
|
|
11
11
|
const childWithClassName = React.useMemo(() => getChildWidthClassname(childWidth), [childWidth]);
|
|
@@ -18,4 +18,4 @@ export const Grid = React.memo((props) => {
|
|
|
18
18
|
[`${rootCls}-divider`]: divider,
|
|
19
19
|
[`${rootCls}-match`]: match,
|
|
20
20
|
}, childWithClassName, className), component: defaultElement, "data-uk-grid": "margin: ", ...restProps }));
|
|
21
|
-
}
|
|
21
|
+
}
|
|
@@ -57,4 +57,4 @@ export interface NavProps extends Omit<React.HTMLAttributes<HTMLUListElement>, '
|
|
|
57
57
|
disabled: boolean;
|
|
58
58
|
}) => React.ReactElement;
|
|
59
59
|
}
|
|
60
|
-
export declare const Nav: React.
|
|
60
|
+
export declare const Nav: React.ForwardRefExoticComponent<NavProps & React.RefAttributes<NavRef>>;
|
|
@@ -20,7 +20,7 @@ import { warnItemProp } from '../../components/Nav/utils/warnUtil';
|
|
|
20
20
|
import { useMounted } from '../../hooks';
|
|
21
21
|
import { getCollapseMotion, getMotionName } from '../../utils';
|
|
22
22
|
const EMPTY_LIST = [];
|
|
23
|
-
const
|
|
23
|
+
export const Nav = React.forwardRef((props, ref) => {
|
|
24
24
|
const config = useConfig();
|
|
25
25
|
const { activeKey, builtinPlacements, children, className, defaultActiveFirst, defaultOpenKeys, defaultSelectedKeys, direction, disabled, disabledOverflow, expandIcon, forceSubNavRender, getPopupContainer, id, inlineCollapsed, itemIcon, items, mode = 'inline', modifiers, motion, multiple = false, openKeys, overflowedIndicator = '...', overflowedIndicatorPopupClassName, popupPrefixCls = `${config.prefixCls}-dropdown`, prefixCls = config.prefixCls, defaultMotions = {
|
|
26
26
|
horizontal: {
|
|
@@ -118,6 +118,7 @@ const ForwardedNav = React.forwardRef((props, ref) => {
|
|
|
118
118
|
: childList.slice(lastVisibleIndex + 1).map(child => child.key));
|
|
119
119
|
}, [lastVisibleIndex, allVisible, refreshOverflowKeys, childList]);
|
|
120
120
|
// ======================== Active ========================
|
|
121
|
+
// eslint-disable-next-line function-paren-newline
|
|
121
122
|
const [mergedActiveKey, setMergedActiveKey] = useMergedState(activeKey || ((defaultActiveFirst && childList[0]?.key)), { value: activeKey });
|
|
122
123
|
const onActive = useMemoCallback((key) => {
|
|
123
124
|
setMergedActiveKey(key);
|
|
@@ -255,4 +256,3 @@ const ForwardedNav = React.forwardRef((props, ref) => {
|
|
|
255
256
|
React.createElement("div", { style: { display: 'none' }, "aria-hidden": true },
|
|
256
257
|
React.createElement(PathRegisterContext.Provider, { value: registerPathContext }, childList))))));
|
|
257
258
|
});
|
|
258
|
-
export const Nav = React.memo(ForwardedNav);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type Tab } from 'rc-tabs/lib/interface';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { type TabsProps } from '../../../components/Tabs';
|
|
4
|
-
export
|
|
4
|
+
export declare function useLegacyItems(items?: TabsProps['items'], children?: React.ReactNode): Tab[];
|
|
@@ -14,4 +14,4 @@ export interface TabsProps extends Exclude<RcTabsProps, 'editable'> {
|
|
|
14
14
|
type?: TabType;
|
|
15
15
|
onEdit?: (event: React.MouseEvent | React.KeyboardEvent | string, action: 'add' | 'remove') => void;
|
|
16
16
|
}
|
|
17
|
-
export declare
|
|
17
|
+
export declare function Tabs(props: TabsProps): React.JSX.Element;
|
|
@@ -3,11 +3,10 @@ import RcTabs from 'rc-tabs';
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { useConfig } from '../../components/ConfigProvider';
|
|
5
5
|
import { Icon } from '../../components/Icon';
|
|
6
|
-
import { useAnimateConfig } from '../../components/Tabs/hooks';
|
|
6
|
+
import { useAnimateConfig, useLegacyItems } from '../../components/Tabs/hooks';
|
|
7
7
|
import { getMotionName } from '../../utils';
|
|
8
8
|
import './index.scss';
|
|
9
|
-
|
|
10
|
-
export const Tabs = React.memo((props) => {
|
|
9
|
+
export function Tabs(props) {
|
|
11
10
|
const config = useConfig();
|
|
12
11
|
const { addIcon, animated, centered, children, className, direction, hideAdd, items, moreIcon = React.createElement(Icon, { icon: "more_horizontal" }), prefixCls = config.prefixCls, size, type, onEdit, ...restProps } = props;
|
|
13
12
|
const rootCls = React.useMemo(() => config.getRootPrefixCls(prefixCls || config.prefixCls, 'tabs'), [config, prefixCls]);
|
|
@@ -29,4 +28,4 @@ export const Tabs = React.memo((props) => {
|
|
|
29
28
|
[`${rootCls}-editable-card`]: type === 'editable-card',
|
|
30
29
|
[`${rootCls}-centered`]: centered,
|
|
31
30
|
}, className), editable: editable, moreIcon: moreIcon, prefixCls: rootCls }));
|
|
32
|
-
}
|
|
31
|
+
}
|