@salutejs/plasma-new-hope 0.317.0-canary.1880.14214278787.0 → 0.317.0-canary.1880.14216408760.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.
Files changed (145) hide show
  1. package/cjs/engines/linaria.js +4 -2
  2. package/cjs/engines/linaria.js.map +1 -1
  3. package/emotion/cjs/components/Typography/Typography.template-doc.mdx +16 -0
  4. package/emotion/cjs/examples/typography/components/Body/Body.stories.tsx +4 -1
  5. package/emotion/cjs/examples/typography/components/Dspl/Dspl.stories.tsx +4 -1
  6. package/emotion/cjs/examples/typography/components/Heading/Heading.stories.tsx +4 -1
  7. package/emotion/cjs/examples/typography/components/Text/Text.stories.tsx +4 -1
  8. package/emotion/es/components/Typography/Typography.template-doc.mdx +16 -0
  9. package/emotion/es/examples/typography/components/Body/Body.stories.tsx +4 -1
  10. package/emotion/es/examples/typography/components/Dspl/Dspl.stories.tsx +4 -1
  11. package/emotion/es/examples/typography/components/Heading/Heading.stories.tsx +4 -1
  12. package/emotion/es/examples/typography/components/Text/Text.stories.tsx +4 -1
  13. package/es/engines/linaria.js +4 -2
  14. package/es/engines/linaria.js.map +1 -1
  15. package/package.json +2 -2
  16. package/styled-components/cjs/components/Typography/Typography.template-doc.mdx +16 -0
  17. package/styled-components/cjs/examples/typography/components/Body/Body.stories.tsx +4 -1
  18. package/styled-components/cjs/examples/typography/components/Dspl/Dspl.stories.tsx +4 -1
  19. package/styled-components/cjs/examples/typography/components/Heading/Heading.stories.tsx +4 -1
  20. package/styled-components/cjs/examples/typography/components/Text/Text.stories.tsx +4 -1
  21. package/styled-components/es/components/Typography/Typography.template-doc.mdx +16 -0
  22. package/styled-components/es/examples/typography/components/Body/Body.stories.tsx +4 -1
  23. package/styled-components/es/examples/typography/components/Dspl/Dspl.stories.tsx +4 -1
  24. package/styled-components/es/examples/typography/components/Heading/Heading.stories.tsx +4 -1
  25. package/styled-components/es/examples/typography/components/Text/Text.stories.tsx +4 -1
  26. package/types/components/Typography/Body/Body.d.ts +2 -2
  27. package/types/components/Typography/Body/Body.d.ts.map +1 -1
  28. package/types/components/Typography/Dspl/Dspl.d.ts +2 -2
  29. package/types/components/Typography/Dspl/Dspl.d.ts.map +1 -1
  30. package/types/components/Typography/Heading/Heading.d.ts +2 -2
  31. package/types/components/Typography/Heading/Heading.d.ts.map +1 -1
  32. package/types/components/Typography/Text/Text.d.ts +2 -2
  33. package/types/components/Typography/Text/Text.d.ts.map +1 -1
  34. package/types/components/Typography/Typography.d.ts +1 -1
  35. package/types/components/Typography/Typography.d.ts.map +1 -1
  36. package/types/components/Typography/Typography.types.d.ts +2 -1
  37. package/types/components/Typography/Typography.types.d.ts.map +1 -1
  38. package/emotion/cjs/examples/typography/components/Old/Body/Body.config.js +0 -20
  39. package/emotion/cjs/examples/typography/components/Old/Body/Body.js +0 -11
  40. package/emotion/cjs/examples/typography/components/Old/Body/Body.stories.tsx +0 -40
  41. package/emotion/cjs/examples/typography/components/Old/Button/Button.config.js +0 -19
  42. package/emotion/cjs/examples/typography/components/Old/Button/Button.js +0 -11
  43. package/emotion/cjs/examples/typography/components/Old/Button/Button.stories.tsx +0 -40
  44. package/emotion/cjs/examples/typography/components/Old/Caption/Caption.config.js +0 -18
  45. package/emotion/cjs/examples/typography/components/Old/Caption/Caption.js +0 -11
  46. package/emotion/cjs/examples/typography/components/Old/Caption/Caption.stories.tsx +0 -40
  47. package/emotion/cjs/examples/typography/components/Old/Display/Display.config.js +0 -20
  48. package/emotion/cjs/examples/typography/components/Old/Display/Display.js +0 -11
  49. package/emotion/cjs/examples/typography/components/Old/Display/Display.stories.tsx +0 -40
  50. package/emotion/cjs/examples/typography/components/Old/Footnote/Footnote.config.js +0 -19
  51. package/emotion/cjs/examples/typography/components/Old/Footnote/Footnote.js +0 -11
  52. package/emotion/cjs/examples/typography/components/Old/Footnote/Footnote.stories.tsx +0 -40
  53. package/emotion/cjs/examples/typography/components/Old/Headline/Headline.config.js +0 -21
  54. package/emotion/cjs/examples/typography/components/Old/Headline/Headline.js +0 -11
  55. package/emotion/cjs/examples/typography/components/Old/Headline/Headline.stories.tsx +0 -40
  56. package/emotion/cjs/examples/typography/components/Old/Paragraph/Paragraph.config.js +0 -19
  57. package/emotion/cjs/examples/typography/components/Old/Paragraph/Paragraph.js +0 -11
  58. package/emotion/cjs/examples/typography/components/Old/Paragraph/Paragraph.stories.tsx +0 -42
  59. package/emotion/cjs/examples/typography/components/Old/Subtitle/Subtitle.config.js +0 -18
  60. package/emotion/cjs/examples/typography/components/Old/Subtitle/Subtitle.js +0 -11
  61. package/emotion/cjs/examples/typography/components/Old/Subtitle/Subtitle.stories.tsx +0 -39
  62. package/emotion/cjs/examples/typography/components/Old/Underline/Underline.config.js +0 -18
  63. package/emotion/cjs/examples/typography/components/Old/Underline/Underline.js +0 -11
  64. package/emotion/cjs/examples/typography/components/Old/Underline/Underline.stories.tsx +0 -40
  65. package/emotion/es/examples/typography/components/Old/Body/Body.config.js +0 -14
  66. package/emotion/es/examples/typography/components/Old/Body/Body.js +0 -5
  67. package/emotion/es/examples/typography/components/Old/Body/Body.stories.tsx +0 -40
  68. package/emotion/es/examples/typography/components/Old/Button/Button.config.js +0 -13
  69. package/emotion/es/examples/typography/components/Old/Button/Button.js +0 -5
  70. package/emotion/es/examples/typography/components/Old/Button/Button.stories.tsx +0 -40
  71. package/emotion/es/examples/typography/components/Old/Caption/Caption.config.js +0 -12
  72. package/emotion/es/examples/typography/components/Old/Caption/Caption.js +0 -5
  73. package/emotion/es/examples/typography/components/Old/Caption/Caption.stories.tsx +0 -40
  74. package/emotion/es/examples/typography/components/Old/Display/Display.config.js +0 -14
  75. package/emotion/es/examples/typography/components/Old/Display/Display.js +0 -5
  76. package/emotion/es/examples/typography/components/Old/Display/Display.stories.tsx +0 -40
  77. package/emotion/es/examples/typography/components/Old/Footnote/Footnote.config.js +0 -13
  78. package/emotion/es/examples/typography/components/Old/Footnote/Footnote.js +0 -5
  79. package/emotion/es/examples/typography/components/Old/Footnote/Footnote.stories.tsx +0 -40
  80. package/emotion/es/examples/typography/components/Old/Headline/Headline.config.js +0 -15
  81. package/emotion/es/examples/typography/components/Old/Headline/Headline.js +0 -5
  82. package/emotion/es/examples/typography/components/Old/Headline/Headline.stories.tsx +0 -40
  83. package/emotion/es/examples/typography/components/Old/Paragraph/Paragraph.config.js +0 -13
  84. package/emotion/es/examples/typography/components/Old/Paragraph/Paragraph.js +0 -5
  85. package/emotion/es/examples/typography/components/Old/Paragraph/Paragraph.stories.tsx +0 -42
  86. package/emotion/es/examples/typography/components/Old/Subtitle/Subtitle.config.js +0 -12
  87. package/emotion/es/examples/typography/components/Old/Subtitle/Subtitle.js +0 -5
  88. package/emotion/es/examples/typography/components/Old/Subtitle/Subtitle.stories.tsx +0 -39
  89. package/emotion/es/examples/typography/components/Old/Underline/Underline.config.js +0 -12
  90. package/emotion/es/examples/typography/components/Old/Underline/Underline.js +0 -5
  91. package/emotion/es/examples/typography/components/Old/Underline/Underline.stories.tsx +0 -40
  92. package/styled-components/cjs/examples/typography/components/Old/Body/Body.config.js +0 -20
  93. package/styled-components/cjs/examples/typography/components/Old/Body/Body.js +0 -11
  94. package/styled-components/cjs/examples/typography/components/Old/Body/Body.stories.tsx +0 -40
  95. package/styled-components/cjs/examples/typography/components/Old/Button/Button.config.js +0 -19
  96. package/styled-components/cjs/examples/typography/components/Old/Button/Button.js +0 -11
  97. package/styled-components/cjs/examples/typography/components/Old/Button/Button.stories.tsx +0 -40
  98. package/styled-components/cjs/examples/typography/components/Old/Caption/Caption.config.js +0 -18
  99. package/styled-components/cjs/examples/typography/components/Old/Caption/Caption.js +0 -11
  100. package/styled-components/cjs/examples/typography/components/Old/Caption/Caption.stories.tsx +0 -40
  101. package/styled-components/cjs/examples/typography/components/Old/Display/Display.config.js +0 -20
  102. package/styled-components/cjs/examples/typography/components/Old/Display/Display.js +0 -11
  103. package/styled-components/cjs/examples/typography/components/Old/Display/Display.stories.tsx +0 -40
  104. package/styled-components/cjs/examples/typography/components/Old/Footnote/Footnote.config.js +0 -19
  105. package/styled-components/cjs/examples/typography/components/Old/Footnote/Footnote.js +0 -11
  106. package/styled-components/cjs/examples/typography/components/Old/Footnote/Footnote.stories.tsx +0 -40
  107. package/styled-components/cjs/examples/typography/components/Old/Headline/Headline.config.js +0 -21
  108. package/styled-components/cjs/examples/typography/components/Old/Headline/Headline.js +0 -11
  109. package/styled-components/cjs/examples/typography/components/Old/Headline/Headline.stories.tsx +0 -40
  110. package/styled-components/cjs/examples/typography/components/Old/Paragraph/Paragraph.config.js +0 -19
  111. package/styled-components/cjs/examples/typography/components/Old/Paragraph/Paragraph.js +0 -11
  112. package/styled-components/cjs/examples/typography/components/Old/Paragraph/Paragraph.stories.tsx +0 -42
  113. package/styled-components/cjs/examples/typography/components/Old/Subtitle/Subtitle.config.js +0 -18
  114. package/styled-components/cjs/examples/typography/components/Old/Subtitle/Subtitle.js +0 -11
  115. package/styled-components/cjs/examples/typography/components/Old/Subtitle/Subtitle.stories.tsx +0 -39
  116. package/styled-components/cjs/examples/typography/components/Old/Underline/Underline.config.js +0 -18
  117. package/styled-components/cjs/examples/typography/components/Old/Underline/Underline.js +0 -11
  118. package/styled-components/cjs/examples/typography/components/Old/Underline/Underline.stories.tsx +0 -40
  119. package/styled-components/es/examples/typography/components/Old/Body/Body.config.js +0 -14
  120. package/styled-components/es/examples/typography/components/Old/Body/Body.js +0 -5
  121. package/styled-components/es/examples/typography/components/Old/Body/Body.stories.tsx +0 -40
  122. package/styled-components/es/examples/typography/components/Old/Button/Button.config.js +0 -13
  123. package/styled-components/es/examples/typography/components/Old/Button/Button.js +0 -5
  124. package/styled-components/es/examples/typography/components/Old/Button/Button.stories.tsx +0 -40
  125. package/styled-components/es/examples/typography/components/Old/Caption/Caption.config.js +0 -12
  126. package/styled-components/es/examples/typography/components/Old/Caption/Caption.js +0 -5
  127. package/styled-components/es/examples/typography/components/Old/Caption/Caption.stories.tsx +0 -40
  128. package/styled-components/es/examples/typography/components/Old/Display/Display.config.js +0 -14
  129. package/styled-components/es/examples/typography/components/Old/Display/Display.js +0 -5
  130. package/styled-components/es/examples/typography/components/Old/Display/Display.stories.tsx +0 -40
  131. package/styled-components/es/examples/typography/components/Old/Footnote/Footnote.config.js +0 -13
  132. package/styled-components/es/examples/typography/components/Old/Footnote/Footnote.js +0 -5
  133. package/styled-components/es/examples/typography/components/Old/Footnote/Footnote.stories.tsx +0 -40
  134. package/styled-components/es/examples/typography/components/Old/Headline/Headline.config.js +0 -15
  135. package/styled-components/es/examples/typography/components/Old/Headline/Headline.js +0 -5
  136. package/styled-components/es/examples/typography/components/Old/Headline/Headline.stories.tsx +0 -40
  137. package/styled-components/es/examples/typography/components/Old/Paragraph/Paragraph.config.js +0 -13
  138. package/styled-components/es/examples/typography/components/Old/Paragraph/Paragraph.js +0 -5
  139. package/styled-components/es/examples/typography/components/Old/Paragraph/Paragraph.stories.tsx +0 -42
  140. package/styled-components/es/examples/typography/components/Old/Subtitle/Subtitle.config.js +0 -12
  141. package/styled-components/es/examples/typography/components/Old/Subtitle/Subtitle.js +0 -5
  142. package/styled-components/es/examples/typography/components/Old/Subtitle/Subtitle.stories.tsx +0 -39
  143. package/styled-components/es/examples/typography/components/Old/Underline/Underline.config.js +0 -12
  144. package/styled-components/es/examples/typography/components/Old/Underline/Underline.js +0 -5
  145. package/styled-components/es/examples/typography/components/Old/Underline/Underline.stories.tsx +0 -40
