@expo/styleguide 8.0.0-alpha.6 → 8.0.0-alpha.7
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 +18 -1
- package/package.json +3 -2
- 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
|
@@ -328,6 +328,22 @@ function getThemedIconClasses(theme) {
|
|
|
328
328
|
return 'text-button-quaternary-icon';
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
|
+
function getButtonIconClasses(size) {
|
|
332
|
+
switch (size) {
|
|
333
|
+
case 'xs':
|
|
334
|
+
return 'px-0 w-8 justify-center items-center';
|
|
335
|
+
case 'sm':
|
|
336
|
+
return 'px-0 w-9 justify-center items-center';
|
|
337
|
+
case 'md':
|
|
338
|
+
return 'px-0 w-10 justify-center items-center';
|
|
339
|
+
case 'lg':
|
|
340
|
+
return 'px-0 w-11 justify-center items-center';
|
|
341
|
+
case 'xl':
|
|
342
|
+
return 'px-0 w-12 justify-center items-center';
|
|
343
|
+
case '2xl':
|
|
344
|
+
return 'px-0 w-15 justify-center items-center';
|
|
345
|
+
}
|
|
346
|
+
}
|
|
331
347
|
function isIconElement(element) {
|
|
332
348
|
var _a, _b, _c;
|
|
333
349
|
if (React.isValidElement(element)) {
|
|
@@ -346,7 +362,8 @@ var Button = React.forwardRef(function (_a, ref) {
|
|
|
346
362
|
var isRightSlotIcon = rightSlot && isIconElement(rightSlot);
|
|
347
363
|
var iconClasses = (isLeftSlotIcon || isRightSlotIcon) &&
|
|
348
364
|
mergeClasses("".concat(getIconSizeClasses(size)), getThemedIconClasses(theme), disabled && 'opacity-60');
|
|
349
|
-
|
|
365
|
+
var isSingleIconButton = (leftSlot || rightSlot) && !children;
|
|
366
|
+
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
367
|
isLeftSlotIcon ? React.cloneElement(leftSlot, getIconProps(leftSlot, iconClasses)) : leftSlot,
|
|
351
368
|
children && (React.createElement("span", { className: mergeClasses('flex self-center text-inherit leading-none', href && 'select-none') }, typeof children === 'string' && !skipCapitalization ? titleCase(children) : children)),
|
|
352
369
|
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.7",
|
|
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",
|
|
@@ -49,5 +50,5 @@
|
|
|
49
50
|
"eslintConfig": {
|
|
50
51
|
"extends": "universe/web"
|
|
51
52
|
},
|
|
52
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "62bbffc1d217d859b3baba05e2bf09b9ab257056"
|
|
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
|
|