thomas-uikit-core 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -143,13 +143,34 @@ Input.displayName = "Input";
143
143
  // src/components/ui/common/Text.tsx
144
144
  var import_react = require("react");
145
145
  var import_jsx_runtime3 = require("react/jsx-runtime");
146
+ var variantToTag = {
147
+ h1: "h1",
148
+ h2: "h2",
149
+ h3: "h3",
150
+ "h3-bold": "h3",
151
+ h4: "h4",
152
+ h5: "h5",
153
+ "body-l": "p",
154
+ "body-m": "p",
155
+ "body-m-bold": "p",
156
+ "body-s": "p",
157
+ "label-l": "label",
158
+ "label-m": "label",
159
+ "label-s": "label",
160
+ "caption-l": "span",
161
+ "caption-m": "span",
162
+ "button-l": "span",
163
+ "button-m": "span",
164
+ "button-s": "span"
165
+ };
146
166
  var Text = ({
147
167
  variant = "body-m",
148
- as: Component = "span",
168
+ as,
149
169
  children,
150
170
  className = "",
151
171
  ...props
152
172
  }) => {
173
+ const Component = as || variantToTag[variant] || "span";
153
174
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
154
175
  Component,
155
176
  {
package/dist/index.js CHANGED
@@ -76,13 +76,34 @@ Input.displayName = "Input";
76
76
  // src/components/ui/common/Text.tsx
77
77
  import "react";
78
78
  import { jsx as jsx3 } from "react/jsx-runtime";
79
+ var variantToTag = {
80
+ h1: "h1",
81
+ h2: "h2",
82
+ h3: "h3",
83
+ "h3-bold": "h3",
84
+ h4: "h4",
85
+ h5: "h5",
86
+ "body-l": "p",
87
+ "body-m": "p",
88
+ "body-m-bold": "p",
89
+ "body-s": "p",
90
+ "label-l": "label",
91
+ "label-m": "label",
92
+ "label-s": "label",
93
+ "caption-l": "span",
94
+ "caption-m": "span",
95
+ "button-l": "span",
96
+ "button-m": "span",
97
+ "button-s": "span"
98
+ };
79
99
  var Text = ({
80
100
  variant = "body-m",
81
- as: Component = "span",
101
+ as,
82
102
  children,
83
103
  className = "",
84
104
  ...props
85
105
  }) => {
106
+ const Component = as || variantToTag[variant] || "span";
86
107
  return /* @__PURE__ */ jsx3(
87
108
  Component,
88
109
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thomas-uikit-core",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "@radix-ui/react-dialog": "^1.1.15",
@@ -27,13 +27,35 @@ interface TextProps extends React.HTMLAttributes<HTMLElement> {
27
27
  className?: string;
28
28
  }
29
29
 
30
+ const variantToTag: Record<TextVariant, React.ElementType> = {
31
+ h1: 'h1',
32
+ h2: 'h2',
33
+ h3: 'h3',
34
+ 'h3-bold': 'h3',
35
+ h4: 'h4',
36
+ h5: 'h5',
37
+ 'body-l': 'p',
38
+ 'body-m': 'p',
39
+ 'body-m-bold': 'p',
40
+ 'body-s': 'p',
41
+ 'label-l': 'label',
42
+ 'label-m': 'label',
43
+ 'label-s': 'label',
44
+ 'caption-l': 'span',
45
+ 'caption-m': 'span',
46
+ 'button-l': 'span',
47
+ 'button-m': 'span',
48
+ 'button-s': 'span',
49
+ };
50
+
30
51
  export const Text: React.FC<TextProps> = ({
31
52
  variant = "body-m",
32
- as: Component = "span",
53
+ as,
33
54
  children,
34
55
  className = "",
35
56
  ...props
36
57
  }) => {
58
+ const Component = as || variantToTag[variant] || 'span';
37
59
  return (
38
60
  <Component
39
61
  className={`text-${variant} ${className}`.trim()}