@basic-ui/material 1.0.0-alpha.24 → 1.0.0-alpha.25

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basic-ui/material",
3
- "version": "1.0.0-alpha.24",
3
+ "version": "1.0.0-alpha.25",
4
4
  "description": "Accessible React Components used as building blocks for UI patterns",
5
5
  "author": "Lucas Terra <lucasterra7@gmail.com>",
6
6
  "license": "MIT",
@@ -27,7 +27,7 @@
27
27
  "test": "echo \"Error: no test specified\" && exit 1"
28
28
  },
29
29
  "dependencies": {
30
- "@basic-ui/core": "^0.0.49",
30
+ "@basic-ui/core": "^0.0.50",
31
31
  "@basic-ui/dynamic-theme": "^0.0.8",
32
32
  "@styled-system/should-forward-prop": "5.1.5",
33
33
  "@types/styled-system": "^5.1.10",
@@ -52,5 +52,5 @@
52
52
  "react": "^16.14.0 || ^17.0.0 || ^18.0.0",
53
53
  "react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0"
54
54
  },
55
- "gitHead": "286cd71d6ab3e7041264d460acae3e03f0b951b8"
55
+ "gitHead": "0d58f1872e2d6e046d1f17296322c9a6588a8a57"
56
56
  }
@@ -38,6 +38,7 @@ export const Badge = forwardRef<HTMLDivElement, BadgeProps>(function Badge(
38
38
  display: 'inline-flex',
39
39
  alignItems: 'center',
40
40
  justifyContent: 'center',
41
+ fontVariantNumeric: 'tabular-nums',
41
42
  ...__css,
42
43
  }}
43
44
  {...otherProps}
package/src/Tab/Tab.tsx CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { ButtonHTMLAttributes } from 'react';
2
- import { useRef, forwardRef } from 'react';
2
+ import { useState, useEffect, useRef, forwardRef } from 'react';
3
3
  import type { TabProps as TabPropsCore } from '@basic-ui/core';
4
4
  import { Tab as TabCore } from '@basic-ui/core';
5
5
  import { rem } from 'polished';
@@ -24,6 +24,11 @@ const TabInner = forwardRef<
24
24
  useTabListContext();
25
25
  const labelRef = useRef<HTMLParagraphElement>(null);
26
26
 
27
+ const [mounted, setMounted] = useState(false);
28
+ useEffect(() => {
29
+ setMounted(true);
30
+ }, []);
31
+
27
32
  return (
28
33
  <Box
29
34
  position="relative"
@@ -44,6 +49,7 @@ const TabInner = forwardRef<
44
49
  disabled={disabled}
45
50
  __css={{
46
51
  px: 3,
52
+ py: 0,
47
53
  color: selected
48
54
  ? selectedTextColor || indicatorColor
49
55
  : alpha(textColor, disabled ? 0.37 : 0.7),
@@ -61,16 +67,33 @@ const TabInner = forwardRef<
61
67
  >
62
68
  <Text
63
69
  as="span"
64
- display="inline-flex"
65
- justifyContent="center"
66
- alignItems="center"
67
70
  variant="title-small"
68
- color="inherit"
69
- height="100%"
70
- textAlign="center"
71
- position="relative"
72
- flexDirection="column"
73
71
  ref={labelRef}
72
+ __css={{
73
+ display: 'inline-flex',
74
+ justifyContent: 'center',
75
+ alignItems: 'center',
76
+ color: 'inherit',
77
+ height: '100%',
78
+ textAlign: 'center',
79
+ position: 'relative',
80
+ flexDirection: 'column',
81
+ ...(variant === 'primary' &&
82
+ selected &&
83
+ !mounted && {
84
+ '&::before': {
85
+ content: '""',
86
+ bg: indicatorColor,
87
+ position: 'absolute',
88
+ bottom: 0,
89
+ zIndex: 1,
90
+ width: '100%',
91
+ height: rem(3),
92
+ borderTopLeftRadius: rem(3),
93
+ borderTopRightRadius: rem(3),
94
+ },
95
+ }),
96
+ }}
74
97
  >
75
98
  {children}
76
99
  </Text>
@@ -79,7 +79,7 @@ export const TabIndicator = forwardRef<HTMLDivElement, TabIndicatorProps>(
79
79
  }
80
80
  }, [selected, variant]);
81
81
 
82
- useEffect(() => {
82
+ useEnhancedEffect(() => {
83
83
  if (variant === 'secondary') {
84
84
  return;
85
85
  }
@@ -176,7 +176,7 @@ export const theme = {
176
176
  'title-small': font('plain', 20, 14, 0.1, 500),
177
177
  'label-large': font('plain', 20, 14, 0.1, 500),
178
178
  'label-medium': font('plain', 16, 12, 0.5, 500),
179
- 'label-small': font('plain', 16, 11, 0.5, 500),
179
+ 'label-small': font('plain', 15, 11, 0.5, 500),
180
180
  'body-large': font('plain', 24, 16, 0.5, 400),
181
181
  'body-medium': font('plain', 20, 14, 0.25, 400),
182
182
  'body-small': font('plain', 16, 12, 0.4, 400),