@hanzogui/text 2.0.0-rc.41-hanzoai.3

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 (104) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/Emphasis.cjs +41 -0
  3. package/dist/cjs/Emphasis.native.js +44 -0
  4. package/dist/cjs/Emphasis.native.js.map +1 -0
  5. package/dist/cjs/Headings.cjs +127 -0
  6. package/dist/cjs/Headings.native.js +130 -0
  7. package/dist/cjs/Headings.native.js.map +1 -0
  8. package/dist/cjs/Paragraph.cjs +37 -0
  9. package/dist/cjs/Paragraph.native.js +40 -0
  10. package/dist/cjs/Paragraph.native.js.map +1 -0
  11. package/dist/cjs/SizableText.cjs +58 -0
  12. package/dist/cjs/SizableText.native.js +61 -0
  13. package/dist/cjs/SizableText.native.js.map +1 -0
  14. package/dist/cjs/index.cjs +25 -0
  15. package/dist/cjs/index.native.js +28 -0
  16. package/dist/cjs/index.native.js.map +1 -0
  17. package/dist/cjs/types.cjs +18 -0
  18. package/dist/cjs/types.native.js +21 -0
  19. package/dist/cjs/types.native.js.map +1 -0
  20. package/dist/cjs/wrapChildrenInText.cjs +80 -0
  21. package/dist/cjs/wrapChildrenInText.native.js +84 -0
  22. package/dist/cjs/wrapChildrenInText.native.js.map +1 -0
  23. package/dist/esm/Emphasis.mjs +14 -0
  24. package/dist/esm/Emphasis.mjs.map +1 -0
  25. package/dist/esm/Emphasis.native.js +14 -0
  26. package/dist/esm/Emphasis.native.js.map +1 -0
  27. package/dist/esm/Headings.mjs +96 -0
  28. package/dist/esm/Headings.mjs.map +1 -0
  29. package/dist/esm/Headings.native.js +96 -0
  30. package/dist/esm/Headings.native.js.map +1 -0
  31. package/dist/esm/Paragraph.mjs +12 -0
  32. package/dist/esm/Paragraph.mjs.map +1 -0
  33. package/dist/esm/Paragraph.native.js +12 -0
  34. package/dist/esm/Paragraph.native.js.map +1 -0
  35. package/dist/esm/SizableText.mjs +33 -0
  36. package/dist/esm/SizableText.mjs.map +1 -0
  37. package/dist/esm/SizableText.native.js +33 -0
  38. package/dist/esm/SizableText.native.js.map +1 -0
  39. package/dist/esm/index.js +7 -0
  40. package/dist/esm/index.js.map +1 -0
  41. package/dist/esm/index.mjs +7 -0
  42. package/dist/esm/index.mjs.map +1 -0
  43. package/dist/esm/index.native.js +7 -0
  44. package/dist/esm/index.native.js.map +1 -0
  45. package/dist/esm/types.mjs +2 -0
  46. package/dist/esm/types.mjs.map +1 -0
  47. package/dist/esm/types.native.js +2 -0
  48. package/dist/esm/types.native.js.map +1 -0
  49. package/dist/esm/wrapChildrenInText.mjs +45 -0
  50. package/dist/esm/wrapChildrenInText.mjs.map +1 -0
  51. package/dist/esm/wrapChildrenInText.native.js +45 -0
  52. package/dist/esm/wrapChildrenInText.native.js.map +1 -0
  53. package/dist/jsx/Emphasis.mjs +14 -0
  54. package/dist/jsx/Emphasis.mjs.map +1 -0
  55. package/dist/jsx/Emphasis.native.js +44 -0
  56. package/dist/jsx/Emphasis.native.js.map +1 -0
  57. package/dist/jsx/Headings.mjs +96 -0
  58. package/dist/jsx/Headings.mjs.map +1 -0
  59. package/dist/jsx/Headings.native.js +130 -0
  60. package/dist/jsx/Headings.native.js.map +1 -0
  61. package/dist/jsx/Paragraph.mjs +12 -0
  62. package/dist/jsx/Paragraph.mjs.map +1 -0
  63. package/dist/jsx/Paragraph.native.js +40 -0
  64. package/dist/jsx/Paragraph.native.js.map +1 -0
  65. package/dist/jsx/SizableText.mjs +33 -0
  66. package/dist/jsx/SizableText.mjs.map +1 -0
  67. package/dist/jsx/SizableText.native.js +61 -0
  68. package/dist/jsx/SizableText.native.js.map +1 -0
  69. package/dist/jsx/index.js +7 -0
  70. package/dist/jsx/index.js.map +1 -0
  71. package/dist/jsx/index.mjs +7 -0
  72. package/dist/jsx/index.mjs.map +1 -0
  73. package/dist/jsx/index.native.js +28 -0
  74. package/dist/jsx/index.native.js.map +1 -0
  75. package/dist/jsx/types.mjs +2 -0
  76. package/dist/jsx/types.mjs.map +1 -0
  77. package/dist/jsx/types.native.js +21 -0
  78. package/dist/jsx/types.native.js.map +1 -0
  79. package/dist/jsx/wrapChildrenInText.mjs +45 -0
  80. package/dist/jsx/wrapChildrenInText.mjs.map +1 -0
  81. package/dist/jsx/wrapChildrenInText.native.js +84 -0
  82. package/dist/jsx/wrapChildrenInText.native.js.map +1 -0
  83. package/package.json +52 -0
  84. package/src/Emphasis.tsx +15 -0
  85. package/src/Headings.tsx +117 -0
  86. package/src/Paragraph.tsx +15 -0
  87. package/src/SizableText.tsx +44 -0
  88. package/src/index.tsx +6 -0
  89. package/src/types.ts +19 -0
  90. package/src/wrapChildrenInText.tsx +62 -0
  91. package/types/Emphasis.d.ts +4 -0
  92. package/types/Emphasis.d.ts.map +1 -0
  93. package/types/Headings.d.ts +31 -0
  94. package/types/Headings.d.ts.map +1 -0
  95. package/types/Paragraph.d.ts +7 -0
  96. package/types/Paragraph.d.ts.map +1 -0
  97. package/types/SizableText.d.ts +7 -0
  98. package/types/SizableText.d.ts.map +1 -0
  99. package/types/index.d.ts +7 -0
  100. package/types/index.d.ts.map +1 -0
  101. package/types/types.d.ts +17 -0
  102. package/types/types.d.ts.map +1 -0
  103. package/types/wrapChildrenInText.d.ts +12 -0
  104. package/types/wrapChildrenInText.d.ts.map +1 -0
