@expo/styleguide 8.0.0-alpha.6 → 8.0.0-alpha.8
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/README.md +3 -1
- package/dist/index.js +21 -3
- package/package.json +4 -3
- package/tailwind.js +16 -0
package/README.md
CHANGED
|
@@ -24,7 +24,9 @@ For the Styleguide we use our custom Tailwind theme, which is based on the defau
|
|
|
24
24
|
* only valid media screen scopes are: `xs:`, `sm:`, `md:`, `lg:` and `xl:`
|
|
25
25
|
* there is a custom `hocus:` scope which is a shorthand for hover and focus states
|
|
26
26
|
* typography elements are predefined as a `heading-[size]` styles sets
|
|
27
|
-
* `icon-[size]` are custom component classes defined for icons sizing
|
|
27
|
+
* `icon-[size]` are custom component classes defined for icons sizing
|
|
28
|
+
|
|
29
|
+
The theme can be extended, if needed, and includes `@tailwindcss/typography` plugin by default, with a stripped down version of default config.
|
|
28
30
|
|
|
29
31
|
## Development
|
|
30
32
|
|
package/dist/index.js
CHANGED
|
@@ -247,11 +247,12 @@ function capitalize(text) {
|
|
|
247
247
|
|
|
248
248
|
var LinkBase = React.forwardRef(function (_a, ref) {
|
|
249
249
|
var children = _a.children, testID = _a.testID, href = _a.href, openInNewTab = _a.openInNewTab, onClick = _a.onClick, target = _a.target, disabled = _a.disabled, rel = _a.rel, rest = __rest(_a, ["children", "testID", "href", "openInNewTab", "onClick", "target", "disabled", "rel"]);
|
|
250
|
-
if (!href)
|
|
251
|
-
return null;
|
|
252
250
|
if (disabled) {
|
|
253
251
|
return (React.createElement("a", __assign({ ref: ref, "data-testid": testID }, rest), children));
|
|
254
252
|
}
|
|
253
|
+
if (!href || href.startsWith('#')) {
|
|
254
|
+
return (React.createElement("a", __assign({ href: href, ref: ref, onClick: onClick, "data-testid": testID }, rest), children));
|
|
255
|
+
}
|
|
255
256
|
return (React.createElement(Link$1, __assign({ href: href, ref: ref, onClick: onClick, target: openInNewTab ? '_blank' : target, rel: openInNewTab ? 'noopener noreferrer' : rel, "data-testid": testID }, rest), children));
|
|
256
257
|
});
|
|
257
258
|
LinkBase.displayName = 'LinkBase';
|
|
@@ -328,6 +329,22 @@ function getThemedIconClasses(theme) {
|
|
|
328
329
|
return 'text-button-quaternary-icon';
|
|
329
330
|
}
|
|
330
331
|
}
|
|
332
|
+
function getButtonIconClasses(size) {
|
|
333
|
+
switch (size) {
|
|
334
|
+
case 'xs':
|
|
335
|
+
return 'px-0 w-8 justify-center items-center';
|
|
336
|
+
case 'sm':
|
|
337
|
+
return 'px-0 w-9 justify-center items-center';
|
|
338
|
+
case 'md':
|
|
339
|
+
return 'px-0 w-10 justify-center items-center';
|
|
340
|
+
case 'lg':
|
|
341
|
+
return 'px-0 w-11 justify-center items-center';
|
|
342
|
+
case 'xl':
|
|
343
|
+
return 'px-0 w-12 justify-center items-center';
|
|
344
|
+
case '2xl':
|
|
345
|
+
return 'px-0 w-15 justify-center items-center';
|
|
346
|
+
}
|
|
347
|
+
}
|
|
331
348
|
function isIconElement(element) {
|
|
332
349
|
var _a, _b, _c;
|
|
333
350
|
if (React.isValidElement(element)) {
|
|
@@ -346,7 +363,8 @@ var Button = React.forwardRef(function (_a, ref) {
|
|
|
346
363
|
var isRightSlotIcon = rightSlot && isIconElement(rightSlot);
|
|
347
364
|
var iconClasses = (isLeftSlotIcon || isRightSlotIcon) &&
|
|
348
365
|
mergeClasses("".concat(getIconSizeClasses(size)), getThemedIconClasses(theme), disabled && 'opacity-60');
|
|
349
|
-
|
|
366
|
+
var isSingleIconButton = (leftSlot || rightSlot) && !children;
|
|
367
|
+
return (React.createElement(Element, __assign({ href: href, className: mergeClasses("inline-flex border border-solid rounded-md font-medium gap-2 items-center whitespace-nowrap transition", getSizeClasses(size), getThemeClasses(theme, disabled), isSingleIconButton && getButtonIconClasses(size), disabled && 'cursor-default opacity-80 pointer-event-none', className), disabled: disabled }, (href ? { openInNewTab: openInNewTab } : {}), rest),
|
|
350
368
|
isLeftSlotIcon ? React.cloneElement(leftSlot, getIconProps(leftSlot, iconClasses)) : leftSlot,
|
|
351
369
|
children && (React.createElement("span", { className: mergeClasses('flex self-center text-inherit leading-none', href && 'select-none') }, typeof children === 'string' && !skipCapitalization ? titleCase(children) : children)),
|
|
352
370
|
isRightSlotIcon ? React.cloneElement(rightSlot, getIconProps(rightSlot, iconClasses)) : rightSlot));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/styleguide",
|
|
3
|
-
"version": "8.0.0-alpha.
|
|
3
|
+
"version": "8.0.0-alpha.8",
|
|
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",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@rollup/plugin-typescript": "^11.0.0",
|
|
33
|
+
"@tailwindcss/typography": "^0.5.9",
|
|
33
34
|
"@types/react": "^18.0.28",
|
|
34
35
|
"npm-run-all": "^4.1.5",
|
|
35
36
|
"rimraf": "^4.1.2",
|
|
@@ -44,10 +45,10 @@
|
|
|
44
45
|
},
|
|
45
46
|
"dependencies": {
|
|
46
47
|
"@expo/styleguide-base": "^1.0.0-alpha.2",
|
|
47
|
-
"tailwind-merge": "^1.
|
|
48
|
+
"tailwind-merge": "^1.12.0"
|
|
48
49
|
},
|
|
49
50
|
"eslintConfig": {
|
|
50
51
|
"extends": "universe/web"
|
|
51
52
|
},
|
|
52
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "573e5979139e7d40c946ac8724d3ec7b66ae60b3"
|
|
53
54
|
}
|
package/tailwind.js
CHANGED
|
@@ -344,6 +344,9 @@ const expoTailwindConfig = {
|
|
|
344
344
|
height: {
|
|
345
345
|
15: '3.75rem',
|
|
346
346
|
},
|
|
347
|
+
width: {
|
|
348
|
+
15: '3.75rem',
|
|
349
|
+
},
|
|
347
350
|
opacity: {
|
|
348
351
|
inherit: 'inherit',
|
|
349
352
|
},
|
|
@@ -363,6 +366,18 @@ const expoTailwindConfig = {
|
|
|
363
366
|
transitionDuration: {
|
|
364
367
|
default: '150ms',
|
|
365
368
|
},
|
|
369
|
+
typography: () => ({
|
|
370
|
+
DEFAULT: {
|
|
371
|
+
css: {
|
|
372
|
+
sm: null,
|
|
373
|
+
base: null,
|
|
374
|
+
lg: null,
|
|
375
|
+
xl: null,
|
|
376
|
+
'2xl': null,
|
|
377
|
+
invert: null,
|
|
378
|
+
},
|
|
379
|
+
},
|
|
380
|
+
}),
|
|
366
381
|
},
|
|
367
382
|
},
|
|
368
383
|
corePlugins: {
|
|
@@ -404,6 +419,7 @@ const expoTailwindConfig = {
|
|
|
404
419
|
},
|
|
405
420
|
});
|
|
406
421
|
}),
|
|
422
|
+
require('@tailwindcss/typography'),
|
|
407
423
|
],
|
|
408
424
|
};
|
|
409
425
|
|