@@ -12,7 +12,7 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
12
12
 
13
13
  var React__default = /*#__PURE__*/_interopDefault(React);
14
14
 
15
- var _excluded = ["className"];
15
+ var _excluded = ["className", "as", "forwardedAs"];
16
16
  /* eslint-disable no-underscore-dangle */
17
17
  var _component = function _component(componentConfig) {
18
18
  var tag = componentConfig.tag,
@@ -21,9 +21,10 @@ var _component = function _component(componentConfig) {
21
21
  intersections = componentConfig.intersections;
22
22
  var staticVariants = utils.getStaticVariants(componentConfig);
23
23
  var dynamicVariants = utils.getDynamicVariants(componentConfig);
24
- var Root = tag;
25
24
  var component = /*#__PURE__*/React.forwardRef(function (props, ref) {
26
25
  var className = props.className,
26
+ as = props.as,
27
+ forwardedAs = props.forwardedAs,
27
28
  rest = _rollupPluginBabelHelpers.objectWithoutProperties(props, _excluded);
28
29
  var variants = dynamicVariants(rest);
29
30
  var intersectionStyles = utils.getIntersectionStyles(rest, intersections);
@@ -51,6 +52,7 @@ var _component = function _component(componentConfig) {
51
52
  }
52
53
  }
53
54
  }
55
+ var Root = as || forwardedAs || tag;
54
56
  return /*#__PURE__*/React__default.default.createElement(Root, _rollupPluginBabelHelpers.extends({
55
57
  className: cls
56
58
  }, htmlAttrs, baseProps));
@@ -1 +1 @@
1
- {"version":3,"file":"linaria.js","sources":["../../src/engines/linaria.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { cx } from '@linaria/core';\n\n// TODO: #1008 Избавиться от импортов и переделать addFocus\nimport 'focus-visible';\nimport { getStaticVariants, getDynamicVariants, getIntersectionStyles } from './utils';\nimport type { ComponentConfig, HTMLAnyAttributes } from './types';\n\n/* eslint-disable no-underscore-dangle */\nexport const _component = (componentConfig: ComponentConfig) => {\n const { tag, base, name, intersections } = componentConfig;\n const staticVariants = getStaticVariants(componentConfig);\n const dynamicVariants = getDynamicVariants(componentConfig);\n\n const Root = tag as React.ElementType;\n\n const component = forwardRef<HTMLElement, HTMLAnyAttributes>((props, ref) => {\n const { className, ...rest } = props;\n const variants = dynamicVariants(rest);\n const intersectionStyles = getIntersectionStyles(rest, intersections);\n\n const cls = cx(className, base as string, ...(staticVariants as string[]), ...variants, ...intersectionStyles);\n\n // styled-components do it inside\n // filter props\n const baseProps: HTMLAnyAttributes = {};\n for (const key in rest) {\n if (!(key in componentConfig.variations)) {\n baseProps[key] = rest[key];\n }\n }\n\n baseProps.ref = ref;\n\n // styled-components do it inside\n // add props that should be attr( disabled for example)\n const htmlAttrs: HTMLAnyAttributes = {};\n for (const key in componentConfig.variations || {}) {\n if (key in rest) {\n const variant = componentConfig.variations[key];\n\n const { attrs } = variant;\n if (typeof attrs === 'boolean') {\n htmlAttrs[key] = rest[key];\n }\n }\n }\n\n return <Root className={cls} {...htmlAttrs} {...baseProps} />;\n });\n if (name) {\n component.displayName = name;\n }\n return component;\n};\n"],"names":["_component","componentConfig","tag","base","name","intersections","staticVariants","getStaticVariants","dynamicVariants","getDynamicVariants","Root","component","forwardRef","props","ref","className","rest","_objectWithoutProperties","_excluded","variants","intersectionStyles","getIntersectionStyles","cls","cx","apply","concat","_toConsumableArray","baseProps","key","variations","htmlAttrs","variant","attrs","React","createElement","_extends","displayName"],"mappings":";;;;;;;;;;;;;;;AAQA;IACaA,UAAU,GAAG,SAAbA,UAAUA,CAAIC,eAAgC,EAAK;AAC5D,EAAA,IAAQC,GAAG,GAAgCD,eAAe,CAAlDC,GAAG;IAAEC,IAAI,GAA0BF,eAAe,CAA7CE,IAAI;IAAEC,IAAI,GAAoBH,eAAe,CAAvCG,IAAI;IAAEC,aAAa,GAAKJ,eAAe,CAAjCI,aAAa,CAAA;AACtC,EAAA,IAAMC,cAAc,GAAGC,uBAAiB,CAACN,eAAe,CAAC,CAAA;AACzD,EAAA,IAAMO,eAAe,GAAGC,wBAAkB,CAACR,eAAe,CAAC,CAAA;EAE3D,IAAMS,IAAI,GAAGR,GAAwB,CAAA;EAErC,IAAMS,SAAS,gBAAGC,gBAAU,CAAiC,UAACC,KAAK,EAAEC,GAAG,EAAK;AACzE,IAAA,IAAQC,SAAS,GAAcF,KAAK,CAA5BE,SAAS;AAAKC,MAAAA,IAAI,GAAAC,iDAAA,CAAKJ,KAAK,EAAAK,SAAA,CAAA,CAAA;AACpC,IAAA,IAAMC,QAAQ,GAAGX,eAAe,CAACQ,IAAI,CAAC,CAAA;AACtC,IAAA,IAAMI,kBAAkB,GAAGC,2BAAqB,CAACL,IAAI,EAAEX,aAAa,CAAC,CAAA;IAErE,IAAMiB,GAAG,GAAGC,OAAE,CAAAC,KAAA,CAAC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AW,GAAGhC,IAAI,CAAA;AAChC,GAAA;AACA,EAAA,OAAOO,SAAS,CAAA;AACpB;;;;"}
1
+ {"version":3,"file":"linaria.js","sources":["../../src/engines/linaria.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { cx } from '@linaria/core';\n\n// TODO: #1008 Избавиться от импортов и переделать addFocus\nimport 'focus-visible';\nimport { getStaticVariants, getDynamicVariants, getIntersectionStyles } from './utils';\nimport type { ComponentConfig, HTMLAnyAttributes } from './types';\n\n/* eslint-disable no-underscore-dangle */\nexport const _component = (componentConfig: ComponentConfig) => {\n const { tag, base, name, intersections } = componentConfig;\n const staticVariants = getStaticVariants(componentConfig);\n const dynamicVariants = getDynamicVariants(componentConfig);\n\n const component = forwardRef<HTMLElement, HTMLAnyAttributes>((props, ref) => {\n const { className, as, forwardedAs, ...rest } = props;\n const variants = dynamicVariants(rest);\n const intersectionStyles = getIntersectionStyles(rest, intersections);\n\n const cls = cx(className, base as string, ...(staticVariants as string[]), ...variants, ...intersectionStyles);\n\n // styled-components do it inside\n // filter props\n const baseProps: HTMLAnyAttributes = {};\n for (const key in rest) {\n if (!(key in componentConfig.variations)) {\n baseProps[key] = rest[key];\n }\n }\n\n baseProps.ref = ref;\n\n // styled-components do it inside\n // add props that should be attr( disabled for example)\n const htmlAttrs: HTMLAnyAttributes = {};\n for (const key in componentConfig.variations || {}) {\n if (key in rest) {\n const variant = componentConfig.variations[key];\n\n const { attrs } = variant;\n if (typeof attrs === 'boolean') {\n htmlAttrs[key] = rest[key];\n }\n }\n }\n\n const Root = as || forwardedAs || (tag as React.ElementType);\n\n return <Root className={cls} {...htmlAttrs} {...baseProps} />;\n });\n if (name) {\n component.displayName = name;\n }\n return component;\n};\n"],"names":["_component","componentConfig","tag","base","name","intersections","staticVariants","getStaticVariants","dynamicVariants","getDynamicVariants","component","forwardRef","props","ref","className","as","forwardedAs","rest","_objectWithoutProperties","_excluded","variants","intersectionStyles","getIntersectionStyles","cls","cx","apply","concat","_toCon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,IAAI,EAAE;AACpB,MAAA,IAAI,EAAEY,GAAG,IAAI5B,eAAe,CAAC6B,UAAU,CAAC,EAAE;AACtCF,QAAAA,SAAS,CAACC,GAAG,CAAC,GAAGZ,IAAI,CAACY,GAAG,CAAC,CAAA;AAC9B,OAAA;AACJ,KAAA;IAEAD,SAAS,CAACf,GAAG,GAAGA,GAAG,CAAA;;AAEnB;AACA;IACA,IAAMkB,SAA4B,GAAG,EAAE,CAAA;IACvC,KAAK,IAAMF,IAAG,IAAI5B,eAAe,CAAC6B,UAAU,IAAI,EAAE,EAAE;MAChD,IAAID,IAAG,IAAIZ,IAAI,EAAE;AACb,QAAA,IAAMe,OAAO,GAAG/B,eAAe,CAAC6B,UAAU,CAACD,IAAG,CAAC,CAAA;AAE/C,QAAA,IAAQI,KAAK,GAAKD,OAAO,CAAjBC,KAAK,CAAA;AACb,QAAA,IAAI,OAAOA,KAAK,KAAK,SAAS,EAAE;AAC5BF,UAAAA,SAAS,CAACF,IAAG,CAAC,GAAGZ,IAAI,CAACY,IAAG,CAAC,CAAA;AAC9B,SAAA;AACJ,OAAA;AACJ,KAAA;AAEA,IAAA,IAAMK,IAAI,GAAGnB,EAAE,IAAIC,WAAW,IAAKd,GAAyB,CAAA;AAE5D,IAAA,oBAAOiC,sBAAA,CAAAC,aAAA,CAACF,IAAI,EAAAG,iCAAA,CAAA;AAACvB,MAAAA,SAAS,EAAES,GAAAA;AAAI,KAAA,EAAKQ,SAAS,EAAMH,SAAS,CAAG,CAAC,CAAA;AACjE,GAAC,CAAC,CAAA;AACF,EAAA,IAAIxB,IAAI,EAAE;IACNM,SAAS,CAAC4B,WAAW,GAAGlC,IAAI,CAAA;AAChC,GAAA;AACA,EAAA,OAAOM,SAAS,CAAA;AACpB;;;;"}
@@ -23,6 +23,22 @@ title: Typography
23
23
  По умолчанию в типографике если текст превышает ширину элемента, то слова будут переноситься по пробелам.
24
24
  Чтобы запретить перенос по пробелам, необходимо установить свойство `noWrap` в значении `true`.
25
25
 
26
+ ## Смена тега
27
+ Если при использовании компонентов необходимо сменить тег, то можно использовать свойство `as`:
28
+
29
+ ```tsx live
30
+ import React from 'react';
31
+ import { BodyM } from '@salutejs/{{ package }}';
32
+
33
+ export function App() {
34
+ return (
35
+ <BodyM as="h3">
36
+ BodyM
37
+ </BodyM>
38
+ );
39
+ }
40
+ ```
41
+
26
42
  ## Состав
27
43
 
28
44
  ### Hero unit
@@ -9,7 +9,7 @@ import { Body } from './Body';
9
9
  import { config } from './Body.config';
10
10
 
11
11
  const meta: Meta<typeof Body> = {
12
- title: 'Data Display/Typography/Body',
12
+ title: 'typography/Body',
13
13
  decorators: [WithTheme],
14
14
  component: Body,
15
15
  argTypes: {
@@ -19,6 +19,9 @@ const meta: Meta<typeof Body> = {
19
19
  type: 'color',
20
20
  },
21
21
  },
22
+ as: {
23
+ control: 'text',
24
+ },
22
25
  },
23
26
  args: {
24
27
  noWrap: false,
@@ -9,7 +9,7 @@ import { Dspl } from './Dspl';
9
9
  import { config } from './Dspl.config';
10
10
 
11
11
  const meta: Meta<typeof Dspl> = {
12
- title: 'Data Display/Typography/Dspl',
12
+ title: 'typography/Dspl',
13
13
  decorators: [WithTheme],
14
14
  component: Dspl,
15
15
  argTypes: {
@@ -19,6 +19,9 @@ const meta: Meta<typeof Dspl> = {
19
19
  type: 'color',
20
20
  },
21
21
  },
22
+ as: {
23
+ control: 'text',
24
+ },
22
25
  },
23
26
  args: {
24
27
  noWrap: false,
@@ -9,7 +9,7 @@ import { Heading } from './Heading';
9
9
  import { config } from './Heading.config';
10
10
 
11
11
  const meta: Meta<typeof Heading> = {
12
- title: 'Data Display/Typography/Heading',
12
+ title: 'typography/Heading',
13
13
  decorators: [WithTheme],
14
14
  component: Heading,
15
15
  argTypes: {
@@ -19,6 +19,9 @@ const meta: Meta<typeof Heading> = {
19
19
  type: 'color',
20
20
  },
21
21
  },
22
+ as: {
23
+ control: 'text',
24
+ },
22
25
  },
23
26
  args: {
24
27
  noWrap: false,
@@ -9,7 +9,7 @@ import { Text } from './Text';
9
9
  import { config } from './Text.config';
10
10
 
11
11
  const meta: Meta<typeof Text> = {
12
- title: 'Data Display/Typography/Text',
12
+ title: 'typography/Text',
13
13
  decorators: [WithTheme],
14
14
  component: Text,
15
15
  argTypes: {
@@ -19,6 +19,9 @@ const meta: Meta<typeof Text> = {
19
19
  type: 'color',
20
20
  },
21
21
  },
22
+ as: {
23
+ control: 'text',
24
+ },
22
25
  },
23
26
  args: {
24
27
  noWrap: false,
@@ -23,6 +23,22 @@ title: Typography
23
23
  По умолчанию в типографике если текст превышает ширину элемента, то слова будут переноситься по пробелам.
24
24
  Чтобы запретить перенос по пробелам, необходимо установить свойство `noWrap` в значении `true`.
25
25
 
26
+ ## Смена тега
27
+ Если при использовании компонентов необходимо сменить тег, то можно использовать свойство `as`:
28
+
29
+ ```tsx live
30
+ import React from 'react';
31
+ import { BodyM } from '@salutejs/{{ package }}';
32
+
33
+ export function App() {
34
+ return (
35
+ <BodyM as="h3">
36
+ BodyM
37
+ </BodyM>
38
+ );
39
+ }
40
+ ```
41
+
26
42
  ## Состав
27
43
 
28
44
  ### Hero unit
@@ -9,7 +9,7 @@ import { Body } from './Body';
9
9
  import { config } from './Body.config';
10
10
 
11
11
  const meta: Meta<typeof Body> = {
12
- title: 'Data Display/Typography/Body',
12
+ title: 'typography/Body',
13
13
  decorators: [WithTheme],
14
14
  component: Body,
15
15
  argTypes: {
@@ -19,6 +19,9 @@ const meta: Meta<typeof Body> = {
19
19
  type: 'color',
20
20
  },
21
21
  },
22
+ as: {
23
+ control: 'text',
24
+ },
22
25
  },
23
26
  args: {
24
27
  noWrap: false,
@@ -9,7 +9,7 @@ import { Dspl } from './Dspl';
9
9
  import { config } from './Dspl.config';
10
10
 
11
11
  const meta: Meta<typeof Dspl> = {
12
- title: 'Data Display/Typography/Dspl',
12
+ title: 'typography/Dspl',
13
13
  decorators: [WithTheme],
14
14
  component: Dspl,
15
15
  argTypes: {
@@ -19,6 +19,9 @@ const meta: Meta<typeof Dspl> = {
19
19
  type: 'color',
20
20
  },
21
21
  },
22
+ as: {
23
+ control: 'text',
24
+ },
22
25
  },
23
26
  args: {
24
27
  noWrap: false,
@@ -9,7 +9,7 @@ import { Heading } from './Heading';
9
9
  import { config } from './Heading.config';
10
10
 
11
11
  const meta: Meta<typeof Heading> = {
12
- title: 'Data Display/Typography/Heading',
12
+ title: 'typography/Heading',
13
13
  decorators: [WithTheme],
14
14
  component: Heading,
15
15
  argTypes: {
@@ -19,6 +19,9 @@ const meta: Meta<typeof Heading> = {
19
19
  type: 'color',
20
20
  },
21
21
  },
22
+ as: {
23
+ control: 'text',
24
+ },
22
25
  },
23
26
  args: {
24
27
  noWrap: false,
@@ -9,7 +9,7 @@ import { Text } from './Text';
9
9
  import { config } from './Text.config';
10
10
 
11
11
  const meta: Meta<typeof Text> = {
12
- title: 'Data Display/Typography/Text',
12
+ title: 'typography/Text',
13
13
  decorators: [WithTheme],
14
14
  component: Text,
15
15
  argTypes: {
@@ -19,6 +19,9 @@ const meta: Meta<typeof Text> = {
19
19
  type: 'color',
20
20
  },
21
21
  },
22
+ as: {
23
+ control: 'text',
24
+ },
22
25
  },
23
26
  args: {
24
27
  noWrap: false,
@@ -4,7 +4,7 @@ import { cx } from '@linaria/core';
4
4
  import 'focus-visible';
5
5
  import { getIntersectionStyles, getStaticVariants, getDynamicVariants } from './utils.js';
6
6
 
7
- var _excluded = ["className"];
7
+ var _excluded = ["className", "as", "forwardedAs"];
8
8
  /* eslint-disable no-underscore-dangle */
9
9
  var _component = function _component(componentConfig) {
10
10
  var tag = componentConfig.tag,
@@ -13,9 +13,10 @@ var _component = function _component(componentConfig) {
13
13
  intersections = componentConfig.intersections;
14
14
  var staticVariants = getStaticVariants(componentConfig);
15
15
  var dynamicVariants = getDynamicVariants(componentConfig);
16
- var Root = tag;
17
16
  var component = /*#__PURE__*/forwardRef(function (props, ref) {
18
17
  var className = props.className,
18
+ as = props.as,
19
+ forwardedAs = props.forwardedAs,
19
20
  rest = _objectWithoutProperties(props, _excluded);
20
21
  var variants = dynamicVariants(rest);
21
22
  var intersectionStyles = getIntersectionStyles(rest, intersections);
@@ -43,6 +44,7 @@ var _component = function _component(componentConfig) {
43
44
  }
44
45
  }
45
46
  }
47
+ var Root = as || forwardedAs || tag;
46
48
  return /*#__PURE__*/React.createElement(Root, _extends({
47
49
  className: cls
48
50
  }, htmlAttrs, baseProps));
@@ -1 +1 @@
1
- {"version":3,"file":"linaria.js","sources":["../../src/engines/linaria.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { cx } from '@linaria/core';\n\n// TODO: #1008 Избавиться от импортов и переделать addFocus\nimport 'focus-visible';\nimport { getStaticVariants, getDynamicVariants, getIntersectionStyles } from './utils';\nimport type { ComponentConfig, HTMLAnyAttributes } from './types';\n\n/* eslint-disable no-underscore-dangle */\nexport const _component = (componentConfig: ComponentConfig) => {\n const { tag, base, name, intersections } = componentConfig;\n const staticVariants = getStaticVariants(componentConfig);\n const dynamicVariants = getDynamicVariants(componentConfig);\n\n const Root = tag as React.ElementType;\n\n const component = forwardRef<HTMLElement, HTMLAnyAttributes>((props, ref) => {\n const { className, ...rest } = props;\n const variants = dynamicVariants(rest);\n const intersectionStyles = getIntersectionStyles(rest, intersections);\n\n const cls = cx(className, base as string, ...(staticVariants as string[]), ...variants, ...intersectionStyles);\n\n // styled-components do it inside\n // filter props\n const baseProps: HTMLAnyAttributes = {};\n for (const key in rest) {\n if (!(key in componentConfig.variations)) {\n baseProps[key] = rest[key];\n }\n }\n\n baseProps.ref = ref;\n\n // styled-components do it inside\n // add props that should be attr( disabled for example)\n const htmlAttrs: HTMLAnyAttributes = {};\n for (const key in componentConfig.variations || {}) {\n if (key in rest) {\n const variant = componentConfig.variations[key];\n\n const { attrs } = variant;\n if (typeof attrs === 'boolean') {\n htmlAttrs[key] = rest[key];\n }\n }\n }\n\n return <Root className={cls} {...htmlAttrs} {...baseProps} />;\n });\n if (name) {\n component.displayName = name;\n }\n return component;\n};\n"],"names":["_component","componentConfig","tag","base","name","intersections","staticVariants","getStaticVariants","dynamicVariants","getDynamicVariants","Root","component","forwardRef","props","ref","className","rest","_objectWithoutProperties","_excluded","variants","intersectionStyles","getIntersectionStyles","cls","cx","apply","concat","_toConsumableArray","baseProps","key","variations","htmlAttrs","variant","attrs","React","createElement","_extends","displayName"],"mappings":";;;;;;;AAQA;IACaA,UAAU,GAAG,SAAbA,UAAUA,CAAIC,eAAgC,EAAK;AAC5D,EAAA,IAAQC,GAAG,GAAgCD,eAAe,CAAlDC,GAAG;IAAEC,IAAI,GAA0BF,eAAe,CAA7CE,IAAI;IAAEC,IAAI,GAAoBH,eAAe,CAAvCG,IAAI;IAAEC,aAAa,GAAKJ,eAAe,CAAjCI,aAAa,CAAA;AACtC,EAAA,IAAMC,cAAc,GAAGC,iBAAiB,CAACN,eAAe,CAAC,CAAA;AACzD,EAAA,IAAMO,eAAe,GAAGC,kBAAkB,CAACR,eAAe,CAAC,CAAA;EAE3D,IAAMS,IAAI,GAAGR,GAAwB,CAAA;EAErC,IAAMS,SAAS,gBAAGC,UAAU,CAAiC,UAACC,KAAK,EAAEC,GAAG,EAAK;AACzE,IAAA,IAAQC,SAAS,GAAcF,KAAK,CAA5BE,SAAS;AAAKC,MAAAA,IAAI,GAAAC,wBAAA,CAAKJ,KAAK,EAAAK,SAAA,CAAA,CAAA;AACpC,IAAA,IAAMC,QAAQ,GAAGX,eAAe,CAACQ,IAAI,CAAC,CAAA;AACtC,IAAA,IAAMI,kBAAkB,GAAGC,qBAAqB,CAACL,IAAI,EAAEX,aAAa,CAAC,CAAA;IAErE,IAAMiB,GAAG,GAAGC,EAAE,CAAAC,KAAA,CAACT,KAAAA,CAAAA,EAAAA,CAAAA,SAAS,EAAEZ,IAAI,CAAAsB,CAAAA,MAAA,CAAAC,kBAAA,CAAgBpB,cAAc,CAAA,EAAAoB,kBAAA,CAAkBP,QAAQ,CAAAO,EAAAA,kBAAA,CAAKN,kBAAkB,CAAC,CAAA,CAAA,CAAA;;AAE9G;AACA;IACA,IAAMO,SAA4B,GAAG,EAAE,CAAA;AACvC,IAAA,KAAK,IAAMC,GAAG,IAAIZ,IAAI,EAAE;AACpB,MAAA,IAAI,EAAEY,GAAG,IAAI3B,eAAe,CAAC4B,UAAU,CAAC,EAAE;AACtCF,QAAAA,SAAS,CAACC,GAAG,CAAC,GAAGZ,IAAI,CAACY,GAAG,CAAC,CAAA;AAC9B,OAAA;AACJ,KAAA;IAEAD,SAAS,CAACb,GAAG,GAAGA,GAAG,CAAA;;AAEnB;AACA;IACA,IAAMgB,SAA4B,GAAG,EAAE,CAAA;IACvC,KAAK,IAAMF,IAAG,IAAI3B,eAAe,CAAC4B,UAAU,IAAI,EAAE,EAAE;MAChD,IAAID,IAAG,IAAIZ,IAAI,EAAE;AACb,QAAA,IAAMe,OAAO,GAAG9B,eAAe,CAAC4B,UAAU,CAACD,IAAG,CAAC,CAAA;AAE/C,QAAA,IAAQI,KAAK,GAAKD,OAAO,CAAjBC,KAAK,CAAA;AACb,QAAA,IAAI,OAAOA,KAAK,KAAK,SAAS,EAAE;AAC5BF,UAAAA,SAAS,CAACF,IAAG,CAAC,GAAGZ,IAAI,CAACY,IAAG,CAAC,CAAA;AAC9B,SAAA;AACJ,OAAA;AACJ,KAAA;AAEA,IAAA,oBAAOK,KAAA,CAAAC,aAAA,CAACxB,IAAI,EAAAyB,QAAA,CAAA;AAACpB,MAAAA,SAAS,EAAEO,GAAAA;AAAI,KAAA,EAAKQ,SAAS,EAAMH,SAAS,CAAG,CAAC,CAAA;AACjE,GAAC,CAAC,CAAA;AACF,EAAA,IAAIvB,IAAI,EAAE;IACNO,SAAS,CAACyB,WAAW,GAAGhC,IAAI,CAAA;AAChC,GAAA;AACA,EAAA,OAAOO,SAAS,CAAA;AACpB;;;;"}
1
+ {"version":3,"file":"linaria.js","sources":["../../src/engines/linaria.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { cx } from '@linaria/core';\n\n// TODO: #1008 Избавиться от импортов и переделать addFocus\nimport 'focus-visible';\nimport { getStaticVariants, getDynamicVariants, getIntersectionStyles } from './utils';\nimport type { ComponentConfig, HTMLAnyAttributes } from './types';\n\n/* eslint-disable no-underscore-dangle */\nexport const _component = (componentConfig: ComponentConfig) => {\n const { tag, base, name, intersections } = componentConfig;\n const staticVariants = getStaticVariants(componentConfig);\n const dynamicVariants = getDynamicVariants(componentConfig);\n\n const component = forwardRef<HTMLElement, HTMLAnyAttributes>((props, ref) => {\n const { className, as, forwardedAs, ...rest } = props;\n const variants = dynamicVariants(rest);\n const intersectionStyles = getIntersectionStyles(rest, intersections);\n\n const cls = cx(className, base as string, ...(staticVariants as string[]), ...variants, ...intersectionStyles);\n\n // styled-components do it inside\n // filter props\n const baseProps: HTMLAnyAttributes = {};\n for (const key in rest) {\n if (!(key in componentConfig.variations)) {\n baseProps[key] = rest[key];\n }\n }\n\n baseProps.ref = ref;\n\n // styled-components do it inside\n // add props that should be attr( disabled for example)\n const htmlAttrs: HTMLAnyAttributes = {};\n for (const key in componentConfig.variations || {}) {\n if (key in rest) {\n const variant = componentConfig.variations[key];\n\n const { attrs } = variant;\n if (typeof attrs === 'boolean') {\n htmlAttrs[key] = rest[key];\n }\n }\n }\n\n const Root = as || forwardedAs || (tag as React.ElementType);\n\n return <Root className={cls} {...htmlAttrs} {...baseProps} />;\n });\n if (name) {\n component.displayName = name;\n }\n return component;\n};\n"],"names":["_component","componentConfig","tag","base","name","intersections","staticVariants","getStaticVariants","dynamicVariants","getDynamicVariants","component","forwardRef","props","ref","className","as","forwardedAs","rest","_objectWithoutProperties","_excluded","variants","intersectionStyles","getIntersectionStyles","cls","cx","apply","concat","_toConsumableArray","baseProps","key","variations","htmlAttrs","variant","attrs","Root","React","createElement","_extends","displayName"],"mappings":";;;;;;;AAQA;IACaA,UAAU,GAAG,SAAbA,UAAUA,CAAIC,eAAgC,EAAK;AAC5D,EAAA,IAAQC,GAAG,GAAgCD,eAAe,CAAlDC,GAAG;I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S,CAACf,GAAG,GAAGA,GAAG,CAAA;;AAEnB;AACA;IACA,IAAMkB,SAA4B,GAAG,EAAE,CAAA;IACvC,KAAK,IAAMF,IAAG,IAAI5B,eAAe,CAAC6B,UAAU,IAAI,EAAE,EAAE;MAChD,IAAID,IAAG,IAAIZ,IAAI,EAAE;AACb,QAAA,IAAMe,OAAO,GAAG/B,eAAe,CAAC6B,UAAU,CAACD,IAAG,CAAC,CAAA;AAE/C,QAAA,IAAQI,KAAK,GAAKD,OAAO,CAAjBC,KAAK,CAAA;AACb,QAAA,IAAI,OAAOA,KAAK,KAAK,SAAS,EAAE;AAC5BF,UAAAA,SAAS,CAACF,IAAG,CAAC,GAAGZ,IAAI,CAACY,IAAG,CAAC,CAAA;AAC9B,SAAA;AACJ,OAAA;AACJ,KAAA;AAEA,IAAA,IAAMK,IAAI,GAAGnB,EAAE,IAAIC,WAAW,IAAKd,GAAyB,CAAA;AAE5D,IAAA,oBAAOiC,KAAA,CAAAC,aAAA,CAACF,IAAI,EAAAG,QAAA,CAAA;AAACvB,MAAAA,SAAS,EAAES,GAAAA;AAAI,KAAA,EAAKQ,SAAS,EAAMH,SAAS,CAAG,CAAC,CAAA;AACjE,GAAC,CAAC,CAAA;AACF,EAAA,IAAIxB,IAAI,EAAE;IACNM,SAAS,CAAC4B,WAAW,GAAGlC,IAAI,CAAA;AAChC,GAAA;AACA,EAAA,OAAOM,SAAS,CAAA;AACpB;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salutejs/plasma-new-hope",
3
- "version": "0.317.0-canary.1880.14214278787.0",
3
+ "version": "0.317.0-canary.1880.14216408760.0",
4
4
  "description": "Salute Design System blueprint",
5
5
  "main": "cjs/index.js",
6
6
  "module": "es/index.js",
@@ -135,5 +135,5 @@
135
135
  "sideEffects": [
136
136
  "*.css"
137
137
  ],
138
- "gitHead": "78f90a1a287b1e1ba3ed06f75719a0728ba22cd2"
138
+ "gitHead": "2f4a64d5682e0557525c982c03cfa937a84c751c"
139
139
  }
@@ -23,6 +23,22 @@ title: Typography
23
23
  По умолчанию в типографике если текст превышает ширину элемента, то слова будут переноситься по пробелам.
24
24
  Чтобы запретить перенос по пробелам, необходимо установить свойство `noWrap` в значении `true`.
25
25
 
26
+ ## Смена тега
27
+ Если при использовании компонентов необходимо сменить тег, то можно использовать свойство `as`:
28
+
29
+ ```tsx live
30
+ import React from 'react';
31
+ import { BodyM } from '@salutejs/{{ package }}';
32
+
33
+ export function App() {
34
+ return (
35
+ <BodyM as="h3">
36
+ BodyM
37
+ </BodyM>
38
+ );
39
+ }
40
+ ```
41
+
26
42
  ## Состав
27
43
 
28
44
  ### Hero unit
@@ -9,7 +9,7 @@ import { Body } from './Body';
9
9
  import { config } from './Body.config';
10
10
 
11
11
  const meta: Meta<typeof Body> = {
12
- title: 'Data Display/Typography/Body',
12
+ title: 'typography/Body',
13
13
  decorators: [WithTheme],
14
14
  component: Body,
15
15
  argTypes: {
@@ -19,6 +19,9 @@ const meta: Meta<typeof Body> = {
19
19
  type: 'color',
20
20
  },
21
21
  },
22
+ as: {
23
+ control: 'text',
24
+ },
22
25
  },
23
26
  args: {
24
27
  noWrap: false,
@@ -9,7 +9,7 @@ import { Dspl } from './Dspl';
9
9
  import { config } from './Dspl.config';
10
10
 
11
11
  const meta: Meta<typeof Dspl> = {
12
- title: 'Data Display/Typography/Dspl',
12
+ title: 'typography/Dspl',
13
13
  decorators: [WithTheme],
14
14
  component: Dspl,
15
15
  argTypes: {
@@ -19,6 +19,9 @@ const meta: Meta<typeof Dspl> = {
19
19
  type: 'color',
20
20
  },
21
21
  },
22
+ as: {
23
+ control: 'text',
24
+ },
22
25
  },
23
26
  args: {
24
27
  noWrap: false,
@@ -9,7 +9,7 @@ import { Heading } from './Heading';
9
9
  import { config } from './Heading.config';
10
10
 
11
11
  const meta: Meta<typeof Heading> = {
12
- title: 'Data Display/Typography/Heading',
12
+ title: 'typography/Heading',
13
13
  decorators: [WithTheme],
14
14
  component: Heading,
15
15
  argTypes: {
@@ -19,6 +19,9 @@ const meta: Meta<typeof Heading> = {
19
19
  type: 'color',
20
20
  },
21
21
  },
22
+ as: {
23
+ control: 'text',
24
+ },
22
25
  },
23
26
  args: {
24
27
  noWrap: false,
@@ -9,7 +9,7 @@ import { Text } from './Text';
9
9
  import { config } from './Text.config';
10
10
 
11
11
  const meta: Meta<typeof Text> = {
12
- title: 'Data Display/Typography/Text',
12
+ title: 'typography/Text',
13
13
  decorators: [WithTheme],
14
14
  component: Text,
15
15
  argTypes: {
@@ -19,6 +19,9 @@ const meta: Meta<typeof Text> = {
19
19
  type: 'color',
20
20
  },
21
21
  },
22
+ as: {
23
+ control: 'text',
24
+ },
22
25
  },
23
26
  args: {
24
27
  noWrap: false,
@@ -23,6 +23,22 @@ title: Typography
23
23
  По умолчанию в типографике если текст превышает ширину элемента, то слова будут переноситься по пробелам.
24
24
  Чтобы запретить перенос по пробелам, необходимо установить свойство `noWrap` в значении `true`.
25
25
 
26
+ ## Смена тега
27
+ Если при использовании компонентов необходимо сменить тег, то можно использовать свойство `as`:
28
+
29
+ ```tsx live
30
+ import React from 'react';
31
+ import { BodyM } from '@salutejs/{{ package }}';
32
+
33
+ export function App() {
34
+ return (
35
+ <BodyM as="h3">
36
+ BodyM
37
+ </BodyM>
38
+ );
39
+ }
40
+ ```
41
+
26
42
  ## Состав
27
43
 
28
44
  ### Hero unit
@@ -9,7 +9,7 @@ import { Body } from './Body';
9
9
  import { config } from './Body.config';
10
10
 
11
11
  const meta: Meta<typeof Body> = {
12
- title: 'Data Display/Typography/Body',
12
+ title: 'typography/Body',
13
13
  decorators: [WithTheme],
14
14
  component: Body,
15
15
  argTypes: {
@@ -19,6 +19,9 @@ const meta: Meta<typeof Body> = {
19
19
  type: 'color',
20
20
  },
21
21
  },
22
+ as: {
23
+ control: 'text',
24
+ },
22
25
  },
23
26
  args: {
24
27
  noWrap: false,
@@ -9,7 +9,7 @@ import { Dspl } from './Dspl';
9
9
  import { config } from './Dspl.config';
10
10
 
11
11
  const meta: Meta<typeof Dspl> = {
12
- title: 'Data Display/Typography/Dspl',
12
+ title: 'typography/Dspl',
13
13
  decorators: [WithTheme],
14
14
  component: Dspl,
15
15
  argTypes: {
@@ -19,6 +19,9 @@ const meta: Meta<typeof Dspl> = {
19
19
  type: 'color',
20
20
  },
21
21
  },
22
+ as: {
23
+ control: 'text',
24
+ },
22
25
  },
23
26
  args: {
24
27
  noWrap: false,
@@ -9,7 +9,7 @@ import { Heading } from './Heading';
9
9
  import { config } from './Heading.config';
10
10
 
11
11
  const meta: Meta<typeof Heading> = {
12
- title: 'Data Display/Typography/Heading',
12
+ title: 'typography/Heading',
13
13
  decorators: [WithTheme],
14
14
  component: Heading,
15
15
  argTypes: {
@@ -19,6 +19,9 @@ const meta: Meta<typeof Heading> = {
19
19
  type: 'color',
20
20
  },
21
21
  },
22
+ as: {
23
+ control: 'text',
24
+ },
22
25
  },
23
26
  args: {
24
27
  noWrap: false,
@@ -9,7 +9,7 @@ import { Text } from './Text';
9
9
  import { config } from './Text.config';
10
10
 
11
11
  const meta: Meta<typeof Text> = {
12
- title: 'Data Display/Typography/Text',
12
+ title: 'typography/Text',
13
13
  decorators: [WithTheme],
14
14
  component: Text,
15
15
  argTypes: {
@@ -19,6 +19,9 @@ const meta: Meta<typeof Text> = {
19
19
  type: 'color',
20
20
  },
21
21
  },
22
+ as: {
23
+ control: 'text',
24
+ },
22
25
  },
23
26
  args: {
24
27
  noWrap: false,
@@ -5,7 +5,7 @@ export declare const bodyRoot: (Root: import("../../..").RootProps<HTMLDivElemen
5
5
  noWrap?: boolean | undefined;
6
6
  breakWord?: boolean | undefined;
7
7
  color?: string | undefined;
8
- } & import("../../..").SpacingProps & import("../Typography.types").BoldProps & import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
8
+ } & import("../../..").SpacingProps & import("../Typography.types").BoldProps & import("../../..").AsProps<any> & import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
9
9
  export declare const bodyConfig: {
10
10
  name: string;
11
11
  tag: string;
@@ -13,7 +13,7 @@ export declare const bodyConfig: {
13
13
  noWrap?: boolean | undefined;
14
14
  breakWord?: boolean | undefined;
15
15
  color?: string | undefined;
16
- } & import("../../..").SpacingProps & import("../Typography.types").BoldProps & import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
16
+ } & import("../../..").SpacingProps & import("../Typography.types").BoldProps & import("../../..").AsProps<any> & import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
17
17
  base: import("@linaria/core").LinariaClassName;
18
18
  variations: {
19
19
  size: {
@@ -1 +1 @@
1
- {"version":3,"file":"Body.d.ts","sourceRoot":"","sources":["../../../../src/components/Typography/Body/Body.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAIrD,oBAAY,SAAS,GAAG,SAAS,CAAC;AAElC,eAAO,MAAM,QAAQ;;;;+KAA0B,CAAC;AAEhD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;CAatB,CAAC"}
1
+ {"version":3,"file":"Body.d.ts","sourceRoot":"","sources":["../../../../src/components/Typography/Body/Body.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAIrD,oBAAY,SAAS,GAAG,SAAS,CAAC;AAElC,eAAO,MAAM,QAAQ;;;;iNAA0B,CAAC;AAEhD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;CAatB,CAAC"}
@@ -5,7 +5,7 @@ export declare const dsplRoot: (Root: import("../../..").RootProps<HTMLDivElemen
5
5
  noWrap?: boolean | undefined;
6
6
  breakWord?: boolean | undefined;
7
7
  color?: string | undefined;
8
- } & import("../../..").SpacingProps & import("../Typography.types").BoldProps & import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
8
+ } & import("../../..").SpacingProps & import("../Typography.types").BoldProps & import("../../..").AsProps<any> & import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
9
9
  export declare const dsplConfig: {
10
10
  name: string;
11
11
  tag: string;
@@ -13,7 +13,7 @@ export declare const dsplConfig: {
13
13
  noWrap?: boolean | undefined;
14
14
  breakWord?: boolean | undefined;
15
15
  color?: string | undefined;
16
- } & import("../../..").SpacingProps & import("../Typography.types").BoldProps & import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
16
+ } & import("../../..").SpacingProps & import("../Typography.types").BoldProps & import("../../..").AsProps<any> & import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
17
17
  base: import("@linaria/core").LinariaClassName;
18
18
  variations: {
19
19
  size: {
@@ -1 +1 @@
1
- {"version":3,"file":"Dspl.d.ts","sourceRoot":"","sources":["../../../../src/components/Typography/Dspl/Dspl.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAIrD,oBAAY,SAAS,GAAG,SAAS,CAAC;AAElC,eAAO,MAAM,QAAQ;;;;+KAA+C,CAAC;AAErE,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;CAatB,CAAC"}
1
+ {"version":3,"file":"Dspl.d.ts","sourceRoot":"","sources":["../../../../src/components/Typography/Dspl/Dspl.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAIrD,oBAAY,SAAS,GAAG,SAAS,CAAC;AAElC,eAAO,MAAM,QAAQ;;;;iNAA+C,CAAC;AAErE,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;CAatB,CAAC"}
@@ -5,7 +5,7 @@ export declare const headingRoot: (Root: import("../../..").RootProps<HTMLDivEle
5
5
  noWrap?: boolean | undefined;
6
6
  breakWord?: boolean | undefined;
7
7
  color?: string | undefined;
8
- } & import("../../..").SpacingProps & import("../Typography.types").BoldProps & import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
8
+ } & import("../../..").SpacingProps & import("../Typography.types").BoldProps & import("../../..").AsProps<any> & import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
9
9
  export declare const headingConfig: {
10
10
  name: string;
11
11
  tag: string;
@@ -13,7 +13,7 @@ export declare const headingConfig: {
13
13
  noWrap?: boolean | undefined;
14
14
  breakWord?: boolean | undefined;
15
15
  color?: string | undefined;
16
- } & import("../../..").SpacingProps & import("../Typography.types").BoldProps & import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
16
+ } & import("../../..").SpacingProps & import("../Typography.types").BoldProps & import("../../..").AsProps<any> & import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
17
17
  base: import("@linaria/core").LinariaClassName;
18
18
  variations: {
19
19
  size: {
@@ -1 +1 @@
1
- {"version":3,"file":"Heading.d.ts","sourceRoot":"","sources":["../../../../src/components/Typography/Heading/Heading.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAIrD,oBAAY,YAAY,GAAG,SAAS,CAAC;AAErC,eAAO,MAAM,WAAW;;;;+KAA+C,CAAC;AAExE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;CAazB,CAAC"}
1
+ {"version":3,"file":"Heading.d.ts","sourceRoot":"","sources":["../../../../src/components/Typography/Heading/Heading.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAIrD,oBAAY,YAAY,GAAG,SAAS,CAAC;AAErC,eAAO,MAAM,WAAW;;;;iNAA+C,CAAC;AAExE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;CAazB,CAAC"}
@@ -5,7 +5,7 @@ export declare const textRoot: (Root: import("../../..").RootProps<HTMLDivElemen
5
5
  noWrap?: boolean | undefined;
6
6
  breakWord?: boolean | undefined;
7
7
  color?: string | undefined;
8
- } & import("../../..").SpacingProps & import("../Typography.types").BoldProps & import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
8
+ } & import("../../..").SpacingProps & import("../Typography.types").BoldProps & import("../../..").AsProps<any> & import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
9
9
  export declare const textConfig: {
10
10
  name: string;
11
11
  tag: string;
@@ -13,7 +13,7 @@ export declare const textConfig: {
13
13
  noWrap?: boolean | undefined;
14
14
  breakWord?: boolean | undefined;
15
15
  color?: string | undefined;
16
- } & import("../../..").SpacingProps & import("../Typography.types").BoldProps & import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
16
+ } & import("../../..").SpacingProps & import("../Typography.types").BoldProps & import("../../..").AsProps<any> & import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
17
17
  base: import("@linaria/core").LinariaClassName;
18
18
  variations: {
19
19
  size: {
@@ -1 +1 @@
1
- {"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../../src/components/Typography/Text/Text.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAIrD,oBAAY,SAAS,GAAG,SAAS,CAAC;AAElC,eAAO,MAAM,QAAQ;;;;+KAA0B,CAAC;AAEhD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;CAatB,CAAC"}
1
+ {"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../../src/components/Typography/Text/Text.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAIrD,oBAAY,SAAS,GAAG,SAAS,CAAC;AAElC,eAAO,MAAM,QAAQ;;;;iNAA0B,CAAC;AAEhD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;CAatB,CAAC"}