@telus-uds/components-base 1.24.2 → 1.25.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.
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
# Change Log - @telus-uds/components-base
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 01 Feb 2023 20:54:30 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.25.0
|
|
8
|
+
|
|
9
|
+
Wed, 01 Feb 2023 20:54:30 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- Floating ui integration for Tooltip component (tiagohldb@gmail.com)
|
|
14
|
+
|
|
15
|
+
### Patches
|
|
16
|
+
|
|
17
|
+
- Fixing sub and sup elements line height (tiagohldb@gmail.com)
|
|
18
|
+
|
|
7
19
|
## 1.24.2
|
|
8
20
|
|
|
9
|
-
Thu, 19 Jan 2023 21:
|
|
21
|
+
Thu, 19 Jan 2023 21:39:36 GMT
|
|
10
22
|
|
|
11
23
|
### Patches
|
|
12
24
|
|
|
@@ -92,17 +92,42 @@ const Typography = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
92
92
|
...(0, _utils2.getA11yPropsFromHtmlTag)(tag, accessibilityRole),
|
|
93
93
|
...selectContainerProps(rest)
|
|
94
94
|
};
|
|
95
|
+
|
|
96
|
+
const resetTagStyling = child => {
|
|
97
|
+
if (typeof child === 'object' && ((child === null || child === void 0 ? void 0 : child.type) === 'sub' || (child === null || child === void 0 ? void 0 : child.type) === 'sup')) {
|
|
98
|
+
var _child$props;
|
|
99
|
+
|
|
100
|
+
const sanitizedChild = /*#__PURE__*/_react.default.cloneElement(child, {
|
|
101
|
+
style: { ...(child === null || child === void 0 ? void 0 : (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.style),
|
|
102
|
+
lineHeight: 0
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
return sanitizedChild;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return child;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const sanitizeChildren = () => {
|
|
113
|
+
if (Array.isArray(children)) {
|
|
114
|
+
return children.map(resetTagStyling);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return resetTagStyling(children);
|
|
118
|
+
};
|
|
119
|
+
|
|
95
120
|
return block ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
96
121
|
ref: ref,
|
|
97
122
|
...containerProps,
|
|
98
123
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, { ...resolvedTextProps,
|
|
99
|
-
children: children
|
|
124
|
+
children: sanitizeChildren(children)
|
|
100
125
|
})
|
|
101
126
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
102
127
|
ref: ref,
|
|
103
128
|
...containerProps,
|
|
104
129
|
...resolvedTextProps,
|
|
105
|
-
children: children
|
|
130
|
+
children: sanitizeChildren(children)
|
|
106
131
|
});
|
|
107
132
|
});
|
|
108
133
|
Typography.displayName = 'Typography';
|
|
@@ -71,17 +71,41 @@ const Typography = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
71
71
|
...getA11yPropsFromHtmlTag(tag, accessibilityRole),
|
|
72
72
|
...selectContainerProps(rest)
|
|
73
73
|
};
|
|
74
|
+
|
|
75
|
+
const resetTagStyling = child => {
|
|
76
|
+
if (typeof child === 'object' && ((child === null || child === void 0 ? void 0 : child.type) === 'sub' || (child === null || child === void 0 ? void 0 : child.type) === 'sup')) {
|
|
77
|
+
var _child$props;
|
|
78
|
+
|
|
79
|
+
const sanitizedChild = /*#__PURE__*/React.cloneElement(child, {
|
|
80
|
+
style: { ...(child === null || child === void 0 ? void 0 : (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.style),
|
|
81
|
+
lineHeight: 0
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
return sanitizedChild;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return child;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const sanitizeChildren = () => {
|
|
91
|
+
if (Array.isArray(children)) {
|
|
92
|
+
return children.map(resetTagStyling);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return resetTagStyling(children);
|
|
96
|
+
};
|
|
97
|
+
|
|
74
98
|
return block ? /*#__PURE__*/_jsx(View, {
|
|
75
99
|
ref: ref,
|
|
76
100
|
...containerProps,
|
|
77
101
|
children: /*#__PURE__*/_jsx(Text, { ...resolvedTextProps,
|
|
78
|
-
children: children
|
|
102
|
+
children: sanitizeChildren(children)
|
|
79
103
|
})
|
|
80
104
|
}) : /*#__PURE__*/_jsx(Text, {
|
|
81
105
|
ref: ref,
|
|
82
106
|
...containerProps,
|
|
83
107
|
...resolvedTextProps,
|
|
84
|
-
children: children
|
|
108
|
+
children: sanitizeChildren(children)
|
|
85
109
|
});
|
|
86
110
|
});
|
|
87
111
|
Typography.displayName = 'Typography';
|
package/package.json
CHANGED
|
@@ -60,6 +60,7 @@ const Typography = forwardRef(
|
|
|
60
60
|
const viewport = useViewport()
|
|
61
61
|
const themeTokens = useThemeTokens('Typography', tokens, variant, { viewport })
|
|
62
62
|
const { themeOptions } = useTheme()
|
|
63
|
+
|
|
63
64
|
const resolvedTextProps = {
|
|
64
65
|
...selectTextProps(rest),
|
|
65
66
|
style: selectTextStyles(
|
|
@@ -76,13 +77,36 @@ const Typography = forwardRef(
|
|
|
76
77
|
...selectContainerProps(rest)
|
|
77
78
|
}
|
|
78
79
|
|
|
80
|
+
const resetTagStyling = (child) => {
|
|
81
|
+
if (typeof child === 'object' && (child?.type === 'sub' || child?.type === 'sup')) {
|
|
82
|
+
const sanitizedChild = React.cloneElement(child, {
|
|
83
|
+
style: {
|
|
84
|
+
...child?.props?.style,
|
|
85
|
+
lineHeight: 0
|
|
86
|
+
}
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
return sanitizedChild
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return child
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const sanitizeChildren = () => {
|
|
96
|
+
if (Array.isArray(children)) {
|
|
97
|
+
return children.map(resetTagStyling)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return resetTagStyling(children)
|
|
101
|
+
}
|
|
102
|
+
|
|
79
103
|
return block ? (
|
|
80
104
|
<View ref={ref} {...containerProps}>
|
|
81
|
-
<Text {...resolvedTextProps}>{children}</Text>
|
|
105
|
+
<Text {...resolvedTextProps}>{sanitizeChildren(children)}</Text>
|
|
82
106
|
</View>
|
|
83
107
|
) : (
|
|
84
108
|
<Text ref={ref} {...containerProps} {...resolvedTextProps}>
|
|
85
|
-
{children}
|
|
109
|
+
{sanitizeChildren(children)}
|
|
86
110
|
</Text>
|
|
87
111
|
)
|
|
88
112
|
}
|