@telus-uds/components-web 2.11.0 → 2.13.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 +38 -2
- package/component-docs.json +123 -35
- package/lib/Autocomplete/Loading.js +5 -10
- package/lib/Autocomplete/dictionary.js +2 -2
- package/lib/Card/Card.js +2 -0
- package/lib/DatePicker/DatePicker.js +6 -0
- package/lib/ExpandCollapseMini/ExpandCollapseMini.js +5 -10
- package/lib/ExpandCollapseMini/ExpandCollapseMiniControl.js +32 -7
- package/lib/Footnote/FootnoteLink.js +1 -2
- package/lib/NavigationBar/NavigationSubMenu.js +4 -8
- package/lib/PriceLockup/PriceLockup.js +6 -1
- package/lib/Spinner/Spinner.js +10 -1
- package/lib/Spinner/SpinnerContent.js +8 -0
- package/lib/Table/Cell.js +62 -91
- package/lib/Table/Header.js +4 -1
- package/lib/Table/SubHeading.js +4 -1
- package/lib/Table/Table.js +2 -1
- package/lib/TermsAndConditions/ExpandCollapse.js +31 -13
- package/lib/TermsAndConditions/TermsAndConditions.js +21 -6
- package/lib/VideoPicker/VideoPickerPlayer.js +4 -2
- package/lib/VideoPicker/VideoPickerThumbnail.js +103 -60
- package/lib/VideoPicker/VideoSlider.js +2 -2
- package/lib-module/Autocomplete/Loading.js +6 -12
- package/lib-module/Autocomplete/dictionary.js +2 -2
- package/lib-module/Card/Card.js +2 -0
- package/lib-module/DatePicker/DatePicker.js +7 -1
- package/lib-module/ExpandCollapseMini/ExpandCollapseMini.js +6 -11
- package/lib-module/ExpandCollapseMini/ExpandCollapseMiniControl.js +32 -7
- package/lib-module/Footnote/FootnoteLink.js +1 -2
- package/lib-module/NavigationBar/NavigationSubMenu.js +5 -9
- package/lib-module/PriceLockup/PriceLockup.js +7 -2
- package/lib-module/Spinner/Spinner.js +10 -1
- package/lib-module/Spinner/SpinnerContent.js +8 -0
- package/lib-module/Table/Cell.js +65 -90
- package/lib-module/Table/Header.js +4 -1
- package/lib-module/Table/SubHeading.js +4 -1
- package/lib-module/Table/Table.js +2 -1
- package/lib-module/TermsAndConditions/ExpandCollapse.js +33 -15
- package/lib-module/TermsAndConditions/TermsAndConditions.js +22 -7
- package/lib-module/VideoPicker/VideoPickerPlayer.js +4 -2
- package/lib-module/VideoPicker/VideoPickerThumbnail.js +103 -61
- package/lib-module/VideoPicker/VideoSlider.js +2 -2
- package/package.json +3 -3
- package/src/Autocomplete/Loading.jsx +2 -5
- package/src/Autocomplete/dictionary.js +2 -2
- package/src/Card/Card.jsx +12 -8
- package/src/DatePicker/DatePicker.jsx +8 -1
- package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +9 -6
- package/src/ExpandCollapseMini/ExpandCollapseMiniControl.jsx +21 -4
- package/src/Footnote/FootnoteLink.jsx +1 -2
- package/src/NavigationBar/NavigationSubMenu.jsx +3 -4
- package/src/PriceLockup/PriceLockup.jsx +7 -2
- package/src/Spinner/Spinner.jsx +9 -1
- package/src/Spinner/SpinnerContent.jsx +13 -1
- package/src/Table/Cell.jsx +58 -78
- package/src/Table/Header.jsx +6 -1
- package/src/Table/SubHeading.jsx +4 -1
- package/src/Table/Table.jsx +10 -2
- package/src/TermsAndConditions/ExpandCollapse.jsx +36 -14
- package/src/TermsAndConditions/TermsAndConditions.jsx +18 -6
- package/src/VideoPicker/VideoPickerPlayer.jsx +2 -2
- package/src/VideoPicker/VideoPickerThumbnail.jsx +51 -30
- package/src/VideoPicker/VideoSlider.jsx +2 -2
- package/types/BaseProvider.d.ts +25 -0
- package/types/index.d.ts +1 -1
|
@@ -48,7 +48,7 @@ const VideoSlider = _ref => {
|
|
|
48
48
|
setContainerWidth(width);
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
const itemsGap =
|
|
51
|
+
const itemsGap = 32; // '5' on spacing scale
|
|
52
52
|
|
|
53
53
|
const itemsCount = viewport === 'lg' || viewport === 'xl' ? 4 : 3;
|
|
54
54
|
const itemGapPortioned = (itemsCount - 1) * itemsGap / itemsCount;
|
|
@@ -57,7 +57,7 @@ const VideoSlider = _ref => {
|
|
|
57
57
|
Math.max(containerWidth / itemsCount - itemGapPortioned, 0 // Prevent negative width breaking layout on very narrow containers
|
|
58
58
|
);
|
|
59
59
|
const content = /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.StackView, {
|
|
60
|
-
space:
|
|
60
|
+
space: 5,
|
|
61
61
|
direction: "row",
|
|
62
62
|
accessibilityRole: "radiogroup",
|
|
63
63
|
tokens: {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { Box, StackView
|
|
3
|
+
import { Box, StackView } from '@telus-uds/components-base';
|
|
4
4
|
import Spinner from '../Spinner';
|
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
6
|
|
|
8
7
|
const Loading = _ref => {
|
|
9
8
|
let {
|
|
@@ -11,23 +10,18 @@ const Loading = _ref => {
|
|
|
11
10
|
} = _ref;
|
|
12
11
|
return /*#__PURE__*/_jsx(Box, {
|
|
13
12
|
space: 3,
|
|
14
|
-
children: /*#__PURE__*/
|
|
13
|
+
children: /*#__PURE__*/_jsx(StackView, {
|
|
15
14
|
direction: "row",
|
|
16
15
|
space: 2,
|
|
17
16
|
tokens: {
|
|
18
17
|
alignItems: 'center'
|
|
19
18
|
},
|
|
20
|
-
children:
|
|
19
|
+
children: /*#__PURE__*/_jsx(Spinner, {
|
|
21
20
|
inline: true,
|
|
22
21
|
show: true,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
size: 'small'
|
|
27
|
-
},
|
|
28
|
-
accessibilityLiveRegion: "polite",
|
|
29
|
-
children: label
|
|
30
|
-
})]
|
|
22
|
+
label: label,
|
|
23
|
+
labelPosition: "right"
|
|
24
|
+
})
|
|
31
25
|
})
|
|
32
26
|
});
|
|
33
27
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
en: {
|
|
3
3
|
hasResults: 'Some results are available',
|
|
4
|
-
loading: '
|
|
4
|
+
loading: 'Searching...',
|
|
5
5
|
noResults: 'No results found'
|
|
6
6
|
},
|
|
7
7
|
fr: {
|
|
8
8
|
hasResults: 'Quelques suggestions sont disponible',
|
|
9
|
-
loading: '
|
|
9
|
+
loading: 'Recherche...',
|
|
10
10
|
noResults: 'Aucun résultat trouvé'
|
|
11
11
|
}
|
|
12
12
|
};
|
package/lib-module/Card/Card.js
CHANGED
|
@@ -12,6 +12,7 @@ const selectCardBaseTokens = _ref => {
|
|
|
12
12
|
let {
|
|
13
13
|
backgroundColor,
|
|
14
14
|
borderColor,
|
|
15
|
+
gradient,
|
|
15
16
|
borderWidth,
|
|
16
17
|
borderRadius,
|
|
17
18
|
shadow,
|
|
@@ -20,6 +21,7 @@ const selectCardBaseTokens = _ref => {
|
|
|
20
21
|
return {
|
|
21
22
|
backgroundColor,
|
|
22
23
|
borderColor,
|
|
24
|
+
gradient,
|
|
23
25
|
borderWidth,
|
|
24
26
|
borderRadius,
|
|
25
27
|
shadow,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { forwardRef, useState } from 'react';
|
|
1
|
+
import React, { forwardRef, useEffect, useState } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import momentPropTypes from 'react-moment-proptypes';
|
|
@@ -110,6 +110,12 @@ const DatePicker = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
110
110
|
dictionary,
|
|
111
111
|
copy
|
|
112
112
|
});
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
if (!moment(date).isSame(inputDate)) {
|
|
115
|
+
setInputDate(date);
|
|
116
|
+
setInputText(date instanceof moment ? date.format(dateFormat) : '');
|
|
117
|
+
}
|
|
118
|
+
}, [date, inputDate]);
|
|
113
119
|
|
|
114
120
|
const onFocusChange = _ref2 => {
|
|
115
121
|
let {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { ExpandCollapse
|
|
3
|
+
import { ExpandCollapse } from '@telus-uds/components-base';
|
|
4
4
|
import ExpandCollapseMiniControl from './ExpandCollapseMiniControl';
|
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
6
|
const ExpandCollapseMini = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
@@ -10,12 +10,6 @@ const ExpandCollapseMini = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
10
10
|
tokens,
|
|
11
11
|
...rest
|
|
12
12
|
} = _ref;
|
|
13
|
-
const {
|
|
14
|
-
variant
|
|
15
|
-
} = rest;
|
|
16
|
-
const {
|
|
17
|
-
borderWidth
|
|
18
|
-
} = useThemeTokens('ExpandCollapseMini', tokens, variant);
|
|
19
13
|
|
|
20
14
|
const handleChange = (openPanels, event) => {
|
|
21
15
|
if (typeof onToggle === 'function') {
|
|
@@ -25,9 +19,6 @@ const ExpandCollapseMini = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
25
19
|
};
|
|
26
20
|
|
|
27
21
|
return /*#__PURE__*/_jsx(ExpandCollapse, {
|
|
28
|
-
tokens: {
|
|
29
|
-
borderWidth
|
|
30
|
-
},
|
|
31
22
|
onChange: handleChange,
|
|
32
23
|
children: expandProps => /*#__PURE__*/_jsx(ExpandCollapse.Panel, { ...expandProps,
|
|
33
24
|
panelId: "ExpandCollapseMiniPanel",
|
|
@@ -35,7 +26,11 @@ const ExpandCollapseMini = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
35
26
|
mini: true
|
|
36
27
|
},
|
|
37
28
|
controlTokens: {
|
|
38
|
-
|
|
29
|
+
// Remove unwanted look and feel from ExpandCollapse(background pressed, focus border and text underline)
|
|
30
|
+
icon: null,
|
|
31
|
+
borderColor: 'transparent',
|
|
32
|
+
textLine: 'none',
|
|
33
|
+
backgroundColor: 'transparent'
|
|
39
34
|
} // TODO refactor
|
|
40
35
|
// eslint-disable-next-line react/no-unstable-nested-components
|
|
41
36
|
,
|
|
@@ -15,7 +15,22 @@ const presentationOnly = {
|
|
|
15
15
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const selectLinkTokens = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
color,
|
|
21
|
+
textLine,
|
|
22
|
+
lineHeight,
|
|
23
|
+
fontSize
|
|
24
|
+
} = _ref;
|
|
25
|
+
return {
|
|
26
|
+
color,
|
|
27
|
+
textLine,
|
|
28
|
+
blockLineHeight: lineHeight,
|
|
29
|
+
blockFontSize: fontSize
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const ExpandCollapseMiniControl = _ref2 => {
|
|
19
34
|
let {
|
|
20
35
|
pressableState,
|
|
21
36
|
collapseTitle,
|
|
@@ -24,16 +39,25 @@ const ExpandCollapseMiniControl = _ref => {
|
|
|
24
39
|
tokens,
|
|
25
40
|
variant = {},
|
|
26
41
|
...rest
|
|
27
|
-
} =
|
|
42
|
+
} = _ref2;
|
|
28
43
|
const {
|
|
29
44
|
expanded,
|
|
30
|
-
hover
|
|
31
|
-
|
|
45
|
+
hover,
|
|
46
|
+
focus
|
|
47
|
+
} = pressableState || {}; // we only want focus outline when focusing, if user is pressing we don't want the border.
|
|
48
|
+
|
|
49
|
+
const {
|
|
50
|
+
outerBorderColor
|
|
51
|
+
} = useThemeTokens('Link', {}, {}, {
|
|
52
|
+
focus
|
|
53
|
+
});
|
|
32
54
|
const {
|
|
33
55
|
size,
|
|
34
|
-
icon
|
|
56
|
+
icon,
|
|
57
|
+
...themeTokens
|
|
35
58
|
} = useThemeTokens('ExpandCollapseMiniControl', tokens, variant, {
|
|
36
|
-
expanded
|
|
59
|
+
expanded,
|
|
60
|
+
focus
|
|
37
61
|
}); // Choose hover styles when any part of Control is hoverred
|
|
38
62
|
|
|
39
63
|
const appearance = { ...variant,
|
|
@@ -61,7 +85,8 @@ const ExpandCollapseMiniControl = _ref => {
|
|
|
61
85
|
icon: icon,
|
|
62
86
|
iconPosition: iconPosition,
|
|
63
87
|
tokens: linkState => ({ ...getTokens(linkState),
|
|
64
|
-
|
|
88
|
+
...selectLinkTokens(themeTokens),
|
|
89
|
+
outerBorderColor
|
|
65
90
|
}),
|
|
66
91
|
...presentationOnly,
|
|
67
92
|
...selectProps(rest),
|
|
@@ -122,7 +122,6 @@ FootnoteLink.propTypes = { ...selectedSystemPropTypes,
|
|
|
122
122
|
fontSize: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
123
123
|
};
|
|
124
124
|
FootnoteLink.defaultProps = {
|
|
125
|
-
copy: 'en'
|
|
126
|
-
fontSize: 'smaller'
|
|
125
|
+
copy: 'en'
|
|
127
126
|
};
|
|
128
127
|
export default FootnoteLink;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useRef } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { Icon,
|
|
3
|
+
import { Icon, useResponsiveProp, useThemeTokens } from '@telus-uds/components-base';
|
|
4
4
|
import NavigationItem from './NavigationItem';
|
|
5
5
|
import Listbox from '../Listbox';
|
|
6
6
|
import useOverlaidPosition from '../utils/useOverlaidPosition';
|
|
@@ -98,22 +98,18 @@ const NavigationSubMenu = _ref => {
|
|
|
98
98
|
onClick: handleClick,
|
|
99
99
|
icon: icoMenu,
|
|
100
100
|
children: _ref2 => {
|
|
101
|
-
var _textStyles
|
|
101
|
+
var _textStyles$;
|
|
102
102
|
|
|
103
103
|
let {
|
|
104
104
|
textStyles
|
|
105
105
|
} = _ref2;
|
|
106
|
-
return [children, /*#__PURE__*/_jsx(
|
|
107
|
-
space: 1,
|
|
108
|
-
direction: "row"
|
|
109
|
-
}, `${id}_spacer`), /*#__PURE__*/_jsx(Icon, {
|
|
106
|
+
return [children, /*#__PURE__*/_jsx(Icon, {
|
|
110
107
|
icon: icoMenu,
|
|
111
108
|
variant: {
|
|
112
|
-
size: '
|
|
109
|
+
size: 'micro'
|
|
113
110
|
},
|
|
114
111
|
tokens: {
|
|
115
|
-
color: (_textStyles$ = textStyles[0]) === null || _textStyles$ === void 0 ? void 0 : _textStyles$.color
|
|
116
|
-
size: (_textStyles$2 = textStyles[0]) === null || _textStyles$2 === void 0 ? void 0 : _textStyles$2.fontSize
|
|
112
|
+
color: (_textStyles$ = textStyles[0]) === null || _textStyles$ === void 0 ? void 0 : _textStyles$.color
|
|
117
113
|
}
|
|
118
114
|
}, `${id}_icon`)];
|
|
119
115
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { A11yText, Divider, selectSystemProps, Typography, useThemeTokens, useViewport } from '@telus-uds/components-base';
|
|
3
|
+
import { A11yText, Divider, selectSystemProps, Typography, useThemeTokens, useViewport, getTokensPropType } from '@telus-uds/components-base';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
import FootnoteLink from '../Footnote/FootnoteLink';
|
|
6
6
|
import getTypographyTokens from './tokens';
|
|
@@ -293,6 +293,11 @@ PriceLockup.propTypes = { ...selectedSystemPropTypes,
|
|
|
293
293
|
*
|
|
294
294
|
* **Note:** a11yText will override strikethrough price, so it must include price (ie. "was 50 dollars per month")
|
|
295
295
|
*/
|
|
296
|
-
a11yText: PropTypes.string
|
|
296
|
+
a11yText: PropTypes.string,
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* `PriceLockup` tokens
|
|
300
|
+
*/
|
|
301
|
+
tokens: getTokensPropType('PriceLockup')
|
|
297
302
|
};
|
|
298
303
|
export default PriceLockup;
|
|
@@ -88,6 +88,7 @@ const Spinner = _ref3 => {
|
|
|
88
88
|
fullScreen = false,
|
|
89
89
|
inline = false,
|
|
90
90
|
label,
|
|
91
|
+
labelPosition,
|
|
91
92
|
show = false,
|
|
92
93
|
isStatic = false,
|
|
93
94
|
tokens,
|
|
@@ -120,6 +121,7 @@ const Spinner = _ref3 => {
|
|
|
120
121
|
...selectProps(rest),
|
|
121
122
|
children: /*#__PURE__*/_jsx(SpinnerContent, {
|
|
122
123
|
label: label,
|
|
124
|
+
labelPosition: labelPosition,
|
|
123
125
|
overlay: true,
|
|
124
126
|
size: size,
|
|
125
127
|
thickness: thickness,
|
|
@@ -139,6 +141,7 @@ const Spinner = _ref3 => {
|
|
|
139
141
|
...selectProps(rest),
|
|
140
142
|
children: [/*#__PURE__*/_jsx(SpinnerContent, {
|
|
141
143
|
label: label,
|
|
144
|
+
labelPosition: labelPosition,
|
|
142
145
|
overlay: true,
|
|
143
146
|
size: size,
|
|
144
147
|
thickness: thickness,
|
|
@@ -164,6 +167,7 @@ const Spinner = _ref3 => {
|
|
|
164
167
|
return /*#__PURE__*/_jsx(SpinnerContainer, { ...selectProps(rest),
|
|
165
168
|
children: /*#__PURE__*/_jsx(SpinnerContent, {
|
|
166
169
|
label: label,
|
|
170
|
+
labelPosition: labelPosition,
|
|
167
171
|
size: size,
|
|
168
172
|
thickness: thickness,
|
|
169
173
|
sizeVariant: sizeVariant,
|
|
@@ -211,6 +215,11 @@ Spinner.propTypes = { ...selectedSystemPropTypes,
|
|
|
211
215
|
/**
|
|
212
216
|
* If true, it should render a static spinner
|
|
213
217
|
*/
|
|
214
|
-
isStatic: PropTypes.bool
|
|
218
|
+
isStatic: PropTypes.bool,
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Determine where the label of the spinner should be placed, left, right, bottom or top.
|
|
222
|
+
*/
|
|
223
|
+
labelPosition: PropTypes.string
|
|
215
224
|
};
|
|
216
225
|
export default Spinner;
|
|
@@ -31,6 +31,7 @@ const Container = /*#__PURE__*/styled.div.withConfig({
|
|
|
31
31
|
const SpinnerContent = _ref2 => {
|
|
32
32
|
let {
|
|
33
33
|
label,
|
|
34
|
+
labelPosition,
|
|
34
35
|
overlay = false,
|
|
35
36
|
sizeVariant,
|
|
36
37
|
size,
|
|
@@ -38,6 +39,12 @@ const SpinnerContent = _ref2 => {
|
|
|
38
39
|
isStatic,
|
|
39
40
|
...rest
|
|
40
41
|
} = _ref2;
|
|
42
|
+
const labelMapping = {
|
|
43
|
+
top: 'column-reverse',
|
|
44
|
+
bottom: 'column',
|
|
45
|
+
left: 'row-reverse',
|
|
46
|
+
right: 'row'
|
|
47
|
+
};
|
|
41
48
|
return /*#__PURE__*/_jsx(Container, {
|
|
42
49
|
overlay: overlay,
|
|
43
50
|
children: /*#__PURE__*/_jsxs(StackView, {
|
|
@@ -45,6 +52,7 @@ const SpinnerContent = _ref2 => {
|
|
|
45
52
|
tokens: {
|
|
46
53
|
alignItems: 'center'
|
|
47
54
|
},
|
|
55
|
+
direction: labelMapping[labelPosition],
|
|
48
56
|
children: [/*#__PURE__*/_jsx(ActivityIndicator, {
|
|
49
57
|
label: label,
|
|
50
58
|
tokens: {
|
package/lib-module/Table/Cell.js
CHANGED
|
@@ -1,93 +1,80 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
|
-
import { Typography, useThemeTokens } from '@telus-uds/components-base';
|
|
4
|
+
import { Typography, useThemeTokens, applyShadowToken } from '@telus-uds/components-base';
|
|
5
5
|
import { useTableContext } from './Table';
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
const
|
|
7
|
+
const HEADER_TYPE = {
|
|
8
|
+
HEADING: 'heading',
|
|
9
|
+
SUBHEADING: 'subHeading',
|
|
10
|
+
ROWHEADING: 'rowHeading'
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const stickyStyles = _ref => {
|
|
8
14
|
let {
|
|
9
|
-
cellStickyShadow
|
|
15
|
+
cellStickyShadow,
|
|
16
|
+
stickyBackgroundColor,
|
|
17
|
+
type
|
|
10
18
|
} = _ref;
|
|
11
|
-
return cellStickyShadow;
|
|
12
|
-
}
|
|
19
|
+
return css(["position:sticky;left:0;z-index:2;clip-path:inset(0 -8px 0 0);", " &::before{content:'';box-shadow:", ";position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;}"], type !== HEADER_TYPE.SUBHEADING && type !== HEADER_TYPE.HEADING ? `background-color: ${stickyBackgroundColor};` : undefined, cellStickyShadow);
|
|
20
|
+
};
|
|
21
|
+
|
|
13
22
|
const sharedStyles = /*#__PURE__*/css(["", ""], _ref2 => {
|
|
14
23
|
let {
|
|
15
24
|
isSticky,
|
|
16
|
-
cellBoxShadowColor,
|
|
17
25
|
align,
|
|
18
26
|
cellPaddingTop,
|
|
19
27
|
cellPaddingRight,
|
|
20
28
|
cellPaddingBottom,
|
|
21
29
|
cellPaddingLeft,
|
|
22
|
-
cellMinWidth
|
|
30
|
+
cellMinWidth,
|
|
31
|
+
cellBackground,
|
|
32
|
+
cellStickyShadow,
|
|
33
|
+
stickyBackgroundColor,
|
|
34
|
+
type
|
|
23
35
|
} = _ref2;
|
|
24
|
-
return css(["
|
|
36
|
+
return css(["text-align:", ";min-width:", "px;padding:", "px ", "px ", "px ", "px;background-color:", ";", ";"], align, cellMinWidth, cellPaddingTop, cellPaddingRight, cellPaddingBottom, cellPaddingLeft, cellBackground, isSticky && stickyStyles({
|
|
37
|
+
type,
|
|
38
|
+
cellStickyShadow,
|
|
39
|
+
stickyBackgroundColor
|
|
40
|
+
}));
|
|
25
41
|
});
|
|
26
|
-
|
|
27
|
-
|
|
42
|
+
|
|
43
|
+
const createStyledCell = htmlElement => styled[htmlElement].withConfig({
|
|
44
|
+
displayName: "Cell__createStyledCell",
|
|
28
45
|
componentId: "components-web__sc-ltgfic-0"
|
|
29
|
-
})(["", ";", ""], sharedStyles, _ref3 => {
|
|
46
|
+
})(["", ";box-shadow:", ";"], sharedStyles, _ref3 => {
|
|
30
47
|
let {
|
|
31
|
-
|
|
32
|
-
|
|
48
|
+
cellBoxShadowColor,
|
|
49
|
+
type
|
|
33
50
|
} = _ref3;
|
|
34
|
-
return `
|
|
35
|
-
background-color: ${cellHeadingBackground};
|
|
36
|
-
box-shadow: inset 0 1px 0 ${cellHeadingBoxShadowColor}, inset 0 -1px 0 ${cellHeadingBoxShadowColor};`;
|
|
37
|
-
});
|
|
38
|
-
const StyledSubHeading = /*#__PURE__*/styled.th.withConfig({
|
|
39
|
-
displayName: "Cell__StyledSubHeading",
|
|
40
|
-
componentId: "components-web__sc-ltgfic-1"
|
|
41
|
-
})(["", ";background-color:", ";"], sharedStyles, _ref4 => {
|
|
42
|
-
let {
|
|
43
|
-
cellSubheadingBackground
|
|
44
|
-
} = _ref4;
|
|
45
|
-
return cellSubheadingBackground;
|
|
46
|
-
});
|
|
47
|
-
const StyledCell = /*#__PURE__*/styled.td.withConfig({
|
|
48
|
-
displayName: "Cell__StyledCell",
|
|
49
|
-
componentId: "components-web__sc-ltgfic-2"
|
|
50
|
-
})(["", ";background-color:", ";"], sharedStyles, _ref5 => {
|
|
51
|
-
let {
|
|
52
|
-
cellBackground
|
|
53
|
-
} = _ref5;
|
|
54
|
-
return cellBackground;
|
|
55
|
-
});
|
|
56
|
-
const StyledRowHeading = /*#__PURE__*/styled.th.withConfig({
|
|
57
|
-
displayName: "Cell__StyledRowHeading",
|
|
58
|
-
componentId: "components-web__sc-ltgfic-3"
|
|
59
|
-
})(["", ";background-color:", ";"], sharedStyles, _ref6 => {
|
|
60
|
-
let {
|
|
61
|
-
cellRowHeadingBackground
|
|
62
|
-
} = _ref6;
|
|
63
|
-
return cellRowHeadingBackground;
|
|
51
|
+
return type === HEADER_TYPE.HEADING ? `inset 0 1px 0 ${cellBoxShadowColor}, inset 0 -1px 0 ${cellBoxShadowColor}` : `inset 0 1px 0 ${cellBoxShadowColor}`;
|
|
64
52
|
});
|
|
65
53
|
|
|
66
|
-
const
|
|
54
|
+
const StyledHeaderCell = createStyledCell('th');
|
|
55
|
+
const StyledDataCell = createStyledCell('td');
|
|
56
|
+
|
|
57
|
+
const Cell = _ref4 => {
|
|
67
58
|
let {
|
|
68
59
|
children,
|
|
69
|
-
type = 'default',
|
|
70
60
|
isFirstInRow,
|
|
71
61
|
align = 'left',
|
|
72
|
-
tokens: cellTokens
|
|
73
|
-
|
|
62
|
+
tokens: cellTokens,
|
|
63
|
+
type
|
|
64
|
+
} = _ref4;
|
|
74
65
|
const {
|
|
75
66
|
text,
|
|
76
67
|
isScrollable: isTableScrollable,
|
|
77
|
-
|
|
78
|
-
|
|
68
|
+
tokens: tableTokens,
|
|
69
|
+
spacing
|
|
79
70
|
} = useTableContext();
|
|
80
71
|
const themeTokens = { ...tableTokens,
|
|
81
72
|
...cellTokens
|
|
82
73
|
};
|
|
83
74
|
const {
|
|
84
75
|
cellMinWidth,
|
|
85
|
-
cellHeadingBackground,
|
|
86
|
-
cellHeadingBoxShadowColor,
|
|
87
76
|
cellBoxShadowColor,
|
|
88
|
-
cellSubheadingBackground,
|
|
89
77
|
cellBackground,
|
|
90
|
-
cellRowHeadingBackground,
|
|
91
78
|
cellStickyShadow,
|
|
92
79
|
cellPaddingTop,
|
|
93
80
|
cellPaddingRight,
|
|
@@ -95,80 +82,72 @@ const Cell = _ref7 => {
|
|
|
95
82
|
cellPaddingBottom,
|
|
96
83
|
fontName,
|
|
97
84
|
fontWeight,
|
|
98
|
-
fontSize
|
|
99
|
-
|
|
85
|
+
fontSize,
|
|
86
|
+
lineHeight,
|
|
87
|
+
stickyBackgroundColor
|
|
88
|
+
} = useThemeTokens('Table', themeTokens, {
|
|
89
|
+
spacing,
|
|
90
|
+
type,
|
|
91
|
+
text
|
|
92
|
+
});
|
|
100
93
|
const sharedProps = {
|
|
101
94
|
align,
|
|
102
95
|
isSticky: isTableScrollable && isFirstInRow,
|
|
96
|
+
cellBackground,
|
|
103
97
|
cellMinWidth,
|
|
104
|
-
cellStickyShadow,
|
|
98
|
+
cellStickyShadow: applyShadowToken(cellStickyShadow).boxShadow,
|
|
105
99
|
cellPaddingTop,
|
|
106
100
|
cellPaddingRight,
|
|
107
101
|
cellPaddingLeft,
|
|
108
102
|
cellPaddingBottom,
|
|
103
|
+
stickyBackgroundColor,
|
|
109
104
|
cellBoxShadowColor
|
|
110
105
|
};
|
|
111
106
|
const typographyTokens = {
|
|
112
107
|
fontName,
|
|
113
108
|
fontWeight,
|
|
114
|
-
fontSize
|
|
109
|
+
fontSize,
|
|
110
|
+
lineHeight
|
|
115
111
|
};
|
|
116
112
|
|
|
117
113
|
switch (type) {
|
|
118
|
-
case
|
|
119
|
-
return /*#__PURE__*/_jsx(
|
|
114
|
+
case HEADER_TYPE.HEADING:
|
|
115
|
+
return /*#__PURE__*/_jsx(StyledHeaderCell, {
|
|
120
116
|
scope: "col",
|
|
121
|
-
cellHeadingBackground: cellHeadingBackground,
|
|
122
|
-
cellHeadingBoxShadowColor: cellHeadingBoxShadowColor,
|
|
123
117
|
...sharedProps,
|
|
118
|
+
type: type,
|
|
124
119
|
children: /*#__PURE__*/_jsx(Typography, {
|
|
125
120
|
tokens: typographyTokens,
|
|
126
|
-
variant: {
|
|
127
|
-
size: 'h4'
|
|
128
|
-
},
|
|
129
121
|
children: children
|
|
130
122
|
})
|
|
131
123
|
});
|
|
132
124
|
|
|
133
|
-
case
|
|
134
|
-
return /*#__PURE__*/_jsx(
|
|
125
|
+
case HEADER_TYPE.SUBHEADING:
|
|
126
|
+
return /*#__PURE__*/_jsx(StyledHeaderCell, {
|
|
135
127
|
scope: "col",
|
|
136
|
-
cellSubheadingBackground: cellSubheadingBackground,
|
|
137
128
|
...sharedProps,
|
|
129
|
+
type: type,
|
|
138
130
|
children: /*#__PURE__*/_jsx(Typography, {
|
|
139
131
|
tokens: typographyTokens,
|
|
140
|
-
variant: {
|
|
141
|
-
size: 'h5'
|
|
142
|
-
},
|
|
143
132
|
children: children
|
|
144
133
|
})
|
|
145
134
|
});
|
|
146
135
|
|
|
147
|
-
case
|
|
148
|
-
return /*#__PURE__*/_jsx(
|
|
136
|
+
case HEADER_TYPE.ROWHEADING:
|
|
137
|
+
return /*#__PURE__*/_jsx(StyledHeaderCell, {
|
|
149
138
|
scope: "row",
|
|
150
|
-
cellRowHeadingBackground: cellRowHeadingBackground,
|
|
151
139
|
...sharedProps,
|
|
140
|
+
type: type,
|
|
152
141
|
children: /*#__PURE__*/_jsx(Typography, {
|
|
153
142
|
tokens: typographyTokens,
|
|
154
|
-
variant: {
|
|
155
|
-
size: text === 'small' ? 'h5' : 'h4'
|
|
156
|
-
},
|
|
157
143
|
children: children
|
|
158
144
|
})
|
|
159
145
|
});
|
|
160
146
|
|
|
161
147
|
default:
|
|
162
|
-
return /*#__PURE__*/_jsx(
|
|
163
|
-
cellBackground: cellBackground,
|
|
164
|
-
...sharedProps,
|
|
148
|
+
return /*#__PURE__*/_jsx(StyledDataCell, { ...sharedProps,
|
|
165
149
|
children: /*#__PURE__*/_jsx(Typography, {
|
|
166
|
-
tokens:
|
|
167
|
-
fontSize
|
|
168
|
-
},
|
|
169
|
-
variant: {
|
|
170
|
-
size: text
|
|
171
|
-
},
|
|
150
|
+
tokens: typographyTokens,
|
|
172
151
|
children: children
|
|
173
152
|
})
|
|
174
153
|
});
|
|
@@ -176,14 +155,10 @@ const Cell = _ref7 => {
|
|
|
176
155
|
};
|
|
177
156
|
|
|
178
157
|
Cell.propTypes = {
|
|
158
|
+
type: PropTypes.oneOf(['default', 'heading', 'subHeading', 'rowHeading']),
|
|
179
159
|
tokens: PropTypes.object,
|
|
180
160
|
children: PropTypes.node,
|
|
181
161
|
|
|
182
|
-
/**
|
|
183
|
-
* Defines the visual styles of a cell, and whether it should be a `td` or `th` element
|
|
184
|
-
*/
|
|
185
|
-
type: PropTypes.oneOf(['default', 'heading', 'subHeading', 'rowHeading']),
|
|
186
|
-
|
|
187
162
|
/**
|
|
188
163
|
* @ignore
|
|
189
164
|
* Used internally for making the first column sticky
|
|
@@ -9,7 +9,10 @@ const Header = _ref => {
|
|
|
9
9
|
} = _ref;
|
|
10
10
|
return /*#__PURE__*/_jsx("thead", {
|
|
11
11
|
children: /*#__PURE__*/_jsx(Row, {
|
|
12
|
-
children: React.Children.map(children, child =>
|
|
12
|
+
children: React.Children.map(children, child =>
|
|
13
|
+
/*#__PURE__*/
|
|
14
|
+
// TO DO: pass type as a variant instead of prop
|
|
15
|
+
cloneElement(child, {
|
|
13
16
|
type: 'heading'
|
|
14
17
|
}))
|
|
15
18
|
})
|
|
@@ -8,7 +8,10 @@ const Header = _ref => {
|
|
|
8
8
|
children
|
|
9
9
|
} = _ref;
|
|
10
10
|
return /*#__PURE__*/_jsx(Row, {
|
|
11
|
-
children: React.Children.map(children, child =>
|
|
11
|
+
children: React.Children.map(children, child =>
|
|
12
|
+
/*#__PURE__*/
|
|
13
|
+
// TO DO: pass type as a variant instead of prop
|
|
14
|
+
cloneElement(child, {
|
|
12
15
|
type: 'subHeading'
|
|
13
16
|
}))
|
|
14
17
|
});
|
|
@@ -39,6 +39,7 @@ export const useTableContext = () => useContext(TableContext);
|
|
|
39
39
|
const Table = _ref2 => {
|
|
40
40
|
let {
|
|
41
41
|
children,
|
|
42
|
+
spacing = 'default',
|
|
42
43
|
fullWidth = true,
|
|
43
44
|
text = 'medium',
|
|
44
45
|
tokens,
|
|
@@ -83,7 +84,7 @@ const Table = _ref2 => {
|
|
|
83
84
|
text,
|
|
84
85
|
isScrollable,
|
|
85
86
|
tokens,
|
|
86
|
-
|
|
87
|
+
spacing
|
|
87
88
|
},
|
|
88
89
|
children: /*#__PURE__*/_jsx(StyledTable, {
|
|
89
90
|
tableWidth: tableWidth,
|