@expo/styleguide 14.2.2 → 14.4.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.
|
@@ -8,6 +8,10 @@ export type ButtonProps = ButtonBaseProps & LinkBaseProps & {
|
|
|
8
8
|
theme?: ButtonTheme;
|
|
9
9
|
leftSlot?: ReactElement;
|
|
10
10
|
rightSlot?: ReactElement;
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Button no longer transforms its label — children always render as written.
|
|
13
|
+
* This prop is a no-op and will be removed in a future release.
|
|
14
|
+
*/
|
|
11
15
|
skipCapitalization?: boolean;
|
|
12
16
|
};
|
|
13
17
|
export declare const Button: import("react").ForwardRefExoticComponent<import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
@@ -22,5 +26,9 @@ export declare const Button: import("react").ForwardRefExoticComponent<import("r
|
|
|
22
26
|
theme?: ButtonTheme;
|
|
23
27
|
leftSlot?: ReactElement;
|
|
24
28
|
rightSlot?: ReactElement;
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated Button no longer transforms its label — children always render as written.
|
|
31
|
+
* This prop is a no-op and will be removed in a future release.
|
|
32
|
+
*/
|
|
25
33
|
skipCapitalization?: boolean;
|
|
26
34
|
} & import("react").RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
var compilerRuntime = require('react/compiler-runtime');
|
|
5
5
|
var react = require('react');
|
|
6
6
|
var ButtonBase = require('./ButtonBase.js');
|
|
7
|
-
var helpers = require('./helpers.js');
|
|
8
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
9
8
|
var LinkBase = require('../Link/LinkBase.js');
|
|
10
9
|
var mergeClasses = require('@expo/styleguide-base/mergeClasses');
|
|
@@ -116,7 +115,7 @@ function getIconProps(element, classNames) {
|
|
|
116
115
|
};
|
|
117
116
|
}
|
|
118
117
|
const Button = /*#__PURE__*/react.forwardRef((t0, ref) => {
|
|
119
|
-
const $ = compilerRuntime.c(
|
|
118
|
+
const $ = compilerRuntime.c(50);
|
|
120
119
|
let children;
|
|
121
120
|
let className;
|
|
122
121
|
let disabled;
|
|
@@ -127,21 +126,30 @@ const Button = /*#__PURE__*/react.forwardRef((t0, ref) => {
|
|
|
127
126
|
let rightSlot;
|
|
128
127
|
let t1;
|
|
129
128
|
let t2;
|
|
130
|
-
let t3;
|
|
131
129
|
if ($[0] !== t0) {
|
|
132
|
-
|
|
133
|
-
children,
|
|
134
|
-
size:
|
|
135
|
-
theme:
|
|
136
|
-
skipCapitalization:
|
|
137
|
-
href,
|
|
138
|
-
disabled,
|
|
139
|
-
className,
|
|
140
|
-
leftSlot,
|
|
141
|
-
rightSlot,
|
|
142
|
-
openInNewTab,
|
|
143
|
-
...
|
|
144
|
-
} = t0
|
|
130
|
+
const {
|
|
131
|
+
children: t3,
|
|
132
|
+
size: t4,
|
|
133
|
+
theme: t5,
|
|
134
|
+
skipCapitalization: _skipCapitalization,
|
|
135
|
+
href: t6,
|
|
136
|
+
disabled: t7,
|
|
137
|
+
className: t8,
|
|
138
|
+
leftSlot: t9,
|
|
139
|
+
rightSlot: t10,
|
|
140
|
+
openInNewTab: t11,
|
|
141
|
+
...t12
|
|
142
|
+
} = t0;
|
|
143
|
+
children = t3;
|
|
144
|
+
t1 = t4;
|
|
145
|
+
t2 = t5;
|
|
146
|
+
href = t6;
|
|
147
|
+
disabled = t7;
|
|
148
|
+
className = t8;
|
|
149
|
+
leftSlot = t9;
|
|
150
|
+
rightSlot = t10;
|
|
151
|
+
openInNewTab = t11;
|
|
152
|
+
rest = t12;
|
|
145
153
|
$[0] = t0;
|
|
146
154
|
$[1] = children;
|
|
147
155
|
$[2] = className;
|
|
@@ -153,7 +161,6 @@ const Button = /*#__PURE__*/react.forwardRef((t0, ref) => {
|
|
|
153
161
|
$[8] = rightSlot;
|
|
154
162
|
$[9] = t1;
|
|
155
163
|
$[10] = t2;
|
|
156
|
-
$[11] = t3;
|
|
157
164
|
} else {
|
|
158
165
|
children = $[1];
|
|
159
166
|
className = $[2];
|
|
@@ -165,125 +172,121 @@ const Button = /*#__PURE__*/react.forwardRef((t0, ref) => {
|
|
|
165
172
|
rightSlot = $[8];
|
|
166
173
|
t1 = $[9];
|
|
167
174
|
t2 = $[10];
|
|
168
|
-
t3 = $[11];
|
|
169
175
|
}
|
|
170
176
|
const size = t1 === undefined ? "sm" : t1;
|
|
171
177
|
const theme = t2 === undefined ? "primary" : t2;
|
|
172
|
-
|
|
178
|
+
let t3;
|
|
173
179
|
let t4;
|
|
174
180
|
let t5;
|
|
175
|
-
let t6;
|
|
176
181
|
let twClasses;
|
|
177
|
-
if ($[
|
|
182
|
+
if ($[11] !== children || $[12] !== className || $[13] !== disabled || $[14] !== href || $[15] !== leftSlot || $[16] !== rightSlot || $[17] !== size || $[18] !== theme) {
|
|
178
183
|
const isLeftSlotIcon = leftSlot && isIconElement(leftSlot);
|
|
179
184
|
const isRightSlotIcon = rightSlot && isIconElement(rightSlot);
|
|
180
185
|
const iconClasses = (isLeftSlotIcon || isRightSlotIcon) && mergeClasses.mergeClasses(getIconSizeClasses(size), getThemedIconClasses(theme), disabled && "opacity-60");
|
|
181
186
|
const isSingleIconButton = (leftSlot || rightSlot) && !children;
|
|
182
|
-
let
|
|
183
|
-
if ($[
|
|
184
|
-
|
|
185
|
-
$[
|
|
186
|
-
$[
|
|
187
|
-
$[
|
|
188
|
-
$[
|
|
189
|
-
$[
|
|
190
|
-
$[
|
|
187
|
+
let t6;
|
|
188
|
+
if ($[23] !== className || $[24] !== disabled || $[25] !== isSingleIconButton || $[26] !== size || $[27] !== theme) {
|
|
189
|
+
t6 = mergeClasses.mergeClasses("inline-flex border border-solid rounded-full font-medium items-center whitespace-nowrap transition gap-2", size === "xs" && "gap-1.5", size === "2xs" && "gap-1", getSizeClasses(size), getThemeClasses(theme, disabled), isSingleIconButton && getButtonIconClasses(size), disabled && "cursor-default opacity-80 pointer-event-none", className);
|
|
190
|
+
$[23] = className;
|
|
191
|
+
$[24] = disabled;
|
|
192
|
+
$[25] = isSingleIconButton;
|
|
193
|
+
$[26] = size;
|
|
194
|
+
$[27] = theme;
|
|
195
|
+
$[28] = t6;
|
|
191
196
|
} else {
|
|
192
|
-
|
|
197
|
+
t6 = $[28];
|
|
193
198
|
}
|
|
194
|
-
twClasses =
|
|
195
|
-
|
|
196
|
-
if ($[
|
|
197
|
-
|
|
199
|
+
twClasses = t6;
|
|
200
|
+
t3 = isLeftSlotIcon ? /*#__PURE__*/react.cloneElement(leftSlot, getIconProps(leftSlot, iconClasses)) : leftSlot;
|
|
201
|
+
if ($[29] !== children || $[30] !== href) {
|
|
202
|
+
t4 = children && /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
198
203
|
className: mergeClasses.mergeClasses("flex self-center text-inherit leading-none", href && "select-none"),
|
|
199
|
-
children:
|
|
204
|
+
children: children
|
|
200
205
|
});
|
|
201
|
-
$[
|
|
202
|
-
$[
|
|
203
|
-
$[
|
|
204
|
-
$[34] = t5;
|
|
206
|
+
$[29] = children;
|
|
207
|
+
$[30] = href;
|
|
208
|
+
$[31] = t4;
|
|
205
209
|
} else {
|
|
206
|
-
|
|
210
|
+
t4 = $[31];
|
|
207
211
|
}
|
|
208
|
-
|
|
209
|
-
$[
|
|
210
|
-
$[
|
|
211
|
-
$[
|
|
212
|
-
$[
|
|
213
|
-
$[
|
|
214
|
-
$[
|
|
215
|
-
$[
|
|
216
|
-
$[
|
|
217
|
-
$[
|
|
218
|
-
$[
|
|
219
|
-
$[
|
|
220
|
-
$[
|
|
221
|
-
$[24] = twClasses;
|
|
212
|
+
t5 = isRightSlotIcon ? /*#__PURE__*/react.cloneElement(rightSlot, getIconProps(rightSlot, iconClasses)) : rightSlot;
|
|
213
|
+
$[11] = children;
|
|
214
|
+
$[12] = className;
|
|
215
|
+
$[13] = disabled;
|
|
216
|
+
$[14] = href;
|
|
217
|
+
$[15] = leftSlot;
|
|
218
|
+
$[16] = rightSlot;
|
|
219
|
+
$[17] = size;
|
|
220
|
+
$[18] = theme;
|
|
221
|
+
$[19] = t3;
|
|
222
|
+
$[20] = t4;
|
|
223
|
+
$[21] = t5;
|
|
224
|
+
$[22] = twClasses;
|
|
222
225
|
} else {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
twClasses = $[
|
|
226
|
+
t3 = $[19];
|
|
227
|
+
t4 = $[20];
|
|
228
|
+
t5 = $[21];
|
|
229
|
+
twClasses = $[22];
|
|
227
230
|
}
|
|
228
|
-
let
|
|
229
|
-
if ($[
|
|
230
|
-
|
|
231
|
-
children: [t4, t5
|
|
231
|
+
let t6;
|
|
232
|
+
if ($[32] !== t3 || $[33] !== t4 || $[34] !== t5) {
|
|
233
|
+
t6 = /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
234
|
+
children: [t3, t4, t5]
|
|
232
235
|
});
|
|
233
|
-
$[
|
|
234
|
-
$[
|
|
235
|
-
$[
|
|
236
|
-
$[
|
|
236
|
+
$[32] = t3;
|
|
237
|
+
$[33] = t4;
|
|
238
|
+
$[34] = t5;
|
|
239
|
+
$[35] = t6;
|
|
237
240
|
} else {
|
|
238
|
-
|
|
241
|
+
t6 = $[35];
|
|
239
242
|
}
|
|
240
|
-
const content =
|
|
243
|
+
const content = t6;
|
|
241
244
|
if (href) {
|
|
242
|
-
const
|
|
243
|
-
let
|
|
244
|
-
if ($[
|
|
245
|
-
|
|
245
|
+
const t7 = ref;
|
|
246
|
+
let t8;
|
|
247
|
+
if ($[36] !== content || $[37] !== disabled || $[38] !== href || $[39] !== openInNewTab || $[40] !== rest || $[41] !== t7 || $[42] !== twClasses) {
|
|
248
|
+
t8 = /*#__PURE__*/jsxRuntime.jsx(LinkBase.LinkBase, {
|
|
246
249
|
href: href,
|
|
247
250
|
className: twClasses,
|
|
248
251
|
disabled: disabled,
|
|
249
|
-
ref:
|
|
252
|
+
ref: t7,
|
|
250
253
|
openInNewTab: openInNewTab,
|
|
251
254
|
...rest,
|
|
252
255
|
children: content
|
|
253
256
|
});
|
|
254
|
-
$[
|
|
255
|
-
$[
|
|
256
|
-
$[
|
|
257
|
-
$[
|
|
258
|
-
$[
|
|
259
|
-
$[
|
|
260
|
-
$[
|
|
261
|
-
$[
|
|
257
|
+
$[36] = content;
|
|
258
|
+
$[37] = disabled;
|
|
259
|
+
$[38] = href;
|
|
260
|
+
$[39] = openInNewTab;
|
|
261
|
+
$[40] = rest;
|
|
262
|
+
$[41] = t7;
|
|
263
|
+
$[42] = twClasses;
|
|
264
|
+
$[43] = t8;
|
|
262
265
|
} else {
|
|
263
|
-
|
|
266
|
+
t8 = $[43];
|
|
264
267
|
}
|
|
265
|
-
return
|
|
268
|
+
return t8;
|
|
266
269
|
} else {
|
|
267
|
-
const
|
|
268
|
-
let
|
|
269
|
-
if ($[
|
|
270
|
-
|
|
270
|
+
const t7 = ref;
|
|
271
|
+
let t8;
|
|
272
|
+
if ($[44] !== content || $[45] !== disabled || $[46] !== rest || $[47] !== t7 || $[48] !== twClasses) {
|
|
273
|
+
t8 = /*#__PURE__*/jsxRuntime.jsx(ButtonBase.ButtonBase, {
|
|
271
274
|
className: twClasses,
|
|
272
275
|
disabled: disabled,
|
|
273
|
-
ref:
|
|
276
|
+
ref: t7,
|
|
274
277
|
...rest,
|
|
275
278
|
children: content
|
|
276
279
|
});
|
|
277
|
-
$[
|
|
278
|
-
$[
|
|
279
|
-
$[
|
|
280
|
-
$[
|
|
281
|
-
$[
|
|
282
|
-
$[
|
|
280
|
+
$[44] = content;
|
|
281
|
+
$[45] = disabled;
|
|
282
|
+
$[46] = rest;
|
|
283
|
+
$[47] = t7;
|
|
284
|
+
$[48] = twClasses;
|
|
285
|
+
$[49] = t8;
|
|
283
286
|
} else {
|
|
284
|
-
|
|
287
|
+
t8 = $[49];
|
|
285
288
|
}
|
|
286
|
-
return
|
|
289
|
+
return t8;
|
|
287
290
|
}
|
|
288
291
|
});
|
|
289
292
|
Button.displayName = 'Button';
|
|
@@ -7,7 +7,7 @@ var react = require('react');
|
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
8
|
|
|
9
9
|
const LinkBase = /*#__PURE__*/react.forwardRef((t0, ref) => {
|
|
10
|
-
const $ = compilerRuntime.c(
|
|
10
|
+
const $ = compilerRuntime.c(36);
|
|
11
11
|
let children;
|
|
12
12
|
let disabled;
|
|
13
13
|
let href;
|
|
@@ -73,11 +73,10 @@ const LinkBase = /*#__PURE__*/react.forwardRef((t0, ref) => {
|
|
|
73
73
|
}
|
|
74
74
|
return t1;
|
|
75
75
|
}
|
|
76
|
-
if (!href
|
|
76
|
+
if (!href) {
|
|
77
77
|
let t1;
|
|
78
|
-
if ($[16] !== children || $[17] !==
|
|
78
|
+
if ($[16] !== children || $[17] !== onClick || $[18] !== ref || $[19] !== rest || $[20] !== testID) {
|
|
79
79
|
t1 = /*#__PURE__*/jsxRuntime.jsx("a", {
|
|
80
|
-
href: href,
|
|
81
80
|
ref: ref,
|
|
82
81
|
onClick: onClick,
|
|
83
82
|
"data-testid": testID,
|
|
@@ -85,14 +84,13 @@ const LinkBase = /*#__PURE__*/react.forwardRef((t0, ref) => {
|
|
|
85
84
|
children: children
|
|
86
85
|
});
|
|
87
86
|
$[16] = children;
|
|
88
|
-
$[17] =
|
|
89
|
-
$[18] =
|
|
90
|
-
$[19] =
|
|
91
|
-
$[20] =
|
|
92
|
-
$[21] =
|
|
93
|
-
$[22] = t1;
|
|
87
|
+
$[17] = onClick;
|
|
88
|
+
$[18] = ref;
|
|
89
|
+
$[19] = rest;
|
|
90
|
+
$[20] = testID;
|
|
91
|
+
$[21] = t1;
|
|
94
92
|
} else {
|
|
95
|
-
t1 = $[
|
|
93
|
+
t1 = $[21];
|
|
96
94
|
}
|
|
97
95
|
return t1;
|
|
98
96
|
}
|
|
@@ -100,31 +98,44 @@ const LinkBase = /*#__PURE__*/react.forwardRef((t0, ref) => {
|
|
|
100
98
|
const t1 = openInNewTab ? "_blank" : target;
|
|
101
99
|
const t2 = openInNewTab ? "noopener noreferrer" : rel;
|
|
102
100
|
let t3;
|
|
103
|
-
if ($[
|
|
104
|
-
t3 =
|
|
101
|
+
if ($[22] !== Tag || $[23] !== href) {
|
|
102
|
+
t3 = Tag === Link && href.startsWith("#") ? {
|
|
103
|
+
prefetch: false
|
|
104
|
+
} : undefined;
|
|
105
|
+
$[22] = Tag;
|
|
106
|
+
$[23] = href;
|
|
107
|
+
$[24] = t3;
|
|
108
|
+
} else {
|
|
109
|
+
t3 = $[24];
|
|
110
|
+
}
|
|
111
|
+
let t4;
|
|
112
|
+
if ($[25] !== Tag || $[26] !== children || $[27] !== href || $[28] !== onClick || $[29] !== ref || $[30] !== rest || $[31] !== t1 || $[32] !== t2 || $[33] !== t3 || $[34] !== testID) {
|
|
113
|
+
t4 = /*#__PURE__*/jsxRuntime.jsx(Tag, {
|
|
105
114
|
href: href,
|
|
106
115
|
ref: ref,
|
|
107
116
|
onClick: onClick,
|
|
108
117
|
target: t1,
|
|
109
118
|
rel: t2,
|
|
110
119
|
"data-testid": testID,
|
|
120
|
+
...t3,
|
|
111
121
|
...rest,
|
|
112
122
|
children: children
|
|
113
123
|
});
|
|
114
|
-
$[
|
|
115
|
-
$[
|
|
116
|
-
$[
|
|
117
|
-
$[
|
|
118
|
-
$[
|
|
119
|
-
$[
|
|
120
|
-
$[
|
|
121
|
-
$[
|
|
122
|
-
$[
|
|
123
|
-
$[
|
|
124
|
+
$[25] = Tag;
|
|
125
|
+
$[26] = children;
|
|
126
|
+
$[27] = href;
|
|
127
|
+
$[28] = onClick;
|
|
128
|
+
$[29] = ref;
|
|
129
|
+
$[30] = rest;
|
|
130
|
+
$[31] = t1;
|
|
131
|
+
$[32] = t2;
|
|
132
|
+
$[33] = t3;
|
|
133
|
+
$[34] = testID;
|
|
134
|
+
$[35] = t4;
|
|
124
135
|
} else {
|
|
125
|
-
|
|
136
|
+
t4 = $[35];
|
|
126
137
|
}
|
|
127
|
-
return
|
|
138
|
+
return t4;
|
|
128
139
|
});
|
|
129
140
|
LinkBase.displayName = 'LinkBase';
|
|
130
141
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/styleguide",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.4.0",
|
|
4
4
|
"description": "Expo's styleguide components for use on the web.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"url": "https://github.com/expo/styleguide/issues"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@expo/styleguide-base": "^3.
|
|
37
|
+
"@expo/styleguide-base": "^3.3.0",
|
|
38
38
|
"tailwind-merge": "^3.5.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"react": ">= 19",
|
|
56
56
|
"tailwindcss": "^4.2.2"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "58d504bb13106ad7859ab8b869da9b943d2c1081"
|
|
59
59
|
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const STOPWORDS = 'a an and at but by for in nor of on or out so the to up with yet'.split(' ');
|
|
4
|
-
function titleCase(value, options = {}) {
|
|
5
|
-
if (!value) return '';
|
|
6
|
-
const stop = options.stopwords ?? STOPWORDS;
|
|
7
|
-
const keep = options.keepSpaces;
|
|
8
|
-
const splitter = /(\s+|[-‑–—,:;!?()])/;
|
|
9
|
-
return value.split(splitter).map((word, index, all) => {
|
|
10
|
-
if (index % 2) {
|
|
11
|
-
if (/\s+/.test(word)) return keep ? word : ' ';
|
|
12
|
-
return word;
|
|
13
|
-
}
|
|
14
|
-
const lower = word.toLocaleLowerCase();
|
|
15
|
-
if (index !== 0 && index !== all.length - 1 && stop.includes(lower)) {
|
|
16
|
-
return lower;
|
|
17
|
-
}
|
|
18
|
-
return capitalize(word);
|
|
19
|
-
}).join('');
|
|
20
|
-
}
|
|
21
|
-
function capitalize(text) {
|
|
22
|
-
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
exports.titleCase = titleCase;
|