@@ -0,0 +1,45 @@
1
+ import React from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+ function wrapChildrenInText(TextComponent, propsIn, extraProps) {
4
+ const {
5
+ children,
6
+ textProps,
7
+ size,
8
+ noTextWrap,
9
+ color,
10
+ fontFamily,
11
+ fontSize,
12
+ fontWeight,
13
+ letterSpacing,
14
+ textAlign,
15
+ fontStyle,
16
+ maxFontSizeMultiplier
17
+ } = propsIn;
18
+ if (noTextWrap || !children) {
19
+ return [children];
20
+ }
21
+ const props = {
22
+ ...extraProps
23
+ };
24
+ if (color) props.color = color;
25
+ if (fontFamily) props.fontFamily = fontFamily;
26
+ if (fontSize) props.fontSize = fontSize;
27
+ if (fontWeight) props.fontWeight = fontWeight;
28
+ if (letterSpacing) props.letterSpacing = letterSpacing;
29
+ if (textAlign) props.textAlign = textAlign;
30
+ if (size) props.size = size;
31
+ if (fontStyle) props.fontStyle = fontStyle;
32
+ if (maxFontSizeMultiplier) props.maxFontSizeMultiplier = maxFontSizeMultiplier;
33
+ return React.Children.toArray(children).map((child, index) => {
34
+ return typeof child === "string" ?
35
+ // so "data-disable-theme" is a hack to fix themeInverse, don't ask me why
36
+ /* @__PURE__ */
37
+ jsx(TextComponent, {
38
+ ...props,
39
+ ...textProps,
40
+ children: child
41
+ }, index) : child;
42
+ });
43
+ }
44
+ export { wrapChildrenInText };
45
+ //# sourceMappingURL=wrapChildrenInText.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","jsx","wrapChildrenInText","TextComponent","propsIn","extraProps","children","textProps","size","noTextWrap","color","fontFamily","fontSize","fontWeight","letterSpacing","textAlign","fontStyle","maxFontSizeMultiplier","props","Children","toArray","map","child","index"],"sources":["../../src/wrapChildrenInText.tsx"],"sourcesContent":[null],"mappings":"AACA,OAAOA,KAAA,MAAW;AAqDZ,SAAAC,GAAA;AA5CC,SAASC,mBACdC,aAAA,EACAC,OAAA,EAGAC,UAAA,EACA;EACA,MAAM;IACJC,QAAA;IACAC,SAAA;IACAC,IAAA;IACAC,UAAA;IACAC,KAAA;IACAC,UAAA;IACAC,QAAA;IACAC,UAAA;IACAC,aAAA;IACAC,SAAA;IACAC,SAAA;IACAC;EACF,IAAIb,OAAA;EAEJ,IAAIK,UAAA,IAAc,CAACH,QAAA,EAAU;IAC3B,OAAO,CAACA,QAAQ;EAClB;EAEA,MAAMY,KAAA,GAAQ;IACZ,GAAGb;EACL;EAGA,IAAIK,KAAA,EAAOQ,KAAA,CAAMR,KAAA,GAAQA,KAAA;EACzB,IAAIC,UAAA,EAAYO,KAAA,CAAMP,UAAA,GAAaA,UAAA;EACnC,IAAIC,QAAA,EAAUM,KAAA,CAAMN,QAAA,GAAWA,QAAA;EAC/B,IAAIC,UAAA,EAAYK,KAAA,CAAML,UAAA,GAAaA,UAAA;EACnC,IAAIC,aAAA,EAAeI,KAAA,CAAMJ,aAAA,GAAgBA,aAAA;EACzC,IAAIC,SAAA,EAAWG,KAAA,CAAMH,SAAA,GAAYA,SAAA;EACjC,IAAIP,IAAA,EAAMU,KAAA,CAAMV,IAAA,GAAOA,IAAA;EACvB,IAAIQ,SAAA,EAAWE,KAAA,CAAMF,SAAA,GAAYA,SAAA;EACjC,IAAIC,qBAAA,EAAuBC,KAAA,CAAMD,qBAAA,GAAwBA,qBAAA;EAEzD,OAAOjB,KAAA,CAAMmB,QAAA,CAASC,OAAA,CAAQd,QAAQ,EAAEe,GAAA,CAAI,CAACC,KAAA,EAAOC,KAAA,KAAU;IAC5D,OAAO,OAAOD,KAAA,KAAU;IAAA;IAEtB;IAAArB,GAAA,CAACE,aAAA;MAA2B,GAAGe,KAAA;MAAQ,GAAGX,SAAA;MACvCD,QAAA,EAAAgB;IAAA,GADiBC,KAEpB,IAEAD,KAAA;EAEJ,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: true
13
+ });
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
18
+ get: () => from[key],
19
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
+ });
21
+ }
22
+ return to;
23
+ };
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
+ // If the importer is in node compatibility mode or this is not an ESM
26
+ // file that has been converted to a CommonJS file using a Babel-
27
+ // compatible transform (i.e. "__esModule" has not been set), then set
28
+ // "default" to the CommonJS "module.exports" for node compatibility.
29
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
30
+ value: mod,
31
+ enumerable: true
32
+ }) : target, mod));
33
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
34
+ value: true
35
+ }), mod);
36
+ var wrapChildrenInText_exports = {};
37
+ __export(wrapChildrenInText_exports, {
38
+ wrapChildrenInText: () => wrapChildrenInText
39
+ });
40
+ module.exports = __toCommonJS(wrapChildrenInText_exports);
41
+ var import_jsx_runtime = require("react/jsx-runtime");
42
+ var import_react = __toESM(require("react"), 1);
43
+ function wrapChildrenInText(TextComponent, propsIn, extraProps) {
44
+ var {
45
+ children,
46
+ textProps,
47
+ size,
48
+ noTextWrap,
49
+ color,
50
+ fontFamily,
51
+ fontSize,
52
+ fontWeight,
53
+ letterSpacing,
54
+ textAlign,
55
+ fontStyle,
56
+ maxFontSizeMultiplier
57
+ } = propsIn;
58
+ if (noTextWrap || !children) {
59
+ return [children];
60
+ }
61
+ var props = {
62
+ ...extraProps
63
+ };
64
+ if (color) props.color = color;
65
+ if (fontFamily) props.fontFamily = fontFamily;
66
+ if (fontSize) props.fontSize = fontSize;
67
+ if (fontWeight) props.fontWeight = fontWeight;
68
+ if (letterSpacing) props.letterSpacing = letterSpacing;
69
+ if (textAlign) props.textAlign = textAlign;
70
+ if (size) props.size = size;
71
+ if (fontStyle) props.fontStyle = fontStyle;
72
+ if (maxFontSizeMultiplier) props.maxFontSizeMultiplier = maxFontSizeMultiplier;
73
+ return import_react.default.Children.toArray(children).map(function (child, index) {
74
+ return typeof child === "string" ?
75
+ // so "data-disable-theme" is a hack to fix themeInverse, don't ask me why
76
+ /* @__PURE__ */
77
+ (0, import_jsx_runtime.jsx)(TextComponent, {
78
+ ...props,
79
+ ...textProps,
80
+ children: child
81
+ }, index) : child;
82
+ });
83
+ }
84
+ //# sourceMappingURL=wrapChildrenInText.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__create","Object","create","__defProp","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__getProtoOf","getPrototypeOf","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toESM","mod","isNodeMode","__esModule","value","__toCommonJS","wrapChildrenInText_exports","wrapChildrenInText","module","exports","import_jsx_runtime","require","import_react","TextComponent","propsIn","extraProps","children","textProps","size","noTextWrap","color","fontFamily","fontSize","fontWeight","letterSpacing","textAlign","fontStyle","maxFontSizeMultiplier"],"sources":["../../src/wrapChildrenInText.tsx"],"sourcesContent":[null],"mappings":"AACA,YAAO;;AAqDD,IAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA;AA5CC,IAAAC,SAAS,GAAAF,MAAA,CAAAG,cACd;AAMA,IAAAC,gBAAM,GAAAJ,MAAA,CAAAK,wBAAA;AAAA,IACJC,iBAAA,GAAAN,MAAA,CAAAO,mBAAA;AAAA,IACAC,YAAA,GAAAR,MAAA,CAAAS,cAAA;AAAA,IACAC,YAAA,GAAAV,MAAA,CAAAW,SAAA,CAAAC,cAAA;AAAA,IACAC,QAAA,GAAAA,CAAAC,MAAA,EAAAC,GAAA;EAAA,KACA,IAAAC,IAAA,IAAAD,GAAA,EACAb,SAAA,CAAAY,MAAA,EAAAE,IAAA;IAAAC,GAAA,EAAAF,GAAA,CAAAC,IAAA;IAAAE,UAAA;EAAA;AAAA;AACA,IACAC,WAAA,GAAAA,CAAAC,EAAA,EAAAC,IAAA,EAAAC,MAAA,EAAAC,IAAA;EAAA,IACAF,IAAA,WAAAA,IAAA,wBAAAA,IAAA;IACA,SAAAG,GAAA,IAAAlB,iBAAA,CAAAe,IAAA,GACA,KAAAX,YAAA,CAAAe,IAAA,CAAAL,EAAA,EAAAI,GAAA,KAAAA,GAAA,KAAAF,MAAA,EACApB,SAAA,CAAAkB,EAAA,EAAAI,GAAA;MAAAP,GAAA,EAAAA,CAAA,KAAAI,IAAA,CAAAG,GAAA;MAAAN,UAAA,IAAAK,IAAA,GAAAnB,gBAAA,CAAAiB,IAAA,EAAAG,GAAA,MAAAD,IAAA,CAAAL;IAAA;EACF;EAEA,OAAIE,EAAA;AACF;AAAgB,IAClBM,OAAA,GAAAA,CAAAC,GAAA,EAAAC,UAAA,EAAAd,MAAA,MAAAA,MAAA,GAAAa,GAAA,WAAA5B,QAAA,CAAAS,YAAA,CAAAmB,GAAA,SAAAR,WAAA;AAEA;AAAc;AAEd;AAGA;AACAS,UAAI,KAAYD,GAAA,IAAM,CAAAA,GAAA,CAAAE,UAAa,GAAA3B,SAAA,CAAAY,MAAA;EAAAgB,KAAA,EAAAH,GAAA;EAAAT,UAAA;AAAA,KAAAJ,MAAA,EACnCa,GACA;AACA,IAAAI,YAAI,GAAeJ,GAAA,IAAMR,WAAA,CAAAjB,SAAgB;EAAA4B,KAAA;AAAA,IAAAH,GAAA;AACzC,IAAAK,0BAAqB,KAAY;AACjCnB,QAAI,CAAAmB,0BAAmB;EACvBC,kBAAe,EAAAA,CAAA,KAAMA;AACrB;AAEAC,MAAA,CAAAC,OAAO,GAAMJ,YAAS,CAAAC,0BAA8B;AAClD,IAAAI,kBAAc,GAAAC,OAAU;AAAA,IAAAC,YAAA,GAAAZ,OAAA,CAAAW,OAAA;AAAA,SAEtBJ,kBAACA,CAAAM,aAAA,EAA2BC,OAAG,EAAAC,UAAW;EAE1C;IAEAC,QAAA;IAAAC,SAAA;IAAAC,IAAA;IAAAC,UAAA;IAAAC,KAAA;IAAAC,UAAA;IAAAC,QAAA;IAAAC,UAAA;IAAAC,aAAA;IAAAC,SAAA;IAAAC,SAAA;IAAAC;EAAA,IAAAb,OAAA;EAEJ,IAACK,UAAA,KAAAH,QAAA;IACH,Q","ignoreList":[]}
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@hanzogui/text",
3
+ "version": "2.0.0-rc.41-hanzoai.3",
4
+ "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
5
+ "source": "src/index.tsx",
6
+ "files": [
7
+ "src",
8
+ "types",
9
+ "dist"
10
+ ],
11
+ "type": "module",
12
+ "sideEffects": [
13
+ "*.css"
14
+ ],
15
+ "main": "dist/cjs",
16
+ "module": "dist/esm",
17
+ "types": "./types/index.d.ts",
18
+ "exports": {
19
+ "./package.json": "./package.json",
20
+ ".": {
21
+ "types": "./types/index.d.ts",
22
+ "react-native": "./dist/esm/index.native.js",
23
+ "browser": "./dist/esm/index.mjs",
24
+ "module": "./dist/esm/index.mjs",
25
+ "import": "./dist/esm/index.mjs",
26
+ "require": "./dist/cjs/index.cjs",
27
+ "default": "./dist/esm/index.mjs"
28
+ }
29
+ },
30
+ "publishConfig": {
31
+ "access": "public"
32
+ },
33
+ "scripts": {
34
+ "build": "hanzogui-build",
35
+ "watch": "hanzogui-build --watch",
36
+ "clean": "hanzogui-build clean",
37
+ "clean:build": "hanzogui-build clean:build"
38
+ },
39
+ "dependencies": {
40
+ "@hanzogui/get-font-sized": "2.0.0-rc.41-hanzoai.3",
41
+ "@hanzogui/component-helpers": "2.0.0-rc.41-hanzoai.3",
42
+ "@hanzogui/web": "2.0.0-rc.41-hanzoai.3"
43
+ },
44
+ "devDependencies": {
45
+ "@hanzogui/build": "2.0.0-rc.41-hanzoai.3",
46
+ "react": ">=19"
47
+ },
48
+ "peerDependencies": {
49
+ "react": ">=19"
50
+ },
51
+ "module:jsx": "dist/jsx"
52
+ }
@@ -0,0 +1,15 @@
1
+ import { styled, Text } from '@hanzogui/web'
2
+
3
+ export const Strong = styled(Text, {
4
+ render: 'strong',
5
+ fontWeight: 'bold',
6
+ })
7
+
8
+ export const Span = styled(Text, {
9
+ render: 'span',
10
+ })
11
+
12
+ export const Em = styled(Text, {
13
+ render: 'em',
14
+ fontStyle: 'italic',
15
+ })
@@ -0,0 +1,117 @@
1
+ import type { GetProps } from '@hanzogui/web'
2
+ import { styled } from '@hanzogui/web'
3
+
4
+ import { Paragraph } from './Paragraph'
5
+
6
+ export const Heading = styled(Paragraph, {
7
+ render: 'span',
8
+ name: 'Heading',
9
+ role: 'heading',
10
+ fontFamily: '$heading',
11
+ size: '$8',
12
+ margin: 0,
13
+ })
14
+
15
+ export type HeadingProps = GetProps<typeof Heading>
16
+
17
+ export const H1 = styled(Heading, {
18
+ name: 'H1',
19
+ render: 'h1',
20
+
21
+ variants: {
22
+ unstyled: {
23
+ false: {
24
+ size: '$10',
25
+ },
26
+ },
27
+ } as const,
28
+
29
+ defaultVariants: {
30
+ unstyled: process.env.HANZOGUI_HEADLESS === '1' ? true : false,
31
+ },
32
+ })
33
+
34
+ export const H2 = styled(Heading, {
35
+ name: 'H2',
36
+ render: 'h2',
37
+
38
+ variants: {
39
+ unstyled: {
40
+ false: {
41
+ size: '$9',
42
+ },
43
+ },
44
+ } as const,
45
+
46
+ defaultVariants: {
47
+ unstyled: process.env.HANZOGUI_HEADLESS === '1' ? true : false,
48
+ },
49
+ })
50
+
51
+ export const H3 = styled(Heading, {
52
+ name: 'H3',
53
+ render: 'h3',
54
+
55
+ variants: {
56
+ unstyled: {
57
+ false: {
58
+ size: '$8',
59
+ },
60
+ },
61
+ } as const,
62
+
63
+ defaultVariants: {
64
+ unstyled: process.env.HANZOGUI_HEADLESS === '1' ? true : false,
65
+ },
66
+ })
67
+
68
+ export const H4 = styled(Heading, {
69
+ name: 'H4',
70
+ render: 'h4',
71
+
72
+ variants: {
73
+ unstyled: {
74
+ false: {
75
+ size: '$7',
76
+ },
77
+ },
78
+ } as const,
79
+
80
+ defaultVariants: {
81
+ unstyled: process.env.HANZOGUI_HEADLESS === '1' ? true : false,
82
+ },
83
+ })
84
+
85
+ export const H5 = styled(Heading, {
86
+ name: 'H5',
87
+ render: 'h5',
88
+
89
+ variants: {
90
+ unstyled: {
91
+ false: {
92
+ size: '$6',
93
+ },
94
+ },
95
+ } as const,
96
+
97
+ defaultVariants: {
98
+ unstyled: process.env.HANZOGUI_HEADLESS === '1' ? true : false,
99
+ },
100
+ })
101
+
102
+ export const H6 = styled(Heading, {
103
+ name: 'H6',
104
+ render: 'h6',
105
+
106
+ variants: {
107
+ unstyled: {
108
+ false: {
109
+ size: '$5',
110
+ },
111
+ },
112
+ } as const,
113
+
114
+ defaultVariants: {
115
+ unstyled: process.env.HANZOGUI_HEADLESS === '1' ? true : false,
116
+ },
117
+ })
@@ -0,0 +1,15 @@
1
+ import type { GetProps } from '@hanzogui/web'
2
+ import { styled } from '@hanzogui/web'
3
+
4
+ import { SizableText } from './SizableText'
5
+
6
+ export const Paragraph = styled(SizableText, {
7
+ name: 'Paragraph',
8
+ render: 'p',
9
+ userSelect: 'auto',
10
+ color: '$color',
11
+ size: '$true',
12
+ whiteSpace: 'normal',
13
+ })
14
+
15
+ export type ParagraphProps = GetProps<typeof Paragraph>
@@ -0,0 +1,44 @@
1
+ import { getFontSized } from '@hanzogui/get-font-sized'
2
+ import type { GetProps } from '@hanzogui/web'
3
+ import { Text, styled } from '@hanzogui/web'
4
+
5
+ export const SizableText = styled(Text, {
6
+ name: 'SizableText',
7
+ fontFamily: '$body',
8
+
9
+ variants: {
10
+ unstyled: {
11
+ false: {
12
+ size: '$true',
13
+ color: '$color',
14
+ },
15
+ },
16
+
17
+ size: getFontSized,
18
+ },
19
+
20
+ defaultVariants: {
21
+ unstyled: process.env.HANZOGUI_HEADLESS === '1',
22
+ },
23
+ })
24
+
25
+ // we are doing weird stuff to avoid bad types
26
+ // TODO make this just work
27
+ SizableText.staticConfig.variants!.fontFamily = {
28
+ '...': (val, extras) => {
29
+ // pass through inherit directly without font variant expansion
30
+ if (val === 'inherit') {
31
+ return { fontFamily: 'inherit' }
32
+ }
33
+
34
+ const sizeProp = extras.props['size']
35
+ const fontSizeProp = extras.props['fontSize']
36
+ const size =
37
+ sizeProp === '$true' && fontSizeProp
38
+ ? fontSizeProp
39
+ : extras.props['size'] || '$true'
40
+ return getFontSized(size, extras)
41
+ },
42
+ }
43
+
44
+ export type SizableTextProps = GetProps<typeof SizableText>
package/src/index.tsx ADDED
@@ -0,0 +1,6 @@
1
+ export * from './Emphasis'
2
+ export * from './SizableText'
3
+ export * from './Paragraph'
4
+ export * from './Headings'
5
+ export * from './wrapChildrenInText'
6
+ export * from './types'
package/src/types.ts ADDED
@@ -0,0 +1,19 @@
1
+ import type { SizableTextProps } from './SizableText'
2
+
3
+ export type TextContextStyles = {
4
+ color?: SizableTextProps['color']
5
+ fontWeight?: SizableTextProps['fontWeight']
6
+ fontSize?: SizableTextProps['fontSize']
7
+ fontFamily?: SizableTextProps['fontFamily']
8
+ fontStyle?: SizableTextProps['fontStyle']
9
+ letterSpacing?: SizableTextProps['letterSpacing']
10
+ textAlign?: SizableTextProps['textAlign']
11
+ ellipsis?: SizableTextProps['ellipsis']
12
+ maxFontSizeMultiplier?: number
13
+ }
14
+
15
+ export type TextParentStyles = TextContextStyles & {
16
+ // all the other text controls
17
+ textProps?: Partial<SizableTextProps>
18
+ noTextWrap?: boolean
19
+ }
@@ -0,0 +1,62 @@
1
+ import type { SizeTokens } from '@hanzogui/web'
2
+ import React from 'react'
3
+
4
+ import type { TextParentStyles } from './types'
5
+
6
+ type Props = TextParentStyles & {
7
+ children?: React.ReactNode
8
+ size?: SizeTokens
9
+ }
10
+
11
+ export function wrapChildrenInText(
12
+ TextComponent: any,
13
+ propsIn: Props & {
14
+ unstyled?: boolean
15
+ },
16
+ extraProps?: Record<string, any>
17
+ ) {
18
+ const {
19
+ children,
20
+ textProps,
21
+ size,
22
+ noTextWrap,
23
+ color,
24
+ fontFamily,
25
+ fontSize,
26
+ fontWeight,
27
+ letterSpacing,
28
+ textAlign,
29
+ fontStyle,
30
+ maxFontSizeMultiplier,
31
+ } = propsIn
32
+
33
+ if (noTextWrap || !children) {
34
+ return [children]
35
+ }
36
+
37
+ const props = {
38
+ ...extraProps,
39
+ }
40
+
41
+ // to avoid setting undefined
42
+ if (color) props.color = color
43
+ if (fontFamily) props.fontFamily = fontFamily
44
+ if (fontSize) props.fontSize = fontSize
45
+ if (fontWeight) props.fontWeight = fontWeight
46
+ if (letterSpacing) props.letterSpacing = letterSpacing
47
+ if (textAlign) props.textAlign = textAlign
48
+ if (size) props.size = size
49
+ if (fontStyle) props.fontStyle = fontStyle
50
+ if (maxFontSizeMultiplier) props.maxFontSizeMultiplier = maxFontSizeMultiplier
51
+
52
+ return React.Children.toArray(children).map((child, index) => {
53
+ return typeof child === 'string' ? (
54
+ // so "data-disable-theme" is a hack to fix themeInverse, don't ask me why
55
+ <TextComponent key={index} {...props} {...textProps}>
56
+ {child}
57
+ </TextComponent>
58
+ ) : (
59
+ child
60
+ )
61
+ })
62
+ }
@@ -0,0 +1,4 @@
1
+ export declare const Strong: import("@hanzogui/web").HanzoguiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").HanzoguiTextElement, import("@hanzogui/web").TextNonStyleProps, import("@hanzogui/web").TextStylePropsBase, {}, import("@hanzogui/web").StaticConfigPublic>;
2
+ export declare const Span: import("@hanzogui/web").HanzoguiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").HanzoguiTextElement, import("@hanzogui/web").TextNonStyleProps, import("@hanzogui/web").TextStylePropsBase, {}, import("@hanzogui/web").StaticConfigPublic>;
3
+ export declare const Em: import("@hanzogui/web").HanzoguiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").HanzoguiTextElement, import("@hanzogui/web").TextNonStyleProps, import("@hanzogui/web").TextStylePropsBase, {}, import("@hanzogui/web").StaticConfigPublic>;
4
+ //# sourceMappingURL=Emphasis.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Emphasis.d.ts","sourceRoot":"","sources":["../src/Emphasis.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,kQAGjB,CAAA;AAEF,eAAO,MAAM,IAAI,kQAEf,CAAA;AAEF,eAAO,MAAM,EAAE,kQAGb,CAAA"}
@@ -0,0 +1,31 @@
1
+ import type { GetProps } from '@hanzogui/web';
2
+ export declare const Heading: import("@hanzogui/web").HanzoguiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").HanzoguiTextElement, import("@hanzogui/web").TextNonStyleProps, import("@hanzogui/web").TextStylePropsBase, {
3
+ unstyled?: boolean | undefined;
4
+ size?: import("@hanzogui/web").FontSizeTokens | undefined;
5
+ }, import("@hanzogui/web").StaticConfigPublic>;
6
+ export type HeadingProps = GetProps<typeof Heading>;
7
+ export declare const H1: import("@hanzogui/web").HanzoguiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").HanzoguiTextElement, import("@hanzogui/web").TextNonStyleProps, import("@hanzogui/web").TextStylePropsBase, {
8
+ unstyled?: boolean | undefined;
9
+ size?: import("@hanzogui/web").FontSizeTokens | undefined;
10
+ }, import("@hanzogui/web").StaticConfigPublic>;
11
+ export declare const H2: import("@hanzogui/web").HanzoguiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").HanzoguiTextElement, import("@hanzogui/web").TextNonStyleProps, import("@hanzogui/web").TextStylePropsBase, {
12
+ unstyled?: boolean | undefined;
13
+ size?: import("@hanzogui/web").FontSizeTokens | undefined;
14
+ }, import("@hanzogui/web").StaticConfigPublic>;
15
+ export declare const H3: import("@hanzogui/web").HanzoguiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").HanzoguiTextElement, import("@hanzogui/web").TextNonStyleProps, import("@hanzogui/web").TextStylePropsBase, {
16
+ unstyled?: boolean | undefined;
17
+ size?: import("@hanzogui/web").FontSizeTokens | undefined;
18
+ }, import("@hanzogui/web").StaticConfigPublic>;
19
+ export declare const H4: import("@hanzogui/web").HanzoguiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").HanzoguiTextElement, import("@hanzogui/web").TextNonStyleProps, import("@hanzogui/web").TextStylePropsBase, {
20
+ unstyled?: boolean | undefined;
21
+ size?: import("@hanzogui/web").FontSizeTokens | undefined;
22
+ }, import("@hanzogui/web").StaticConfigPublic>;
23
+ export declare const H5: import("@hanzogui/web").HanzoguiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").HanzoguiTextElement, import("@hanzogui/web").TextNonStyleProps, import("@hanzogui/web").TextStylePropsBase, {
24
+ unstyled?: boolean | undefined;
25
+ size?: import("@hanzogui/web").FontSizeTokens | undefined;
26
+ }, import("@hanzogui/web").StaticConfigPublic>;
27
+ export declare const H6: import("@hanzogui/web").HanzoguiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").HanzoguiTextElement, import("@hanzogui/web").TextNonStyleProps, import("@hanzogui/web").TextStylePropsBase, {
28
+ unstyled?: boolean | undefined;
29
+ size?: import("@hanzogui/web").FontSizeTokens | undefined;
30
+ }, import("@hanzogui/web").StaticConfigPublic>;
31
+ //# sourceMappingURL=Headings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Headings.d.ts","sourceRoot":"","sources":["../src/Headings.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAK7C,eAAO,MAAM,OAAO;;;8CAOlB,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC,OAAO,OAAO,CAAC,CAAA;AAEnD,eAAO,MAAM,EAAE;;;8CAeb,CAAA;AAEF,eAAO,MAAM,EAAE;;;8CAeb,CAAA;AAEF,eAAO,MAAM,EAAE;;;8CAeb,CAAA;AAEF,eAAO,MAAM,EAAE;;;8CAeb,CAAA;AAEF,eAAO,MAAM,EAAE;;;8CAeb,CAAA;AAEF,eAAO,MAAM,EAAE;;;8CAeb,CAAA"}
@@ -0,0 +1,7 @@
1
+ import type { GetProps } from '@hanzogui/web';
2
+ export declare const Paragraph: import("@hanzogui/web").HanzoguiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").HanzoguiTextElement, import("@hanzogui/web").TextNonStyleProps, import("@hanzogui/web").TextStylePropsBase, {
3
+ unstyled?: boolean | undefined;
4
+ size?: import("@hanzogui/web").FontSizeTokens | undefined;
5
+ }, import("@hanzogui/web").StaticConfigPublic>;
6
+ export type ParagraphProps = GetProps<typeof Paragraph>;
7
+ //# sourceMappingURL=Paragraph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Paragraph.d.ts","sourceRoot":"","sources":["../src/Paragraph.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAK7C,eAAO,MAAM,SAAS;;;8CAOpB,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC,OAAO,SAAS,CAAC,CAAA"}
@@ -0,0 +1,7 @@
1
+ import type { GetProps } from '@hanzogui/web';
2
+ export declare const SizableText: import("@hanzogui/web").HanzoguiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").HanzoguiTextElement, import("@hanzogui/web").TextNonStyleProps, import("@hanzogui/web").TextStylePropsBase, {
3
+ unstyled?: boolean | undefined;
4
+ size?: import("@hanzogui/web").FontSizeTokens | undefined;
5
+ }, import("@hanzogui/web").StaticConfigPublic>;
6
+ export type SizableTextProps = GetProps<typeof SizableText>;
7
+ //# sourceMappingURL=SizableText.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SizableText.d.ts","sourceRoot":"","sources":["../src/SizableText.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAG7C,eAAO,MAAM,WAAW;;;8CAkBtB,CAAA;AAqBF,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC,OAAO,WAAW,CAAC,CAAA"}
@@ -0,0 +1,7 @@
1
+ export * from './Emphasis';
2
+ export * from './SizableText';
3
+ export * from './Paragraph';
4
+ export * from './Headings';
5
+ export * from './wrapChildrenInText';
6
+ export * from './types';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,sBAAsB,CAAA;AACpC,cAAc,SAAS,CAAA"}
@@ -0,0 +1,17 @@
1
+ import type { SizableTextProps } from './SizableText';
2
+ export type TextContextStyles = {
3
+ color?: SizableTextProps['color'];
4
+ fontWeight?: SizableTextProps['fontWeight'];
5
+ fontSize?: SizableTextProps['fontSize'];
6
+ fontFamily?: SizableTextProps['fontFamily'];
7
+ fontStyle?: SizableTextProps['fontStyle'];
8
+ letterSpacing?: SizableTextProps['letterSpacing'];
9
+ textAlign?: SizableTextProps['textAlign'];
10
+ ellipsis?: SizableTextProps['ellipsis'];
11
+ maxFontSizeMultiplier?: number;
12
+ };
13
+ export type TextParentStyles = TextContextStyles & {
14
+ textProps?: Partial<SizableTextProps>;
15
+ noTextWrap?: boolean;
16
+ };
17
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAErD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAA;IACjC,UAAU,CAAC,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAA;IAC3C,QAAQ,CAAC,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAA;IACvC,UAAU,CAAC,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAA;IAC3C,SAAS,CAAC,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAA;IACzC,aAAa,CAAC,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAA;IACjD,SAAS,CAAC,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAA;IACzC,QAAQ,CAAC,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAA;IACvC,qBAAqB,CAAC,EAAE,MAAM,CAAA;CAC/B,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,GAAG;IAEjD,SAAS,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAA;IACrC,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA"}
@@ -0,0 +1,12 @@
1
+ import type { SizeTokens } from '@hanzogui/web';
2
+ import React from 'react';
3
+ import type { TextParentStyles } from './types';
4
+ type Props = TextParentStyles & {
5
+ children?: React.ReactNode;
6
+ size?: SizeTokens;
7
+ };
8
+ export declare function wrapChildrenInText(TextComponent: any, propsIn: Props & {
9
+ unstyled?: boolean;
10
+ }, extraProps?: Record<string, any>): React.ReactNode[] | (number | bigint | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element)[];
11
+ export {};
12
+ //# sourceMappingURL=wrapChildrenInText.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrapChildrenInText.d.ts","sourceRoot":"","sources":["../src/wrapChildrenInText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE/C,KAAK,KAAK,GAAG,gBAAgB,GAAG;IAC9B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,IAAI,CAAC,EAAE,UAAU,CAAA;CAClB,CAAA;AAED,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,GAAG,EAClB,OAAO,EAAE,KAAK,GAAG;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,EACD,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,2SA8CjC"}