@react-md/core 1.0.0-next.7 → 1.0.0-next.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/.turbo/turbo-build.log +6 -6
- package/CHANGELOG.md +6 -0
- package/coverage/clover.xml +264 -389
- package/coverage/coverage-final.json +2 -3
- package/coverage/lcov-report/MenuItemCheckbox.tsx.html +223 -0
- package/coverage/lcov-report/MenuItemInputToggle.tsx.html +178 -232
- package/coverage/lcov-report/MenuItemRadio.tsx.html +436 -0
- package/coverage/lcov-report/SrOnly.tsx.html +328 -0
- package/coverage/lcov-report/Typography.tsx.html +1027 -0
- package/coverage/lcov-report/index.html +15 -30
- package/coverage/lcov-report/menuItemInputToggleStyles.ts.html +319 -0
- package/coverage/lcov.info +304 -436
- package/dist/_core.scss +49 -43
- package/dist/badge/_badge.scss +23 -19
- package/dist/form/MenuItemInputToggle.d.ts +2 -15
- package/dist/form/MenuItemInputToggle.js +26 -37
- package/dist/form/MenuItemInputToggle.js.map +1 -1
- package/dist/form/_form.scss +39 -16
- package/dist/form/menuItemInputToggleStyles.d.ts +39 -0
- package/dist/form/menuItemInputToggleStyles.js +31 -0
- package/dist/form/menuItemInputToggleStyles.js.map +1 -0
- package/dist/icon/_icon.scss +7 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/interaction/_interaction.scss +56 -44
- package/dist/list/types.d.ts +10 -1
- package/dist/list/types.js.map +1 -1
- package/dist/menu/_menu.scss +1 -0
- package/dist/theme/_theme.scss +192 -34
- package/dist/typography/SrOnly.d.ts +3 -3
- package/dist/typography/SrOnly.js +4 -4
- package/dist/typography/SrOnly.js.map +1 -1
- package/dist/typography/Typography.d.ts +19 -19
- package/dist/typography/Typography.js +19 -19
- package/dist/typography/Typography.js.map +1 -1
- package/dist/typography/_typography.scss +65 -25
- package/package.json +11 -11
- package/src/_core.scss +49 -43
- package/src/badge/_badge.scss +23 -19
- package/src/button/__tests__/__snapshots__/Button.tsx.snap +1 -1
- package/src/form/MenuItemInputToggle.tsx +46 -64
- package/src/form/__tests__/MenuItemCheckbox.tsx +53 -0
- package/src/form/__tests__/MenuItemRadio.tsx +53 -0
- package/src/form/__tests__/__snapshots__/FileInput.tsx.snap +23 -23
- package/src/form/__tests__/__snapshots__/MenuItemCheckbox.tsx.snap +96 -0
- package/src/form/__tests__/__snapshots__/MenuItemRadio.tsx.snap +96 -0
- package/src/form/_form.scss +39 -16
- package/src/form/menuItemInputToggleStyles.ts +78 -0
- package/src/icon/_icon.scss +7 -5
- package/src/index.ts +1 -0
- package/src/interaction/_interaction.scss +56 -44
- package/src/list/types.ts +12 -1
- package/src/menu/_menu.scss +1 -0
- package/src/theme/_theme.scss +192 -34
- package/src/typography/SrOnly.tsx +9 -9
- package/src/typography/Typography.tsx +19 -19
- package/src/typography/__tests__/__snapshots__/SrOnly.tsx.snap +5 -5
- package/src/typography/_typography.scss +65 -25
- package/.turbo/turbo-lint.log +0 -12
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { Typography } from "./Typography.js";
|
|
4
3
|
import { cssUtils } from "../cssUtils.js";
|
|
5
4
|
/**
|
|
6
5
|
* **Server Component**
|
|
@@ -25,10 +24,11 @@ import { cssUtils } from "../cssUtils.js";
|
|
|
25
24
|
* }
|
|
26
25
|
* ```
|
|
27
26
|
*/ export const SrOnly = /*#__PURE__*/ forwardRef(function SrOnly(props, ref) {
|
|
28
|
-
const { as = "span", className, phoneOnly, focusable, children, tabIndex, ...remaining } = props;
|
|
29
|
-
|
|
27
|
+
const { as: AsComponent = "span", className, phoneOnly, focusable, children, tabIndex, ...remaining } = props;
|
|
28
|
+
// do some type-casting so ref works
|
|
29
|
+
const Component = AsComponent;
|
|
30
|
+
return /*#__PURE__*/ _jsx(Component, {
|
|
30
31
|
...remaining,
|
|
31
|
-
as: as,
|
|
32
32
|
ref: ref,
|
|
33
33
|
tabIndex: tabIndex ?? (focusable ? 0 : undefined),
|
|
34
34
|
className: cssUtils({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/typography/SrOnly.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/typography/SrOnly.tsx"],"sourcesContent":["import { forwardRef, type ElementType, type HTMLAttributes } from \"react\";\nimport { cssUtils } from \"../cssUtils.js\";\nimport {\n type CustomTypographyComponent,\n type TypographyHTMLElement,\n} from \"./Typography.js\";\n\nexport interface SrOnlyProps extends HTMLAttributes<TypographyHTMLElement> {\n /** @defaultValue `\"span\"` */\n as?: CustomTypographyComponent;\n\n /**\n * Set this to `true` if the content should only be screen reader only text on\n * phones. This is useful for only displaying an icon on phones when there is\n * limited space and then displaying an icon and text on larger devices.\n *\n * @defaultValue `false`\n */\n phoneOnly?: boolean;\n\n /**\n * Set this to `true` if the element should be keyboard focusable.\n *\n * @defaultValue `false`\n */\n focusable?: boolean;\n}\n\n/**\n * **Server Component**\n *\n * @example\n * Simple Example\n * ```tsx\n * import { SrOnly } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <>\n * <SrOnly>\n * I am only visible to screen readers.\n * </SrOnly>\n * <SrOnly focusable>\n * I am only visible to screen readers but can be focused.\n * </SrOnly>\n * </>\n * );\n * }\n * ```\n */\nexport const SrOnly = forwardRef<TypographyHTMLElement, SrOnlyProps>(\n function SrOnly(props, ref) {\n const {\n as: AsComponent = \"span\",\n className,\n phoneOnly,\n focusable,\n children,\n tabIndex,\n ...remaining\n } = props;\n\n // do some type-casting so ref works\n const Component = AsComponent as ElementType;\n\n return (\n <Component\n {...remaining}\n ref={ref}\n tabIndex={tabIndex ?? (focusable ? 0 : undefined)}\n className={cssUtils({\n srOnly: focusable ? \"focusable\" : phoneOnly ? \"phone\" : true,\n className,\n })}\n >\n {children}\n </Component>\n );\n }\n);\n"],"names":["forwardRef","cssUtils","SrOnly","props","ref","as","AsComponent","className","phoneOnly","focusable","children","tabIndex","remaining","Component","undefined","srOnly"],"mappings":";AAAA,SAASA,UAAU,QAA+C,QAAQ;AAC1E,SAASC,QAAQ,QAAQ,iBAAiB;AA2B1C;;;;;;;;;;;;;;;;;;;;;;CAsBC,GACD,OAAO,MAAMC,uBAASF,WACpB,SAASE,OAAOC,KAAK,EAAEC,GAAG;IACxB,MAAM,EACJC,IAAIC,cAAc,MAAM,EACxBC,SAAS,EACTC,SAAS,EACTC,SAAS,EACTC,QAAQ,EACRC,QAAQ,EACR,GAAGC,WACJ,GAAGT;IAEJ,oCAAoC;IACpC,MAAMU,YAAYP;IAElB,qBACE,KAACO;QACE,GAAGD,SAAS;QACbR,KAAKA;QACLO,UAAUA,YAAaF,CAAAA,YAAY,IAAIK,SAAQ;QAC/CP,WAAWN,SAAS;YAClBc,QAAQN,YAAY,cAAcD,YAAY,UAAU;YACxDD;QACF;kBAECG;;AAGP,GACA"}
|
|
@@ -36,24 +36,24 @@ export type NullableTypographyClassNameOptions = Omit<TypographyClassNameOptions
|
|
|
36
36
|
* @example
|
|
37
37
|
* Simple Example
|
|
38
38
|
* ```ts
|
|
39
|
-
* import {
|
|
39
|
+
* import { typography } from "@react-md/core";
|
|
40
40
|
*
|
|
41
41
|
* function Example() {
|
|
42
42
|
* return (
|
|
43
43
|
* <>
|
|
44
|
-
* <h1 className={
|
|
45
|
-
* <h2 className={
|
|
46
|
-
* <h3 className={
|
|
47
|
-
* <h4 className={
|
|
48
|
-
* <h5 className={
|
|
49
|
-
* <h6 className={
|
|
50
|
-
* <h5 className={
|
|
51
|
-
* <h6 className={
|
|
52
|
-
* <p className={
|
|
53
|
-
* <p className={
|
|
54
|
-
* <p className={
|
|
55
|
-
* <caption className={
|
|
56
|
-
* <span className={
|
|
44
|
+
* <h1 className={typography({ type: "headline-1" })} />
|
|
45
|
+
* <h2 className={typography({ type: "headline-2" })} />
|
|
46
|
+
* <h3 className={typography({ type: "headline-3" })} />
|
|
47
|
+
* <h4 className={typography({ type: "headline-4" })} />
|
|
48
|
+
* <h5 className={typography({ type: "headline-5" })} />
|
|
49
|
+
* <h6 className={typography({ type: "headline-6" })} />
|
|
50
|
+
* <h5 className={typography({ type: "subtitle-1" })} />
|
|
51
|
+
* <h6 className={typography({ type: "subtitle-2" })} />
|
|
52
|
+
* <p className={typography()} />
|
|
53
|
+
* <p className={typography({ type "body-1" })} />
|
|
54
|
+
* <p className={typography({ type "body-1" })} />
|
|
55
|
+
* <caption className={typography({ type: "caption" })} />
|
|
56
|
+
* <span className={typography({ type: "overline" })} />
|
|
57
57
|
* </>
|
|
58
58
|
* );
|
|
59
59
|
* }
|
|
@@ -62,14 +62,14 @@ export type NullableTypographyClassNameOptions = Omit<TypographyClassNameOptions
|
|
|
62
62
|
* @example
|
|
63
63
|
* Applying Additional Styles
|
|
64
64
|
* ```ts
|
|
65
|
-
* import {
|
|
65
|
+
* import { typography } from "@react-md/core";
|
|
66
66
|
*
|
|
67
67
|
* function Example() {
|
|
68
68
|
* return (
|
|
69
69
|
* <>
|
|
70
70
|
* <h1
|
|
71
71
|
* // only maintain the default margin-bottom
|
|
72
|
-
* className={
|
|
72
|
+
* className={typography({
|
|
73
73
|
* type: "headline-1",
|
|
74
74
|
* margin: "bottom",
|
|
75
75
|
* })}
|
|
@@ -77,7 +77,7 @@ export type NullableTypographyClassNameOptions = Omit<TypographyClassNameOptions
|
|
|
77
77
|
*
|
|
78
78
|
* <h2
|
|
79
79
|
* // remove all default margin
|
|
80
|
-
* className={
|
|
80
|
+
* className={typography({
|
|
81
81
|
* type: "headline-2",
|
|
82
82
|
* margin: "none",
|
|
83
83
|
* })}
|
|
@@ -85,7 +85,7 @@ export type NullableTypographyClassNameOptions = Omit<TypographyClassNameOptions
|
|
|
85
85
|
*
|
|
86
86
|
* <h3
|
|
87
87
|
* // only maintain the default margin-top
|
|
88
|
-
* className={
|
|
88
|
+
* className={typography({
|
|
89
89
|
* type: "headline-3",
|
|
90
90
|
* margin: "top",
|
|
91
91
|
* })}
|
|
@@ -93,7 +93,7 @@ export type NullableTypographyClassNameOptions = Omit<TypographyClassNameOptions
|
|
|
93
93
|
*
|
|
94
94
|
* <p
|
|
95
95
|
* // center the text, set to bold, and only maintain default margin-bottom
|
|
96
|
-
* className={
|
|
96
|
+
* className={typography({
|
|
97
97
|
* type "subtitle-1",
|
|
98
98
|
* align: "center",
|
|
99
99
|
* margin: "bottom",
|
|
@@ -10,24 +10,24 @@ import { cssUtils } from "../cssUtils.js";
|
|
|
10
10
|
* @example
|
|
11
11
|
* Simple Example
|
|
12
12
|
* ```ts
|
|
13
|
-
* import {
|
|
13
|
+
* import { typography } from "@react-md/core";
|
|
14
14
|
*
|
|
15
15
|
* function Example() {
|
|
16
16
|
* return (
|
|
17
17
|
* <>
|
|
18
|
-
* <h1 className={
|
|
19
|
-
* <h2 className={
|
|
20
|
-
* <h3 className={
|
|
21
|
-
* <h4 className={
|
|
22
|
-
* <h5 className={
|
|
23
|
-
* <h6 className={
|
|
24
|
-
* <h5 className={
|
|
25
|
-
* <h6 className={
|
|
26
|
-
* <p className={
|
|
27
|
-
* <p className={
|
|
28
|
-
* <p className={
|
|
29
|
-
* <caption className={
|
|
30
|
-
* <span className={
|
|
18
|
+
* <h1 className={typography({ type: "headline-1" })} />
|
|
19
|
+
* <h2 className={typography({ type: "headline-2" })} />
|
|
20
|
+
* <h3 className={typography({ type: "headline-3" })} />
|
|
21
|
+
* <h4 className={typography({ type: "headline-4" })} />
|
|
22
|
+
* <h5 className={typography({ type: "headline-5" })} />
|
|
23
|
+
* <h6 className={typography({ type: "headline-6" })} />
|
|
24
|
+
* <h5 className={typography({ type: "subtitle-1" })} />
|
|
25
|
+
* <h6 className={typography({ type: "subtitle-2" })} />
|
|
26
|
+
* <p className={typography()} />
|
|
27
|
+
* <p className={typography({ type "body-1" })} />
|
|
28
|
+
* <p className={typography({ type "body-1" })} />
|
|
29
|
+
* <caption className={typography({ type: "caption" })} />
|
|
30
|
+
* <span className={typography({ type: "overline" })} />
|
|
31
31
|
* </>
|
|
32
32
|
* );
|
|
33
33
|
* }
|
|
@@ -36,14 +36,14 @@ import { cssUtils } from "../cssUtils.js";
|
|
|
36
36
|
* @example
|
|
37
37
|
* Applying Additional Styles
|
|
38
38
|
* ```ts
|
|
39
|
-
* import {
|
|
39
|
+
* import { typography } from "@react-md/core";
|
|
40
40
|
*
|
|
41
41
|
* function Example() {
|
|
42
42
|
* return (
|
|
43
43
|
* <>
|
|
44
44
|
* <h1
|
|
45
45
|
* // only maintain the default margin-bottom
|
|
46
|
-
* className={
|
|
46
|
+
* className={typography({
|
|
47
47
|
* type: "headline-1",
|
|
48
48
|
* margin: "bottom",
|
|
49
49
|
* })}
|
|
@@ -51,7 +51,7 @@ import { cssUtils } from "../cssUtils.js";
|
|
|
51
51
|
*
|
|
52
52
|
* <h2
|
|
53
53
|
* // remove all default margin
|
|
54
|
-
* className={
|
|
54
|
+
* className={typography({
|
|
55
55
|
* type: "headline-2",
|
|
56
56
|
* margin: "none",
|
|
57
57
|
* })}
|
|
@@ -59,7 +59,7 @@ import { cssUtils } from "../cssUtils.js";
|
|
|
59
59
|
*
|
|
60
60
|
* <h3
|
|
61
61
|
* // only maintain the default margin-top
|
|
62
|
-
* className={
|
|
62
|
+
* className={typography({
|
|
63
63
|
* type: "headline-3",
|
|
64
64
|
* margin: "top",
|
|
65
65
|
* })}
|
|
@@ -67,7 +67,7 @@ import { cssUtils } from "../cssUtils.js";
|
|
|
67
67
|
*
|
|
68
68
|
* <p
|
|
69
69
|
* // center the text, set to bold, and only maintain default margin-bottom
|
|
70
|
-
* className={
|
|
70
|
+
* className={typography({
|
|
71
71
|
* type "subtitle-1",
|
|
72
72
|
* align: "center",
|
|
73
73
|
* margin: "bottom",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/typography/Typography.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport {\n forwardRef,\n type ElementType,\n type HTMLAttributes,\n type ReactElement,\n} from \"react\";\nimport { cssUtils, type TextCssUtilsOptions } from \"../cssUtils.js\";\n\n/**\n * A union of all the material design provided typography styles. When used with\n * the Typography component, this will generate the correct typography className\n * to apply and determine what component to be rendered as if none was provided.\n *\n * @remarks \\@since 4.0.0\n */\nexport type TypographyType =\n | \"headline-1\"\n | \"headline-2\"\n | \"headline-3\"\n | \"headline-4\"\n | \"headline-5\"\n | \"headline-6\"\n | \"subtitle-1\"\n | \"subtitle-2\"\n | \"body-1\"\n | \"body-2\"\n | \"caption\"\n | \"overline\";\n\n/** @remarks \\@since 6.0.0 */\nexport interface TypographyClassNameOptions extends TextCssUtilsOptions {\n className?: string;\n\n /**\n * @see {@link TypographyType}\n * @defaultValue `\"body-1\"`\n */\n type?: TypographyType;\n}\n\n/** @remarks \\@since 6.0.0 */\nexport type NullableTypographyClassNameOptions = Omit<\n TypographyClassNameOptions,\n \"type\"\n> & {\n /**\n * When using the {@link typography} class name utility, the `type` can be set\n * to `null` to inherit font.\n *\n * @see {@link TypographyType}\n * @defaultValue `\"body-1\"`\n */\n type?: TypographyType | null;\n};\n\n/**\n * Get a typography class name based on different typography options. This is\n * only useful if you are unable to use the {@link Typography} component for\n * some reason.\n *\n * @example\n * Simple Example\n * ```ts\n * import { getTypographyClassName } from \"@react-md/core\";\n *\n * function Example() {\n * return (\n * <>\n * <h1 className={getTypographyClassName({ type: \"headline-1\" })} />\n * <h2 className={getTypographyClassName({ type: \"headline-2\" })} />\n * <h3 className={getTypographyClassName({ type: \"headline-3\" })} />\n * <h4 className={getTypographyClassName({ type: \"headline-4\" })} />\n * <h5 className={getTypographyClassName({ type: \"headline-5\" })} />\n * <h6 className={getTypographyClassName({ type: \"headline-6\" })} />\n * <h5 className={getTypographyClassName({ type: \"subtitle-1\" })} />\n * <h6 className={getTypographyClassName({ type: \"subtitle-2\" })} />\n * <p className={getTypographyClassName()} />\n * <p className={getTypographyClassName({ type \"body-1\" })} />\n * <p className={getTypographyClassName({ type \"body-1\" })} />\n * <caption className={getTypographyClassName({ type: \"caption\" })} />\n * <span className={getTypographyClassName({ type: \"overline\" })} />\n * </>\n * );\n * }\n * ```\n *\n * @example\n * Applying Additional Styles\n * ```ts\n * import { getTypography } from \"@react-md/core\";\n *\n * function Example() {\n * return (\n * <>\n * <h1\n * // only maintain the default margin-bottom\n * className={getTypographyClassName({\n * type: \"headline-1\",\n * margin: \"bottom\",\n * })}\n * />\n *\n * <h2\n * // remove all default margin\n * className={getTypographyClassName({\n * type: \"headline-2\",\n * margin: \"none\",\n * })}\n * />\n *\n * <h3\n * // only maintain the default margin-top\n * className={getTypographyClassName({\n * type: \"headline-3\",\n * margin: \"top\",\n * })}\n * />\n *\n * <p\n * // center the text, set to bold, and only maintain default margin-bottom\n * className={getTypographyClassName({\n * type \"subtitle-1\",\n * align: \"center\",\n * margin: \"bottom\",\n * })}\n * />\n * </>\n * );\n * }\n * ```\n *\n * @see {@link Typography}\n * @param options - An optional object of options used to create the typography\n * class name.\n * @returns a typography class name string\n * @remarks \\@since 6.0.0\n */\nexport function typography(\n options: NullableTypographyClassNameOptions = {}\n): string {\n const { type = \"body-1\" } = options;\n\n // using `&&` instead of `bem` since the latest version of typescript does not\n // support setting the same object key (empty string)\n return cnb(\n \"rmd-typography\",\n type && `rmd-typography--${type}`,\n cssUtils(options)\n );\n}\n\n/**\n * A union of the default supported elements that the `Typography` component can\n * be rendered as. This is mostly used for adding the correct `HTMLAttributes`\n * and enabling the forward ref.\n *\n * @remarks \\@since 4.0.0\n */\nexport type TypographyHTMLElement =\n | HTMLHeadingElement\n | HTMLParagraphElement\n | HTMLSpanElement\n | HTMLDivElement\n | HTMLAnchorElement\n | HTMLBodyElement\n | HTMLHtmlElement;\n\n/** @remarks \\@since 6.0.0 */\nexport type CustomTypographyComponent = ElementType<\n HTMLAttributes<TypographyHTMLElement> & { className: string }\n>;\n\n/** @internal */\nfunction getComponent(\n as: CustomTypographyComponent | undefined,\n type: TypographyType\n): ElementType {\n if (as) {\n return as;\n }\n\n switch (type) {\n case \"headline-1\":\n return \"h1\";\n case \"headline-2\":\n return \"h2\";\n case \"headline-3\":\n return \"h3\";\n case \"headline-4\":\n return \"h4\";\n case \"headline-5\":\n return \"h5\";\n case \"headline-6\":\n case \"subtitle-1\":\n case \"subtitle-2\":\n return \"h6\";\n case \"body-1\":\n case \"body-2\":\n return \"p\";\n case \"caption\":\n return \"caption\";\n default:\n return \"span\";\n }\n}\n\nexport interface TypographyProps\n extends HTMLAttributes<TypographyHTMLElement>,\n TypographyClassNameOptions {\n /**\n * The component to render as when the children are not a render function. If\n * this prop is omitted, the component will be determined by the `type` prop\n * where:\n *\n * - `\"headline-1\" -> <h1>`\n * - `\"headline-2\" -> <h2>`\n * - `\"headline-3\" -> <h3>`\n * - `\"headline-4\" -> <h4>`\n * - `\"headline-5\" -> <h5>`\n * - `\"headline-6\" -> <h6>`\n * - `\"subtitle-1\" -> <h5>`\n * - `\"subtitle-2\" -> <h6>`\n * - `\"body-1\" -> <p>`\n * - `\"body-2\" -> <p>`\n * - `\"caption\" -> <caption>`\n * - `\"overline\" -> <span>`\n */\n as?: CustomTypographyComponent;\n}\n\n/**\n * **Server Component**\n *\n * Render text with one of the material design typography styles applied and\n * optional styles like font-weight, font-style, text color, etc.\n *\n * @example\n * All Example\n * ```tsx\n * import { Typography } from \"@react-md/core\":\n *\n * export function Example() {\n * return (\n * <>\n * <Typography type=\"headline-1\">Headline 1</Typography>\n * <Typography type=\"headline-2\">Headline 2</Typography>\n * <Typography type=\"headline-3\">Headline 3</Typography>\n * <Typography type=\"headline-4\">Headline 4</Typography>\n * <Typography type=\"headline-5\">Headline 5</Typography>\n * <Typography type=\"headline-6\">Headline 6</Typography>\n * <Typography type=\"subtitle-1\">Subtitle 1</Typography>\n * <Typography type=\"subtitle-2\">Subtitle 2</Typography>\n * <Typography>\n * A paragraph of text.\n * </Typography>\n * <Typography type=\"body-1\">\n * A paragraph of text.\n * </Typography>\n * <Typography type=\"body-2\">\n * Another paragraph of text.\n * </Typography>\n * <Typography type=\"caption\" component=\"h5\">\n * Caption text\n * </Typography>\n * <Typography type=\"overline\" component=\"h5\">\n * Overline text\n * </Typography>\n * </>\n * ):\n * }\n * ```\n */\nexport const Typography = forwardRef<TypographyHTMLElement, TypographyProps>(\n function Typography(props, ref): ReactElement {\n const {\n as,\n type = \"body-1\",\n className,\n margin,\n fontStyle,\n fontWeight,\n textAlign,\n textColor,\n textDecoration,\n textTransform,\n textOverflow,\n children,\n ...remaining\n } = props;\n\n const Component = getComponent(as, type);\n return (\n <Component\n {...remaining}\n ref={ref}\n className={typography({\n type,\n margin,\n fontStyle,\n fontWeight,\n textAlign,\n textColor,\n textDecoration,\n textTransform,\n textOverflow,\n className,\n })}\n >\n {children}\n </Component>\n );\n }\n);\n"],"names":["cnb","forwardRef","cssUtils","typography","options","type","getComponent","as","Typography","props","ref","className","margin","fontStyle","fontWeight","textAlign","textColor","textDecoration","textTransform","textOverflow","children","remaining","Component"],"mappings":";AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SACEC,UAAU,QAIL,QAAQ;AACf,SAASC,QAAQ,QAAkC,iBAAiB;AAiDpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiFC,GACD,OAAO,SAASC,WACdC,UAA8C,CAAC,CAAC;IAEhD,MAAM,EAAEC,OAAO,QAAQ,EAAE,GAAGD;IAE5B,8EAA8E;IAC9E,qDAAqD;IACrD,OAAOJ,IACL,kBACAK,QAAQ,CAAC,gBAAgB,EAAEA,KAAK,CAAC,EACjCH,SAASE;AAEb;AAuBA,cAAc,GACd,SAASE,aACPC,EAAyC,EACzCF,IAAoB;IAEpB,IAAIE,IAAI;QACN,OAAOA;IACT;IAEA,OAAQF;QACN,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT,KAAK;QACL,KAAK;QACL,KAAK;YACH,OAAO;QACT,KAAK;QACL,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT;YACE,OAAO;IACX;AACF;AA0BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCC,GACD,OAAO,MAAMG,2BAAaP,WACxB,SAASO,WAAWC,KAAK,EAAEC,GAAG;IAC5B,MAAM,EACJH,EAAE,EACFF,OAAO,QAAQ,EACfM,SAAS,EACTC,MAAM,EACNC,SAAS,EACTC,UAAU,EACVC,SAAS,EACTC,SAAS,EACTC,cAAc,EACdC,aAAa,EACbC,YAAY,EACZC,QAAQ,EACR,GAAGC,WACJ,GAAGZ;IAEJ,MAAMa,YAAYhB,aAAaC,IAAIF;IACnC,qBACE,KAACiB;QACE,GAAGD,SAAS;QACbX,KAAKA;QACLC,WAAWR,WAAW;YACpBE;YACAO;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAR;QACF;kBAECS;;AAGP,GACA"}
|
|
1
|
+
{"version":3,"sources":["../../src/typography/Typography.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport {\n forwardRef,\n type ElementType,\n type HTMLAttributes,\n type ReactElement,\n} from \"react\";\nimport { cssUtils, type TextCssUtilsOptions } from \"../cssUtils.js\";\n\n/**\n * A union of all the material design provided typography styles. When used with\n * the Typography component, this will generate the correct typography className\n * to apply and determine what component to be rendered as if none was provided.\n *\n * @remarks \\@since 4.0.0\n */\nexport type TypographyType =\n | \"headline-1\"\n | \"headline-2\"\n | \"headline-3\"\n | \"headline-4\"\n | \"headline-5\"\n | \"headline-6\"\n | \"subtitle-1\"\n | \"subtitle-2\"\n | \"body-1\"\n | \"body-2\"\n | \"caption\"\n | \"overline\";\n\n/** @remarks \\@since 6.0.0 */\nexport interface TypographyClassNameOptions extends TextCssUtilsOptions {\n className?: string;\n\n /**\n * @see {@link TypographyType}\n * @defaultValue `\"body-1\"`\n */\n type?: TypographyType;\n}\n\n/** @remarks \\@since 6.0.0 */\nexport type NullableTypographyClassNameOptions = Omit<\n TypographyClassNameOptions,\n \"type\"\n> & {\n /**\n * When using the {@link typography} class name utility, the `type` can be set\n * to `null` to inherit font.\n *\n * @see {@link TypographyType}\n * @defaultValue `\"body-1\"`\n */\n type?: TypographyType | null;\n};\n\n/**\n * Get a typography class name based on different typography options. This is\n * only useful if you are unable to use the {@link Typography} component for\n * some reason.\n *\n * @example\n * Simple Example\n * ```ts\n * import { typography } from \"@react-md/core\";\n *\n * function Example() {\n * return (\n * <>\n * <h1 className={typography({ type: \"headline-1\" })} />\n * <h2 className={typography({ type: \"headline-2\" })} />\n * <h3 className={typography({ type: \"headline-3\" })} />\n * <h4 className={typography({ type: \"headline-4\" })} />\n * <h5 className={typography({ type: \"headline-5\" })} />\n * <h6 className={typography({ type: \"headline-6\" })} />\n * <h5 className={typography({ type: \"subtitle-1\" })} />\n * <h6 className={typography({ type: \"subtitle-2\" })} />\n * <p className={typography()} />\n * <p className={typography({ type \"body-1\" })} />\n * <p className={typography({ type \"body-1\" })} />\n * <caption className={typography({ type: \"caption\" })} />\n * <span className={typography({ type: \"overline\" })} />\n * </>\n * );\n * }\n * ```\n *\n * @example\n * Applying Additional Styles\n * ```ts\n * import { typography } from \"@react-md/core\";\n *\n * function Example() {\n * return (\n * <>\n * <h1\n * // only maintain the default margin-bottom\n * className={typography({\n * type: \"headline-1\",\n * margin: \"bottom\",\n * })}\n * />\n *\n * <h2\n * // remove all default margin\n * className={typography({\n * type: \"headline-2\",\n * margin: \"none\",\n * })}\n * />\n *\n * <h3\n * // only maintain the default margin-top\n * className={typography({\n * type: \"headline-3\",\n * margin: \"top\",\n * })}\n * />\n *\n * <p\n * // center the text, set to bold, and only maintain default margin-bottom\n * className={typography({\n * type \"subtitle-1\",\n * align: \"center\",\n * margin: \"bottom\",\n * })}\n * />\n * </>\n * );\n * }\n * ```\n *\n * @see {@link Typography}\n * @param options - An optional object of options used to create the typography\n * class name.\n * @returns a typography class name string\n * @remarks \\@since 6.0.0\n */\nexport function typography(\n options: NullableTypographyClassNameOptions = {}\n): string {\n const { type = \"body-1\" } = options;\n\n // using `&&` instead of `bem` since the latest version of typescript does not\n // support setting the same object key (empty string)\n return cnb(\n \"rmd-typography\",\n type && `rmd-typography--${type}`,\n cssUtils(options)\n );\n}\n\n/**\n * A union of the default supported elements that the `Typography` component can\n * be rendered as. This is mostly used for adding the correct `HTMLAttributes`\n * and enabling the forward ref.\n *\n * @remarks \\@since 4.0.0\n */\nexport type TypographyHTMLElement =\n | HTMLHeadingElement\n | HTMLParagraphElement\n | HTMLSpanElement\n | HTMLDivElement\n | HTMLAnchorElement\n | HTMLBodyElement\n | HTMLHtmlElement;\n\n/** @remarks \\@since 6.0.0 */\nexport type CustomTypographyComponent = ElementType<\n HTMLAttributes<TypographyHTMLElement> & { className: string }\n>;\n\n/** @internal */\nfunction getComponent(\n as: CustomTypographyComponent | undefined,\n type: TypographyType\n): ElementType {\n if (as) {\n return as;\n }\n\n switch (type) {\n case \"headline-1\":\n return \"h1\";\n case \"headline-2\":\n return \"h2\";\n case \"headline-3\":\n return \"h3\";\n case \"headline-4\":\n return \"h4\";\n case \"headline-5\":\n return \"h5\";\n case \"headline-6\":\n case \"subtitle-1\":\n case \"subtitle-2\":\n return \"h6\";\n case \"body-1\":\n case \"body-2\":\n return \"p\";\n case \"caption\":\n return \"caption\";\n default:\n return \"span\";\n }\n}\n\nexport interface TypographyProps\n extends HTMLAttributes<TypographyHTMLElement>,\n TypographyClassNameOptions {\n /**\n * The component to render as when the children are not a render function. If\n * this prop is omitted, the component will be determined by the `type` prop\n * where:\n *\n * - `\"headline-1\" -> <h1>`\n * - `\"headline-2\" -> <h2>`\n * - `\"headline-3\" -> <h3>`\n * - `\"headline-4\" -> <h4>`\n * - `\"headline-5\" -> <h5>`\n * - `\"headline-6\" -> <h6>`\n * - `\"subtitle-1\" -> <h5>`\n * - `\"subtitle-2\" -> <h6>`\n * - `\"body-1\" -> <p>`\n * - `\"body-2\" -> <p>`\n * - `\"caption\" -> <caption>`\n * - `\"overline\" -> <span>`\n */\n as?: CustomTypographyComponent;\n}\n\n/**\n * **Server Component**\n *\n * Render text with one of the material design typography styles applied and\n * optional styles like font-weight, font-style, text color, etc.\n *\n * @example\n * All Example\n * ```tsx\n * import { Typography } from \"@react-md/core\":\n *\n * export function Example() {\n * return (\n * <>\n * <Typography type=\"headline-1\">Headline 1</Typography>\n * <Typography type=\"headline-2\">Headline 2</Typography>\n * <Typography type=\"headline-3\">Headline 3</Typography>\n * <Typography type=\"headline-4\">Headline 4</Typography>\n * <Typography type=\"headline-5\">Headline 5</Typography>\n * <Typography type=\"headline-6\">Headline 6</Typography>\n * <Typography type=\"subtitle-1\">Subtitle 1</Typography>\n * <Typography type=\"subtitle-2\">Subtitle 2</Typography>\n * <Typography>\n * A paragraph of text.\n * </Typography>\n * <Typography type=\"body-1\">\n * A paragraph of text.\n * </Typography>\n * <Typography type=\"body-2\">\n * Another paragraph of text.\n * </Typography>\n * <Typography type=\"caption\" component=\"h5\">\n * Caption text\n * </Typography>\n * <Typography type=\"overline\" component=\"h5\">\n * Overline text\n * </Typography>\n * </>\n * ):\n * }\n * ```\n */\nexport const Typography = forwardRef<TypographyHTMLElement, TypographyProps>(\n function Typography(props, ref): ReactElement {\n const {\n as,\n type = \"body-1\",\n className,\n margin,\n fontStyle,\n fontWeight,\n textAlign,\n textColor,\n textDecoration,\n textTransform,\n textOverflow,\n children,\n ...remaining\n } = props;\n\n const Component = getComponent(as, type);\n return (\n <Component\n {...remaining}\n ref={ref}\n className={typography({\n type,\n margin,\n fontStyle,\n fontWeight,\n textAlign,\n textColor,\n textDecoration,\n textTransform,\n textOverflow,\n className,\n })}\n >\n {children}\n </Component>\n );\n }\n);\n"],"names":["cnb","forwardRef","cssUtils","typography","options","type","getComponent","as","Typography","props","ref","className","margin","fontStyle","fontWeight","textAlign","textColor","textDecoration","textTransform","textOverflow","children","remaining","Component"],"mappings":";AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SACEC,UAAU,QAIL,QAAQ;AACf,SAASC,QAAQ,QAAkC,iBAAiB;AAiDpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiFC,GACD,OAAO,SAASC,WACdC,UAA8C,CAAC,CAAC;IAEhD,MAAM,EAAEC,OAAO,QAAQ,EAAE,GAAGD;IAE5B,8EAA8E;IAC9E,qDAAqD;IACrD,OAAOJ,IACL,kBACAK,QAAQ,CAAC,gBAAgB,EAAEA,KAAK,CAAC,EACjCH,SAASE;AAEb;AAuBA,cAAc,GACd,SAASE,aACPC,EAAyC,EACzCF,IAAoB;IAEpB,IAAIE,IAAI;QACN,OAAOA;IACT;IAEA,OAAQF;QACN,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT,KAAK;QACL,KAAK;QACL,KAAK;YACH,OAAO;QACT,KAAK;QACL,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT;YACE,OAAO;IACX;AACF;AA0BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCC,GACD,OAAO,MAAMG,2BAAaP,WACxB,SAASO,WAAWC,KAAK,EAAEC,GAAG;IAC5B,MAAM,EACJH,EAAE,EACFF,OAAO,QAAQ,EACfM,SAAS,EACTC,MAAM,EACNC,SAAS,EACTC,UAAU,EACVC,SAAS,EACTC,SAAS,EACTC,cAAc,EACdC,aAAa,EACbC,YAAY,EACZC,QAAQ,EACR,GAAGC,WACJ,GAAGZ;IAEJ,MAAMa,YAAYhB,aAAaC,IAAIF;IACnC,qBACE,KAACiB;QACE,GAAGD,SAAS;QACbX,KAAKA;QACLC,WAAWR,WAAW;YACpBE;YACAO;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAR;QACF;kBAECS;;AAGP,GACA"}
|
|
@@ -4,6 +4,18 @@
|
|
|
4
4
|
@use "../utils";
|
|
5
5
|
|
|
6
6
|
$disable-text-container: false !default;
|
|
7
|
+
$disable-headline-1: false !default;
|
|
8
|
+
$disable-headline-2: false !default;
|
|
9
|
+
$disable-headline-3: false !default;
|
|
10
|
+
$disable-headline-4: false !default;
|
|
11
|
+
$disable-headline-5: false !default;
|
|
12
|
+
$disable-headline-6: false !default;
|
|
13
|
+
$disable-subtitle-1: false !default;
|
|
14
|
+
$disable-subtitle-2: false !default;
|
|
15
|
+
$disable-body-1: false !default;
|
|
16
|
+
$disable-body-2: false !default;
|
|
17
|
+
$disable-caption: false !default;
|
|
18
|
+
$disable-overline: false !default;
|
|
7
19
|
|
|
8
20
|
/// A small utility function to get the letter spacing based on tracking and
|
|
9
21
|
/// font-size
|
|
@@ -216,9 +228,13 @@ $button-recommended-styles: map.merge(
|
|
|
216
228
|
$base-font-styles,
|
|
217
229
|
(
|
|
218
230
|
font-size: 0.875rem,
|
|
219
|
-
line-height: 2.25rem,
|
|
220
231
|
font-weight: map.get($font-weights, medium),
|
|
221
232
|
letter-spacing: get-letter-spacing(1.25, 0.875),
|
|
233
|
+
line-height: 2.25rem,
|
|
234
|
+
// buttons with multiple lines of text look terrible because of the large
|
|
235
|
+
// line-height. You normally want to use a different component if the
|
|
236
|
+
// clickable area has so much content to line-wrap
|
|
237
|
+
line-wrap: nowrap,
|
|
222
238
|
)
|
|
223
239
|
);
|
|
224
240
|
$button-custom-styles: () !default;
|
|
@@ -276,52 +292,76 @@ $typography-variables: (line-length, text-container-padding);
|
|
|
276
292
|
.rmd-typography {
|
|
277
293
|
@include utils.map-to-styles($base-font-styles);
|
|
278
294
|
|
|
279
|
-
|
|
280
|
-
|
|
295
|
+
@if not $disable-headline-1 {
|
|
296
|
+
&--headline-1 {
|
|
297
|
+
@include utils.map-to-styles($headline-1-styles);
|
|
298
|
+
}
|
|
281
299
|
}
|
|
282
300
|
|
|
283
|
-
|
|
284
|
-
|
|
301
|
+
@if not $disable-headline-2 {
|
|
302
|
+
&--headline-2 {
|
|
303
|
+
@include utils.map-to-styles($headline-2-styles);
|
|
304
|
+
}
|
|
285
305
|
}
|
|
286
306
|
|
|
287
|
-
|
|
288
|
-
|
|
307
|
+
@if not $disable-headline-3 {
|
|
308
|
+
&--headline-3 {
|
|
309
|
+
@include utils.map-to-styles($headline-3-styles);
|
|
310
|
+
}
|
|
289
311
|
}
|
|
290
312
|
|
|
291
|
-
|
|
292
|
-
|
|
313
|
+
@if not $disable-headline-4 {
|
|
314
|
+
&--headline-4 {
|
|
315
|
+
@include utils.map-to-styles($headline-4-styles);
|
|
316
|
+
}
|
|
293
317
|
}
|
|
294
318
|
|
|
295
|
-
|
|
296
|
-
|
|
319
|
+
@if not $disable-headline-5 {
|
|
320
|
+
&--headline-5 {
|
|
321
|
+
@include utils.map-to-styles($headline-5-styles);
|
|
322
|
+
}
|
|
297
323
|
}
|
|
298
324
|
|
|
299
|
-
|
|
300
|
-
|
|
325
|
+
@if not $disable-headline-6 {
|
|
326
|
+
&--headline-6 {
|
|
327
|
+
@include utils.map-to-styles($headline-6-styles);
|
|
328
|
+
}
|
|
301
329
|
}
|
|
302
330
|
|
|
303
|
-
|
|
304
|
-
|
|
331
|
+
@if not $disable-subtitle-1 {
|
|
332
|
+
&--subtitle-1 {
|
|
333
|
+
@include utils.map-to-styles($subtitle-1-styles);
|
|
334
|
+
}
|
|
305
335
|
}
|
|
306
336
|
|
|
307
|
-
|
|
308
|
-
|
|
337
|
+
@if not $disable-subtitle-2 {
|
|
338
|
+
&--subtitle-2 {
|
|
339
|
+
@include utils.map-to-styles($subtitle-2-styles);
|
|
340
|
+
}
|
|
309
341
|
}
|
|
310
342
|
|
|
311
|
-
|
|
312
|
-
|
|
343
|
+
@if not $disable-body-1 {
|
|
344
|
+
&--body-1 {
|
|
345
|
+
@include utils.map-to-styles($body-1-styles);
|
|
346
|
+
}
|
|
313
347
|
}
|
|
314
348
|
|
|
315
|
-
|
|
316
|
-
|
|
349
|
+
@if not $disable-body-2 {
|
|
350
|
+
&--body-2 {
|
|
351
|
+
@include utils.map-to-styles($body-2-styles);
|
|
352
|
+
}
|
|
317
353
|
}
|
|
318
354
|
|
|
319
|
-
|
|
320
|
-
|
|
355
|
+
@if not $disable-caption {
|
|
356
|
+
&--caption {
|
|
357
|
+
@include utils.map-to-styles($caption-styles);
|
|
358
|
+
}
|
|
321
359
|
}
|
|
322
360
|
|
|
323
|
-
|
|
324
|
-
|
|
361
|
+
@if not $disable-overline {
|
|
362
|
+
&--overline {
|
|
363
|
+
@include utils.map-to-styles($overline-styles);
|
|
364
|
+
}
|
|
325
365
|
}
|
|
326
366
|
}
|
|
327
367
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-md/core",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.8",
|
|
4
4
|
"description": "The core components and functionality for react-md.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sass": "./dist/_core.scss",
|
|
@@ -60,15 +60,15 @@
|
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@jest/globals": "^29.7.0",
|
|
62
62
|
"@jest/types": "^29.6.3",
|
|
63
|
-
"@swc/cli": "^0.
|
|
64
|
-
"@swc/core": "1.3.
|
|
63
|
+
"@swc/cli": "^0.3.2",
|
|
64
|
+
"@swc/core": "1.3.106",
|
|
65
65
|
"@swc/jest": "^0.2.31",
|
|
66
66
|
"@testing-library/dom": "^9.3.4",
|
|
67
67
|
"@testing-library/jest-dom": "^6.3.0",
|
|
68
68
|
"@testing-library/react": "^14.1.2",
|
|
69
69
|
"@testing-library/user-event": "^14.5.2",
|
|
70
70
|
"@types/lodash": "^4.14.202",
|
|
71
|
-
"@types/node": "^20.11.
|
|
71
|
+
"@types/node": "^20.11.7",
|
|
72
72
|
"@types/react": "^18.2.48",
|
|
73
73
|
"@types/react-dom": "^18.2.18",
|
|
74
74
|
"chokidar": "^3.5.3",
|
|
@@ -90,12 +90,12 @@
|
|
|
90
90
|
"typescript": "^5.3.3"
|
|
91
91
|
},
|
|
92
92
|
"peerDependencies": {
|
|
93
|
-
"@jest/globals": "^29.
|
|
94
|
-
"@jest/types": "^29.6.
|
|
95
|
-
"@testing-library/dom": "^9.3.
|
|
96
|
-
"@testing-library/jest-dom": "^
|
|
97
|
-
"@testing-library/react": "^14.
|
|
98
|
-
"@testing-library/user-event": "^14.
|
|
93
|
+
"@jest/globals": "^29.7.0",
|
|
94
|
+
"@jest/types": "^29.6.3",
|
|
95
|
+
"@testing-library/dom": "^9.3.4",
|
|
96
|
+
"@testing-library/jest-dom": "^6.3.0",
|
|
97
|
+
"@testing-library/react": "^14.1.2",
|
|
98
|
+
"@testing-library/user-event": "^14.5.2",
|
|
99
99
|
"react": ">= 18",
|
|
100
100
|
"react-dom": ">= 18"
|
|
101
101
|
},
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
"dev": "npm-run-all --parallel build-esm-watch build-scss-watch build-types-watch",
|
|
133
133
|
"prepare-release": "npm-run-all clean-dist build",
|
|
134
134
|
"build": "npm-run-all build-esm build-scss build-types",
|
|
135
|
-
"build-esm": "swc
|
|
135
|
+
"build-esm": "swc -d ./dist --strip-leading-paths src",
|
|
136
136
|
"build-esm-watch": "pnpm run build-esm --watch",
|
|
137
137
|
"build-types": "tsc -P tsconfig.types.json",
|
|
138
138
|
"build-types-watch": "pnpm run build-types --watch",
|
package/src/_core.scss
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
@forward "icon/icon" as icon-*;
|
|
14
14
|
@forward "divider/divider" as divider-*;
|
|
15
15
|
@forward "progress/progress" as progress-*;
|
|
16
|
+
@forward "overlay/overlay" as overlay-*;
|
|
16
17
|
@forward "button/button" as button-*;
|
|
17
18
|
@forward "badge/badge" as badge-*;
|
|
18
19
|
@forward "tabs/tabs" as tabs-*;
|
|
@@ -21,7 +22,6 @@
|
|
|
21
22
|
@forward "table/table" as table-*;
|
|
22
23
|
@forward "app-bar/app-bar" as app-bar-*;
|
|
23
24
|
@forward "responsive-item/responsive-item" as responsive-item-*;
|
|
24
|
-
@forward "overlay/overlay" as overlay-*;
|
|
25
25
|
@forward "card/card" as card-*;
|
|
26
26
|
@forward "link/link" as link-*;
|
|
27
27
|
@forward "list/list" as list-*;
|
|
@@ -361,53 +361,59 @@ $_layer-order: (
|
|
|
361
361
|
@include typography.typography-variables;
|
|
362
362
|
}
|
|
363
363
|
|
|
364
|
-
@mixin styles
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
@
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
@
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
@
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
@include
|
|
381
|
-
@include
|
|
382
|
-
@include
|
|
383
|
-
@include
|
|
384
|
-
@include
|
|
385
|
-
@include
|
|
386
|
-
@include
|
|
387
|
-
@include
|
|
388
|
-
@include
|
|
389
|
-
@include
|
|
390
|
-
@include
|
|
391
|
-
@include
|
|
392
|
-
@include
|
|
393
|
-
@include
|
|
394
|
-
@include
|
|
395
|
-
@include
|
|
396
|
-
@include
|
|
397
|
-
@include
|
|
398
|
-
@include
|
|
399
|
-
@include
|
|
400
|
-
@include
|
|
364
|
+
@mixin styles(
|
|
365
|
+
$disable-layer: false,
|
|
366
|
+
$disable-layer-order: $disable-layer,
|
|
367
|
+
$disable-reset: false,
|
|
368
|
+
$disable-css-utils: false
|
|
369
|
+
) {
|
|
370
|
+
@if not $disable-layer-order {
|
|
371
|
+
@layer #{$_layer-order};
|
|
372
|
+
}
|
|
373
|
+
@if not $disable-reset {
|
|
374
|
+
@include css-reset;
|
|
375
|
+
}
|
|
376
|
+
@if not $disable-css-utils {
|
|
377
|
+
@include css-utils($disable-layer);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
@include app-bar.styles($disable-layer);
|
|
381
|
+
@include avatar.styles($disable-layer);
|
|
382
|
+
@include badge.styles($disable-layer);
|
|
383
|
+
@include box.styles($disable-layer);
|
|
384
|
+
@include button.styles($disable-layer);
|
|
385
|
+
@include card.styles($disable-layer);
|
|
386
|
+
@include chip.styles($disable-layer);
|
|
387
|
+
@include dialog.styles($disable-layer);
|
|
388
|
+
@include divider.styles($disable-layer);
|
|
389
|
+
@include draggable.styles($disable-layer);
|
|
390
|
+
@include expansion-panel.styles($disable-layer);
|
|
391
|
+
@include form.styles($disable-layer);
|
|
392
|
+
@include icon.styles($disable-layer);
|
|
393
|
+
@include interaction.styles($disable-layer);
|
|
394
|
+
@include layout.styles($disable-layer);
|
|
395
|
+
@include link.styles($disable-layer);
|
|
396
|
+
@include list.styles($disable-layer);
|
|
397
|
+
@include menu.styles($disable-layer);
|
|
398
|
+
@include overlay.styles($disable-layer);
|
|
399
|
+
@include progress.styles($disable-layer);
|
|
400
|
+
@include responsive-item.styles($disable-layer);
|
|
401
|
+
@include segmented-button.styles($disable-layer);
|
|
402
|
+
@include sheet.styles($disable-layer);
|
|
403
|
+
@include snackbar.styles($disable-layer);
|
|
404
|
+
@include table.styles($disable-layer);
|
|
405
|
+
@include tabs.styles($disable-layer);
|
|
406
|
+
@include tooltip.styles($disable-layer);
|
|
407
|
+
@include transition.transition-styles($disable-layer);
|
|
408
|
+
@include tree.styles($disable-layer);
|
|
409
|
+
@include typography.typography-styles($disable-layer);
|
|
410
|
+
@include window-splitter.styles($disable-layer);
|
|
401
411
|
|
|
402
412
|
@if not theme.$disable-default-root-theme {
|
|
403
413
|
:root {
|
|
404
414
|
@include variables;
|
|
405
415
|
|
|
406
|
-
@if
|
|
407
|
-
theme.$disable-default-system-theme and
|
|
408
|
-
theme.$color-scheme ==
|
|
409
|
-
system
|
|
410
|
-
{
|
|
416
|
+
@if theme.$color-scheme == system {
|
|
411
417
|
@media (prefers-color-scheme: dark) {
|
|
412
418
|
@include use-dark-theme;
|
|
413
419
|
}
|
package/src/badge/_badge.scss
CHANGED
|
@@ -69,31 +69,35 @@ $variables: (
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
@mixin use-light-theme {
|
|
72
|
-
@if $
|
|
73
|
-
$
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
@
|
|
72
|
+
@if not $disable-everything {
|
|
73
|
+
@if $light-theme-greyscale-background-color !=
|
|
74
|
+
$dark-theme-greyscale-background-color
|
|
75
|
+
{
|
|
76
|
+
@include set-var(
|
|
77
|
+
greyscale-background-color,
|
|
78
|
+
$light-theme-greyscale-background-color
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
@if $light-theme-greyscale-color != $dark-theme-greyscale-color {
|
|
82
|
+
@include set-var(greyscale-color, $light-theme-greyscale-color);
|
|
83
|
+
}
|
|
82
84
|
}
|
|
83
85
|
}
|
|
84
86
|
|
|
85
87
|
@mixin use-dark-theme {
|
|
86
|
-
@if $
|
|
87
|
-
$
|
|
88
|
-
{
|
|
89
|
-
@include set-var(
|
|
90
|
-
greyscale-background-color,
|
|
88
|
+
@if not $disable-everything {
|
|
89
|
+
@if $light-theme-greyscale-background-color !=
|
|
91
90
|
$dark-theme-greyscale-background-color
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
{
|
|
92
|
+
@include set-var(
|
|
93
|
+
greyscale-background-color,
|
|
94
|
+
$dark-theme-greyscale-background-color
|
|
95
|
+
);
|
|
96
|
+
}
|
|
94
97
|
|
|
95
|
-
|
|
96
|
-
|
|
98
|
+
@if $light-theme-greyscale-color != $dark-theme-greyscale-color {
|
|
99
|
+
@include set-var(greyscale-color, $dark-theme-greyscale-color);
|
|
100
|
+
}
|
|
97
101
|
}
|
|
98
102
|
}
|
|
99
103
|
|