@vinyasa/typography 1.0.23 → 1.0.25

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 (56) hide show
  1. package/README.md +77 -2
  2. package/dist/cjs/blockquote.cjs +3 -2
  3. package/dist/cjs/caption.cjs +82 -14
  4. package/dist/cjs/caption.css +104 -2
  5. package/dist/cjs/code.cjs +4 -3
  6. package/dist/cjs/heading.cjs +82 -14
  7. package/dist/cjs/heading.css +104 -2
  8. package/dist/cjs/highlight.cjs +700 -0
  9. package/dist/cjs/highlight.css +197 -0
  10. package/dist/cjs/index.cjs +597 -21
  11. package/dist/cjs/index.css +172 -2
  12. package/dist/cjs/kbd.cjs +3 -2
  13. package/dist/cjs/label.cjs +82 -14
  14. package/dist/cjs/label.css +104 -2
  15. package/dist/cjs/link.cjs +82 -14
  16. package/dist/cjs/link.css +104 -2
  17. package/dist/cjs/list.cjs +431 -0
  18. package/dist/cjs/list.css +60 -0
  19. package/dist/cjs/mark.cjs +246 -0
  20. package/dist/cjs/mark.css +8 -0
  21. package/dist/cjs/markdown-renderer.cjs +87 -17
  22. package/dist/cjs/markdown-renderer.css +104 -2
  23. package/dist/cjs/paragraph.cjs +82 -14
  24. package/dist/cjs/paragraph.css +104 -2
  25. package/dist/cjs/text.cjs +83 -15
  26. package/dist/cjs/text.css +104 -2
  27. package/dist/esm/191.css +104 -2
  28. package/dist/esm/191.js +74 -13
  29. package/dist/esm/227.css +7 -0
  30. package/dist/esm/227.js +39 -0
  31. package/dist/esm/513.css +60 -0
  32. package/dist/esm/513.js +126 -0
  33. package/dist/esm/651.js +4 -2
  34. package/dist/esm/767.js +33 -0
  35. package/dist/esm/783.js +3 -1
  36. package/dist/esm/919.js +3 -1
  37. package/dist/esm/components/highlight/Highlight.d.ts +14 -0
  38. package/dist/esm/components/highlight/index.d.ts +1 -0
  39. package/dist/esm/components/list/List.css.d.ts +47 -0
  40. package/dist/esm/components/list/List.d.ts +52 -0
  41. package/dist/esm/components/list/index.d.ts +1 -0
  42. package/dist/esm/components/mark/Mark.css.d.ts +1 -0
  43. package/dist/esm/components/mark/Mark.d.ts +5 -0
  44. package/dist/esm/components/mark/index.d.ts +1 -0
  45. package/dist/esm/components/text/Text.css.d.ts +94 -1
  46. package/dist/esm/components/text/Text.d.ts +55 -9
  47. package/dist/esm/highlight.d.ts +2 -0
  48. package/dist/esm/highlight.js +1 -0
  49. package/dist/esm/index.d.ts +4 -0
  50. package/dist/esm/index.js +26 -0
  51. package/dist/esm/list.d.ts +2 -0
  52. package/dist/esm/list.js +1 -0
  53. package/dist/esm/mark.d.ts +2 -0
  54. package/dist/esm/mark.js +1 -0
  55. package/dist/esm/useIsTruncated.d.ts +15 -0
  56. package/package.json +25 -5
