@auth0/quantum-product 2.2.0 → 2.3.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/card/card-header/card-header.d.ts +2 -2
- package/description-block/description-block.d.ts +2 -2
- package/empty-state/empty-state.d.ts +24 -2
- package/esm/text/index.js +2 -3
- package/esm/text/text-classes.js +50 -0
- package/esm/text/text.js +93 -0
- package/expansion-panel/expansion-panel-header.d.ts +2 -2
- package/package.json +2 -2
- package/panel/panel-header/panel-header.d.ts +1 -1
- package/region/region.d.ts +1 -1
- package/styled.d.ts +1 -0
- package/text/index.d.ts +4 -6
- package/text/index.js +6 -27
- package/text/text-classes.d.ts +5 -0
- package/text/text-classes.js +54 -0
- package/text/text.d.ts +104 -0
- package/text/text.js +122 -0
- package/theme/tokens.d.ts +1 -14
|
@@ -75,7 +75,7 @@ export declare const CardHeader: React.ForwardRefExoticComponent<Partial<ICardCo
|
|
|
75
75
|
* These props will be forwarded to the subheader
|
|
76
76
|
* (as long as disableTypography is not `true`).
|
|
77
77
|
*/
|
|
78
|
-
subheaderTypographyProps?: ITextProps<any
|
|
78
|
+
subheaderTypographyProps?: ITextProps<any> | undefined;
|
|
79
79
|
/**
|
|
80
80
|
* The content of the component.
|
|
81
81
|
*/
|
|
@@ -84,5 +84,5 @@ export declare const CardHeader: React.ForwardRefExoticComponent<Partial<ICardCo
|
|
|
84
84
|
* These props will be forwarded to the title
|
|
85
85
|
* (as long as disableTypography is not `true`).
|
|
86
86
|
*/
|
|
87
|
-
titleTypographyProps?: ITextProps<any
|
|
87
|
+
titleTypographyProps?: ITextProps<any> | undefined;
|
|
88
88
|
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "title" | "ref" | "action" | "size" | "classes" | "avatar" | "disableTypography" | "subheader" | "subheaderTypographyProps" | "titleTypographyProps"> & import("../../styled").IStyledCommonProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -20,8 +20,8 @@ export declare const DescriptionBlock: React.ForwardRefExoticComponent<IDescript
|
|
|
20
20
|
description: React.ReactNode;
|
|
21
21
|
code?: boolean | undefined;
|
|
22
22
|
component?: any;
|
|
23
|
-
labelTypographyProps?: ITextProps<"span"
|
|
24
|
-
descriptionTypographyProps?: ITextProps<"span"
|
|
23
|
+
labelTypographyProps?: ITextProps<"span"> | undefined;
|
|
24
|
+
descriptionTypographyProps?: ITextProps<"span"> | undefined;
|
|
25
25
|
onCopy?(event: React.MouseEvent<HTMLButtonElement>): void;
|
|
26
26
|
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "code" | "ref" | "onCopy" | "component" | "description" | "descriptionTypographyProps" | keyof IDescriptionBlockRootOwnerState | "labelTypographyProps"> & import("../styled").IStyledCommonProps & React.RefAttributes<HTMLDivElement>>;
|
|
27
27
|
export {};
|
|
@@ -5,11 +5,33 @@ import { IRowLayoutProps } from '../row-layout';
|
|
|
5
5
|
import { ITextProps } from '../text';
|
|
6
6
|
import { EmptyStateClasses } from './empty-state-classes';
|
|
7
7
|
export declare const StyledCard: import("styled-components").StyledComponent<import("../overridable-component").OverridableComponent<import("../card/card").ICardTypeMap<{}, "div">>, import("..").ITheme, import("@mui/system").MUIStyledCommonProps<import("..").ITheme>, never>;
|
|
8
|
-
export declare const Subtitle: import("styled-components").StyledComponent<
|
|
8
|
+
export declare const Subtitle: import("styled-components").StyledComponent<React.ForwardRefExoticComponent<Omit<import("@mui/material").TypographyOwnProps, "color" | "classes" | "sx" | "variant" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "component" | "as"> & {
|
|
9
|
+
align?: "center" | "inherit" | "left" | "right" | "justify" | undefined;
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
classes?: Partial<Record<"type_code_50" | "type_code_100" | "type_code_200" | "type_code_300" | "type_heading_100" | "type_heading_200" | "type_heading_300" | "type_heading_400" | "type_heading_500" | "type_heading_600" | "type_heading_700" | "type_heading_800" | "type_heading_900" | "type_heading_1000" | "type_body_50" | "type_body_100" | "type_body_200" | "type_body_300" | "type_body_400" | "type_body_500" | "type_body_50_emphasis" | "type_body_50_emphasis_paragraph" | "type_body_100_emphasis" | "type_body_100_emphasis_paragraph" | "type_body_200_emphasis" | "type_body_200_emphasis_paragraph" | "type_body_300_emphasis" | "type_body_300_emphasis_paragraph" | "type_body_400_emphasis" | "type_body_400_emphasis_paragraph" | "type_body_500_emphasis" | "type_preset_page_title" | "type_preset_page_title_compact" | "type_preset_section_title" | "type_preset_section_subtitle" | "type_preset_button" | "type_preset_form_label" | "type_preset_form_text" | "type_preset_caption" | "type_preset_caption_emphasis" | "type_preset_menu_item" | "type_preset_overline" | "root", string>> | undefined;
|
|
12
|
+
color?: import("../text/text").LiteralUnion<import("@auth0/quantum-tokens").ThemeColorFGTokenName> | undefined;
|
|
13
|
+
component?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
14
|
+
gutterBottom?: boolean | undefined;
|
|
15
|
+
noWrap?: boolean | undefined;
|
|
16
|
+
paragraph?: boolean | undefined;
|
|
17
|
+
sx?: import("../styled").SxProps | undefined;
|
|
18
|
+
variant?: "button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "overline" | "subtitle1" | "subtitle2" | "body1" | "body2" | "code1" | "code2" | import("@auth0/quantum-tokens").ThemeTypeTokenName | undefined;
|
|
19
|
+
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "p" | "ref" | "border" | "color" | "left" | "right" | "bottom" | "top" | "flex" | "position" | "padding" | "alignContent" | "alignItems" | "alignSelf" | "boxShadow" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "visibility" | "whiteSpace" | "width" | "zIndex" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "paddingBlock" | "paddingInline" | "classes" | "children" | "sx" | "variant" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping" | "component"> & React.RefAttributes<HTMLAnchorElement>>, import("..").ITheme, import("@mui/system").MUIStyledCommonProps<import("..").ITheme>, never>;
|
|
9
20
|
export declare const Content: import("styled-components").StyledComponent<React.ForwardRefExoticComponent<import("../utils/layouts").ILayoutComponentProps & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref" | keyof import("../utils/layouts").ILayoutComponentProps> & import("../styled").IStyledCommonProps & React.RefAttributes<HTMLDivElement>>, import("..").ITheme, import("@mui/system").MUIStyledCommonProps<import("..").ITheme>, never>;
|
|
10
21
|
export declare const Actions: import("styled-components").StyledComponent<"div", import("..").ITheme, import("@mui/system").MUIStyledCommonProps<import("..").ITheme>, never>;
|
|
11
22
|
export declare const Icon: import("styled-components").StyledComponent<"div", import("..").ITheme, import("@mui/system").MUIStyledCommonProps<import("..").ITheme>, never>;
|
|
12
|
-
export declare const Message: import("styled-components").StyledComponent<
|
|
23
|
+
export declare const Message: import("styled-components").StyledComponent<React.ForwardRefExoticComponent<Omit<import("@mui/material").TypographyOwnProps, "color" | "classes" | "sx" | "variant" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "component" | "as"> & {
|
|
24
|
+
align?: "center" | "inherit" | "left" | "right" | "justify" | undefined;
|
|
25
|
+
children?: React.ReactNode;
|
|
26
|
+
classes?: Partial<Record<"type_code_50" | "type_code_100" | "type_code_200" | "type_code_300" | "type_heading_100" | "type_heading_200" | "type_heading_300" | "type_heading_400" | "type_heading_500" | "type_heading_600" | "type_heading_700" | "type_heading_800" | "type_heading_900" | "type_heading_1000" | "type_body_50" | "type_body_100" | "type_body_200" | "type_body_300" | "type_body_400" | "type_body_500" | "type_body_50_emphasis" | "type_body_50_emphasis_paragraph" | "type_body_100_emphasis" | "type_body_100_emphasis_paragraph" | "type_body_200_emphasis" | "type_body_200_emphasis_paragraph" | "type_body_300_emphasis" | "type_body_300_emphasis_paragraph" | "type_body_400_emphasis" | "type_body_400_emphasis_paragraph" | "type_body_500_emphasis" | "type_preset_page_title" | "type_preset_page_title_compact" | "type_preset_section_title" | "type_preset_section_subtitle" | "type_preset_button" | "type_preset_form_label" | "type_preset_form_text" | "type_preset_caption" | "type_preset_caption_emphasis" | "type_preset_menu_item" | "type_preset_overline" | "root", string>> | undefined;
|
|
27
|
+
color?: import("../text/text").LiteralUnion<import("@auth0/quantum-tokens").ThemeColorFGTokenName> | undefined;
|
|
28
|
+
component?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
29
|
+
gutterBottom?: boolean | undefined;
|
|
30
|
+
noWrap?: boolean | undefined;
|
|
31
|
+
paragraph?: boolean | undefined;
|
|
32
|
+
sx?: import("../styled").SxProps | undefined;
|
|
33
|
+
variant?: "button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "overline" | "subtitle1" | "subtitle2" | "body1" | "body2" | "code1" | "code2" | import("@auth0/quantum-tokens").ThemeTypeTokenName | undefined;
|
|
34
|
+
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "p" | "ref" | "border" | "color" | "left" | "right" | "bottom" | "top" | "flex" | "position" | "padding" | "alignContent" | "alignItems" | "alignSelf" | "boxShadow" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "visibility" | "whiteSpace" | "width" | "zIndex" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "paddingBlock" | "paddingInline" | "classes" | "children" | "sx" | "variant" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping" | "component"> & React.RefAttributes<HTMLAnchorElement>>, import("..").ITheme, import("@mui/system").MUIStyledCommonProps<import("..").ITheme>, never>;
|
|
13
35
|
export interface IEmptyStateProps extends Omit<IRowLayoutProps, 'title' | 'classes'> {
|
|
14
36
|
/** Optional sibling breadcrumb content */
|
|
15
37
|
breadcrumbs?: React.ReactNode;
|
package/esm/text/index.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
export var Text = MuiText;
|
|
1
|
+
export { Text } from './text';
|
|
2
|
+
export { textClasses, textComponentName } from './text-classes';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { generateUtilityClass, generateUtilityClasses } from '../styles/classes';
|
|
2
|
+
export var textComponentName = 'QuantumText';
|
|
3
|
+
export function getTextUtilityClass(slot) {
|
|
4
|
+
return generateUtilityClass(textComponentName, slot);
|
|
5
|
+
}
|
|
6
|
+
export var textClasses = generateUtilityClasses(textComponentName, [
|
|
7
|
+
'root',
|
|
8
|
+
'type_code_50',
|
|
9
|
+
'type_code_100',
|
|
10
|
+
'type_code_200',
|
|
11
|
+
'type_code_300',
|
|
12
|
+
'type_heading_100',
|
|
13
|
+
'type_heading_200',
|
|
14
|
+
'type_heading_300',
|
|
15
|
+
'type_heading_400',
|
|
16
|
+
'type_heading_500',
|
|
17
|
+
'type_heading_600',
|
|
18
|
+
'type_heading_700',
|
|
19
|
+
'type_heading_800',
|
|
20
|
+
'type_heading_900',
|
|
21
|
+
'type_heading_1000',
|
|
22
|
+
'type_body_50',
|
|
23
|
+
'type_body_100',
|
|
24
|
+
'type_body_200',
|
|
25
|
+
'type_body_300',
|
|
26
|
+
'type_body_400',
|
|
27
|
+
'type_body_500',
|
|
28
|
+
'type_body_50_emphasis',
|
|
29
|
+
'type_body_50_emphasis_paragraph',
|
|
30
|
+
'type_body_100_emphasis',
|
|
31
|
+
'type_body_100_emphasis_paragraph',
|
|
32
|
+
'type_body_200_emphasis',
|
|
33
|
+
'type_body_200_emphasis_paragraph',
|
|
34
|
+
'type_body_300_emphasis',
|
|
35
|
+
'type_body_300_emphasis_paragraph',
|
|
36
|
+
'type_body_400_emphasis',
|
|
37
|
+
'type_body_400_emphasis_paragraph',
|
|
38
|
+
'type_body_500_emphasis',
|
|
39
|
+
'type_preset_page_title',
|
|
40
|
+
'type_preset_page_title_compact',
|
|
41
|
+
'type_preset_section_title',
|
|
42
|
+
'type_preset_section_subtitle',
|
|
43
|
+
'type_preset_button',
|
|
44
|
+
'type_preset_form_label',
|
|
45
|
+
'type_preset_form_text',
|
|
46
|
+
'type_preset_caption',
|
|
47
|
+
'type_preset_caption_emphasis',
|
|
48
|
+
'type_preset_menu_item',
|
|
49
|
+
'type_preset_overline',
|
|
50
|
+
]);
|
package/esm/text/text.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import * as React from 'react';
|
|
24
|
+
import { styled } from '../styled';
|
|
25
|
+
import { composeClasses } from '../styles/classes';
|
|
26
|
+
import { getTextUtilityClass } from './text-classes';
|
|
27
|
+
import Typography from '@mui/material/Typography';
|
|
28
|
+
import clsx from '../utils/clsx';
|
|
29
|
+
var useUtilityClasses = function (variant, classes) {
|
|
30
|
+
var slots = {
|
|
31
|
+
root: ['root', variant],
|
|
32
|
+
};
|
|
33
|
+
return composeClasses(slots, getTextUtilityClass, classes);
|
|
34
|
+
};
|
|
35
|
+
var Root = styled(Typography, { name: 'QuantumText', slot: 'Root' })(function (_a) {
|
|
36
|
+
var _b, _c;
|
|
37
|
+
var variant = _a.variant, theme = _a.theme, color = _a.color;
|
|
38
|
+
var typeStyles = variant ? theme.tokens[variant] || {} : {};
|
|
39
|
+
var colorValue = color ? theme.tokens[color] || undefined : undefined;
|
|
40
|
+
var isBodyVariant = variant && variant.includes('body_') && !variant.includes('emphasis');
|
|
41
|
+
return __assign(__assign(__assign({}, typeStyles), { color: colorValue }), (isBodyVariant && {
|
|
42
|
+
'strong, b': {
|
|
43
|
+
fontWeight: (_b = theme.tokens["".concat(variant, "_emphasis")]) === null || _b === void 0 ? void 0 : _b.fontWeight,
|
|
44
|
+
},
|
|
45
|
+
'p&': {
|
|
46
|
+
'strong, b': {
|
|
47
|
+
fontWeight: (_c = theme.tokens["".concat(variant, "_emphasis_paragraph")]) === null || _c === void 0 ? void 0 : _c.fontWeight,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
}));
|
|
51
|
+
});
|
|
52
|
+
export var textVariantMapping = {
|
|
53
|
+
type_heading_100: 'h5',
|
|
54
|
+
type_heading_200: 'h4',
|
|
55
|
+
type_heading_300: 'h3',
|
|
56
|
+
type_heading_400: 'h2',
|
|
57
|
+
type_heading_500: 'h1',
|
|
58
|
+
type_heading_600: 'h1',
|
|
59
|
+
type_heading_700: 'h1',
|
|
60
|
+
type_heading_800: 'h1',
|
|
61
|
+
type_heading_900: 'h1',
|
|
62
|
+
type_heading_1000: 'h1',
|
|
63
|
+
type_preset_page_title: 'h1',
|
|
64
|
+
type_preset_page_title_compact: 'h1',
|
|
65
|
+
type_preset_section_title: 'h2',
|
|
66
|
+
type_preset_section_subtitle: 'h3',
|
|
67
|
+
type_preset_button: 'span',
|
|
68
|
+
type_preset_form_label: 'span',
|
|
69
|
+
type_preset_form_text: 'span',
|
|
70
|
+
type_preset_caption: 'p',
|
|
71
|
+
type_preset_caption_emphasis: 'p',
|
|
72
|
+
type_preset_menu_item: 'span',
|
|
73
|
+
type_preset_overline: 'span',
|
|
74
|
+
};
|
|
75
|
+
var getComponentForVariant = function (_a) {
|
|
76
|
+
var variant = _a.variant;
|
|
77
|
+
if (!variant) {
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
if (variant.includes('type_body')) {
|
|
81
|
+
return 'p';
|
|
82
|
+
}
|
|
83
|
+
if (variant.includes('type_code')) {
|
|
84
|
+
return 'span';
|
|
85
|
+
}
|
|
86
|
+
return textVariantMapping[variant];
|
|
87
|
+
};
|
|
88
|
+
export var Text = React.forwardRef(function (props, ref) {
|
|
89
|
+
var variant = props.variant, propClasses = props.classes, propComponent = props.component, className = props.className, rootProps = __rest(props, ["variant", "classes", "component", "className"]);
|
|
90
|
+
var classes = useUtilityClasses(variant, propClasses);
|
|
91
|
+
var component = propComponent || getComponentForVariant({ variant: variant });
|
|
92
|
+
return (React.createElement(Root, __assign({ ref: ref, variant: variant, className: clsx([classes.root, className]) }, { component: component }, rootProps)));
|
|
93
|
+
});
|
|
@@ -7,7 +7,7 @@ export declare const ExpansionPanelHeader: import("styled-components").StyledCom
|
|
|
7
7
|
classes?: Partial<Record<"title" | "action" | "content" | "root" | "avatar" | "subheader", string>> | undefined;
|
|
8
8
|
disableTypography?: boolean | undefined;
|
|
9
9
|
subheader?: import("react").ReactNode;
|
|
10
|
-
subheaderTypographyProps?: import("..").ITextProps<any
|
|
10
|
+
subheaderTypographyProps?: import("..").ITextProps<any> | undefined;
|
|
11
11
|
title?: import("react").ReactNode;
|
|
12
|
-
titleTypographyProps?: import("..").ITextProps<any
|
|
12
|
+
titleTypographyProps?: import("..").ITextProps<any> | undefined;
|
|
13
13
|
} & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "title" | "ref" | "action" | "size" | "classes" | "avatar" | "disableTypography" | "subheader" | "subheaderTypographyProps" | "titleTypographyProps"> & import("../styled").IStyledCommonProps & import("react").RefAttributes<HTMLDivElement>>, import("..").ITheme, import("@mui/system").MUIStyledCommonProps<import("..").ITheme>, never>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@auth0/quantum-product",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"types": "./index.d.ts",
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@auth0/quantum-icons": "^1.1.0",
|
|
15
|
-
"@auth0/quantum-tokens": "^1.
|
|
15
|
+
"@auth0/quantum-tokens": "^1.3.0",
|
|
16
16
|
"@mui/material": "5.15.9",
|
|
17
17
|
"@mui/system": "5.15.9",
|
|
18
18
|
"@mui/utils": "5.15.9",
|
|
@@ -16,7 +16,7 @@ export type IPanelHeaderProps = IStyledComponentProps<{
|
|
|
16
16
|
export declare const PanelHeader: React.ForwardRefExoticComponent<{
|
|
17
17
|
title: React.ReactNode;
|
|
18
18
|
titleComponent?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
19
|
-
titleTextProps?: Partial<ITextProps<"span"
|
|
19
|
+
titleTextProps?: Partial<ITextProps<"span">> | undefined;
|
|
20
20
|
endAdornment?: React.ReactNode;
|
|
21
21
|
classes?: Partial<Record<"title" | "content" | "root" | "endAdornment", string>> | undefined;
|
|
22
22
|
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "title" | "ref" | "classes" | "endAdornment" | "titleComponent" | "titleTextProps"> & import("../../styled").IStyledCommonProps & React.RefAttributes<HTMLDivElement>>;
|
package/region/region.d.ts
CHANGED
|
@@ -20,6 +20,6 @@ export declare const Region: React.ForwardRefExoticComponent<{
|
|
|
20
20
|
size?: RegionSize | undefined;
|
|
21
21
|
icon?: React.ReactNode;
|
|
22
22
|
label?: React.ReactNode;
|
|
23
|
-
labelTypographyProps?: ITextProps<"span"
|
|
23
|
+
labelTypographyProps?: ITextProps<"span"> | undefined;
|
|
24
24
|
classes?: Partial<Record<"label" | "root" | "flag", string>> | undefined;
|
|
25
25
|
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "label" | "ref" | "size" | "icon" | "classes" | "labelTypographyProps" | "locality"> & import("../styled").IStyledCommonProps & React.RefAttributes<HTMLElement>>;
|
package/styled.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import type { DefaultComponentProps, OverridableTypeMap } from './overridable-component';
|
|
3
3
|
import { shouldForwardProp, SxProps as MUISxProps } from '@mui/system';
|
|
4
4
|
import { ITheme } from './theme';
|
|
5
|
+
export { DefaultComponentProps };
|
|
5
6
|
export type SxProps = MUISxProps<ITheme>;
|
|
6
7
|
export interface IStyledCommonProps {
|
|
7
8
|
sx?: SxProps;
|
package/text/index.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export {
|
|
5
|
-
export type ITextProps<D extends React.ElementType = TypographyTypeMap['defaultComponent'], P = {}> = OverrideProps<TypographyTypeMap<P, D>, D>;
|
|
6
|
-
export declare const Text: OverridableComponent<TypographyTypeMap<{}, "span">>;
|
|
1
|
+
export { Text } from './text';
|
|
2
|
+
export type { ITextProps } from './text';
|
|
3
|
+
export { textClasses, textComponentName } from './text-classes';
|
|
4
|
+
export type { TextClasses } from './text-classes';
|
package/text/index.js
CHANGED
|
@@ -1,29 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
27
|
-
var
|
|
28
|
-
Object.defineProperty(exports, "
|
|
29
|
-
|
|
3
|
+
exports.textComponentName = exports.textClasses = exports.Text = void 0;
|
|
4
|
+
var text_1 = require("./text");
|
|
5
|
+
Object.defineProperty(exports, "Text", { enumerable: true, get: function () { return text_1.Text; } });
|
|
6
|
+
var text_classes_1 = require("./text-classes");
|
|
7
|
+
Object.defineProperty(exports, "textClasses", { enumerable: true, get: function () { return text_classes_1.textClasses; } });
|
|
8
|
+
Object.defineProperty(exports, "textComponentName", { enumerable: true, get: function () { return text_classes_1.textComponentName; } });
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const textComponentName: "QuantumText";
|
|
2
|
+
export declare function getTextUtilityClass(slot: string): string;
|
|
3
|
+
export declare const textClasses: Record<"type_code_50" | "type_code_100" | "type_code_200" | "type_code_300" | "type_heading_100" | "type_heading_200" | "type_heading_300" | "type_heading_400" | "type_heading_500" | "type_heading_600" | "type_heading_700" | "type_heading_800" | "type_heading_900" | "type_heading_1000" | "type_body_50" | "type_body_100" | "type_body_200" | "type_body_300" | "type_body_400" | "type_body_500" | "type_body_50_emphasis" | "type_body_50_emphasis_paragraph" | "type_body_100_emphasis" | "type_body_100_emphasis_paragraph" | "type_body_200_emphasis" | "type_body_200_emphasis_paragraph" | "type_body_300_emphasis" | "type_body_300_emphasis_paragraph" | "type_body_400_emphasis" | "type_body_400_emphasis_paragraph" | "type_body_500_emphasis" | "type_preset_page_title" | "type_preset_page_title_compact" | "type_preset_section_title" | "type_preset_section_subtitle" | "type_preset_button" | "type_preset_form_label" | "type_preset_form_text" | "type_preset_caption" | "type_preset_caption_emphasis" | "type_preset_menu_item" | "type_preset_overline" | "root", string>;
|
|
4
|
+
export type TextClasses = typeof textClasses;
|
|
5
|
+
export type TextClassKey = keyof TextClasses;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.textClasses = exports.getTextUtilityClass = exports.textComponentName = void 0;
|
|
4
|
+
var classes_1 = require("../styles/classes");
|
|
5
|
+
exports.textComponentName = 'QuantumText';
|
|
6
|
+
function getTextUtilityClass(slot) {
|
|
7
|
+
return (0, classes_1.generateUtilityClass)(exports.textComponentName, slot);
|
|
8
|
+
}
|
|
9
|
+
exports.getTextUtilityClass = getTextUtilityClass;
|
|
10
|
+
exports.textClasses = (0, classes_1.generateUtilityClasses)(exports.textComponentName, [
|
|
11
|
+
'root',
|
|
12
|
+
'type_code_50',
|
|
13
|
+
'type_code_100',
|
|
14
|
+
'type_code_200',
|
|
15
|
+
'type_code_300',
|
|
16
|
+
'type_heading_100',
|
|
17
|
+
'type_heading_200',
|
|
18
|
+
'type_heading_300',
|
|
19
|
+
'type_heading_400',
|
|
20
|
+
'type_heading_500',
|
|
21
|
+
'type_heading_600',
|
|
22
|
+
'type_heading_700',
|
|
23
|
+
'type_heading_800',
|
|
24
|
+
'type_heading_900',
|
|
25
|
+
'type_heading_1000',
|
|
26
|
+
'type_body_50',
|
|
27
|
+
'type_body_100',
|
|
28
|
+
'type_body_200',
|
|
29
|
+
'type_body_300',
|
|
30
|
+
'type_body_400',
|
|
31
|
+
'type_body_500',
|
|
32
|
+
'type_body_50_emphasis',
|
|
33
|
+
'type_body_50_emphasis_paragraph',
|
|
34
|
+
'type_body_100_emphasis',
|
|
35
|
+
'type_body_100_emphasis_paragraph',
|
|
36
|
+
'type_body_200_emphasis',
|
|
37
|
+
'type_body_200_emphasis_paragraph',
|
|
38
|
+
'type_body_300_emphasis',
|
|
39
|
+
'type_body_300_emphasis_paragraph',
|
|
40
|
+
'type_body_400_emphasis',
|
|
41
|
+
'type_body_400_emphasis_paragraph',
|
|
42
|
+
'type_body_500_emphasis',
|
|
43
|
+
'type_preset_page_title',
|
|
44
|
+
'type_preset_page_title_compact',
|
|
45
|
+
'type_preset_section_title',
|
|
46
|
+
'type_preset_section_subtitle',
|
|
47
|
+
'type_preset_button',
|
|
48
|
+
'type_preset_form_label',
|
|
49
|
+
'type_preset_form_text',
|
|
50
|
+
'type_preset_caption',
|
|
51
|
+
'type_preset_caption_emphasis',
|
|
52
|
+
'type_preset_menu_item',
|
|
53
|
+
'type_preset_overline',
|
|
54
|
+
]);
|
package/text/text.d.ts
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { DefaultComponentProps, SxProps } from '../styled';
|
|
3
|
+
import { ThemeColorFGTokenName, ThemeTypeTokenName } from '../theme/tokens';
|
|
4
|
+
import { TextClasses } from './text-classes';
|
|
5
|
+
import { TypographyOwnProps } from '@mui/material/Typography';
|
|
6
|
+
export type LiteralUnion<LiteralType> = LiteralType | (string & Record<never, never>);
|
|
7
|
+
export type ITextProps<RootComponent extends React.ElementType = 'span'> = DefaultComponentProps<{
|
|
8
|
+
props: Omit<TypographyOwnProps, 'as' | 'component' | 'sx' | 'variant' | 'color' | 'align' | 'classes' | 'gutterBottom' | 'noWrap' | 'paragraph'> & {
|
|
9
|
+
/**
|
|
10
|
+
* Set the text-align on the component.
|
|
11
|
+
* @default 'inherit'
|
|
12
|
+
*/
|
|
13
|
+
align?: 'inherit' | 'left' | 'center' | 'right' | 'justify';
|
|
14
|
+
/**
|
|
15
|
+
* The content of the component.
|
|
16
|
+
*/
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Override or extend the styles applied to the component.
|
|
20
|
+
*/
|
|
21
|
+
classes?: Partial<TextClasses>;
|
|
22
|
+
/**
|
|
23
|
+
* The color of the text. Only foreground tokens are supported.
|
|
24
|
+
*/
|
|
25
|
+
color?: LiteralUnion<ThemeColorFGTokenName>;
|
|
26
|
+
/**
|
|
27
|
+
* The component used for the root node.
|
|
28
|
+
* Either a string to use a HTML element or a component.
|
|
29
|
+
*/
|
|
30
|
+
component?: React.ElementType;
|
|
31
|
+
/**
|
|
32
|
+
* If `true`, the text will have a bottom margin.
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
gutterBottom?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* If `true`, the text will not wrap, but instead will truncate with a text overflow ellipsis.
|
|
38
|
+
*
|
|
39
|
+
* Note that text overflow can only happen with block or inline-block level elements
|
|
40
|
+
* (the element needs to have a width in order to overflow).
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
43
|
+
noWrap?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* If `true`, the element will be a paragraph element.
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
paragraph?: boolean;
|
|
49
|
+
sx?: SxProps;
|
|
50
|
+
/**
|
|
51
|
+
* The color of the text. Only foreground tokens are supported.
|
|
52
|
+
*/
|
|
53
|
+
variant?: ThemeTypeTokenName | TypographyOwnProps['variant'];
|
|
54
|
+
};
|
|
55
|
+
defaultComponent: RootComponent;
|
|
56
|
+
}>;
|
|
57
|
+
export declare const textVariantMapping: Partial<Record<ThemeTypeTokenName, React.ElementType>>;
|
|
58
|
+
export declare const Text: React.ForwardRefExoticComponent<Omit<TypographyOwnProps, "color" | "classes" | "sx" | "variant" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "component" | "as"> & {
|
|
59
|
+
/**
|
|
60
|
+
* Set the text-align on the component.
|
|
61
|
+
* @default 'inherit'
|
|
62
|
+
*/
|
|
63
|
+
align?: "center" | "inherit" | "left" | "right" | "justify" | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* The content of the component.
|
|
66
|
+
*/
|
|
67
|
+
children?: React.ReactNode;
|
|
68
|
+
/**
|
|
69
|
+
* Override or extend the styles applied to the component.
|
|
70
|
+
*/
|
|
71
|
+
classes?: Partial<Record<"type_code_50" | "type_code_100" | "type_code_200" | "type_code_300" | "type_heading_100" | "type_heading_200" | "type_heading_300" | "type_heading_400" | "type_heading_500" | "type_heading_600" | "type_heading_700" | "type_heading_800" | "type_heading_900" | "type_heading_1000" | "type_body_50" | "type_body_100" | "type_body_200" | "type_body_300" | "type_body_400" | "type_body_500" | "type_body_50_emphasis" | "type_body_50_emphasis_paragraph" | "type_body_100_emphasis" | "type_body_100_emphasis_paragraph" | "type_body_200_emphasis" | "type_body_200_emphasis_paragraph" | "type_body_300_emphasis" | "type_body_300_emphasis_paragraph" | "type_body_400_emphasis" | "type_body_400_emphasis_paragraph" | "type_body_500_emphasis" | "type_preset_page_title" | "type_preset_page_title_compact" | "type_preset_section_title" | "type_preset_section_subtitle" | "type_preset_button" | "type_preset_form_label" | "type_preset_form_text" | "type_preset_caption" | "type_preset_caption_emphasis" | "type_preset_menu_item" | "type_preset_overline" | "root", string>> | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* The color of the text. Only foreground tokens are supported.
|
|
74
|
+
*/
|
|
75
|
+
color?: LiteralUnion<ThemeColorFGTokenName> | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* The component used for the root node.
|
|
78
|
+
* Either a string to use a HTML element or a component.
|
|
79
|
+
*/
|
|
80
|
+
component?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* If `true`, the text will have a bottom margin.
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
85
|
+
gutterBottom?: boolean | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* If `true`, the text will not wrap, but instead will truncate with a text overflow ellipsis.
|
|
88
|
+
*
|
|
89
|
+
* Note that text overflow can only happen with block or inline-block level elements
|
|
90
|
+
* (the element needs to have a width in order to overflow).
|
|
91
|
+
* @default false
|
|
92
|
+
*/
|
|
93
|
+
noWrap?: boolean | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* If `true`, the element will be a paragraph element.
|
|
96
|
+
* @default false
|
|
97
|
+
*/
|
|
98
|
+
paragraph?: boolean | undefined;
|
|
99
|
+
sx?: SxProps | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* The color of the text. Only foreground tokens are supported.
|
|
102
|
+
*/
|
|
103
|
+
variant?: ThemeTypeTokenName | TypographyOwnProps['variant'];
|
|
104
|
+
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "p" | "ref" | "border" | "color" | "left" | "right" | "bottom" | "top" | "flex" | "position" | "padding" | "alignContent" | "alignItems" | "alignSelf" | "boxShadow" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "visibility" | "whiteSpace" | "width" | "zIndex" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "paddingBlock" | "paddingInline" | "classes" | "children" | "sx" | "variant" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping" | "component"> & React.RefAttributes<HTMLAnchorElement>>;
|
package/text/text.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
37
|
+
var t = {};
|
|
38
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
39
|
+
t[p] = s[p];
|
|
40
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
41
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
42
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
43
|
+
t[p[i]] = s[p[i]];
|
|
44
|
+
}
|
|
45
|
+
return t;
|
|
46
|
+
};
|
|
47
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
48
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
49
|
+
};
|
|
50
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
+
exports.Text = exports.textVariantMapping = void 0;
|
|
52
|
+
var React = __importStar(require("react"));
|
|
53
|
+
var styled_1 = require("../styled");
|
|
54
|
+
var classes_1 = require("../styles/classes");
|
|
55
|
+
var text_classes_1 = require("./text-classes");
|
|
56
|
+
var Typography_1 = __importDefault(require("@mui/material/Typography"));
|
|
57
|
+
var clsx_1 = __importDefault(require("../utils/clsx"));
|
|
58
|
+
var useUtilityClasses = function (variant, classes) {
|
|
59
|
+
var slots = {
|
|
60
|
+
root: ['root', variant],
|
|
61
|
+
};
|
|
62
|
+
return (0, classes_1.composeClasses)(slots, text_classes_1.getTextUtilityClass, classes);
|
|
63
|
+
};
|
|
64
|
+
var Root = (0, styled_1.styled)(Typography_1.default, { name: 'QuantumText', slot: 'Root' })(function (_a) {
|
|
65
|
+
var _b, _c;
|
|
66
|
+
var variant = _a.variant, theme = _a.theme, color = _a.color;
|
|
67
|
+
var typeStyles = variant ? theme.tokens[variant] || {} : {};
|
|
68
|
+
var colorValue = color ? theme.tokens[color] || undefined : undefined;
|
|
69
|
+
var isBodyVariant = variant && variant.includes('body_') && !variant.includes('emphasis');
|
|
70
|
+
return __assign(__assign(__assign({}, typeStyles), { color: colorValue }), (isBodyVariant && {
|
|
71
|
+
'strong, b': {
|
|
72
|
+
fontWeight: (_b = theme.tokens["".concat(variant, "_emphasis")]) === null || _b === void 0 ? void 0 : _b.fontWeight,
|
|
73
|
+
},
|
|
74
|
+
'p&': {
|
|
75
|
+
'strong, b': {
|
|
76
|
+
fontWeight: (_c = theme.tokens["".concat(variant, "_emphasis_paragraph")]) === null || _c === void 0 ? void 0 : _c.fontWeight,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
}));
|
|
80
|
+
});
|
|
81
|
+
exports.textVariantMapping = {
|
|
82
|
+
type_heading_100: 'h5',
|
|
83
|
+
type_heading_200: 'h4',
|
|
84
|
+
type_heading_300: 'h3',
|
|
85
|
+
type_heading_400: 'h2',
|
|
86
|
+
type_heading_500: 'h1',
|
|
87
|
+
type_heading_600: 'h1',
|
|
88
|
+
type_heading_700: 'h1',
|
|
89
|
+
type_heading_800: 'h1',
|
|
90
|
+
type_heading_900: 'h1',
|
|
91
|
+
type_heading_1000: 'h1',
|
|
92
|
+
type_preset_page_title: 'h1',
|
|
93
|
+
type_preset_page_title_compact: 'h1',
|
|
94
|
+
type_preset_section_title: 'h2',
|
|
95
|
+
type_preset_section_subtitle: 'h3',
|
|
96
|
+
type_preset_button: 'span',
|
|
97
|
+
type_preset_form_label: 'span',
|
|
98
|
+
type_preset_form_text: 'span',
|
|
99
|
+
type_preset_caption: 'p',
|
|
100
|
+
type_preset_caption_emphasis: 'p',
|
|
101
|
+
type_preset_menu_item: 'span',
|
|
102
|
+
type_preset_overline: 'span',
|
|
103
|
+
};
|
|
104
|
+
var getComponentForVariant = function (_a) {
|
|
105
|
+
var variant = _a.variant;
|
|
106
|
+
if (!variant) {
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
if (variant.includes('type_body')) {
|
|
110
|
+
return 'p';
|
|
111
|
+
}
|
|
112
|
+
if (variant.includes('type_code')) {
|
|
113
|
+
return 'span';
|
|
114
|
+
}
|
|
115
|
+
return exports.textVariantMapping[variant];
|
|
116
|
+
};
|
|
117
|
+
exports.Text = React.forwardRef(function (props, ref) {
|
|
118
|
+
var variant = props.variant, propClasses = props.classes, propComponent = props.component, className = props.className, rootProps = __rest(props, ["variant", "classes", "component", "className"]);
|
|
119
|
+
var classes = useUtilityClasses(variant, propClasses);
|
|
120
|
+
var component = propComponent || getComponentForVariant({ variant: variant });
|
|
121
|
+
return (React.createElement(Root, __assign({ ref: ref, variant: variant, className: (0, clsx_1.default)([classes.root, className]) }, { component: component }, rootProps)));
|
|
122
|
+
});
|
package/theme/tokens.d.ts
CHANGED
|
@@ -1,17 +1,4 @@
|
|
|
1
1
|
import { okta, auth0 } from '@auth0/quantum-tokens';
|
|
2
|
-
type
|
|
3
|
-
type ColorTokenPattern = `color_${string}`;
|
|
4
|
-
type TypeTokenPattern = `type_${string}`;
|
|
2
|
+
export type { GlobalThemeTokenName, GlobalThemeTokens, ThemeColorBGTokenName, ThemeColorBGTokens, ThemeColorBorderTokenName, ThemeColorBorderTokens, ThemeColorFGTokenName, ThemeColorFGTokens, ThemeTypeTokenName, ThemeTypeTokens, ThemeColorTokenName, ThemeColorTokens, ThemeSizeTokenName, ThemeSizeTokens, SemanticThemeTokenName, SemanticThemeTokens, } from '@auth0/quantum-tokens';
|
|
5
3
|
export type ThemeTokens = typeof okta.light | typeof auth0.light;
|
|
6
4
|
export type ThemeTokenName = keyof ThemeTokens;
|
|
7
|
-
type FilterGlobalTokens<TokenKey extends string> = TokenKey extends GlobalTokenPatten ? never : TokenKey;
|
|
8
|
-
type PickTokenType<Pattern extends string, TokenKey extends string> = TokenKey extends Pattern ? TokenKey : never;
|
|
9
|
-
export type GlobalThemeTokenName = PickTokenType<GlobalTokenPatten, ThemeTokenName>;
|
|
10
|
-
export type GlobalThemeTokens = Pick<ThemeTokens, GlobalThemeTokenName>;
|
|
11
|
-
export type SemanticThemeTokenName = FilterGlobalTokens<ThemeTokenName>;
|
|
12
|
-
export type SemanticThemeTokens = Pick<ThemeTokens, SemanticThemeTokenName>;
|
|
13
|
-
export type ThemeColorTokenName = FilterGlobalTokens<PickTokenType<ColorTokenPattern, ThemeTokenName>>;
|
|
14
|
-
export type ThemeColorTokens = Pick<ThemeTokens, ThemeColorTokenName>;
|
|
15
|
-
export type ThemeTypeTokenName = FilterGlobalTokens<PickTokenType<TypeTokenPattern, ThemeTokenName>>;
|
|
16
|
-
export type ThemeTypeTokens = Pick<ThemeTokens, ThemeTypeTokenName>;
|
|
17
|
-
export {};
|