@react-md/core 1.0.0-next.6 → 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.
Files changed (59) hide show
  1. package/.turbo/turbo-build.log +6 -6
  2. package/CHANGELOG.md +12 -0
  3. package/coverage/clover.xml +264 -389
  4. package/coverage/coverage-final.json +2 -3
  5. package/coverage/lcov-report/MenuItemCheckbox.tsx.html +223 -0
  6. package/coverage/lcov-report/MenuItemInputToggle.tsx.html +178 -232
  7. package/coverage/lcov-report/MenuItemRadio.tsx.html +436 -0
  8. package/coverage/lcov-report/SrOnly.tsx.html +328 -0
  9. package/coverage/lcov-report/Typography.tsx.html +1027 -0
  10. package/coverage/lcov-report/index.html +15 -30
  11. package/coverage/lcov-report/menuItemInputToggleStyles.ts.html +319 -0
  12. package/coverage/lcov.info +304 -436
  13. package/dist/_core.scss +49 -43
  14. package/dist/badge/_badge.scss +23 -19
  15. package/dist/form/MenuItemInputToggle.d.ts +2 -15
  16. package/dist/form/MenuItemInputToggle.js +26 -37
  17. package/dist/form/MenuItemInputToggle.js.map +1 -1
  18. package/dist/form/_form.scss +109 -87
  19. package/dist/form/menuItemInputToggleStyles.d.ts +39 -0
  20. package/dist/form/menuItemInputToggleStyles.js +31 -0
  21. package/dist/form/menuItemInputToggleStyles.js.map +1 -0
  22. package/dist/icon/_icon.scss +7 -5
  23. package/dist/index.d.ts +1 -0
  24. package/dist/index.js +1 -0
  25. package/dist/index.js.map +1 -1
  26. package/dist/interaction/_interaction.scss +56 -44
  27. package/dist/list/types.d.ts +10 -1
  28. package/dist/list/types.js.map +1 -1
  29. package/dist/menu/_menu.scss +1 -0
  30. package/dist/theme/_theme.scss +192 -34
  31. package/dist/typography/SrOnly.d.ts +3 -3
  32. package/dist/typography/SrOnly.js +4 -4
  33. package/dist/typography/SrOnly.js.map +1 -1
  34. package/dist/typography/Typography.d.ts +19 -19
  35. package/dist/typography/Typography.js +19 -19
  36. package/dist/typography/Typography.js.map +1 -1
  37. package/dist/typography/_typography.scss +65 -25
  38. package/package.json +11 -11
  39. package/src/_core.scss +49 -43
  40. package/src/badge/_badge.scss +23 -19
  41. package/src/button/__tests__/__snapshots__/Button.tsx.snap +1 -1
  42. package/src/form/MenuItemInputToggle.tsx +46 -64
  43. package/src/form/__tests__/MenuItemCheckbox.tsx +53 -0
  44. package/src/form/__tests__/MenuItemRadio.tsx +53 -0
  45. package/src/form/__tests__/__snapshots__/FileInput.tsx.snap +23 -23
  46. package/src/form/__tests__/__snapshots__/MenuItemCheckbox.tsx.snap +96 -0
  47. package/src/form/__tests__/__snapshots__/MenuItemRadio.tsx.snap +96 -0
  48. package/src/form/_form.scss +109 -87
  49. package/src/form/menuItemInputToggleStyles.ts +78 -0
  50. package/src/icon/_icon.scss +7 -5
  51. package/src/index.ts +1 -0
  52. package/src/interaction/_interaction.scss +56 -44
  53. package/src/list/types.ts +12 -1
  54. package/src/menu/_menu.scss +1 -0
  55. package/src/theme/_theme.scss +192 -34
  56. package/src/typography/SrOnly.tsx +9 -9
  57. package/src/typography/Typography.tsx +19 -19
  58. package/src/typography/__tests__/__snapshots__/SrOnly.tsx.snap +5 -5
  59. package/src/typography/_typography.scss +65 -25
@@ -37,6 +37,25 @@ $disable-dark-elevation: $color-scheme == light !default;
37
37
  $disable-default-system-theme: false !default;
38
38
  $disable-default-root-theme: false !default;
39
39
 