@@ -0,0 +1,60 @@
1
+ ._1ohxnc10 {
2
+ font-family: var(--vinyasa-font-family-sans);
3
+ font-size: var(--vinyasa-font-size-md);
4
+ color: var(--vinyasa-text-default);
5
+ flex-direction: column;
6
+ margin: 0;
7
+ display: flex;
8
+ }
9
+
10
+ ._1ohxnc11 {
11
+ gap: var(--vinyasa-space1);
12
+ }
13
+
14
+ ._1ohxnc12 {
15
+ gap: var(--vinyasa-space2);
16
+ }
17
+
18
+ ._1ohxnc13 {
19
+ gap: var(--vinyasa-space3);
20
+ }
21
+
22
+ ._1ohxnc14 {
23
+ gap: var(--vinyasa-space4);
24
+ }
25
+
26
+ ._1ohxnc15 {
27
+ gap: var(--vinyasa-space5);
28
+ }
29
+
30
+ ._1ohxnc16 {
31
+ gap: var(--vinyasa-space6);
32
+ }
33
+
34
+ ._1ohxnc17 {
35
+ padding-left: var(--vinyasa-space5);
36
+ }
37
+
38
+ ._1ohxnc18 {
39
+ padding-left: 0;
40
+ list-style: none;
41
+ }
42
+
43
+ ._1ohxnc1a {
44
+ align-items: flex-start;
45
+ gap: var(--vinyasa-space2);
46
+ list-style: none;
47
+ display: flex;
48
+ }
49
+
50
+ ._1ohxnc1b {
51
+ align-items: center;
52
+ }
53
+
54
+ ._1ohxnc1c {
55
+ flex-shrink: 0;
56
+ align-items: center;
57
+ line-height: 1;
58
+ display: inline-flex;
59
+ }
60
+
@@ -0,0 +1,126 @@
1
+ import "./513.css";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useThemedRef } from "@vinyasa/tokens";
4
+ import { createContext, forwardRef, useContext } from "react";
5
+ import { createRuntimeFn } from "./953.js";
6
+ import { resolveSpacingStyle } from "./474.js";
7
+ var item = createRuntimeFn({
8
+ defaultClassName: '_1ohxnc19',
9
+ variantClassNames: {
10
+ withIcon: {
11
+ true: '_1ohxnc1a'
12
+ },
13
+ center: {
14
+ true: '_1ohxnc1b'
15
+ }
16
+ },
17
+ defaultVariants: {},
18
+ compoundVariants: []
19
+ });
20
+ var itemIcon = '_1ohxnc1c';
21
+ var list = createRuntimeFn({
22
+ defaultClassName: '_1ohxnc10',
23
+ variantClassNames: {
24
+ spacing: {
25
+ 1: '_1ohxnc11',
26
+ 2: '_1ohxnc12',
27
+ 3: '_1ohxnc13',
28
+ 4: '_1ohxnc14',
29
+ 5: '_1ohxnc15',
30
+ 6: '_1ohxnc16'
31
+ },
32
+ withPadding: {
33
+ true: '_1ohxnc17',
34
+ false: '_1ohxnc18'
35
+ }
36
+ },
37
+ defaultVariants: {
38
+ spacing: 2,
39
+ withPadding: true
40
+ },
41
+ compoundVariants: []
42
+ });
43
+ const ListContext = /*#__PURE__*/ createContext({});
44
+ const ListRoot = /*#__PURE__*/ forwardRef(({ type = 'unordered', spacing, withPadding, icon, center, m, mt, mr, mb, ml, mx, my, p, pt, pr, pb, pl, px, py, className, style, children, ...rest }, ref)=>{
45
+ const themedRef = useThemedRef(ref);
46
+ const classes = className ? `${list({
47
+ spacing,
48
+ withPadding
49
+ })} ${className}` : list({
50
+ spacing,
51
+ withPadding
52
+ });
53
+ const computedStyle = {
54
+ ...resolveSpacingStyle({
55
+ m,
56
+ mt,
57
+ mr,
58
+ mb,
59
+ ml,
60
+ mx,
61
+ my,
62
+ p,
63
+ pt,
64
+ pr,
65
+ pb,
66
+ pl,
67
+ px,
68
+ py
69
+ }),
70
+ ...style
71
+ };
72
+ const contextValue = {
73
+ icon,
74
+ center
75
+ };
76
+ if ('ordered' === type) return /*#__PURE__*/ jsx(ListContext.Provider, {
77
+ value: contextValue,
78
+ children: /*#__PURE__*/ jsx("ol", {
79
+ ref: themedRef,
80
+ className: classes,
81
+ style: computedStyle,
82
+ ...rest,
83
+ children: children
84
+ })
85
+ });
86
+ return /*#__PURE__*/ jsx(ListContext.Provider, {
87
+ value: contextValue,
88
+ children: /*#__PURE__*/ jsx("ul", {
89
+ ref: themedRef,
90
+ className: classes,
91
+ style: computedStyle,
92
+ ...rest,
93
+ children: children
94
+ })
95
+ });
96
+ });
97
+ ListRoot.displayName = 'List';
98
+ const ListItem = /*#__PURE__*/ forwardRef(({ icon, className, children, ...rest }, ref)=>{
99
+ const context = useContext(ListContext);
100
+ const resolvedIcon = icon ?? context.icon;
101
+ const classes = className ? `${item({
102
+ withIcon: Boolean(resolvedIcon),
103
+ center: context.center
104
+ })} ${className}` : item({
105
+ withIcon: Boolean(resolvedIcon),
106
+ center: context.center
107
+ });
108
+ return /*#__PURE__*/ jsxs("li", {
109
+ ref: ref,
110
+ className: classes,
111
+ ...rest,
112
+ children: [
113
+ resolvedIcon ? /*#__PURE__*/ jsx("span", {
114
+ className: itemIcon,
115
+ children: resolvedIcon
116
+ }) : null,
117
+ children
118
+ ]
119
+ });
120
+ });
121
+ ListItem.displayName = 'ListItem';
122
+ const List = Object.assign(ListRoot, {
123
+ Item: ListItem
124
+ });
125
+ const list_List = List;
126
+ export { list_List as List };
package/dist/esm/651.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import "./651.css";
2
2
  import { jsx } from "react/jsx-runtime";
