@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
|
+
}
|
|
@@ -32,14 +32,15 @@ const rc_collapse_1 = __importDefault(require("rc-collapse"));
|
|
|
32
32
|
const React = __importStar(require("react"));
|
|
33
33
|
const ConfigProvider_1 = require("../../components/ConfigProvider");
|
|
34
34
|
const utils_1 = require("../../utils");
|
|
35
|
-
|
|
35
|
+
function Accordion(props) {
|
|
36
36
|
const config = (0, ConfigProvider_1.useConfig)();
|
|
37
37
|
const { className, direction, prefixCls = config.prefixCls, ...restProps } = props;
|
|
38
38
|
const rootCls = React.useMemo(() => config.getRootPrefixCls(prefixCls || config.prefixCls, 'accordion'), [config, prefixCls]);
|
|
39
39
|
return (React.createElement(rc_collapse_1.default, { className: (0, classnames_1.default)({
|
|
40
40
|
[`${rootCls}-rtl`]: direction === 'rtl',
|
|
41
41
|
}, className), openMotion: (0, utils_1.getCollapseMotion)(prefixCls || config.prefixCls), prefixCls: rootCls, ...restProps }));
|
|
42
|
-
}
|
|
42
|
+
}
|
|
43
|
+
exports.Accordion = Accordion;
|
|
43
44
|
if (process.env.NODE_ENV !== 'production') {
|
|
44
|
-
|
|
45
|
+
Accordion.displayName = 'Accordion';
|
|
45
46
|
}
|
|
@@ -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
|
+
}
|
|
@@ -31,12 +31,13 @@ const Icon_1 = require("../../components/Icon");
|
|
|
31
31
|
* Use Accordion items props instead
|
|
32
32
|
* @deprecated
|
|
33
33
|
*/
|
|
34
|
-
|
|
34
|
+
function Item(props) {
|
|
35
35
|
const { expandIcon, ...restProps } = props;
|
|
36
36
|
const mergedExpandIcon = React.useMemo(() => expandIcon
|
|
37
37
|
|| (({ isActive }) => (React.createElement(Icon_1.Icon, { icon: isActive ? 'expand_more' : 'chevron_right' }))), [expandIcon]);
|
|
38
38
|
return React.createElement(rc_collapse_1.Panel, { expandIcon: mergedExpandIcon, ...restProps });
|
|
39
|
-
}
|
|
39
|
+
}
|
|
40
|
+
exports.Item = Item;
|
|
40
41
|
if (process.env.NODE_ENV !== 'production') {
|
|
41
|
-
|
|
42
|
+
Item.displayName = 'Accordion.Item';
|
|
42
43
|
}
|
|
@@ -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>>;
|
|
@@ -33,9 +33,9 @@ const Component_1 = require("../../components/Component");
|
|
|
33
33
|
const ConfigProvider_1 = require("../../components/ConfigProvider");
|
|
34
34
|
const Link_1 = require("../../components/Link");
|
|
35
35
|
const defaultElement = 'button';
|
|
36
|
-
|
|
36
|
+
exports.Button = React.forwardRef((props, ref) => {
|
|
37
37
|
const config = (0, ConfigProvider_1.useConfig)();
|
|
38
|
-
const { children, ghost, htmlType = 'button', prefixCls = config.prefixCls, shape, size, type, ...restProps } = props;
|
|
38
|
+
const { children, ghost, htmlType = 'button', prefixCls = config.prefixCls, shape = config.buttonShape, size = config.buttonSize, type, ...restProps } = props;
|
|
39
39
|
const buttonRef = React.useRef(null);
|
|
40
40
|
const onClick = React.useCallback(event => {
|
|
41
41
|
if (restProps.disabled) {
|
|
@@ -56,8 +56,6 @@ const ForwardedButton = React.forwardRef((props, ref) => {
|
|
|
56
56
|
}
|
|
57
57
|
return (React.createElement(Component_1.Component, { ref: ref || buttonRef, component: defaultElement, type: htmlType, ...restProps, className: className, onClick: onClick }, children));
|
|
58
58
|
});
|
|
59
|
-
exports.Button = React.memo(ForwardedButton);
|
|
60
59
|
if (process.env.NODE_ENV !== 'production') {
|
|
61
|
-
ForwardedButton.displayName = 'Button.Forwarded';
|
|
62
60
|
exports.Button.displayName = 'Button';
|
|
63
61
|
}
|
|
@@ -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
|
+
}
|
|
@@ -30,12 +30,13 @@ exports.Group = void 0;
|
|
|
30
30
|
const classnames_1 = __importDefault(require("classnames"));
|
|
31
31
|
const React = __importStar(require("react"));
|
|
32
32
|
const ConfigProvider_1 = require("../../components/ConfigProvider");
|
|
33
|
-
|
|
33
|
+
function Group(props) {
|
|
34
34
|
const config = (0, ConfigProvider_1.useConfig)();
|
|
35
35
|
const { className, prefixCls = config.prefixCls, ...restProps } = props;
|
|
36
36
|
const rootCls = React.useMemo(() => config.getRootPrefixCls(prefixCls || config.prefixCls, 'button-group'), [config, prefixCls]);
|
|
37
37
|
return React.createElement("div", { className: (0, classnames_1.default)(rootCls, className), ...restProps });
|
|
38
|
-
}
|
|
38
|
+
}
|
|
39
|
+
exports.Group = Group;
|
|
39
40
|
if (process.env.NODE_ENV !== 'production') {
|
|
40
|
-
|
|
41
|
+
Group.displayName = 'Button.Group';
|
|
41
42
|
}
|
|
@@ -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 {};
|
|
@@ -34,7 +34,7 @@ const Component_1 = require("../../components/Component");
|
|
|
34
34
|
const ComponentProvider_1 = require("../../components/ComponentProvider");
|
|
35
35
|
const ConfigProvider_1 = require("../../components/ConfigProvider");
|
|
36
36
|
const defaultElement = 'div';
|
|
37
|
-
|
|
37
|
+
function Card(props) {
|
|
38
38
|
const config = (0, ConfigProvider_1.useConfig)();
|
|
39
39
|
const { asBody, className, color, colorMode = color !== 'default' && color !== undefined
|
|
40
40
|
// @ts-ignore
|
|
@@ -49,7 +49,8 @@ exports.Card = React.memo((props) => {
|
|
|
49
49
|
[`${rootCls}-hover`]: hoverable,
|
|
50
50
|
[`${config.prefixCls}-${colorMode}`]: colorMode !== undefined,
|
|
51
51
|
}, className), component: defaultElement, ...restProps })));
|
|
52
|
-
}
|
|
52
|
+
}
|
|
53
|
+
exports.Card = Card;
|
|
53
54
|
if (process.env.NODE_ENV !== 'production') {
|
|
54
|
-
|
|
55
|
+
Card.displayName = 'Card';
|
|
55
56
|
}
|
|
@@ -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;
|
|
@@ -72,7 +72,7 @@ function useConfig() {
|
|
|
72
72
|
return React.useContext(exports.ConfigContext);
|
|
73
73
|
}
|
|
74
74
|
exports.useConfig = useConfig;
|
|
75
|
-
|
|
75
|
+
function ConfigContextProvider(props) {
|
|
76
76
|
const initialContext = useConfig();
|
|
77
77
|
const { children, ...restProps } = props;
|
|
78
78
|
const context = React.useMemo(() => {
|
|
@@ -86,7 +86,8 @@ exports.ConfigContextProvider = React.memo((props) => {
|
|
|
86
86
|
return { ...initialContext, direction, ...restProps };
|
|
87
87
|
}, [initialContext, restProps]);
|
|
88
88
|
return React.createElement(exports.ConfigContext.Provider, { value: context }, children);
|
|
89
|
-
}
|
|
89
|
+
}
|
|
90
|
+
exports.ConfigContextProvider = ConfigContextProvider;
|
|
90
91
|
if (process.env.NODE_ENV !== 'production') {
|
|
91
92
|
exports.ConfigContext.displayName = 'ConfigContext';
|
|
92
93
|
}
|
|
@@ -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 {};
|
|
@@ -34,7 +34,7 @@ const ComponentProvider_1 = require("../../components/ComponentProvider");
|
|
|
34
34
|
const ConfigProvider_1 = require("../../components/ConfigProvider");
|
|
35
35
|
const utils_1 = require("../../utils");
|
|
36
36
|
const defaultElement = 'div';
|
|
37
|
-
|
|
37
|
+
function Flex(props) {
|
|
38
38
|
const config = (0, ConfigProvider_1.useConfig)();
|
|
39
39
|
const { alignContent, alignItems, className, flexDirection, flexWrap, inline, justifyContent, prefixCls = config.prefixCls, ...restProps } = props;
|
|
40
40
|
const rootCls = React.useMemo(() => config.getRootPrefixCls(prefixCls || config.prefixCls, 'flex'), [config, prefixCls]);
|
|
@@ -50,4 +50,5 @@ exports.Flex = React.memo((props) => {
|
|
|
50
50
|
[`${rootCls}-${flexWrap}`]: flexWrap !== undefined,
|
|
51
51
|
[`${rootCls}-wrap-${alignContent}`]: alignContent !== undefined,
|
|
52
52
|
}, justifyContentCls, className), component: defaultElement, ...restProps })));
|
|
53
|
-
}
|
|
53
|
+
}
|
|
54
|
+
exports.Flex = Flex;
|
|
@@ -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 {};
|
|
@@ -34,7 +34,7 @@ const ComponentProvider_1 = require("../../components/ComponentProvider");
|
|
|
34
34
|
const ConfigProvider_1 = require("../../components/ConfigProvider");
|
|
35
35
|
const utils_1 = require("../../utils");
|
|
36
36
|
const defaultElement = 'div';
|
|
37
|
-
|
|
37
|
+
function Item(props) {
|
|
38
38
|
const config = (0, ConfigProvider_1.useConfig)();
|
|
39
39
|
const { getRootCls } = (0, ComponentProvider_1.useComponentContext)();
|
|
40
40
|
const { className, itemDimensions, order, prefixCls = getRootCls(), ...restProps } = props;
|
|
@@ -44,4 +44,5 @@ exports.Item = React.memo((props) => {
|
|
|
44
44
|
return (React.createElement(Component_1.Component, { className: (0, classnames_1.default)({
|
|
45
45
|
[`${prefixCls}-${itemDimensions}`]: itemDimensions !== undefined,
|
|
46
46
|
}, orderCls, className), component: defaultElement, ...restProps }));
|
|
47
|
-
}
|
|
47
|
+
}
|
|
48
|
+
exports.Item = Item;
|
|
@@ -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 {};
|
|
@@ -34,7 +34,7 @@ const ConfigProvider_1 = require("../../components/ConfigProvider");
|
|
|
34
34
|
const Width_1 = require("../../components/Width");
|
|
35
35
|
require("./index.scss");
|
|
36
36
|
const defaultElement = 'div';
|
|
37
|
-
|
|
37
|
+
function Grid(props) {
|
|
38
38
|
const config = (0, ConfigProvider_1.useConfig)();
|
|
39
39
|
const { childWidth, className, columnGap, divider, gap, margin, match, prefixCls = config.prefixCls, rowGap, ...restProps } = props;
|
|
40
40
|
const childWithClassName = React.useMemo(() => (0, Width_1.getChildWidthClassname)(childWidth), [childWidth]);
|
|
@@ -47,4 +47,5 @@ exports.Grid = React.memo((props) => {
|
|
|
47
47
|
[`${rootCls}-divider`]: divider,
|
|
48
48
|
[`${rootCls}-match`]: match,
|
|
49
49
|
}, childWithClassName, className), component: defaultElement, "data-uk-grid": "margin: ", ...restProps }));
|
|
50
|
-
}
|
|
50
|
+
}
|
|
51
|
+
exports.Grid = Grid;
|
|
@@ -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>>;
|
|
@@ -49,7 +49,7 @@ const warnUtil_1 = require("../../components/Nav/utils/warnUtil");
|
|
|
49
49
|
const hooks_1 = require("../../hooks");
|
|
50
50
|
const utils_1 = require("../../utils");
|
|
51
51
|
const EMPTY_LIST = [];
|
|
52
|
-
|
|
52
|
+
exports.Nav = React.forwardRef((props, ref) => {
|
|
53
53
|
const config = (0, ConfigProvider_1.useConfig)();
|
|
54
54
|
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 = {
|
|
55
55
|
horizontal: {
|
|
@@ -147,6 +147,7 @@ const ForwardedNav = React.forwardRef((props, ref) => {
|
|
|
147
147
|
: childList.slice(lastVisibleIndex + 1).map(child => child.key));
|
|
148
148
|
}, [lastVisibleIndex, allVisible, refreshOverflowKeys, childList]);
|
|
149
149
|
// ======================== Active ========================
|
|
150
|
+
// eslint-disable-next-line function-paren-newline
|
|
150
151
|
const [mergedActiveKey, setMergedActiveKey] = (0, useMergedState_1.default)(activeKey || ((defaultActiveFirst && childList[0]?.key)), { value: activeKey });
|
|
151
152
|
const onActive = (0, useMemoCallback_1.useMemoCallback)((key) => {
|
|
152
153
|
setMergedActiveKey(key);
|
|
@@ -284,4 +285,3 @@ const ForwardedNav = React.forwardRef((props, ref) => {
|
|
|
284
285
|
React.createElement("div", { style: { display: 'none' }, "aria-hidden": true },
|
|
285
286
|
React.createElement(PathContext_1.PathRegisterContext.Provider, { value: registerPathContext }, childList))))));
|
|
286
287
|
});
|
|
287
|
-
exports.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[];
|
|
@@ -26,6 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.useLegacyItems = void 0;
|
|
29
30
|
const js_utils_1 = require("@broxus/js-utils");
|
|
30
31
|
const toArray_1 = __importDefault(require("rc-util/lib/Children/toArray"));
|
|
31
32
|
const React = __importStar(require("react"));
|
|
@@ -52,4 +53,4 @@ function useLegacyItems(items, children) {
|
|
|
52
53
|
});
|
|
53
54
|
return filter(childrenItems);
|
|
54
55
|
}
|
|
55
|
-
exports.
|
|
56
|
+
exports.useLegacyItems = useLegacyItems;
|
|
@@ -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;
|
|
@@ -35,8 +35,7 @@ const Icon_1 = require("../../components/Icon");
|
|
|
35
35
|
const hooks_1 = require("../../components/Tabs/hooks");
|
|
36
36
|
const utils_1 = require("../../utils");
|
|
37
37
|
require("./index.scss");
|
|
38
|
-
|
|
39
|
-
exports.Tabs = React.memo((props) => {
|
|
38
|
+
function Tabs(props) {
|
|
40
39
|
const config = (0, ConfigProvider_1.useConfig)();
|
|
41
40
|
const { addIcon, animated, centered, children, className, direction, hideAdd, items, moreIcon = React.createElement(Icon_1.Icon, { icon: "more_horizontal" }), prefixCls = config.prefixCls, size, type, onEdit, ...restProps } = props;
|
|
42
41
|
const rootCls = React.useMemo(() => config.getRootPrefixCls(prefixCls || config.prefixCls, 'tabs'), [config, prefixCls]);
|
|
@@ -52,10 +51,11 @@ exports.Tabs = React.memo((props) => {
|
|
|
52
51
|
},
|
|
53
52
|
}
|
|
54
53
|
: undefined), [addIcon, hideAdd, onEdit, type]);
|
|
55
|
-
return (React.createElement(rc_tabs_1.default, { animated: (0, hooks_1.useAnimateConfig)(rootCls, animated), direction: direction, items: (0,
|
|
54
|
+
return (React.createElement(rc_tabs_1.default, { animated: (0, hooks_1.useAnimateConfig)(rootCls, animated), direction: direction, items: (0, hooks_1.useLegacyItems)(items, children), moreTransitionName: (0, utils_1.getMotionName)(prefixCls || config.prefixCls, 'slide-bottom-small'), ...restProps, className: (0, classnames_1.default)({
|
|
56
55
|
[`${rootCls}-${size}`]: size,
|
|
57
56
|
[`${rootCls}-card`]: ['card', 'editable-card'].includes(type),
|
|
58
57
|
[`${rootCls}-editable-card`]: type === 'editable-card',
|
|
59
58
|
[`${rootCls}-centered`]: centered,
|
|
60
59
|
}, className), editable: editable, moreIcon: moreIcon, prefixCls: rootCls }));
|
|
61
|
-
}
|
|
60
|
+
}
|
|
61
|
+
exports.Tabs = Tabs;
|