@telus-uds/components-base 3.3.0 → 3.4.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 +11 -2
- package/lib/cjs/Button/ButtonBase.js +1 -1
- package/lib/cjs/Button/ButtonLink.js +1 -0
- package/lib/cjs/ExpandCollapse/ExpandCollapse.js +3 -1
- package/lib/cjs/ExpandCollapseMini/ExpandCollapseMini.js +10 -1
- package/lib/cjs/Link/Link.js +8 -1
- package/lib/cjs/Link/LinkBase.js +2 -0
- package/lib/cjs/utils/useUniqueId.js +2 -6
- package/lib/esm/Button/ButtonBase.js +2 -2
- package/lib/esm/Button/ButtonLink.js +2 -1
- package/lib/esm/ExpandCollapse/ExpandCollapse.js +4 -2
- package/lib/esm/ExpandCollapseMini/ExpandCollapseMini.js +11 -2
- package/lib/esm/Link/Link.js +8 -1
- package/lib/esm/Link/LinkBase.js +2 -0
- package/lib/esm/utils/useUniqueId.js +3 -7
- package/lib/package.json +1 -1
- package/package.json +1 -1
- package/src/Button/ButtonBase.jsx +4 -2
- package/src/Button/ButtonLink.jsx +3 -1
- package/src/ExpandCollapse/ExpandCollapse.jsx +9 -4
- package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +15 -3
- package/src/Link/Link.jsx +8 -1
- package/src/Link/LinkBase.jsx +2 -0
- package/src/utils/useUniqueId.js +3 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
# Change Log - @telus-uds/components-base
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Tue, 11 Mar 2025 21:13:58 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 3.4.0
|
|
8
|
+
|
|
9
|
+
Tue, 11 Mar 2025 21:13:58 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- `dataSet`: add new contenful attributes (sergio.ramirez@telus.com)
|
|
14
|
+
- Use React's useId hook within useUniqueId for SSR-safe ids (6854874+kyletsang@users.noreply.github.com)
|
|
15
|
+
|
|
7
16
|
## 3.3.0
|
|
8
17
|
|
|
9
|
-
Wed, 05 Mar 2025 00:
|
|
18
|
+
Wed, 05 Mar 2025 00:06:37 GMT
|
|
10
19
|
|
|
11
20
|
### Minor changes
|
|
12
21
|
|
|
@@ -16,7 +16,7 @@ var _utils = require("../utils");
|
|
|
16
16
|
var _Icon = require("../Icon");
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
18
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
|
-
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.focusHandlerProps, _utils.linkProps, _utils.viewProps]);
|
|
19
|
+
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.focusHandlerProps, _utils.linkProps, _utils.viewProps, _utils.contentfulProps]);
|
|
20
20
|
const getOuterBorderOffset = _ref => {
|
|
21
21
|
let {
|
|
22
22
|
outerBorderGap = 0,
|
|
@@ -50,6 +50,7 @@ ButtonLink.propTypes = {
|
|
|
50
50
|
..._props.a11yProps.types,
|
|
51
51
|
..._propTypes2.default,
|
|
52
52
|
..._props.linkProps.types,
|
|
53
|
+
..._props.contentfulProps.types,
|
|
53
54
|
children: _propTypes2.textAndA11yText,
|
|
54
55
|
dataSet: _propTypes.default.object,
|
|
55
56
|
accessibilityRole: _propTypes.default.string
|
|
@@ -12,7 +12,7 @@ var _ThemeProvider = require("../ThemeProvider");
|
|
|
12
12
|
var _utils = require("../utils");
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]);
|
|
15
|
+
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps, _utils.contentfulProps]);
|
|
16
16
|
function selectBorderStyles(tokens) {
|
|
17
17
|
return {
|
|
18
18
|
borderBottomWidth: tokens.borderWidth,
|
|
@@ -37,6 +37,7 @@ const ExpandCollapse = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
37
37
|
open,
|
|
38
38
|
initialOpen,
|
|
39
39
|
onChange,
|
|
40
|
+
dataSet,
|
|
40
41
|
...rest
|
|
41
42
|
} = _ref;
|
|
42
43
|
const {
|
|
@@ -56,6 +57,7 @@ const ExpandCollapse = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
56
57
|
style: staticStyles.container,
|
|
57
58
|
ref: ref,
|
|
58
59
|
...selectProps(rest),
|
|
60
|
+
dataSet: dataSet,
|
|
59
61
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
60
62
|
style: selectBorderStyles(themeTokens),
|
|
61
63
|
children: typeof children === 'function' ? children({
|
|
@@ -11,6 +11,7 @@ var _utils = require("../utils");
|
|
|
11
11
|
var _ExpandCollapseMiniControl = _interopRequireDefault(require("./ExpandCollapseMiniControl"));
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
const [selectContainerProps, selectedContainerPropTypes] = (0, _utils.selectSystemProps)([_utils.contentfulProps]);
|
|
14
15
|
const ExpandCollapseMini = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
15
16
|
let {
|
|
16
17
|
children,
|
|
@@ -18,6 +19,7 @@ const ExpandCollapseMini = /*#__PURE__*/_react.default.forwardRef((_ref, ref) =>
|
|
|
18
19
|
tokens = {},
|
|
19
20
|
nativeID,
|
|
20
21
|
initialOpen = false,
|
|
22
|
+
dataSet,
|
|
21
23
|
...rest
|
|
22
24
|
} = _ref;
|
|
23
25
|
const expandCollapeMiniPanelId = 'ExpandCollapseMiniPanel';
|
|
@@ -31,6 +33,8 @@ const ExpandCollapseMini = /*#__PURE__*/_react.default.forwardRef((_ref, ref) =>
|
|
|
31
33
|
onChange: handleChange,
|
|
32
34
|
tokens: tokens,
|
|
33
35
|
initialOpen: initialOpen ? [expandCollapeMiniPanelId] : [],
|
|
36
|
+
...selectContainerProps(rest),
|
|
37
|
+
dataSet: dataSet,
|
|
34
38
|
children: expandProps => /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandCollapse.default.Panel, {
|
|
35
39
|
...expandProps,
|
|
36
40
|
panelId: expandCollapeMiniPanelId,
|
|
@@ -60,6 +64,7 @@ const ExpandCollapseMini = /*#__PURE__*/_react.default.forwardRef((_ref, ref) =>
|
|
|
60
64
|
ExpandCollapseMini.displayName = 'ExpandCollapseMini';
|
|
61
65
|
ExpandCollapseMini.propTypes = {
|
|
62
66
|
..._ExpandCollapseMiniControl.default.propTypes,
|
|
67
|
+
...selectedContainerPropTypes,
|
|
63
68
|
/**
|
|
64
69
|
* Function to call on pressing the panel's control, which should open or close the panel.
|
|
65
70
|
*/
|
|
@@ -79,6 +84,10 @@ ExpandCollapseMini.propTypes = {
|
|
|
79
84
|
/**
|
|
80
85
|
* Optional variant object to override the default theme tokens
|
|
81
86
|
*/
|
|
82
|
-
tokens: (0, _utils.getTokensPropType)('ExpandCollapseMini')
|
|
87
|
+
tokens: (0, _utils.getTokensPropType)('ExpandCollapseMini'),
|
|
88
|
+
/**
|
|
89
|
+
* The dataSet prop allows to pass data-* attributes element to the component.
|
|
90
|
+
*/
|
|
91
|
+
dataSet: _propTypes.default.object
|
|
83
92
|
};
|
|
84
93
|
var _default = exports.default = ExpandCollapseMini;
|
package/lib/cjs/Link/Link.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
9
|
var _ThemeProvider = require("../ThemeProvider");
|
|
9
10
|
var _LinkBase = _interopRequireDefault(require("./LinkBase"));
|
|
10
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -31,5 +32,11 @@ const Link = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
31
32
|
});
|
|
32
33
|
});
|
|
33
34
|
Link.displayName = 'Link';
|
|
34
|
-
Link.propTypes =
|
|
35
|
+
Link.propTypes = {
|
|
36
|
+
..._LinkBase.default.propTypes,
|
|
37
|
+
/**
|
|
38
|
+
* The dataSet prop allows to pass data-* attributes element to the component.
|
|
39
|
+
*/
|
|
40
|
+
dataSet: _propTypes.default.object
|
|
41
|
+
};
|
|
35
42
|
var _default = exports.default = Link;
|
package/lib/cjs/Link/LinkBase.js
CHANGED
|
@@ -143,6 +143,7 @@ const LinkBase = /*#__PURE__*/_react.default.forwardRef((_ref6, ref) => {
|
|
|
143
143
|
variant,
|
|
144
144
|
tokens = {},
|
|
145
145
|
children,
|
|
146
|
+
dataSet,
|
|
146
147
|
accessibilityRole = 'link',
|
|
147
148
|
...rawRest
|
|
148
149
|
} = _ref6;
|
|
@@ -177,6 +178,7 @@ const LinkBase = /*#__PURE__*/_react.default.forwardRef((_ref6, ref) => {
|
|
|
177
178
|
} = (0, _ThemeProvider.useTheme)();
|
|
178
179
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InlinePressable.default, {
|
|
179
180
|
...selectedProps,
|
|
181
|
+
dataSet: dataSet,
|
|
180
182
|
inlineFlex: hasIcon
|
|
181
183
|
// assuming links without icons should be inline (even if they are long)
|
|
182
184
|
,
|
|
@@ -5,13 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
|
-
let id = 0;
|
|
9
8
|
function useUniqueId() {
|
|
10
9
|
let prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
return `${prefix}-${id}`;
|
|
14
|
-
});
|
|
15
|
-
return uniqueId;
|
|
10
|
+
const id = (0, _react.useId)();
|
|
11
|
+
return `${prefix ? `${prefix}-` : ''}${id}`;
|
|
16
12
|
}
|
|
17
13
|
var _default = exports.default = useUniqueId;
|
|
@@ -6,10 +6,10 @@ import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
|
6
6
|
import Platform from "react-native-web/dist/exports/Platform";
|
|
7
7
|
import { applyTextStyles, applyShadowToken, applyOuterBorder, useTheme } from '../ThemeProvider';
|
|
8
8
|
import buttonPropTypes from './propTypes';
|
|
9
|
-
import { a11yProps, clickProps, focusHandlerProps, getCursorStyle, linkProps, resolvePressableState, resolvePressableTokens, selectSystemProps, viewProps, wrapStringsInText, withLinkRouter } from '../utils';
|
|
9
|
+
import { a11yProps, clickProps, focusHandlerProps, getCursorStyle, linkProps, resolvePressableState, resolvePressableTokens, selectSystemProps, viewProps, wrapStringsInText, withLinkRouter, contentfulProps } from '../utils';
|
|
10
10
|
import { IconText } from '../Icon';
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, focusHandlerProps, linkProps, viewProps]);
|
|
12
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, focusHandlerProps, linkProps, viewProps, contentfulProps]);
|
|
13
13
|
const getOuterBorderOffset = _ref => {
|
|
14
14
|
let {
|
|
15
15
|
outerBorderGap = 0,
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import ButtonBase from './ButtonBase';
|
|
4
4
|
import buttonPropTypes, { textAndA11yText } from './propTypes';
|
|
5
|
-
import { a11yProps, hrefAttrsProp, linkProps } from '../utils/props';
|
|
5
|
+
import { a11yProps, hrefAttrsProp, linkProps, contentfulProps } from '../utils/props';
|
|
6
6
|
import { useThemeTokensCallback } from '../ThemeProvider';
|
|
7
7
|
import { useViewport } from '../ViewportProvider';
|
|
8
8
|
|
|
@@ -43,6 +43,7 @@ ButtonLink.propTypes = {
|
|
|
43
43
|
...a11yProps.types,
|
|
44
44
|
...buttonPropTypes,
|
|
45
45
|
...linkProps.types,
|
|
46
|
+
...contentfulProps.types,
|
|
46
47
|
children: textAndA11yText,
|
|
47
48
|
dataSet: PropTypes.object,
|
|
48
49
|
accessibilityRole: PropTypes.string
|
|
@@ -3,9 +3,9 @@ import View from "react-native-web/dist/exports/View";
|
|
|
3
3
|
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { useThemeTokens } from '../ThemeProvider';
|
|
6
|
-
import { a11yProps, getTokensPropType, selectSystemProps, useMultipleInputValues, variantProp, viewProps } from '../utils';
|
|
6
|
+
import { a11yProps, getTokensPropType, selectSystemProps, useMultipleInputValues, variantProp, viewProps, contentfulProps } from '../utils';
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
|
|
8
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps, contentfulProps]);
|
|
9
9
|
function selectBorderStyles(tokens) {
|
|
10
10
|
return {
|
|
11
11
|
borderBottomWidth: tokens.borderWidth,
|
|
@@ -30,6 +30,7 @@ const ExpandCollapse = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
30
30
|
open,
|
|
31
31
|
initialOpen,
|
|
32
32
|
onChange,
|
|
33
|
+
dataSet,
|
|
33
34
|
...rest
|
|
34
35
|
} = _ref;
|
|
35
36
|
const {
|
|
@@ -49,6 +50,7 @@ const ExpandCollapse = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
49
50
|
style: staticStyles.container,
|
|
50
51
|
ref: ref,
|
|
51
52
|
...selectProps(rest),
|
|
53
|
+
dataSet: dataSet,
|
|
52
54
|
children: /*#__PURE__*/_jsx(View, {
|
|
53
55
|
style: selectBorderStyles(themeTokens),
|
|
54
56
|
children: typeof children === 'function' ? children({
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import ExpandCollapse from '../ExpandCollapse';
|
|
4
|
-
import { getTokensPropType } from '../utils';
|
|
4
|
+
import { getTokensPropType, selectSystemProps, contentfulProps } from '../utils';
|
|
5
5
|
import ExpandCollapseMiniControl from './ExpandCollapseMiniControl';
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
const [selectContainerProps, selectedContainerPropTypes] = selectSystemProps([contentfulProps]);
|
|
7
8
|
const ExpandCollapseMini = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
8
9
|
let {
|
|
9
10
|
children,
|
|
@@ -11,6 +12,7 @@ const ExpandCollapseMini = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
11
12
|
tokens = {},
|
|
12
13
|
nativeID,
|
|
13
14
|
initialOpen = false,
|
|
15
|
+
dataSet,
|
|
14
16
|
...rest
|
|
15
17
|
} = _ref;
|
|
16
18
|
const expandCollapeMiniPanelId = 'ExpandCollapseMiniPanel';
|
|
@@ -24,6 +26,8 @@ const ExpandCollapseMini = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
24
26
|
onChange: handleChange,
|
|
25
27
|
tokens: tokens,
|
|
26
28
|
initialOpen: initialOpen ? [expandCollapeMiniPanelId] : [],
|
|
29
|
+
...selectContainerProps(rest),
|
|
30
|
+
dataSet: dataSet,
|
|
27
31
|
children: expandProps => /*#__PURE__*/_jsx(ExpandCollapse.Panel, {
|
|
28
32
|
...expandProps,
|
|
29
33
|
panelId: expandCollapeMiniPanelId,
|
|
@@ -53,6 +57,7 @@ const ExpandCollapseMini = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
53
57
|
ExpandCollapseMini.displayName = 'ExpandCollapseMini';
|
|
54
58
|
ExpandCollapseMini.propTypes = {
|
|
55
59
|
...ExpandCollapseMiniControl.propTypes,
|
|
60
|
+
...selectedContainerPropTypes,
|
|
56
61
|
/**
|
|
57
62
|
* Function to call on pressing the panel's control, which should open or close the panel.
|
|
58
63
|
*/
|
|
@@ -72,6 +77,10 @@ ExpandCollapseMini.propTypes = {
|
|
|
72
77
|
/**
|
|
73
78
|
* Optional variant object to override the default theme tokens
|
|
74
79
|
*/
|
|
75
|
-
tokens: getTokensPropType('ExpandCollapseMini')
|
|
80
|
+
tokens: getTokensPropType('ExpandCollapseMini'),
|
|
81
|
+
/**
|
|
82
|
+
* The dataSet prop allows to pass data-* attributes element to the component.
|
|
83
|
+
*/
|
|
84
|
+
dataSet: PropTypes.object
|
|
76
85
|
};
|
|
77
86
|
export default ExpandCollapseMini;
|
package/lib/esm/Link/Link.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
2
3
|
import { useThemeTokensCallback } from '../ThemeProvider';
|
|
3
4
|
import LinkBase from './LinkBase';
|
|
4
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -24,5 +25,11 @@ const Link = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
24
25
|
});
|
|
25
26
|
});
|
|
26
27
|
Link.displayName = 'Link';
|
|
27
|
-
Link.propTypes =
|
|
28
|
+
Link.propTypes = {
|
|
29
|
+
...LinkBase.propTypes,
|
|
30
|
+
/**
|
|
31
|
+
* The dataSet prop allows to pass data-* attributes element to the component.
|
|
32
|
+
*/
|
|
33
|
+
dataSet: PropTypes.object
|
|
34
|
+
};
|
|
28
35
|
export default Link;
|
package/lib/esm/Link/LinkBase.js
CHANGED
|
@@ -136,6 +136,7 @@ const LinkBase = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
|
|
|
136
136
|
variant,
|
|
137
137
|
tokens = {},
|
|
138
138
|
children,
|
|
139
|
+
dataSet,
|
|
139
140
|
accessibilityRole = 'link',
|
|
140
141
|
...rawRest
|
|
141
142
|
} = _ref6;
|
|
@@ -170,6 +171,7 @@ const LinkBase = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
|
|
|
170
171
|
} = useTheme();
|
|
171
172
|
return /*#__PURE__*/_jsx(InlinePressable, {
|
|
172
173
|
...selectedProps,
|
|
174
|
+
dataSet: dataSet,
|
|
173
175
|
inlineFlex: hasIcon
|
|
174
176
|
// assuming links without icons should be inline (even if they are long)
|
|
175
177
|
,
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
let id = 0;
|
|
1
|
+
import { useId } from 'react';
|
|
3
2
|
function useUniqueId() {
|
|
4
3
|
let prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
return `${prefix}-${id}`;
|
|
8
|
-
});
|
|
9
|
-
return uniqueId;
|
|
4
|
+
const id = useId();
|
|
5
|
+
return `${prefix ? `${prefix}-` : ''}${id}`;
|
|
10
6
|
}
|
|
11
7
|
export default useUniqueId;
|
package/lib/package.json
CHANGED
package/package.json
CHANGED
|
@@ -15,7 +15,8 @@ import {
|
|
|
15
15
|
selectSystemProps,
|
|
16
16
|
viewProps,
|
|
17
17
|
wrapStringsInText,
|
|
18
|
-
withLinkRouter
|
|
18
|
+
withLinkRouter,
|
|
19
|
+
contentfulProps
|
|
19
20
|
} from '../utils'
|
|
20
21
|
import { IconText } from '../Icon'
|
|
21
22
|
|
|
@@ -23,7 +24,8 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([
|
|
|
23
24
|
a11yProps,
|
|
24
25
|
focusHandlerProps,
|
|
25
26
|
linkProps,
|
|
26
|
-
viewProps
|
|
27
|
+
viewProps,
|
|
28
|
+
contentfulProps
|
|
27
29
|
])
|
|
28
30
|
|
|
29
31
|
const getOuterBorderOffset = ({ outerBorderGap = 0, outerBorderWidth = 0 }) =>
|
|
@@ -2,7 +2,7 @@ import React from 'react'
|
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import ButtonBase from './ButtonBase'
|
|
4
4
|
import buttonPropTypes, { textAndA11yText } from './propTypes'
|
|
5
|
-
import { a11yProps, hrefAttrsProp, linkProps } from '../utils/props'
|
|
5
|
+
import { a11yProps, hrefAttrsProp, linkProps, contentfulProps } from '../utils/props'
|
|
6
6
|
import { useThemeTokensCallback } from '../ThemeProvider'
|
|
7
7
|
import { useViewport } from '../ViewportProvider'
|
|
8
8
|
|
|
@@ -16,6 +16,7 @@ const ButtonLink = React.forwardRef(
|
|
|
16
16
|
const viewport = useViewport()
|
|
17
17
|
const buttonVariant = { viewport, ...variant }
|
|
18
18
|
const getTokens = useThemeTokensCallback('Button', tokens, buttonVariant)
|
|
19
|
+
|
|
19
20
|
return (
|
|
20
21
|
<ButtonBase
|
|
21
22
|
ref={ref}
|
|
@@ -34,6 +35,7 @@ ButtonLink.propTypes = {
|
|
|
34
35
|
...a11yProps.types,
|
|
35
36
|
...buttonPropTypes,
|
|
36
37
|
...linkProps.types,
|
|
38
|
+
...contentfulProps.types,
|
|
37
39
|
children: textAndA11yText,
|
|
38
40
|
dataSet: PropTypes.object,
|
|
39
41
|
accessibilityRole: PropTypes.string
|
|
@@ -9,10 +9,15 @@ import {
|
|
|
9
9
|
selectSystemProps,
|
|
10
10
|
useMultipleInputValues,
|
|
11
11
|
variantProp,
|
|
12
|
-
viewProps
|
|
12
|
+
viewProps,
|
|
13
|
+
contentfulProps
|
|
13
14
|
} from '../utils'
|
|
14
15
|
|
|
15
|
-
const [selectProps, selectedSystemPropTypes] = selectSystemProps([
|
|
16
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([
|
|
17
|
+
a11yProps,
|
|
18
|
+
viewProps,
|
|
19
|
+
contentfulProps
|
|
20
|
+
])
|
|
16
21
|
|
|
17
22
|
function selectBorderStyles(tokens) {
|
|
18
23
|
return {
|
|
@@ -30,7 +35,7 @@ function selectBorderStyles(tokens) {
|
|
|
30
35
|
* nested (they do not need to be direct children), and non-interactive items may be included too.
|
|
31
36
|
*/
|
|
32
37
|
const ExpandCollapse = React.forwardRef(
|
|
33
|
-
({ children, tokens, variant, maxOpen, open, initialOpen, onChange, ...rest }, ref) => {
|
|
38
|
+
({ children, tokens, variant, maxOpen, open, initialOpen, onChange, dataSet, ...rest }, ref) => {
|
|
34
39
|
const {
|
|
35
40
|
currentValues: openIds,
|
|
36
41
|
toggleOneValue: onToggle,
|
|
@@ -46,7 +51,7 @@ const ExpandCollapse = React.forwardRef(
|
|
|
46
51
|
const themeTokens = useThemeTokens('ExpandCollapse', tokens, variant)
|
|
47
52
|
|
|
48
53
|
return (
|
|
49
|
-
<View style={staticStyles.container} ref={ref} {...selectProps(rest)}>
|
|
54
|
+
<View style={staticStyles.container} ref={ref} {...selectProps(rest)} dataSet={dataSet}>
|
|
50
55
|
<View style={selectBorderStyles(themeTokens)}>
|
|
51
56
|
{typeof children === 'function'
|
|
52
57
|
? children({ openIds, onToggle, resetValues, setValues, unsetValues })
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import ExpandCollapse from '../ExpandCollapse'
|
|
4
|
-
import { getTokensPropType } from '../utils'
|
|
4
|
+
import { getTokensPropType, selectSystemProps, contentfulProps } from '../utils'
|
|
5
5
|
import ExpandCollapseMiniControl from './ExpandCollapseMiniControl'
|
|
6
6
|
|
|
7
|
+
const [selectContainerProps, selectedContainerPropTypes] = selectSystemProps([contentfulProps])
|
|
8
|
+
|
|
7
9
|
const ExpandCollapseMini = React.forwardRef(
|
|
8
|
-
(
|
|
10
|
+
(
|
|
11
|
+
{ children, onToggle = () => {}, tokens = {}, nativeID, initialOpen = false, dataSet, ...rest },
|
|
12
|
+
ref
|
|
13
|
+
) => {
|
|
9
14
|
const expandCollapeMiniPanelId = 'ExpandCollapseMiniPanel'
|
|
10
15
|
const handleChange = (openPanels, event) => {
|
|
11
16
|
if (typeof onToggle === 'function') {
|
|
@@ -19,6 +24,8 @@ const ExpandCollapseMini = React.forwardRef(
|
|
|
19
24
|
onChange={handleChange}
|
|
20
25
|
tokens={tokens}
|
|
21
26
|
initialOpen={initialOpen ? [expandCollapeMiniPanelId] : []}
|
|
27
|
+
{...selectContainerProps(rest)}
|
|
28
|
+
dataSet={dataSet}
|
|
22
29
|
>
|
|
23
30
|
{(expandProps) => (
|
|
24
31
|
<ExpandCollapse.Panel
|
|
@@ -51,6 +58,7 @@ ExpandCollapseMini.displayName = 'ExpandCollapseMini'
|
|
|
51
58
|
|
|
52
59
|
ExpandCollapseMini.propTypes = {
|
|
53
60
|
...ExpandCollapseMiniControl.propTypes,
|
|
61
|
+
...selectedContainerPropTypes,
|
|
54
62
|
/**
|
|
55
63
|
* Function to call on pressing the panel's control, which should open or close the panel.
|
|
56
64
|
*/
|
|
@@ -70,7 +78,11 @@ ExpandCollapseMini.propTypes = {
|
|
|
70
78
|
/**
|
|
71
79
|
* Optional variant object to override the default theme tokens
|
|
72
80
|
*/
|
|
73
|
-
tokens: getTokensPropType('ExpandCollapseMini')
|
|
81
|
+
tokens: getTokensPropType('ExpandCollapseMini'),
|
|
82
|
+
/**
|
|
83
|
+
* The dataSet prop allows to pass data-* attributes element to the component.
|
|
84
|
+
*/
|
|
85
|
+
dataSet: PropTypes.object
|
|
74
86
|
}
|
|
75
87
|
|
|
76
88
|
export default ExpandCollapseMini
|
package/src/Link/Link.jsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
2
3
|
|
|
3
4
|
import { useThemeTokensCallback } from '../ThemeProvider'
|
|
4
5
|
import LinkBase from './LinkBase'
|
|
@@ -25,6 +26,12 @@ const Link = React.forwardRef(
|
|
|
25
26
|
)
|
|
26
27
|
Link.displayName = 'Link'
|
|
27
28
|
|
|
28
|
-
Link.propTypes =
|
|
29
|
+
Link.propTypes = {
|
|
30
|
+
...LinkBase.propTypes,
|
|
31
|
+
/**
|
|
32
|
+
* The dataSet prop allows to pass data-* attributes element to the component.
|
|
33
|
+
*/
|
|
34
|
+
dataSet: PropTypes.object
|
|
35
|
+
}
|
|
29
36
|
|
|
30
37
|
export default Link
|
package/src/Link/LinkBase.jsx
CHANGED
|
@@ -132,6 +132,7 @@ const LinkBase = React.forwardRef(
|
|
|
132
132
|
variant,
|
|
133
133
|
tokens = {},
|
|
134
134
|
children,
|
|
135
|
+
dataSet,
|
|
135
136
|
accessibilityRole = 'link',
|
|
136
137
|
...rawRest
|
|
137
138
|
},
|
|
@@ -162,6 +163,7 @@ const LinkBase = React.forwardRef(
|
|
|
162
163
|
return (
|
|
163
164
|
<InlinePressable
|
|
164
165
|
{...selectedProps}
|
|
166
|
+
dataSet={dataSet}
|
|
165
167
|
inlineFlex={hasIcon}
|
|
166
168
|
// assuming links without icons should be inline (even if they are long)
|
|
167
169
|
ref={ref}
|
package/src/utils/useUniqueId.js
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
let id = 0
|
|
1
|
+
import { useId } from 'react'
|
|
4
2
|
|
|
5
3
|
function useUniqueId(prefix = '') {
|
|
6
|
-
const
|
|
7
|
-
id += 1
|
|
8
|
-
return `${prefix}-${id}`
|
|
9
|
-
})
|
|
4
|
+
const id = useId()
|
|
10
5
|
|
|
11
|
-
return
|
|
6
|
+
return `${prefix ? `${prefix}-` : ''}${id}`
|
|
12
7
|
}
|
|
13
8
|
|
|
14
9
|
export default useUniqueId
|