40
+ // this should only be used if your application does not use menu, dialog,
41
+ // sheet, card, expansion-panel, select, app-bar (theme="surface")
42
+ $disable-surface-color: false !default;
43
+ $disable-primary-color: false !default;
44
+ $disable-on-primary-color: $disable-primary-color !default;
45
+ $disable-secondary-color: false !default;
46
+ $disable-on-secondary-color: $disable-secondary-color !default;
47
+ $disable-warning-color: false !default;
48
+ $disable-on-warning-color: $disable-warning-color !default;
49
+ $disable-error-color: false !default;
50
+ $disable-on-error-color: $disable-error-color !default;
51
+ $disable-success-color: false !default;
52
+ $disable-on-success-color: $disable-success-color !default;
53
+ $disable-outline-grey-color: false !default;
54
+ $disable-text-primary-color: false !default;
55
+ $disable-text-secondary-color: false !default;
56
+ $disable-text-hint-color: false !default;
57
+ $disable-text-disabled-color: false !default;
58
+
40
59
  $primary-color: colors.$blue-500 !default;
41
60
  $on-primary-color: a11y.contrast-color($primary-color) !default;
42
61
  $secondary-color: colors.$orange-a-400 !default;
@@ -152,7 +171,79 @@ $theme-variables: (
152
171
  outline-grey-color
153
172
  );
154
173
 