3
+ import { useThemedRef } from "@vinyasa/tokens";
3
4
  import { forwardRef } from "react";
4
5
  import { createRuntimeFn } from "./953.js";
5
6
  import { resolveSpacingStyle } from "./474.js";
@@ -17,6 +18,7 @@ var code = createRuntimeFn({
17
18
  compoundVariants: []
18
19
  });
19
20
  const Code = /*#__PURE__*/ forwardRef(({ block = false, m, mt, mr, mb, ml, mx, my, p, pt, pr, pb, pl, px, py, className, style, children, ...rest }, ref)=>{
21
+ const themedRef = useThemedRef(ref);
20
22
  const classes = className ? `${code({
21
23
  block
22
24
  })} ${className}` : code({
@@ -42,7 +44,7 @@ const Code = /*#__PURE__*/ forwardRef(({ block = false, m, mt, mr, mb, ml, mx, m
42
44
  ...style
43
45
  };
44
46
  if (block) return /*#__PURE__*/ jsx("pre", {
45
- ref: ref,
47
+ ref: themedRef,
46
48
  className: classes,
47
49
  style: computedStyle,
48
50
  ...rest,
@@ -51,7 +53,7 @@ const Code = /*#__PURE__*/ forwardRef(({ block = false, m, mt, mr, mb, ml, mx, m
51
53
  })
52
54
  });
53
55
  return /*#__PURE__*/ jsx("code", {
54
- ref: ref,
56
+ ref: themedRef,
55
57
  className: classes,
56
58
  style: computedStyle,
57
59
  ...rest,
@@ -0,0 +1,33 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Fragment, forwardRef } from "react";
3
+ import { Text as text_Text } from "./191.js";
4
+ import { Mark as mark_Mark } from "./227.js";
5
+ const escapeRegExp = (value)=>value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
6
+ const Highlight = /*#__PURE__*/ forwardRef(({ children, highlight, ...props }, ref)=>{
7
+ const terms = (Array.isArray(highlight) ? highlight : [
8
+ highlight
9
+ ]).filter(Boolean);
10
+ if (0 === terms.length) return /*#__PURE__*/ jsx(text_Text, {
11
+ ref: ref,
12
+ ...props,
13
+ children: children
14
+ });
15
+ const lowerTerms = new Set(terms.map((term)=>term.toLowerCase()));
16
+ const pattern = new RegExp(`(${terms.map(escapeRegExp).join('|')})`, 'gi');
17
+ const parts = children.split(pattern);
18
+ return /*#__PURE__*/ jsx(text_Text, {
19
+ ref: ref,
20
+ ...props,
21
+ children: parts.map((part, index)=>{
22
+ const key = `${String(index)}-${part}`;
23
+ return lowerTerms.has(part.toLowerCase()) ? /*#__PURE__*/ jsx(mark_Mark, {
24
+ children: part
25
+ }, key) : /*#__PURE__*/ jsx(Fragment, {
26
+ children: part
27
+ }, key);
28
+ })
29
+ });
30
+ });
31
+ Highlight.displayName = 'Highlight';
32
+ const highlight_Highlight = Highlight;
33
+ export { highlight_Highlight as Highlight };
package/dist/esm/783.js CHANGED
@@ -1,9 +1,11 @@
1
1
  import "./783.css";
2
2
  import { jsx } from "react/jsx-runtime";
3
+ import { useThemedRef } from "@vinyasa/tokens";
3
4
  import { forwardRef } from "react";
4
5
  import { resolveSpacingStyle } from "./474.js";
5
6
  var blockquote = 'adxw6l0';
6
7
  const Blockquote = /*#__PURE__*/ forwardRef(({ m, mt, mr, mb, ml, mx, my, p, pt, pr, pb, pl, px, py, className, style, children, ...rest }, ref)=>{
8
+ const themedRef = useThemedRef(ref);
7
9
  const classes = className ? `${blockquote} ${className}` : blockquote;
8
10
  const computedStyle = {
9
11
  ...resolveSpacingStyle({
@@ -25,7 +27,7 @@ const Blockquote = /*#__PURE__*/ forwardRef(({ m, mt, mr, mb, ml, mx, my, p, pt,
25
27
  ...style
26
28
  };
27
29
  return /*#__PURE__*/ jsx("blockquote", {
28
- ref: ref,
30
+ ref: themedRef,
29
31
  className: classes,
30
32
  style: computedStyle,
31
33
  ...rest,
package/dist/esm/919.js CHANGED
@@ -1,9 +1,11 @@
1
1
  import "./919.css";
2
2
  import { jsx } from "react/jsx-runtime";
3
+ import { useThemedRef } from "@vinyasa/tokens";
3
4
  import { forwardRef } from "react";
4
5
  import { resolveSpacingStyle } from "./474.js";
5
6
  var kbd = '_18ahdyj0';
6
7
  const Kbd = /*#__PURE__*/ forwardRef(({ m, mt, mr, mb, ml, mx, my, p, pt, pr, pb, pl, px, py, className, style, children, ...rest }, ref)=>{
8
+ const themedRef = useThemedRef(ref);
7
9
  const classes = className ? `${kbd} ${className}` : kbd;
8
10
  const computedStyle = {
9
11
  ...resolveSpacingStyle({
@@ -25,7 +27,7 @@ const Kbd = /*#__PURE__*/ forwardRef(({ m, mt, mr, mb, ml, mx, my, p, pt, pr, pb
25
27
  ...style
26
28
  };
27
29
  return /*#__PURE__*/ jsx("kbd", {
28
- ref: ref,
30
+ ref: themedRef,
29
31
  className: classes,
30
32
  style: computedStyle,
31
33
  ...rest,
@@ -0,0 +1,14 @@
1
+ import { type TextProps } from '../text/Text';
2
+ export type HighlightProps = Omit<TextProps, 'children'> & {
3
+ /** Plain text to search within. Rich `children` can't be reliably split and re-wrapped, so this only accepts a string, unlike Text's own `children`. */
4
+ children: string;
5
+ /** Substring(s) to wrap in a `Mark`, matched case-insensitively. */
6
+ highlight: string | string[];
7
+ };
8
+ declare const Highlight: import("react").ForwardRefExoticComponent<Omit<TextProps, "children"> & {
9
+ /** Plain text to search within. Rich `children` can't be reliably split and re-wrapped, so this only accepts a string, unlike Text's own `children`. */
10
+ children: string;
11
+ /** Substring(s) to wrap in a `Mark`, matched case-insensitively. */
12
+ highlight: string | string[];
13
+ } & import("react").RefAttributes<HTMLElement>>;
14
+ export default Highlight;
@@ -0,0 +1 @@
1
+ export { default, type HighlightProps } from './Highlight';
@@ -0,0 +1,47 @@
1
+ export declare const list: import("@vanilla-extract/recipes").RuntimeFn<{
2
+ spacing: {
3
+ 1: {
4
+ gap: `var(--${string})`;
5
+ };
6
+ 2: {
7
+ gap: `var(--${string})`;
8
+ };
9
+ 3: {
10
+ gap: `var(--${string})`;
11
+ };
12
+ 4: {
13
+ gap: `var(--${string})`;
14
+ };
15
+ 5: {
16
+ gap: `var(--${string})`;
17
+ };
18
+ 6: {
19
+ gap: `var(--${string})`;
20
+ };
21
+ };
22
+ withPadding: {
23
+ true: {
24
+ paddingLeft: `var(--${string})`;
25
+ };
26
+ false: {
27
+ paddingLeft: number;
28
+ listStyle: "none";
29
+ };
30
+ };
31
+ }>;
32
+ export declare const item: import("@vanilla-extract/recipes").RuntimeFn<{
33
+ withIcon: {
34
+ true: {
35
+ display: "flex";
36
+ alignItems: "flex-start";
37
+ gap: `var(--${string})`;
38
+ listStyle: "none";
39
+ };
40
+ };
41
+ center: {
42
+ true: {
43
+ alignItems: "center";
44
+ };
45
+ };
46
+ }>;
47
+ export declare const itemIcon: string;
@@ -0,0 +1,52 @@
1
+ import { type ComponentPropsWithoutRef, type ReactNode } from 'react';
2
+ import { type SpaceScale, type SpacingProps } from '../../spacing';
3
+ export type ListRootProps = Omit<ComponentPropsWithoutRef<'ul'>, 'type'> & SpacingProps & {
4
+ /** Renders `<ol>` instead of `<ul>`. */
5
+ type?: 'unordered' | 'ordered';
6
+ /** Gap between items, on the shared 1-6 space scale. */
7
+ spacing?: SpaceScale;
8
+ /**
9
+ * Keeps the browser's default list indent. On by default; turn off
10
+ * when every item supplies its own `icon`, which already replaces the
11
+ * native marker and its indent.
12
+ */
13
+ withPadding?: boolean;
14
+ /**
15
+ * Default icon rendered before every item's content, replacing the
16
+ * native bullet/number. Overridable per-item via `List.Item`'s own
17
+ * `icon`.
18
+ */
19
+ icon?: ReactNode;
20
+ /** Vertically centers each item's icon against its content instead of aligning both to the top. */
21
+ center?: boolean;
22
+ };
23
+ export type ListItemProps = ComponentPropsWithoutRef<'li'> & {
24
+ /** Overrides the list's own default `icon` for this item only. */
25
+ icon?: ReactNode;
26
+ };
27
+ declare const List: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "ref">, "type"> & SpacingProps & {
28
+ /** Renders `<ol>` instead of `<ul>`. */
29
+ type?: "unordered" | "ordered";
30
+ /** Gap between items, on the shared 1-6 space scale. */
31
+ spacing?: SpaceScale;
32
+ /**
33
+ * Keeps the browser's default list indent. On by default; turn off
34
+ * when every item supplies its own `icon`, which already replaces the
35
+ * native marker and its indent.
36
+ */
37
+ withPadding?: boolean;
38
+ /**
39
+ * Default icon rendered before every item's content, replacing the
40
+ * native bullet/number. Overridable per-item via `List.Item`'s own
41
+ * `icon`.
42
+ */
43
+ icon?: ReactNode;
44
+ /** Vertically centers each item's icon against its content instead of aligning both to the top. */
45
+ center?: boolean;
46
+ } & import("react").RefAttributes<HTMLOListElement | HTMLUListElement>> & {
47
+ Item: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & {
48
+ /** Overrides the list's own default `icon` for this item only. */
49
+ icon?: ReactNode;
50
+ } & import("react").RefAttributes<HTMLLIElement>>;
51
+ };
52
+ export default List;
@@ -0,0 +1 @@
1
+ export { default, type ListItemProps, type ListRootProps } from './List';
@@ -0,0 +1 @@
1
+ export declare const mark: string;
@@ -0,0 +1,5 @@
1
+ import { type ComponentPropsWithoutRef } from 'react';
2
+ import { type SpacingProps } from '../../spacing';
3
+ export type MarkProps = ComponentPropsWithoutRef<'mark'> & SpacingProps;
4
+ declare const Mark: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & SpacingProps & import("react").RefAttributes<HTMLElement>>;
5
+ export default Mark;
@@ -0,0 +1 @@
1
+ export { default, type MarkProps } from './Mark';
@@ -60,15 +60,108 @@ export declare const text: import("@vanilla-extract/recipes").RuntimeFn<{
60
60
  primary: {
61
61
  color: `var(--${string})`;
62
62
  };
63
+ info: {
64
+ color: `var(--${string})`;
65
+ };
66
+ success: {
67
+ color: `var(--${string})`;
68
+ };
69
+ warning: {
70
+ color: `var(--${string})`;
71
+ };
63
72
  error: {
64
73
  color: `var(--${string})`;
65
74
  };
66
75
  };
67
76
  truncate: {
68
- true: {
77
+ end: {
78
+ display: "inline-block";
79
+ maxWidth: "100%";
80
+ overflow: "hidden";
81
+ textOverflow: "ellipsis";
82
+ whiteSpace: "nowrap";
83
+ };
84
+ start: {
85
+ display: "inline-block";
86
+ maxWidth: "100%";
69
87
  overflow: "hidden";
70
88
  textOverflow: "ellipsis";
71
89
  whiteSpace: "nowrap";
90
+ direction: "rtl";
91
+ textAlign: "left";
92
+ };
93
+ };
94
+ italic: {
95
+ true: {
96
+ fontStyle: "italic";
97
+ };
98
+ };
99
+ textTransform: {
100
+ uppercase: {
101
+ textTransform: "uppercase";
102
+ };
103
+ lowercase: {
104
+ textTransform: "lowercase";
105
+ };
106
+ capitalize: {
107
+ textTransform: "capitalize";
108
+ };
109
+ none: {
110
+ textTransform: "none";
111
+ };
112
+ };
113
+ decoration: {
114
+ underline: {
115
+ textDecoration: "underline";
116
+ };
117
+ 'line-through': {
118
+ textDecoration: "line-through";
119
+ };
120
+ none: {
121
+ textDecoration: "none";
122
+ };
123
+ };
124
+ letterSpacing: {
125
+ tight: {
126
+ letterSpacing: `var(--${string})`;
127
+ };
128
+ normal: {
129
+ letterSpacing: `var(--${string})`;
130
+ };
131
+ wide: {
132
+ letterSpacing: `var(--${string})`;
133
+ };
134
+ };
135
+ lineHeight: {
136
+ tight: {
137
+ lineHeight: `var(--${string})`;
138
+ };
139
+ normal: {
140
+ lineHeight: `var(--${string})`;
141
+ };
142
+ loose: {
143
+ lineHeight: `var(--${string})`;
144
+ };
145
+ };
146
+ textWrap: {
147
+ wrap: {
148
+ textWrap: "wrap";
149
+ };
150
+ balance: {
151
+ textWrap: "balance";
152
+ };
153
+ pretty: {
154
+ textWrap: "pretty";
155
+ };
156
+ nowrap: {
157
+ textWrap: "nowrap";
158
+ };
159
+ };
160
+ variant: {
161
+ gradient: {
162
+ backgroundClip: "text";
163
+ WebkitBackgroundClip: "text";
164
+ color: "transparent";
72
165
  };
73
166
  };
74
167
  }>;
@@ -2,13 +2,59 @@ import type { RecipeVariants } from '@vanilla-extract/recipes';
2
2
  import type { PolymorphicProps } from '../../polymorphic';
3
3
  import { type SpacingProps } from '../../spacing';
4
4
  import { text } from './Text.css';
5
- type TextVariants = RecipeVariants<typeof text>;
6
- export type TextProps = PolymorphicProps & TextVariants & SpacingProps;
7
- declare const Text: import("react").ForwardRefExoticComponent<PolymorphicProps & {
8
- size?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | undefined;
9
- weight?: "medium" | "bold" | "regular" | "semibold" | undefined;
10
- align?: "left" | "right" | "center" | undefined;
11
- color?: "default" | "muted" | "primary" | "error" | undefined;
12
- truncate?: boolean | undefined;
13
- } & SpacingProps & import("react").RefAttributes<HTMLElement>>;
5
+ type TextVariants = Omit<NonNullable<RecipeVariants<typeof text>>, 'truncate'>;
6
+ export type TextProps = PolymorphicProps & TextVariants & SpacingProps & {
7
+ /**
8
+ * Truncate to one line with an ellipsis. `true` (or `'end'`) clips the
9
+ * end; `'start'` clips the beginning instead e.g. a long file path
10
+ * where the filename at the end matters most.
11
+ */
12
+ truncate?: boolean | 'start' | 'end';
13
+ /**
14
+ * Clamp to this many lines with a trailing ellipsis instead of a
15
+ * single-line `truncate`. Takes precedence over `truncate` when both
16
+ * are set.
17
+ */
18
+ lineClamp?: number;
19
+ /**
20
+ * Skip Text's own font-size/weight/color/line-height and inherit them
21
+ * from the closest styled ancestor — for composing Text inside a
22
+ * heading or another Text where it should pick up the surrounding
23
+ * type instead of resetting to Text's own defaults.
24
+ */
25
+ inherit?: boolean;
26
+ /** Paints the text with a gradient instead of a solid `color`. Only applied when `variant="gradient"`. */
27
+ gradient?: {
28
+ from: string;
29
+ to: string;
30
+ deg?: number;
31
+ };
32
+ };
33
+ declare const Text: import("react").ForwardRefExoticComponent<PolymorphicProps & TextVariants & SpacingProps & {
34
+ /**
35
+ * Truncate to one line with an ellipsis. `true` (or `'end'`) clips the
36
+ * end; `'start'` clips the beginning instead — e.g. a long file path
37
+ * where the filename at the end matters most.
38
+ */
39
+ truncate?: boolean | "start" | "end";
40
+ /**
41
+ * Clamp to this many lines with a trailing ellipsis instead of a
42
+ * single-line `truncate`. Takes precedence over `truncate` when both
43
+ * are set.
44
+ */
45
+ lineClamp?: number;
46
+ /**
47
+ * Skip Text's own font-size/weight/color/line-height and inherit them
48
+ * from the closest styled ancestor — for composing Text inside a
49
+ * heading or another Text where it should pick up the surrounding
50
+ * type instead of resetting to Text's own defaults.
51
+ */
52
+ inherit?: boolean;
53
+ /** Paints the text with a gradient instead of a solid `color`. Only applied when `variant="gradient"`. */
54
+ gradient?: {
55
+ from: string;
56
+ to: string;
57
+ deg?: number;
58
+ };
59
+ } & import("react").RefAttributes<HTMLElement>>;
14
60
  export default Text;
@@ -0,0 +1,2 @@
1
+ export * from './components/highlight/index';
2
+ export { default } from './components/highlight/index';
@@ -0,0 +1 @@
1
+ export { Highlight as default } from "./767.js";
@@ -2,9 +2,13 @@ export { default as Blockquote, type BlockquoteProps } from './components/blockq
2
2
  export { default as Caption, type CaptionProps } from './components/caption';
3
3
  export { default as Code, type CodeProps } from './components/code';
4
4
  export { default as Heading, type HeadingLevel, type HeadingProps } from './components/heading';
5
+ export { default as Highlight, type HighlightProps } from './components/highlight';
5
6
  export { default as Kbd, type KbdProps } from './components/kbd';
6
7
  export { default as Label, type LabelProps } from './components/label';
7
8
  export { default as Link, type LinkProps } from './components/link';
9
+ export { default as List, type ListItemProps, type ListRootProps } from './components/list';
10
+ export { default as Mark, type MarkProps } from './components/mark';
8
11
  export { default as MarkdownRenderer, type MarkdownRendererProps, } from './components/markdown-renderer';
9
12
  export { default as Paragraph, type ParagraphProps } from './components/paragraph';
10
13
  export { default as Text, type TextProps } from './components/text';
14
+ export { useIsTruncated } from './useIsTruncated';
package/dist/esm/index.js CHANGED
@@ -1,10 +1,36 @@
1
+ import { useLayoutEffect, useRef, useState } from "react";
2
+ const checkOverflow = (element)=>element.scrollWidth > element.clientWidth || element.scrollHeight > element.clientHeight;
3
+ const useIsTruncated = (deps = [])=>{
4
+ const ref = useRef(null);
5
+ const [isTruncated, setIsTruncated] = useState(false);
6
+ useLayoutEffect(()=>{
7
+ const element = ref.current;
8
+ if (!element) return;
9
+ setIsTruncated(checkOverflow(element));
10
+ const observer = new ResizeObserver(()=>{
11
+ setIsTruncated(checkOverflow(element));
12
+ });
13
+ observer.observe(element);
14
+ return ()=>{
15
+ observer.disconnect();
16
+ };
17
+ }, deps);
18
+ return [
19
+ ref,
20
+ isTruncated
21
+ ];
22
+ };
1
23
  export { Blockquote } from "./783.js";
2
24
  export { Caption } from "./975.js";
3
25
  export { Code } from "./651.js";
4
26
  export { Heading } from "./63.js";
27
+ export { Highlight } from "./767.js";
5
28
  export { Kbd } from "./919.js";
6
29
  export { Label } from "./691.js";
7
30
  export { Link } from "./57.js";
31
+ export { List } from "./513.js";
32
+ export { Mark } from "./227.js";
8
33
  export { MarkdownRenderer } from "./654.js";
9
34
  export { Paragraph } from "./895.js";
10
35
  export { Text } from "./191.js";
36
+ export { useIsTruncated };
@@ -0,0 +1,2 @@
1
+ export * from './components/list/index';
2
+ export { default } from './components/list/index';
@@ -0,0 +1 @@
1
+ export { List as default } from "./513.js";