@telus-uds/components-base 1.49.0 → 1.50.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 +15 -2
- package/component-docs.json +4 -6
- package/lib/TextInput/TextInput.js +17 -15
- package/lib/ThemeProvider/ThemeProvider.js +7 -1
- package/lib-module/TextInput/TextInput.js +19 -15
- package/lib-module/ThemeProvider/ThemeProvider.js +8 -2
- package/package.json +2 -2
- package/src/Card/CardBase.jsx +0 -1
- package/src/TextInput/TextInput.jsx +8 -5
- package/src/ThemeProvider/ThemeProvider.jsx +9 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
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, 14 Jun 2023 00:01:25 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.50.0
|
|
8
|
+
|
|
9
|
+
Wed, 14 Jun 2023 00:01:25 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- Datepicker refactor (srikanthkhari@gmail.com)
|
|
14
|
+
- Bump @telus-uds/system-theme-tokens to v2.32.0
|
|
15
|
+
|
|
16
|
+
### Patches
|
|
17
|
+
|
|
18
|
+
- Allow dynamic swap of `defaultTheme` passed to `ThemeProvider` (shahzaibkhalidmalik@outlook.com)
|
|
19
|
+
|
|
7
20
|
## 1.49.0
|
|
8
21
|
|
|
9
|
-
Fri, 09 Jun 2023 00:
|
|
22
|
+
Fri, 09 Jun 2023 00:28:33 GMT
|
|
10
23
|
|
|
11
24
|
### Minor changes
|
|
12
25
|
|
package/component-docs.json
CHANGED
|
@@ -547,12 +547,6 @@
|
|
|
547
547
|
"calendarMonthCaptionFontWeight": "fontWeight",
|
|
548
548
|
"calendarMonthCaptionLineHeight": "lineHeight",
|
|
549
549
|
"calendarMonthCaptionPaddingBottom": "size",
|
|
550
|
-
"dateInputBorderColor": "color",
|
|
551
|
-
"dateInputBorderRadius": "radius",
|
|
552
|
-
"dateInputFocusBorderColor": "color",
|
|
553
|
-
"dateInputHoverBorderColor": "color",
|
|
554
|
-
"dateInputInsideBorderColor": "color",
|
|
555
|
-
"dateInputInsideColor": "color",
|
|
556
550
|
"dateInputStrokeColor": "color",
|
|
557
551
|
"dayPickerWeekHeaderColor": "color",
|
|
558
552
|
"dayPickerWeekHeaderFontName": "fontName",
|
|
@@ -10089,6 +10083,10 @@
|
|
|
10089
10083
|
"themeTokensVersion": {
|
|
10090
10084
|
"name": "string",
|
|
10091
10085
|
"required": true
|
|
10086
|
+
},
|
|
10087
|
+
"name": {
|
|
10088
|
+
"name": "string",
|
|
10089
|
+
"required": true
|
|
10092
10090
|
}
|
|
10093
10091
|
},
|
|
10094
10092
|
"required": true
|
|
@@ -62,21 +62,23 @@ const TextInput = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
62
62
|
validation: supportsProps.validation
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
65
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
66
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_InputSupports.default, {
|
|
67
|
+
nativeID: nativeID,
|
|
68
|
+
...supportsProps,
|
|
69
|
+
children: _ref2 => {
|
|
70
|
+
let {
|
|
71
|
+
inputId,
|
|
72
|
+
...propsFromInputSupports
|
|
73
|
+
} = _ref2;
|
|
74
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextInputBase.default, {
|
|
75
|
+
ref: ref,
|
|
76
|
+
nativeID: inputId,
|
|
77
|
+
...propsFromInputSupports,
|
|
78
|
+
...inputProps
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}), rest.children]
|
|
80
82
|
});
|
|
81
83
|
});
|
|
82
84
|
TextInput.displayName = 'TextInput';
|
|
@@ -45,6 +45,11 @@ const ThemeProvider = _ref => {
|
|
|
45
45
|
themeOptions = {}
|
|
46
46
|
} = _ref;
|
|
47
47
|
const [theme, setTheme] = (0, _react.useState)(defaultTheme);
|
|
48
|
+
(0, _react.useEffect)(() => {
|
|
49
|
+
if (theme.metadata.name !== defaultTheme.metadata.name) {
|
|
50
|
+
setTheme(defaultTheme);
|
|
51
|
+
}
|
|
52
|
+
}, [theme.metadata.name, defaultTheme]);
|
|
48
53
|
const appliedThemeOptions = { ...defaultThemeOptions,
|
|
49
54
|
...themeOptions
|
|
50
55
|
}; // Validate the theme tokens version on every render.
|
|
@@ -67,7 +72,8 @@ ThemeProvider.propTypes = {
|
|
|
67
72
|
children: _propTypes.default.node.isRequired,
|
|
68
73
|
defaultTheme: _propTypes.default.shape({
|
|
69
74
|
metadata: _propTypes.default.shape({
|
|
70
|
-
themeTokensVersion: _propTypes.default.string.isRequired
|
|
75
|
+
themeTokensVersion: _propTypes.default.string.isRequired,
|
|
76
|
+
name: _propTypes.default.string.isRequired
|
|
71
77
|
}).isRequired
|
|
72
78
|
}).isRequired,
|
|
73
79
|
|
|
@@ -5,6 +5,8 @@ import InputSupports from '../InputSupports';
|
|
|
5
5
|
import TextInputBase from './TextInputBase';
|
|
6
6
|
import textInputPropTypes from './propTypes';
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
9
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
10
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, focusHandlerProps, inputSupportsProps, textInputHandlerProps, textInputProps, viewProps]);
|
|
9
11
|
/**
|
|
10
12
|
* A basic text input component. Use in forms or individually to receive user's input.
|
|
@@ -42,21 +44,23 @@ const TextInput = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
42
44
|
validation: supportsProps.validation
|
|
43
45
|
}
|
|
44
46
|
};
|
|
45
|
-
return /*#__PURE__*/
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
47
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
48
|
+
children: [/*#__PURE__*/_jsx(InputSupports, {
|
|
49
|
+
nativeID: nativeID,
|
|
50
|
+
...supportsProps,
|
|
51
|
+
children: _ref2 => {
|
|
52
|
+
let {
|
|
53
|
+
inputId,
|
|
54
|
+
...propsFromInputSupports
|
|
55
|
+
} = _ref2;
|
|
56
|
+
return /*#__PURE__*/_jsx(TextInputBase, {
|
|
57
|
+
ref: ref,
|
|
58
|
+
nativeID: inputId,
|
|
59
|
+
...propsFromInputSupports,
|
|
60
|
+
...inputProps
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}), rest.children]
|
|
60
64
|
});
|
|
61
65
|
});
|
|
62
66
|
TextInput.displayName = 'TextInput';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { createContext, useState } from 'react';
|
|
1
|
+
import React, { createContext, useEffect, useState } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { validateThemeTokensVersion } from './utils';
|
|
4
4
|
import responsiveProps from '../utils/props/responsiveProps';
|
|
@@ -24,6 +24,11 @@ const ThemeProvider = _ref => {
|
|
|
24
24
|
themeOptions = {}
|
|
25
25
|
} = _ref;
|
|
26
26
|
const [theme, setTheme] = useState(defaultTheme);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (theme.metadata.name !== defaultTheme.metadata.name) {
|
|
29
|
+
setTheme(defaultTheme);
|
|
30
|
+
}
|
|
31
|
+
}, [theme.metadata.name, defaultTheme]);
|
|
27
32
|
const appliedThemeOptions = { ...defaultThemeOptions,
|
|
28
33
|
...themeOptions
|
|
29
34
|
}; // Validate the theme tokens version on every render.
|
|
@@ -46,7 +51,8 @@ ThemeProvider.propTypes = {
|
|
|
46
51
|
children: PropTypes.node.isRequired,
|
|
47
52
|
defaultTheme: PropTypes.shape({
|
|
48
53
|
metadata: PropTypes.shape({
|
|
49
|
-
themeTokensVersion: PropTypes.string.isRequired
|
|
54
|
+
themeTokensVersion: PropTypes.string.isRequired,
|
|
55
|
+
name: PropTypes.string.isRequired
|
|
50
56
|
}).isRequired
|
|
51
57
|
}).isRequired,
|
|
52
58
|
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"@floating-ui/react-native": "^0.8.1",
|
|
12
12
|
"@gorhom/portal": "^1.0.14",
|
|
13
13
|
"@telus-uds/system-constants": "^1.2.1",
|
|
14
|
-
"@telus-uds/system-theme-tokens": "^2.
|
|
14
|
+
"@telus-uds/system-theme-tokens": "^2.32.0",
|
|
15
15
|
"airbnb-prop-types": "^2.16.0",
|
|
16
16
|
"lodash.debounce": "^4.0.8",
|
|
17
17
|
"lodash.merge": "^4.6.2",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"standard-engine": {
|
|
73
73
|
"skip": true
|
|
74
74
|
},
|
|
75
|
-
"version": "1.
|
|
75
|
+
"version": "1.50.0"
|
|
76
76
|
}
|
package/src/Card/CardBase.jsx
CHANGED
|
@@ -42,7 +42,6 @@ const selectStyles = ({
|
|
|
42
42
|
const CardBase = forwardRef(({ children, tokens, dataSet, ...rest }, ref) => {
|
|
43
43
|
const cardStyle = selectStyles(typeof tokens === 'function' ? tokens() : tokens)
|
|
44
44
|
const props = selectProps(rest)
|
|
45
|
-
|
|
46
45
|
return (
|
|
47
46
|
<View style={cardStyle} dataSet={dataSet} ref={ref} {...props}>
|
|
48
47
|
{children}
|
|
@@ -52,11 +52,14 @@ const TextInput = forwardRef(({ tokens, nativeID, variant = {}, ...rest }, ref)
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
return (
|
|
55
|
-
|
|
56
|
-
{
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
<>
|
|
56
|
+
<InputSupports nativeID={nativeID} {...supportsProps}>
|
|
57
|
+
{({ inputId, ...propsFromInputSupports }) => (
|
|
58
|
+
<TextInputBase ref={ref} nativeID={inputId} {...propsFromInputSupports} {...inputProps} />
|
|
59
|
+
)}
|
|
60
|
+
</InputSupports>
|
|
61
|
+
{rest.children}
|
|
62
|
+
</>
|
|
60
63
|
)
|
|
61
64
|
})
|
|
62
65
|
TextInput.displayName = 'TextInput'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { createContext, useState } from 'react'
|
|
1
|
+
import React, { createContext, useEffect, useState } from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import { validateThemeTokensVersion } from './utils'
|
|
4
4
|
import responsiveProps from '../utils/props/responsiveProps'
|
|
@@ -22,6 +22,12 @@ const defaultThemeOptions = {
|
|
|
22
22
|
const ThemeProvider = ({ children, defaultTheme, themeOptions = {} }) => {
|
|
23
23
|
const [theme, setTheme] = useState(defaultTheme)
|
|
24
24
|
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (theme.metadata.name !== defaultTheme.metadata.name) {
|
|
27
|
+
setTheme(defaultTheme)
|
|
28
|
+
}
|
|
29
|
+
}, [theme.metadata.name, defaultTheme])
|
|
30
|
+
|
|
25
31
|
const appliedThemeOptions = { ...defaultThemeOptions, ...themeOptions }
|
|
26
32
|
|
|
27
33
|
// Validate the theme tokens version on every render.
|
|
@@ -42,7 +48,8 @@ ThemeProvider.propTypes = {
|
|
|
42
48
|
children: PropTypes.node.isRequired,
|
|
43
49
|
defaultTheme: PropTypes.shape({
|
|
44
50
|
metadata: PropTypes.shape({
|
|
45
|
-
themeTokensVersion: PropTypes.string.isRequired
|
|
51
|
+
themeTokensVersion: PropTypes.string.isRequired,
|
|
52
|
+
name: PropTypes.string.isRequired
|
|
46
53
|
}).isRequired
|
|
47
54
|
}).isRequired,
|
|
48
55
|
/**
|