174
+ @function _is-var-disabled($name) {
175
+ @if $name == surface-color {
176
+ @return $disable-surface-color;
177
+ }
178
+
179
+ @if $name == primary-color {
180
+ @return $disable-primary-color;
181
+ }
182
+
183
+ @if $name == on-primary-color {
184
+ @return $disable-on-primary-color;
185
+ }
186
+
187
+ @if $name == secondary-color {
188
+ @return $disable-secondary-color;
189
+ }
190
+
191
+ @if $name == on-secondary-color {
192
+ @return $disable-on-secondary-color;
193
+ }
194
+
195
+ @if $name == warning-color {
196
+ @return $disable-warning-color;
197
+ }
198
+
199
+ @if $name == on-warning-color {
200
+ @return $disable-on-warning-color;
201
+ }
202
+
203
+ @if $name == error-color {
204
+ @return $disable-error-color;
205
+ }
206
+
207
+ @if $name == on-error-color {
208
+ @return $disable-on-error-color;
209
+ }
210
+
211
+ @if $name == success-color {
212
+ @return $disable-success-color;
213
+ }
214
+
215
+ @if $name == on-success-color {
216
+ @return $disable-on-success-color;
217
+ }
218
+
219
+ @if $name == text-primary-color {
220
+ @return $disable-text-primary-color;
221
+ }
222
+
223
+ @if $name == text-secondary-color {
224
+ @return $disable-text-secondary-color;
225
+ }
226
+
227
+ @if $name == text-hint-color {
228
+ @return $disable-text-hint-color;
229
+ }
230
+
231
+ @if $name == text-disabled-color {
232
+ @return $disable-text-disabled-color;
233
+ }
234
+
235
+ @if $name == outline-grey-color {
236
+ @return $disable-outline-grey-color;
237
+ }
238
+
239
+ @return false;
240
+ }
241
+
155
242
  @function theme-get-var($name, $fallback: null) {
243
+ @if _is-var-disabled($name) {
244
+ @return $fallback;
245
+ }
246
+
156
247
  $var: utils.get-var-name($theme-variables, $name, "theme");
157
248
 
158
249
  @if $fallback {
@@ -175,6 +266,10 @@ $theme-variables: (
175
266
  }
176
267
 
177
268
  @mixin theme-set-var($name, $value-or-theme-name) {
269
+ @if _is-var-disabled($name) {
270
+ @error '"#{$name}" is currently disabled and cannot be changed. Set "$disable-#{$name}-var" to `true` or remove it from the Sass module overrides.';
271
+ }
272
+
178
273
  $var: utils.get-var-name($theme-variables, $name, "theme");
179
274
  $value: $value-or-theme-name;
180
275
  @if list.index($theme-variables, $value-or-theme-name) {
@@ -186,6 +281,10 @@ $theme-variables: (
186
281
  }
187
282
 
188
283
  @mixin theme-use-var($property, $name: $property, $fallback: null) {
284
+ @if _is-var-disabled($name) {
285
+ @error '"#{$name}" is currently disabled and cannot be changed. Set "$disable-#{$name}-var" to `true` or remove it from the Sass module overrides.';
286
+ }
287
+
189
288
  #{$property}: theme-get-var($name, $fallback);
190
289
  }
191
290
 
@@ -203,16 +302,27 @@ $theme-variables: (
203
302
 
204
303
  @mixin use-light-theme-colors {
205
304
  @include theme-set-var(background-color, $light-theme-background-color);
206
- @if $disable-dark-elevation {
305
+ @if $disable-dark-elevation and not $disable-surface-color {
207
306
  @include theme-set-var(surface-color, $light-theme-surface-color);
208
307
  }
209
- @include theme-set-var(text-primary-color, $light-theme-text-primary-color);
210
- @include theme-set-var(
211
- text-secondary-color,
212
- $light-theme-text-secondary-color
213
- );
214
- @include theme-set-var(text-hint-color, $light-theme-text-hint-color);
215
- @include theme-set-var(text-disabled-color, $light-theme-text-disabled-color);
308
+ @if not $disable-text-primary-color {
309
+ @include theme-set-var(text-primary-color, $light-theme-text-primary-color);
310
+ }
311
+ @if not $disable-text-secondary-color {
312
+ @include theme-set-var(
313
+ text-secondary-color,
314
+ $light-theme-text-secondary-color
315
+ );
316
+ }
317
+ @if not $disable-text-hint-color {
318
+ @include theme-set-var(text-hint-color, $light-theme-text-hint-color);
319
+ }
320
+ @if not $disable-text-disabled-color {
321
+ @include theme-set-var(
322
+ text-disabled-color,
323
+ $light-theme-text-disabled-color
324
+ );
325
+ }
216
326
 
217
327
  @if not $disable-dark-elevation and $color-scheme != light {
218
328
  @include use-light-theme-elevation-colors;
@@ -221,16 +331,27 @@ $theme-variables: (
221
331
 
222
332
  @mixin use-dark-theme-colors {
223
333
  @include theme-set-var(background-color, $dark-theme-background-color);
224
- @if $disable-dark-elevation {
334
+ @if $disable-dark-elevation and not $disable-surface-color {
225
335
  @include theme-set-var(surface-color, $dark-theme-surface-color);
226
336
  }
227
- @include theme-set-var(text-primary-color, $dark-theme-text-primary-color);
228
- @include theme-set-var(
229
- text-secondary-color,
230
- $dark-theme-text-secondary-color
231
- );
232
- @include theme-set-var(text-hint-color, $dark-theme-text-hint-color);
233
- @include theme-set-var(text-disabled-color, $dark-theme-text-disabled-color);
337
+ @if not $disable-text-primary-color {
338
+ @include theme-set-var(text-primary-color, $dark-theme-text-primary-color);
339
+ }
340
+ @if not $disable-text-secondary-color {
341
+ @include theme-set-var(
342
+ text-secondary-color,
343
+ $dark-theme-text-secondary-color
344
+ );
345
+ }
346
+ @if not $disable-text-hint-color {
347
+ @include theme-set-var(text-hint-color, $dark-theme-text-hint-color);
348
+ }
349
+ @if not $disable-text-disabled-color {
350
+ @include theme-set-var(
351
+ text-disabled-color,
352
+ $dark-theme-text-disabled-color
353
+ );
354
+ }
234
355
 
235
356
  @if not $disable-dark-elevation {
236
357
  @include use-dark-theme-elevation-colors;
@@ -239,24 +360,52 @@ $theme-variables: (
239
360
 
240
361
  @mixin theme-variables {
241
362
  @include theme-set-var(background-color, $background-color);
242
- @if $disable-dark-elevation {
363
+ @if $disable-dark-elevation and not $disable-surface-color {
243
364
  @include theme-set-var(surface-color, $surface-color);
244
365
  }
245
366
 
246
- @include theme-set-var(primary-color, $primary-color);
247
- @include theme-set-var(on-primary-color, $on-primary-color);
248
- @include theme-set-var(secondary-color, $secondary-color);
249
- @include theme-set-var(on-secondary-color, $on-secondary-color);
250
- @include theme-set-var(warning-color, $warning-color);
251
- @include theme-set-var(on-warning-color, $on-warning-color);
252
- @include theme-set-var(error-color, $error-color);
253
- @include theme-set-var(on-error-color, $on-error-color);
254
- @include theme-set-var(success-color, $success-color);
255
- @include theme-set-var(on-success-color, $on-success-color);
256
- @include theme-set-var(text-primary-color, $text-primary-color);
257
- @include theme-set-var(text-secondary-color, $text-secondary-color);
258
- @include theme-set-var(text-hint-color, $text-hint-color);
259
- @include theme-set-var(text-disabled-color, $text-disabled-color);
367
+ @if not $disable-primary-color {
368
+ @include theme-set-var(primary-color, $primary-color);
369
+ }
370
+ @if not $disable-on-primary-color {
371
+ @include theme-set-var(on-primary-color, $on-primary-color);
372
+ }
373
+ @if not $disable-secondary-color {
374
+ @include theme-set-var(secondary-color, $secondary-color);
375
+ }
376
+ @if not $disable-on-secondary-color {
377
+ @include theme-set-var(on-secondary-color, $on-secondary-color);
378
+ }
379
+ @if not $disable-warning-color {
380
+ @include theme-set-var(warning-color, $warning-color);
381
+ }
382
+ @if not $disable-on-warning-color {
383
+ @include theme-set-var(on-warning-color, $on-warning-color);
384
+ }
385
+ @if not $disable-error-color {
386
+ @include theme-set-var(error-color, $error-color);
387
+ }
388
+ @if not $disable-on-error-color {
389
+ @include theme-set-var(on-error-color, $on-error-color);
390
+ }
391
+ @if not $disable-success-color {
392
+ @include theme-set-var(success-color, $success-color);
393
+ }
394
+ @if not $disable-on-success-color {
395
+ @include theme-set-var(on-success-color, $on-success-color);
396
+ }
397
+ @if not $disable-text-primary-color {
398
+ @include theme-set-var(text-primary-color, $text-primary-color);
399
+ }
400
+ @if not $disable-text-secondary-color {
401
+ @include theme-set-var(text-secondary-color, $text-secondary-color);
402
+ }
403
+ @if not $disable-text-hint-color {
404
+ @include theme-set-var(text-hint-color, $text-hint-color);
405
+ }
406
+ @if not $disable-text-disabled-color {
407
+ @include theme-set-var(text-disabled-color, $text-disabled-color);
408
+ }
260
409
 
261
410
  @if not $disable-dark-elevation {
262
411
  @if $color-scheme == dark {
@@ -268,7 +417,9 @@ $theme-variables: (
268
417
 
269
418
  @include theme-set-var(outline-width, $outline-width);
270
419
  @include theme-set-var(outline-color, $outline-color);
271
- @include theme-set-var(outline-grey-color, $outline-grey-color);
420
+ @if not $disable-outline-grey-color {
421
+ @include theme-set-var(outline-grey-color, $outline-grey-color);
422
+ }
272
423
  }
273
424
 
274
425
  @mixin create-surface($z-value, $disable-colors: $disable-dark-elevation) {
@@ -278,7 +429,9 @@ $theme-variables: (
278
429
  @if not $disable-colors {
279
430
  @include theme-set-var(background-color, theme-get-var(surface-color));
280
431
  @include theme-use-var(background-color);
281
- @include theme-use-var(color, text-primary-color);
432
+ @if not $disable-text-primary-color {
433
+ @include theme-use-var(color, text-primary-color);
434
+ }
282
435
  }
283
436
  }
284
437
 
@@ -351,7 +504,12 @@ $theme-variables: (
351
504
  }
352
505
 
353
506
  @mixin default-system-theme {
354
- @if not $disable-default-system-theme and $color-scheme == system {
507
+ @if not
508
+ $disable-default-system-theme and
509
+ $disable-default-root-theme and
510
+ $color-scheme ==
511
+ system
512
+ {
355
513
  @media (prefers-color-scheme: dark) {
356
514
  :root {
357
515
  @content;
@@ -1,6 +1,6 @@
1
- /// <reference types="react" />
2
- import { type CustomTypographyComponent, type TypographyHTMLElement, type TypographyProps } from "./Typography.js";
3
- export interface SrOnlyProps extends TypographyProps {
1
+ import { type HTMLAttributes } from "react";
2
+ import { type CustomTypographyComponent, type TypographyHTMLElement } from "./Typography.js";
3
+ export interface SrOnlyProps extends HTMLAttributes<TypographyHTMLElement> {
4
4
  /** @defaultValue `"span"` */
5
5
  as?: CustomTypographyComponent;
6
6
  /**
@@ -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
- return /*#__PURE__*/ _jsx(Typography, {
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 {\n Typography,\n type CustomTypographyComponent,\n type TypographyHTMLElement,\n type TypographyProps,\n} from \"./Typography.js\";\nimport { cssUtils } from \"../cssUtils.js\";\n\nexport interface SrOnlyProps extends TypographyProps {\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 = \"span\",\n className,\n phoneOnly,\n focusable,\n children,\n tabIndex,\n ...remaining\n } = props;\n\n return (\n <Typography\n {...remaining}\n as={as}\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 </Typography>\n );\n }\n);\n"],"names":["forwardRef","Typography","cssUtils","SrOnly","props","ref","as","className","phoneOnly","focusable","children","tabIndex","remaining","undefined","srOnly"],"mappings":";AAAA,SAASA,UAAU,QAAQ,QAAQ;AACnC,SACEC,UAAU,QAIL,kBAAkB;AACzB,SAASC,QAAQ,QAAQ,iBAAiB;AAuB1C;;;;;;;;;;;;;;;;;;;;;;CAsBC,GACD,OAAO,MAAMC,uBAASH,WACpB,SAASG,OAAOC,KAAK,EAAEC,GAAG;IACxB,MAAM,EACJC,KAAK,MAAM,EACXC,SAAS,EACTC,SAAS,EACTC,SAAS,EACTC,QAAQ,EACRC,QAAQ,EACR,GAAGC,WACJ,GAAGR;IAEJ,qBACE,KAACH;QACE,GAAGW,SAAS;QACbN,IAAIA;QACJD,KAAKA;QACLM,UAAUA,YAAaF,CAAAA,YAAY,IAAII,SAAQ;QAC/CN,WAAWL,SAAS;YAClBY,QAAQL,YAAY,cAAcD,YAAY,UAAU;YACxDD;QACF;kBAECG;;AAGP,GACA"}
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 { getTypographyClassName } from "@react-md/core";
39
+ * import { typography } from "@react-md/core";
40
40
  *
41
41
  * function Example() {
42
42
  * return (
43
43
  * <>
44
- * <h1 className={getTypographyClassName({ type: "headline-1" })} />
45
- * <h2 className={getTypographyClassName({ type: "headline-2" })} />
46
- * <h3 className={getTypographyClassName({ type: "headline-3" })} />
47
- * <h4 className={getTypographyClassName({ type: "headline-4" })} />
48
- * <h5 className={getTypographyClassName({ type: "headline-5" })} />
49
- * <h6 className={getTypographyClassName({ type: "headline-6" })} />
50
- * <h5 className={getTypographyClassName({ type: "subtitle-1" })} />
51
- * <h6 className={getTypographyClassName({ type: "subtitle-2" })} />
52
- * <p className={getTypographyClassName()} />
53
- * <p className={getTypographyClassName({ type "body-1" })} />
54
- * <p className={getTypographyClassName({ type "body-1" })} />
55
- * <caption className={getTypographyClassName({ type: "caption" })} />
56
- * <span className={getTypographyClassName({ type: "overline" })} />
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 { getTypography } from "@react-md/core";
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={getTypographyClassName({
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={getTypographyClassName({
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={getTypographyClassName({
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={getTypographyClassName({
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 { getTypographyClassName } from "@react-md/core";
13
+ * import { typography } from "@react-md/core";
14
14
  *
15
15
  * function Example() {
16
16
  * return (
17
17
  * <>
18
- * <h1 className={getTypographyClassName({ type: "headline-1" })} />
19
- * <h2 className={getTypographyClassName({ type: "headline-2" })} />
20
- * <h3 className={getTypographyClassName({ type: "headline-3" })} />
21
- * <h4 className={getTypographyClassName({ type: "headline-4" })} />
22
- * <h5 className={getTypographyClassName({ type: "headline-5" })} />
23
- * <h6 className={getTypographyClassName({ type: "headline-6" })} />
24
- * <h5 className={getTypographyClassName({ type: "subtitle-1" })} />
25
- * <h6 className={getTypographyClassName({ type: "subtitle-2" })} />
26
- * <p className={getTypographyClassName()} />
27
- * <p className={getTypographyClassName({ type "body-1" })} />
28
- * <p className={getTypographyClassName({ type "body-1" })} />
29
- * <caption className={getTypographyClassName({ type: "caption" })} />
30
- * <span className={getTypographyClassName({ type: "overline" })} />
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 { getTypography } from "@react-md/core";
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={getTypographyClassName({
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={getTypographyClassName({
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={getTypographyClassName({
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={getTypographyClassName({
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"}