@limetry/ui 1.2.80 → 1.2.81
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 +18 -2
- package/dist/index.js +18 -2
- package/package.json +9 -7
- package/src/components/button.tsx +30 -2
- package/src/lib/site-footer-links.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -111,6 +111,21 @@ var textSizeStyles = {
|
|
|
111
111
|
md: "text-base",
|
|
112
112
|
lg: "text-lg"
|
|
113
113
|
};
|
|
114
|
+
function isTextish(value) {
|
|
115
|
+
return typeof value === "string" || typeof value === "number";
|
|
116
|
+
}
|
|
117
|
+
function textishLabel(children) {
|
|
118
|
+
if (isTextish(children)) {
|
|
119
|
+
return String(children);
|
|
120
|
+
}
|
|
121
|
+
if (!Array.isArray(children) || children.length === 0) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
if (!children.every((child) => isTextish(child) || child === null || child === false || child === true || child === void 0)) {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
return children.filter(isTextish).join("");
|
|
128
|
+
}
|
|
114
129
|
function Button({
|
|
115
130
|
children,
|
|
116
131
|
variant = "primary",
|
|
@@ -120,6 +135,7 @@ function Button({
|
|
|
120
135
|
disabled,
|
|
121
136
|
...props
|
|
122
137
|
}) {
|
|
138
|
+
const label = textishLabel(children);
|
|
123
139
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
124
140
|
import_react_native2.Pressable,
|
|
125
141
|
{
|
|
@@ -133,7 +149,7 @@ function Button({
|
|
|
133
149
|
),
|
|
134
150
|
disabled,
|
|
135
151
|
...props,
|
|
136
|
-
children:
|
|
152
|
+
children: label !== null ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
137
153
|
import_react_native2.Text,
|
|
138
154
|
{
|
|
139
155
|
className: cn(
|
|
@@ -141,7 +157,7 @@ function Button({
|
|
|
141
157
|
textSizeStyles[size],
|
|
142
158
|
textClassName
|
|
143
159
|
),
|
|
144
|
-
children
|
|
160
|
+
children: label
|
|
145
161
|
}
|
|
146
162
|
) : children
|
|
147
163
|
}
|
package/dist/index.js
CHANGED
|
@@ -59,6 +59,21 @@ var textSizeStyles = {
|
|
|
59
59
|
md: "text-base",
|
|
60
60
|
lg: "text-lg"
|
|
61
61
|
};
|
|
62
|
+
function isTextish(value) {
|
|
63
|
+
return typeof value === "string" || typeof value === "number";
|
|
64
|
+
}
|
|
65
|
+
function textishLabel(children) {
|
|
66
|
+
if (isTextish(children)) {
|
|
67
|
+
return String(children);
|
|
68
|
+
}
|
|
69
|
+
if (!Array.isArray(children) || children.length === 0) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
if (!children.every((child) => isTextish(child) || child === null || child === false || child === true || child === void 0)) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
return children.filter(isTextish).join("");
|
|
76
|
+
}
|
|
62
77
|
function Button({
|
|
63
78
|
children,
|
|
64
79
|
variant = "primary",
|
|
@@ -68,6 +83,7 @@ function Button({
|
|
|
68
83
|
disabled,
|
|
69
84
|
...props
|
|
70
85
|
}) {
|
|
86
|
+
const label = textishLabel(children);
|
|
71
87
|
return /* @__PURE__ */ jsx2(
|
|
72
88
|
Pressable,
|
|
73
89
|
{
|
|
@@ -81,7 +97,7 @@ function Button({
|
|
|
81
97
|
),
|
|
82
98
|
disabled,
|
|
83
99
|
...props,
|
|
84
|
-
children:
|
|
100
|
+
children: label !== null ? /* @__PURE__ */ jsx2(
|
|
85
101
|
Text2,
|
|
86
102
|
{
|
|
87
103
|
className: cn(
|
|
@@ -89,7 +105,7 @@ function Button({
|
|
|
89
105
|
textSizeStyles[size],
|
|
90
106
|
textClassName
|
|
91
107
|
),
|
|
92
|
-
children
|
|
108
|
+
children: label
|
|
93
109
|
}
|
|
94
110
|
) : children
|
|
95
111
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@limetry/ui",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.81",
|
|
4
4
|
"description": "Shared design system for Limetry — components, icons, and design tokens.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -71,13 +71,15 @@
|
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@babel/core": "^7.26.0",
|
|
74
|
-
"@
|
|
75
|
-
"react": "19.
|
|
76
|
-
"react
|
|
77
|
-
"react-
|
|
74
|
+
"@react-native/metro-config": "^0.88.1",
|
|
75
|
+
"@types/react": "~19.3.0",
|
|
76
|
+
"react": "19.3.0",
|
|
77
|
+
"react-dom": "19.3.0",
|
|
78
|
+
"react-native": "0.88.1",
|
|
78
79
|
"react-native-css-interop": "^0.2.6",
|
|
79
|
-
"react-native-reanimated": "
|
|
80
|
-
"react-native-svg": "15.
|
|
80
|
+
"react-native-reanimated": "4.7.1",
|
|
81
|
+
"react-native-svg": "15.16.0",
|
|
82
|
+
"react-native-worklets": "0.13.0",
|
|
81
83
|
"tailwindcss": "^4.3.3",
|
|
82
84
|
"tsup": "^8.5.0",
|
|
83
85
|
"typescript": "^5.8.2",
|
|
@@ -71,6 +71,32 @@ const textSizeStyles: Record<ButtonSize, string> = {
|
|
|
71
71
|
lg: "text-lg",
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
function isTextish(value: ReactNode): value is string | number {
|
|
75
|
+
return typeof value === "string" || typeof value === "number"
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Flattens JSX text/number children into one label string.
|
|
80
|
+
*
|
|
81
|
+
* JSX like `Use existing ({count})` becomes an array of strings and numbers.
|
|
82
|
+
* React Native cannot render those raw text nodes inside Pressable.
|
|
83
|
+
*
|
|
84
|
+
* @param children - Button children.
|
|
85
|
+
* @returns Joined label when every child is textish; otherwise null.
|
|
86
|
+
*/
|
|
87
|
+
function textishLabel(children: ReactNode): string | null {
|
|
88
|
+
if (isTextish(children)) {
|
|
89
|
+
return String(children)
|
|
90
|
+
}
|
|
91
|
+
if (!Array.isArray(children) || children.length === 0) {
|
|
92
|
+
return null
|
|
93
|
+
}
|
|
94
|
+
if (!children.every((child) => isTextish(child) || child === null || child === false || child === true || child === undefined)) {
|
|
95
|
+
return null
|
|
96
|
+
}
|
|
97
|
+
return children.filter(isTextish).join("")
|
|
98
|
+
}
|
|
99
|
+
|
|
74
100
|
/**
|
|
75
101
|
* Accessible pressable button that wraps string children in styled `Text`.
|
|
76
102
|
*
|
|
@@ -86,6 +112,8 @@ export function Button({
|
|
|
86
112
|
disabled,
|
|
87
113
|
...props
|
|
88
114
|
}: ButtonProps): React.JSX.Element {
|
|
115
|
+
const label = textishLabel(children)
|
|
116
|
+
|
|
89
117
|
return (
|
|
90
118
|
<Pressable
|
|
91
119
|
accessibilityRole="button"
|
|
@@ -99,7 +127,7 @@ export function Button({
|
|
|
99
127
|
disabled={disabled}
|
|
100
128
|
{...props}
|
|
101
129
|
>
|
|
102
|
-
{
|
|
130
|
+
{label !== null ? (
|
|
103
131
|
<Text
|
|
104
132
|
className={cn(
|
|
105
133
|
textVariantStyles[variant],
|
|
@@ -107,7 +135,7 @@ export function Button({
|
|
|
107
135
|
textClassName,
|
|
108
136
|
)}
|
|
109
137
|
>
|
|
110
|
-
{
|
|
138
|
+
{label}
|
|
111
139
|
</Text>
|
|
112
140
|
) : (
|
|
113
141
|
children
|