@mezzanine-ui/react 1.0.0-canary.0 → 1.0.0-canary.2
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/Accordion/AccordionSummary.js +2 -2
- package/Button/Button.js +23 -19
- package/Button/ButtonGroup.d.ts +6 -28
- package/Button/ButtonGroup.js +6 -16
- package/Button/index.d.ts +2 -9
- package/Button/index.js +2 -3
- package/Button/typings.d.ts +11 -26
- package/Loading/Loading.js +1 -1
- package/Table/expandable/TableExpandable.js +1 -1
- package/Table/rowSelection/TableRowSelection.js +1 -1
- package/Table/sorting/TableSortingIcon.js +1 -1
- package/Typography/Typography.d.ts +6 -9
- package/Typography/Typography.js +7 -9
- package/Typography/index.d.ts +2 -5
- package/index.d.ts +2 -2
- package/index.js +1 -2
- package/package.json +4 -4
- package/Button/IconButton.d.ts +0 -21
- package/Button/IconButton.js +0 -13
|
@@ -35,11 +35,11 @@ const AccordionSummary = forwardRef(function AccordionSummary(props, ref) {
|
|
|
35
35
|
}
|
|
36
36
|
return result;
|
|
37
37
|
}, [detailsId, expanded]);
|
|
38
|
-
const defaultIconElement = useMemo(() => (jsx(Icon, { color: disabled ? '
|
|
38
|
+
const defaultIconElement = useMemo(() => (jsx(Icon, { color: disabled ? 'neutral-faint' : 'neutral', className: cx(accordionClasses.summaryIcon, {
|
|
39
39
|
[accordionClasses.summaryIconExpanded]: expanded,
|
|
40
40
|
[accordionClasses.summaryIconDisabled]: disabled,
|
|
41
41
|
}, iconClassNameProp), icon: ChevronDownIcon, onClick: onToggle, onMouseDown: (evt) => evt.preventDefault(), role: "button" })), [disabled, expanded, iconClassNameProp, onToggle]);
|
|
42
|
-
const defaultIconWithPrefixClassName = useMemo(() => (jsx(Icon, { color: disabled ? '
|
|
42
|
+
const defaultIconWithPrefixClassName = useMemo(() => (jsx(Icon, { color: disabled ? 'neutral-faint' : 'neutral', className: cx(accordionClasses.summaryIcon, {
|
|
43
43
|
[accordionClasses.summaryIconExpanded]: expanded,
|
|
44
44
|
[accordionClasses.summaryIconDisabled]: disabled,
|
|
45
45
|
}, accordionClasses.summaryMainPartPrefix, iconClassNameProp), icon: ChevronDownIcon, onClick: onToggle, onMouseDown: (evt) => evt.preventDefault(), role: "button" })), [disabled, expanded, iconClassNameProp, onToggle]);
|
package/Button/Button.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import { forwardRef
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
4
|
import { SpinnerIcon } from '@mezzanine-ui/icons';
|
|
5
5
|
import { buttonClasses } from '@mezzanine-ui/core/button';
|
|
6
|
-
import { MezzanineConfig } from '../Provider/context.js';
|
|
7
6
|
import Icon from '../Icon/Icon.js';
|
|
8
7
|
import cx from 'clsx';
|
|
9
8
|
|
|
@@ -11,30 +10,35 @@ import cx from 'clsx';
|
|
|
11
10
|
* The react component for `mezzanine` button.
|
|
12
11
|
*/
|
|
13
12
|
const Button = forwardRef(function Button(props, ref) {
|
|
14
|
-
const {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
const { children, className, component: Component = 'button', disabled = false, icon, loading = false, onClick, size = 'main', variant = 'base-primary', ...rest } = props;
|
|
14
|
+
// 判斷是否為 icon-only 模式
|
|
15
|
+
const isIconOnly = (icon === null || icon === void 0 ? void 0 : icon.position) === 'icon-only' || (!!icon && !children);
|
|
16
|
+
// 判斷 icon 位置
|
|
17
|
+
const hasLeadingIcon = (icon === null || icon === void 0 ? void 0 : icon.position) === 'leading' && !isIconOnly;
|
|
18
|
+
const hasTrailingIcon = (icon === null || icon === void 0 ? void 0 : icon.position) === 'trailing' && !isIconOnly;
|
|
19
|
+
// Loading 狀態下的 icon
|
|
20
|
+
const loadingIcon = jsx(Icon, { icon: SpinnerIcon, spin: true });
|
|
21
|
+
// 渲染 icon 內容
|
|
22
|
+
const renderIcon = () => {
|
|
23
|
+
if (loading) {
|
|
24
|
+
return loadingIcon;
|
|
22
25
|
}
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
if (icon) {
|
|
27
|
+
return jsx(Icon, { icon: icon.src });
|
|
25
28
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
[buttonClasses.danger]: danger,
|
|
29
|
+
return null;
|
|
30
|
+
};
|
|
31
|
+
return (jsx(Component, { ...rest, ref: ref, "aria-disabled": disabled, className: cx(buttonClasses.host, buttonClasses.variant(variant), buttonClasses.size(size), {
|
|
30
32
|
[buttonClasses.disabled]: disabled,
|
|
31
|
-
[buttonClasses.icon]: asIconBtn,
|
|
32
33
|
[buttonClasses.loading]: loading,
|
|
34
|
+
[buttonClasses.iconLeading]: hasLeadingIcon,
|
|
35
|
+
[buttonClasses.iconTrailing]: hasTrailingIcon,
|
|
36
|
+
[buttonClasses.iconOnly]: isIconOnly,
|
|
33
37
|
}, className), disabled: disabled, onClick: (event) => {
|
|
34
38
|
if (!disabled && !loading && onClick) {
|
|
35
39
|
onClick(event);
|
|
36
40
|
}
|
|
37
|
-
}, children:
|
|
41
|
+
}, children: loading ? (renderIcon()) : (jsxs(Fragment, { children: [(hasLeadingIcon || isIconOnly) && renderIcon(), !isIconOnly && children, hasTrailingIcon && renderIcon()] })) }));
|
|
38
42
|
});
|
|
39
43
|
|
|
40
44
|
export { Button as default };
|
package/Button/ButtonGroup.d.ts
CHANGED
|
@@ -1,29 +1,13 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ButtonGroupOrientation, ButtonSize, ButtonVariant } from '@mezzanine-ui/core/button';
|
|
3
3
|
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
4
4
|
import { ButtonProps } from './Button';
|
|
5
|
-
|
|
6
|
-
export type ButtonGroupChild = ReactElement<ButtonProps | IconButtonProps> | null | undefined | false;
|
|
5
|
+
export type ButtonGroupChild = ReactElement<ButtonProps> | null | undefined | false;
|
|
7
6
|
export interface ButtonGroupProps extends NativeElementPropsWithoutKeyAndRef<'div'> {
|
|
8
7
|
/**
|
|
9
|
-
*
|
|
10
|
-
* @default false
|
|
11
|
-
*/
|
|
12
|
-
attached?: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Only accept button elements or icon button elements.
|
|
8
|
+
* Only accept button elements.
|
|
15
9
|
*/
|
|
16
10
|
children: ButtonGroupChild | ButtonGroupChild[];
|
|
17
|
-
/**
|
|
18
|
-
* If the `color` of a button inside group not provided, the `color` of group will override it.
|
|
19
|
-
* @default 'primary'
|
|
20
|
-
*/
|
|
21
|
-
color?: ButtonColor;
|
|
22
|
-
/**
|
|
23
|
-
* If the `danger` of a button inside group not provided, the `danger` of group will override it.
|
|
24
|
-
* @default false
|
|
25
|
-
*/
|
|
26
|
-
danger?: boolean;
|
|
27
11
|
/**
|
|
28
12
|
* If the `disabled` of a button inside group not provided, the `disabled` of group will override it.
|
|
29
13
|
* @default false
|
|
@@ -36,23 +20,17 @@ export interface ButtonGroupProps extends NativeElementPropsWithoutKeyAndRef<'di
|
|
|
36
20
|
fullWidth?: boolean;
|
|
37
21
|
/**
|
|
38
22
|
* The orientation of button group.
|
|
39
|
-
* @default horizontal
|
|
23
|
+
* @default 'horizontal'
|
|
40
24
|
*/
|
|
41
25
|
orientation?: ButtonGroupOrientation;
|
|
42
26
|
/**
|
|
43
27
|
* If the `size` of a button inside group not provided, the `size` of group will override it.
|
|
44
|
-
* @default '
|
|
28
|
+
* @default 'main'
|
|
45
29
|
*/
|
|
46
30
|
size?: ButtonSize;
|
|
47
|
-
/**
|
|
48
|
-
* The spacing level of button gap between each buttons.
|
|
49
|
-
* Will be added on if `attached`=false.
|
|
50
|
-
* @default small:3,others:4
|
|
51
|
-
*/
|
|
52
|
-
spacing?: ButtonGroupSpacing;
|
|
53
31
|
/**
|
|
54
32
|
* If the `variant` of a button inside group not provided, the `variant` of group will override it.
|
|
55
|
-
* @default '
|
|
33
|
+
* @default 'base-primary'
|
|
56
34
|
*/
|
|
57
35
|
variant?: ButtonVariant;
|
|
58
36
|
}
|
package/Button/ButtonGroup.js
CHANGED
|
@@ -1,34 +1,24 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { forwardRef,
|
|
4
|
-
import {
|
|
5
|
-
import { MezzanineConfig } from '../Provider/context.js';
|
|
3
|
+
import { forwardRef, Children, cloneElement } from 'react';
|
|
4
|
+
import { buttonGroupClasses } from '@mezzanine-ui/core/button';
|
|
6
5
|
import cx from 'clsx';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* The react component for `mezzanine` button group.
|
|
10
9
|
*/
|
|
11
10
|
const ButtonGroup = forwardRef(function ButtonGroup(props, ref) {
|
|
12
|
-
const { size
|
|
13
|
-
const { attached = false, children, className, color = 'primary', danger = false, disabled = false, fullWidth = false, orientation = 'horizontal', role = 'group', size = globalSize, spacing, style: styleProp, variant = 'text', ...rest } = props;
|
|
14
|
-
const cssVars = toButtonGroupCssVars({ size, spacing });
|
|
15
|
-
const style = {
|
|
16
|
-
...styleProp,
|
|
17
|
-
...cssVars,
|
|
18
|
-
};
|
|
11
|
+
const { children, className, disabled = false, fullWidth = false, orientation = 'horizontal', role = 'group', size = 'main', variant = 'base-primary', ...rest } = props;
|
|
19
12
|
return (jsx("div", { ref: ref, ...rest, "aria-orientation": orientation, className: cx(buttonGroupClasses.host, buttonGroupClasses.orientation(orientation), {
|
|
20
13
|
[buttonGroupClasses.fullWidth]: fullWidth,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var _a, _b;
|
|
14
|
+
}, className), role: role, children: Children.map(children, (unknownChild) => {
|
|
15
|
+
var _a;
|
|
24
16
|
const child = unknownChild;
|
|
25
17
|
if (!child) {
|
|
26
18
|
return null;
|
|
27
19
|
}
|
|
28
20
|
return cloneElement(child, {
|
|
29
|
-
|
|
30
|
-
danger: (_a = child.props.danger) !== null && _a !== void 0 ? _a : danger,
|
|
31
|
-
disabled: (_b = child.props.disabled) !== null && _b !== void 0 ? _b : disabled,
|
|
21
|
+
disabled: (_a = child.props.disabled) !== null && _a !== void 0 ? _a : disabled,
|
|
32
22
|
size: child.props.size || size,
|
|
33
23
|
variant: child.props.variant || variant,
|
|
34
24
|
});
|
package/Button/index.d.ts
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
import { PropsWithoutRef, ReactElement, RefAttributes } from 'react';
|
|
2
2
|
import { ButtonComponent, ButtonPropsBase } from './typings';
|
|
3
3
|
import { ButtonProps } from './Button';
|
|
4
|
-
|
|
5
|
-
export type { ButtonColor, ButtonGroupOrientation, ButtonGroupSpacing, ButtonSize, ButtonVariant, } from '@mezzanine-ui/core/button';
|
|
4
|
+
export type { ButtonIcon, ButtonIconPosition, ButtonGroupOrientation, ButtonSize, ButtonVariant, } from '@mezzanine-ui/core/button';
|
|
6
5
|
export { default as ButtonGroup } from './ButtonGroup';
|
|
7
6
|
export type { ButtonGroupChild, ButtonGroupProps } from './ButtonGroup';
|
|
8
|
-
export type { ButtonComponent, ButtonProps, ButtonPropsBase
|
|
9
|
-
/**
|
|
10
|
-
* @remark
|
|
11
|
-
* Add type alias here for parsable to react docgen typescript.
|
|
12
|
-
*/
|
|
13
|
-
type GenericIconButton = <C extends ButtonComponent = 'button'>(props: PropsWithoutRef<IconButtonProps<C>> & RefAttributes<HTMLElement>) => ReactElement<any>;
|
|
14
|
-
export declare const IconButton: GenericIconButton;
|
|
7
|
+
export type { ButtonComponent, ButtonProps, ButtonPropsBase };
|
|
15
8
|
/**
|
|
16
9
|
* @remark
|
|
17
10
|
* Add type alias here for parsable to react docgen typescript.
|
package/Button/index.js
CHANGED
package/Button/typings.d.ts
CHANGED
|
@@ -1,44 +1,29 @@
|
|
|
1
|
-
import { JSXElementConstructor
|
|
2
|
-
import {
|
|
1
|
+
import { JSXElementConstructor } from 'react';
|
|
2
|
+
import { ButtonIcon, ButtonSize, ButtonVariant } from '@mezzanine-ui/core/button';
|
|
3
3
|
export type ButtonComponent = 'button' | 'a' | JSXElementConstructor<any>;
|
|
4
4
|
export interface ButtonPropsBase {
|
|
5
5
|
/**
|
|
6
|
-
* The
|
|
7
|
-
* @default 'primary'
|
|
6
|
+
* The variant of button.
|
|
7
|
+
* @default 'base-primary'
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
variant?: ButtonVariant;
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
* @default
|
|
11
|
+
* The size of button.
|
|
12
|
+
* @default 'main'
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
size?: ButtonSize;
|
|
15
15
|
/**
|
|
16
16
|
* If true, button will be disabled
|
|
17
17
|
* @default false
|
|
18
18
|
*/
|
|
19
19
|
disabled?: boolean;
|
|
20
20
|
/**
|
|
21
|
-
* If true,
|
|
22
|
-
* Replace suffix if only suffix provided, or prefix.
|
|
21
|
+
* If true, show loading state with spinner icon.
|
|
23
22
|
* @default false
|
|
24
23
|
*/
|
|
25
24
|
loading?: boolean;
|
|
26
25
|
/**
|
|
27
|
-
*
|
|
28
|
-
*/
|
|
29
|
-
prefix?: ReactNode;
|
|
30
|
-
/**
|
|
31
|
-
* The size of button.
|
|
32
|
-
* @default 'medium'
|
|
26
|
+
* Icon configuration with position and icon source.
|
|
33
27
|
*/
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* The element placed on the end of button.
|
|
37
|
-
*/
|
|
38
|
-
suffix?: ReactNode;
|
|
39
|
-
/**
|
|
40
|
-
* The variant of button.
|
|
41
|
-
* @default 'text'
|
|
42
|
-
*/
|
|
43
|
-
variant?: ButtonVariant;
|
|
28
|
+
icon?: ButtonIcon;
|
|
44
29
|
}
|
package/Loading/Loading.js
CHANGED
|
@@ -15,7 +15,7 @@ const Loading = forwardRef(function Loading(props, ref) {
|
|
|
15
15
|
const composedHostRef = useComposeRefs([ref, hostRef]);
|
|
16
16
|
const spinElement = loading ? (jsxs("div", { ref: isNestedPattern ? null : ref, className: cx(iconClasses.spin, {
|
|
17
17
|
[iconClasses.stretch]: stretch,
|
|
18
|
-
}), children: [jsx(Icon, { ...iconPropsRest, className: cx(iconClasses.icon, iconClassName), color: iconColor
|
|
18
|
+
}), children: [jsx(Icon, { ...iconPropsRest, className: cx(iconClasses.icon, iconClassName), color: iconColor, icon: SpinnerIcon, spin: true, style: {
|
|
19
19
|
...(iconSize ? { fontSize: `${iconSize}px` } : {}),
|
|
20
20
|
...(iconStyle || {}),
|
|
21
21
|
} }), tip ? (jsx("span", { className: cx(iconClasses.tip, tipClassName), children: tip })) : null] })) : null;
|
|
@@ -18,7 +18,7 @@ const TableExpandable = forwardRef(function TableExpandable(props, ref) {
|
|
|
18
18
|
};
|
|
19
19
|
return (jsx("div", { ...rest, ref: ref, className: cx(tableClasses.collapseAction, className), children: jsx("div", { className: tableClasses.icon, children: showIcon ? (jsx(Icon, { className: cx(tableClasses.icon, {
|
|
20
20
|
[tableClasses.iconClickable]: expandable,
|
|
21
|
-
}), color: expandable ? '
|
|
21
|
+
}), color: expandable ? 'brand' : 'neutral-faint', icon: ChevronDownIcon, onClick: onClick, style: { transform: `rotate(${expanded ? '180deg' : '0'})` } })) : null }) }));
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
export { TableExpandable as default };
|
|
@@ -87,7 +87,7 @@ const TableRowSelection = forwardRef(function TableRowSelection(props, ref) {
|
|
|
87
87
|
},
|
|
88
88
|
}, children: (dropdownRef) => (jsx(Icon, { ref: dropdownRef, className: cx(tableClasses.icon, {
|
|
89
89
|
[tableClasses.iconClickable]: isMenuAllowOpen,
|
|
90
|
-
}), color: isMenuAllowOpen ? '
|
|
90
|
+
}), color: isMenuAllowOpen ? 'brand' : 'neutral-faint', icon: MoreVerticalIcon, onClick: onIconClicked })) })) : null })) : null] }));
|
|
91
91
|
});
|
|
92
92
|
|
|
93
93
|
export { TableRowSelection as default };
|
|
@@ -15,7 +15,7 @@ const TableSortingIcon = forwardRef(function TableSortingIcon(props, ref) {
|
|
|
15
15
|
/** styling */
|
|
16
16
|
const currentType = (key === (sorting === null || sorting === void 0 ? void 0 : sorting.sortedOn) ? sorting.sortedType : 'none');
|
|
17
17
|
const currentIconStyle = useMemo(() => ({
|
|
18
|
-
color: currentType === 'none' ? '
|
|
18
|
+
color: currentType === 'none' ? 'neutral' : 'neutral-strong',
|
|
19
19
|
style: {
|
|
20
20
|
transform: `rotate(${90 * (currentType === 'asc' ? -1 : 1)}deg)`,
|
|
21
21
|
},
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { JSXElementConstructor } from 'react';
|
|
2
|
-
import { TypographyAlign, TypographyColor, TypographyDisplay
|
|
2
|
+
import { TypographyAlign, TypographyColor, TypographyDisplay } from '@mezzanine-ui/core/typography';
|
|
3
|
+
import { TypographySemanticType } from '@mezzanine-ui/system/typography';
|
|
3
4
|
import { ComponentOverridableForwardRefComponentPropsFactory } from '../utils/jsx-types';
|
|
4
5
|
export type TypographyComponent = `h${1 | 2 | 3 | 4 | 5 | 6}` | 'p' | 'span' | 'label' | 'div' | 'caption' | 'a' | JSXElementConstructor<any>;
|
|
5
6
|
interface TypographyPropsBase {
|
|
@@ -8,7 +9,7 @@ interface TypographyPropsBase {
|
|
|
8
9
|
*/
|
|
9
10
|
align?: TypographyAlign;
|
|
10
11
|
/**
|
|
11
|
-
* The color
|
|
12
|
+
* The text semantic color from the palette.
|
|
12
13
|
*/
|
|
13
14
|
color?: TypographyColor;
|
|
14
15
|
/**
|
|
@@ -28,14 +29,10 @@ interface TypographyPropsBase {
|
|
|
28
29
|
*/
|
|
29
30
|
noWrap?: boolean;
|
|
30
31
|
/**
|
|
31
|
-
* Applies the typography
|
|
32
|
-
* @default '
|
|
32
|
+
* Applies the typography semantic type.
|
|
33
|
+
* @default 'body'
|
|
33
34
|
*/
|
|
34
|
-
variant?:
|
|
35
|
-
/**
|
|
36
|
-
* The css variable for customizing `font-weight`.
|
|
37
|
-
*/
|
|
38
|
-
weight?: TypographyWeight;
|
|
35
|
+
variant?: TypographySemanticType;
|
|
39
36
|
}
|
|
40
37
|
export type TypographyProps<C extends TypographyComponent = 'p'> = ComponentOverridableForwardRefComponentPropsFactory<TypographyComponent, C, TypographyPropsBase>;
|
|
41
38
|
/**
|
package/Typography/Typography.js
CHANGED
|
@@ -3,11 +3,11 @@ import { forwardRef } from 'react';
|
|
|
3
3
|
import { toTypographyCssVars, typographyClasses } from '@mezzanine-ui/core/typography';
|
|
4
4
|
import cx from 'clsx';
|
|
5
5
|
|
|
6
|
-
function
|
|
7
|
-
if (
|
|
8
|
-
return
|
|
6
|
+
function getComponentFromType(type) {
|
|
7
|
+
if (type === 'h1' || type === 'h2' || type === 'h3') {
|
|
8
|
+
return type;
|
|
9
9
|
}
|
|
10
|
-
if (
|
|
10
|
+
if (type.startsWith('body') || type.startsWith('text-link-body')) {
|
|
11
11
|
return 'p';
|
|
12
12
|
}
|
|
13
13
|
return 'span';
|
|
@@ -16,26 +16,24 @@ function getComponentFromVariant(variant) {
|
|
|
16
16
|
* The react component for `mezzanine` typography.
|
|
17
17
|
*/
|
|
18
18
|
const Typography = forwardRef(function Typography(props, ref) {
|
|
19
|
-
const { align, children, className, color, component, display, ellipsis = false, noWrap = false, variant = '
|
|
20
|
-
const Component = component ||
|
|
19
|
+
const { align, children, className, color, component, display, ellipsis = false, noWrap = false, variant = 'body', style: styleProp, ...rest } = props;
|
|
20
|
+
const Component = component || getComponentFromType(variant);
|
|
21
21
|
const cssVars = toTypographyCssVars({
|
|
22
22
|
align,
|
|
23
23
|
color,
|
|
24
24
|
display,
|
|
25
|
-
weight,
|
|
26
25
|
});
|
|
27
26
|
const style = {
|
|
28
27
|
...cssVars,
|
|
29
28
|
...styleProp,
|
|
30
29
|
};
|
|
31
30
|
const title = ellipsis && typeof children === 'string' ? children : undefined;
|
|
32
|
-
return (jsx(Component, { ...rest, ref: ref, className: cx(typographyClasses.
|
|
31
|
+
return (jsx(Component, { ...rest, ref: ref, className: cx(typographyClasses.type(variant), {
|
|
33
32
|
[typographyClasses.align]: align,
|
|
34
33
|
[typographyClasses.color]: color,
|
|
35
34
|
[typographyClasses.display]: display,
|
|
36
35
|
[typographyClasses.ellipsis]: ellipsis,
|
|
37
36
|
[typographyClasses.noWrap]: noWrap,
|
|
38
|
-
[typographyClasses.weight]: weight,
|
|
39
37
|
}, className), style: style, title: title, children: children }));
|
|
40
38
|
});
|
|
41
39
|
|
package/Typography/index.d.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { PropsWithoutRef, ReactElement, RefAttributes } from 'react';
|
|
2
2
|
import { TypographyComponent, TypographyProps } from './Typography';
|
|
3
|
-
export type { TypographyAlign, TypographyColor, TypographyDisplay,
|
|
3
|
+
export type { TypographyAlign, TypographyColor, TypographyDisplay, } from '@mezzanine-ui/core/typography';
|
|
4
|
+
export type { TypographySemanticType } from '@mezzanine-ui/system/typography';
|
|
4
5
|
export type { TypographyComponent, TypographyProps };
|
|
5
|
-
/**
|
|
6
|
-
* @remark
|
|
7
|
-
* Add type alias here for parsable to react docgen typescript.
|
|
8
|
-
*/
|
|
9
6
|
type GenericTypography = <C extends TypographyComponent = 'p'>(props: PropsWithoutRef<TypographyProps<C>> & RefAttributes<HTMLElement>) => ReactElement<any>;
|
|
10
7
|
declare const _default: GenericTypography;
|
|
11
8
|
export default _default;
|
package/index.d.ts
CHANGED
|
@@ -32,8 +32,8 @@ export * from './Form/useSwitchControlValue';
|
|
|
32
32
|
/**
|
|
33
33
|
* General
|
|
34
34
|
*/
|
|
35
|
-
export { default as Button,
|
|
36
|
-
export type {
|
|
35
|
+
export { default as Button, ButtonGroup } from './Button';
|
|
36
|
+
export type { ButtonComponent, ButtonSize, ButtonVariant, ButtonProps, ButtonPropsBase, ButtonGroupChild, ButtonGroupOrientation, ButtonGroupProps, } from './Button';
|
|
37
37
|
export type { IconColor, IconProps } from './Icon';
|
|
38
38
|
export { default as Icon } from './Icon';
|
|
39
39
|
export { default as Typography } from './Typography';
|
package/index.js
CHANGED
|
@@ -23,10 +23,9 @@ export { useInputWithClearControlValue } from './Form/useInputWithClearControlVa
|
|
|
23
23
|
export { useRadioControlValue } from './Form/useRadioControlValue.js';
|
|
24
24
|
export { useSelectValueControl } from './Form/useSelectValueControl.js';
|
|
25
25
|
export { useSwitchControlValue } from './Form/useSwitchControlValue.js';
|
|
26
|
-
export { IconButton } from './Button/index.js';
|
|
27
|
-
export { default as Typography } from './Typography/Typography.js';
|
|
28
26
|
export { default as Button } from './Button/Button.js';
|
|
29
27
|
export { default as ButtonGroup } from './Button/ButtonGroup.js';
|
|
28
|
+
export { default as Typography } from './Typography/Typography.js';
|
|
30
29
|
export { default as Icon } from './Icon/Icon.js';
|
|
31
30
|
export { default as MenuDivider } from './Menu/MenuDivider.js';
|
|
32
31
|
export { default as MenuItem } from './Menu/MenuItem.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mezzanine-ui/react",
|
|
3
|
-
"version": "1.0.0-canary.
|
|
3
|
+
"version": "1.0.0-canary.2",
|
|
4
4
|
"description": "React components for mezzanine-ui",
|
|
5
5
|
"author": "Mezzanine",
|
|
6
6
|
"repository": {
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@hello-pangea/dnd": "^18.0.1",
|
|
32
|
-
"@mezzanine-ui/core": "^1.0.0-canary.
|
|
33
|
-
"@mezzanine-ui/icons": "^1.0.0-canary.
|
|
34
|
-
"@mezzanine-ui/system": "^1.0.0-canary.
|
|
32
|
+
"@mezzanine-ui/core": "^1.0.0-canary.2",
|
|
33
|
+
"@mezzanine-ui/icons": "^1.0.0-canary.1",
|
|
34
|
+
"@mezzanine-ui/system": "^1.0.0-canary.1",
|
|
35
35
|
"@popperjs/core": "^2.11.8",
|
|
36
36
|
"@types/react-transition-group": "^4.4.12",
|
|
37
37
|
"clsx": "^2.1.1",
|
package/Button/IconButton.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { ComponentOverridableForwardRefComponentPropsFactory } from '../utils/jsx-types';
|
|
3
|
-
import { ButtonComponent, ButtonPropsBase } from './typings';
|
|
4
|
-
export type IconButtonProps<C extends ButtonComponent = 'button'> = ComponentOverridableForwardRefComponentPropsFactory<ButtonComponent, C, Omit<ButtonPropsBase, 'prefix' | 'suffix'> & {
|
|
5
|
-
/**
|
|
6
|
-
* The icon element.
|
|
7
|
-
*/
|
|
8
|
-
children?: ReactNode;
|
|
9
|
-
}>;
|
|
10
|
-
/**
|
|
11
|
-
* The react component for `mezzanine` button only has icon.
|
|
12
|
-
*/
|
|
13
|
-
declare const IconButton: import("react").ForwardRefExoticComponent<Omit<Omit<import("../utils/jsx-types").ComponentPropsWithoutKeyAndRef<"button">, "size" | "color" | "children" | "disabled" | "danger" | "loading" | "variant"> & Omit<ButtonPropsBase, "prefix" | "suffix"> & {
|
|
14
|
-
/**
|
|
15
|
-
* The icon element.
|
|
16
|
-
*/
|
|
17
|
-
children?: ReactNode;
|
|
18
|
-
}, "component"> & {
|
|
19
|
-
component?: ButtonComponent | undefined;
|
|
20
|
-
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
21
|
-
export default IconButton;
|
package/Button/IconButton.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { forwardRef } from 'react';
|
|
3
|
-
import Button from './Button.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* The react component for `mezzanine` button only has icon.
|
|
7
|
-
*/
|
|
8
|
-
const IconButton = forwardRef(function IconButton(props, ref) {
|
|
9
|
-
const { children, ...rest } = props;
|
|
10
|
-
return jsx(Button, { ...rest, ref: ref, prefix: children });
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
export { IconButton as default };
|