@telus-uds/components-web 2.44.0 → 3.0.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/.eslintrc.cjs +26 -0
- package/CHANGELOG.md +13 -2
- package/babel.config.cjs +4 -0
- package/jest.config.cjs +29 -0
- package/lib/Badge/Badge.js +21 -29
- package/lib/Badge/index.js +2 -10
- package/lib/BlockQuote/BlockQuote.js +31 -39
- package/lib/BlockQuote/index.js +2 -10
- package/lib/Breadcrumbs/Breadcrumbs.js +39 -49
- package/lib/Breadcrumbs/Item/Item.js +26 -34
- package/lib/Breadcrumbs/index.js +1 -13
- package/lib/Callout/Callout.js +19 -27
- package/lib/Callout/index.js +2 -10
- package/lib/Card/Card.js +44 -54
- package/lib/Card/CardContent.js +17 -25
- package/lib/Card/CardFooter.js +16 -24
- package/lib/Card/index.js +2 -10
- package/lib/Countdown/Countdown.js +34 -42
- package/lib/Countdown/Segment.js +26 -34
- package/lib/Countdown/constants.js +4 -14
- package/lib/Countdown/dictionary.js +2 -9
- package/lib/Countdown/index.js +2 -10
- package/lib/Countdown/types.js +18 -28
- package/lib/Countdown/useCountdown.js +4 -11
- package/lib/DatePicker/CalendarContainer.js +6 -12
- package/lib/DatePicker/DatePicker.js +94 -103
- package/lib/DatePicker/dictionary.js +1 -8
- package/lib/DatePicker/index.js +2 -10
- package/lib/DatePicker/reactDatesCss.js +3 -10
- package/lib/Disclaimer/Disclaimer.js +15 -23
- package/lib/Disclaimer/index.js +1 -13
- package/lib/ExpandCollapseMini/ExpandCollapseMini.js +16 -24
- package/lib/ExpandCollapseMini/ExpandCollapseMiniControl.js +17 -26
- package/lib/ExpandCollapseMini/index.js +2 -10
- package/lib/Footnote/Footnote.js +85 -95
- package/lib/Footnote/FootnoteLink.js +25 -33
- package/lib/Footnote/dictionary.js +2 -9
- package/lib/Footnote/index.js +4 -12
- package/lib/IconButton/IconButton.js +12 -20
- package/lib/IconButton/index.js +2 -10
- package/lib/Image/Image.js +17 -25
- package/lib/Image/index.js +6 -18
- package/lib/Image/server.js +4 -12
- package/lib/List/List.js +2 -9
- package/lib/List/ListItem.js +10 -18
- package/lib/List/index.js +4 -12
- package/lib/NavigationBar/NavigationBar.js +51 -59
- package/lib/NavigationBar/NavigationItem.js +19 -27
- package/lib/NavigationBar/NavigationSubMenu.js +34 -40
- package/lib/NavigationBar/collapseItems.js +1 -11
- package/lib/NavigationBar/index.js +4 -12
- package/lib/NavigationBar/resolveItemSelection.js +1 -8
- package/lib/OptimizeImage/OptimizeImage.js +26 -34
- package/lib/OptimizeImage/index.js +2 -10
- package/lib/OptimizeImage/utils/getFallbackUrl.js +3 -10
- package/lib/OptimizeImage/utils/getImageUrls.js +9 -16
- package/lib/OptimizeImage/utils/getOptimizedUrl.js +3 -10
- package/lib/OptimizeImage/utils/hasWebpSupport.js +1 -7
- package/lib/OptimizeImage/utils/index.js +5 -34
- package/lib/OptimizeImage/utils/isSvgUrl.js +1 -7
- package/lib/OrderedList/Item.js +28 -36
- package/lib/OrderedList/ItemBase.js +8 -16
- package/lib/OrderedList/OrderedList.js +22 -30
- package/lib/OrderedList/OrderedListBase.js +12 -20
- package/lib/OrderedList/constants.js +1 -8
- package/lib/OrderedList/index.js +4 -12
- package/lib/Paragraph/Paragraph.js +22 -30
- package/lib/Paragraph/index.js +2 -10
- package/lib/PreviewCard/AuthorDate.js +17 -21
- package/lib/PreviewCard/PreviewCard.js +40 -49
- package/lib/PreviewCard/index.js +2 -10
- package/lib/PriceLockup/PriceLockup.js +56 -64
- package/lib/PriceLockup/index.js +2 -10
- package/lib/PriceLockup/tokens.js +2 -9
- package/lib/Progress/ProgressBar.js +17 -24
- package/lib/Progress/index.js +4 -12
- package/lib/QuantitySelector/QuantitySelector.js +55 -63
- package/lib/QuantitySelector/SideButton.js +15 -23
- package/lib/QuantitySelector/dictionary.js +2 -9
- package/lib/QuantitySelector/index.js +2 -10
- package/lib/QuantitySelector/styles.js +4 -13
- package/lib/ResponsiveImage/ResponsiveImage.js +29 -37
- package/lib/ResponsiveImage/index.js +2 -10
- package/lib/Ribbon/Ribbon.js +22 -30
- package/lib/Ribbon/index.js +2 -10
- package/lib/SkeletonProvider/SkeletonImage.js +14 -22
- package/lib/SkeletonProvider/SkeletonProvider.js +17 -25
- package/lib/SkeletonProvider/SkeletonTypography.js +14 -22
- package/lib/SkeletonProvider/index.js +2 -10
- package/lib/Span/Span.js +23 -31
- package/lib/Span/index.js +2 -10
- package/lib/Spinner/Spinner.js +43 -51
- package/lib/Spinner/SpinnerContent.js +21 -29
- package/lib/Spinner/constants.js +4 -14
- package/lib/Spinner/index.js +2 -10
- package/lib/StoryCard/StoryCard.js +40 -49
- package/lib/StoryCard/index.js +2 -10
- package/lib/Table/Body.js +7 -15
- package/lib/Table/Cell.js +28 -38
- package/lib/Table/Header.js +11 -19
- package/lib/Table/Row.js +8 -16
- package/lib/Table/SubHeading.js +10 -18
- package/lib/Table/Table.js +26 -35
- package/lib/Table/index.js +12 -20
- package/lib/TermsAndConditions/ExpandCollapse.js +22 -30
- package/lib/TermsAndConditions/TermsAndConditions.js +52 -60
- package/lib/TermsAndConditions/dictionary.js +2 -9
- package/lib/TermsAndConditions/index.js +1 -13
- package/lib/Testimonial/Testimonial.js +37 -45
- package/lib/Testimonial/index.js +2 -10
- package/lib/Toast/Toast.js +32 -42
- package/lib/Toast/index.js +2 -10
- package/lib/Video/ControlBar/ControlBar.js +73 -81
- package/lib/Video/ControlBar/Controls/VideoButton/VideoButton.js +16 -24
- package/lib/Video/ControlBar/Controls/VideoMenu/VideoMenu.js +27 -35
- package/lib/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +27 -36
- package/lib/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.js +30 -38
- package/lib/Video/MiddleControlButton/MiddleControlButton.js +16 -24
- package/lib/Video/Video.js +74 -83
- package/lib/Video/index.js +2 -10
- package/lib/Video/videoText.js +1 -8
- package/lib/VideoPicker/VideoPicker.js +43 -53
- package/lib/VideoPicker/VideoPickerPlayer.js +17 -25
- package/lib/VideoPicker/VideoPickerThumbnail.js +38 -46
- package/lib/VideoPicker/VideoSlider.js +17 -26
- package/lib/VideoPicker/index.js +2 -10
- package/lib/VideoPicker/videoPropType.js +9 -18
- package/lib/WaffleGrid/WaffleGrid.js +33 -43
- package/lib/WaffleGrid/index.js +2 -10
- package/lib/WebVideo/WebVideo.js +42 -52
- package/lib/WebVideo/index.js +2 -10
- package/lib/WebVideo/utils/index.js +3 -11
- package/lib/baseExports.js +18 -431
- package/lib/index.js +38 -323
- package/lib/server.js +4 -12
- package/lib/shared/ConditionalWrapper/ConditionalWrapper.js +9 -17
- package/lib/shared/ConditionalWrapper/index.js +2 -10
- package/lib/shared/FullBleedContent/FullBleedContent.js +21 -29
- package/lib/shared/FullBleedContent/getFullBleedBorderRadius.js +1 -8
- package/lib/shared/FullBleedContent/index.js +4 -24
- package/lib/shared/FullBleedContent/useFullBleedContentProps.js +4 -11
- package/lib/shared/VideoSplash/SplashButton/SplashButton.js +19 -27
- package/lib/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +27 -35
- package/lib/shared/VideoSplash/VideoSplash.js +24 -32
- package/lib/shared/VideoSplash/helpers.js +5 -14
- package/lib/utils/index.js +10 -75
- package/lib/utils/isElementFocusable.js +1 -8
- package/lib/utils/logger.js +6 -15
- package/lib/utils/media.js +5 -11
- package/lib/utils/renderStructuredContent.js +8 -15
- package/lib/utils/ssr.js +5 -12
- package/lib/utils/theming/get-theme-from-server.js +2 -10
- package/lib/utils/theming/with-client-theme.js +9 -17
- package/lib/utils/theming/with-server-theme.js +11 -19
- package/lib/utils/transforms.js +3 -11
- package/lib/utils/useOverlaidPosition.js +15 -23
- package/lib/utils/useTypographyTheme.js +6 -13
- package/package.json +18 -20
- package/src/Card/Card.jsx +2 -2
- package/src/DatePicker/DatePicker.jsx +1 -2
- package/src/PreviewCard/AuthorDate.jsx +5 -3
- package/src/utils/logger.js +2 -2
- package/lib-module/Badge/Badge.js +0 -121
- package/lib-module/Badge/index.js +0 -2
- package/lib-module/BlockQuote/BlockQuote.js +0 -204
- package/lib-module/BlockQuote/index.js +0 -2
- package/lib-module/Breadcrumbs/Breadcrumbs.js +0 -250
- package/lib-module/Breadcrumbs/Item/Item.js +0 -175
- package/lib-module/Breadcrumbs/index.js +0 -1
- package/lib-module/Callout/Callout.js +0 -135
- package/lib-module/Callout/index.js +0 -2
- package/lib-module/Card/Card.js +0 -251
- package/lib-module/Card/CardContent.js +0 -90
- package/lib-module/Card/CardFooter.js +0 -78
- package/lib-module/Card/index.js +0 -2
- package/lib-module/Countdown/Countdown.js +0 -169
- package/lib-module/Countdown/Segment.js +0 -96
- package/lib-module/Countdown/constants.js +0 -4
- package/lib-module/Countdown/dictionary.js +0 -22
- package/lib-module/Countdown/index.js +0 -2
- package/lib-module/Countdown/types.js +0 -24
- package/lib-module/Countdown/useCountdown.js +0 -26
- package/lib-module/DatePicker/CalendarContainer.js +0 -208
- package/lib-module/DatePicker/DatePicker.js +0 -519
- package/lib-module/DatePicker/dictionary.js +0 -119
- package/lib-module/DatePicker/index.js +0 -2
- package/lib-module/DatePicker/reactDatesCss.js +0 -3
- package/lib-module/Disclaimer/Disclaimer.js +0 -54
- package/lib-module/Disclaimer/index.js +0 -1
- package/lib-module/ExpandCollapseMini/ExpandCollapseMini.js +0 -73
- package/lib-module/ExpandCollapseMini/ExpandCollapseMiniControl.js +0 -117
- package/lib-module/ExpandCollapseMini/index.js +0 -2
- package/lib-module/Footnote/Footnote.js +0 -632
- package/lib-module/Footnote/FootnoteLink.js +0 -118
- package/lib-module/Footnote/dictionary.js +0 -12
- package/lib-module/Footnote/index.js +0 -4
- package/lib-module/IconButton/IconButton.js +0 -55
- package/lib-module/IconButton/index.js +0 -2
- package/lib-module/Image/Image.js +0 -83
- package/lib-module/Image/index.js +0 -9
- package/lib-module/Image/server.js +0 -4
- package/lib-module/List/List.js +0 -2
- package/lib-module/List/ListItem.js +0 -28
- package/lib-module/List/index.js +0 -4
- package/lib-module/NavigationBar/NavigationBar.js +0 -224
- package/lib-module/NavigationBar/NavigationItem.js +0 -87
- package/lib-module/NavigationBar/NavigationSubMenu.js +0 -162
- package/lib-module/NavigationBar/collapseItems.js +0 -41
- package/lib-module/NavigationBar/index.js +0 -4
- package/lib-module/NavigationBar/resolveItemSelection.js +0 -16
- package/lib-module/OptimizeImage/OptimizeImage.js +0 -92
- package/lib-module/OptimizeImage/index.js +0 -2
- package/lib-module/OptimizeImage/utils/getFallbackUrl.js +0 -7
- package/lib-module/OptimizeImage/utils/getImageUrls.js +0 -12
- package/lib-module/OptimizeImage/utils/getOptimizedUrl.js +0 -17
- package/lib-module/OptimizeImage/utils/hasWebpSupport.js +0 -28
- package/lib-module/OptimizeImage/utils/index.js +0 -5
- package/lib-module/OptimizeImage/utils/isSvgUrl.js +0 -3
- package/lib-module/OrderedList/Item.js +0 -145
- package/lib-module/OrderedList/ItemBase.js +0 -27
- package/lib-module/OrderedList/OrderedList.js +0 -86
- package/lib-module/OrderedList/OrderedListBase.js +0 -45
- package/lib-module/OrderedList/constants.js +0 -2
- package/lib-module/OrderedList/index.js +0 -4
- package/lib-module/Paragraph/Paragraph.js +0 -90
- package/lib-module/Paragraph/index.js +0 -2
- package/lib-module/PreviewCard/AuthorDate.js +0 -57
- package/lib-module/PreviewCard/PreviewCard.js +0 -209
- package/lib-module/PreviewCard/index.js +0 -2
- package/lib-module/PriceLockup/PriceLockup.js +0 -335
- package/lib-module/PriceLockup/index.js +0 -2
- package/lib-module/PriceLockup/tokens.js +0 -55
- package/lib-module/Progress/ProgressBar.js +0 -83
- package/lib-module/Progress/index.js +0 -4
- package/lib-module/QuantitySelector/QuantitySelector.js +0 -261
- package/lib-module/QuantitySelector/SideButton.js +0 -70
- package/lib-module/QuantitySelector/dictionary.js +0 -26
- package/lib-module/QuantitySelector/index.js +0 -2
- package/lib-module/QuantitySelector/styles.js +0 -9
- package/lib-module/ResponsiveImage/ResponsiveImage.js +0 -95
- package/lib-module/ResponsiveImage/index.js +0 -2
- package/lib-module/Ribbon/Ribbon.js +0 -216
- package/lib-module/Ribbon/index.js +0 -2
- package/lib-module/SkeletonProvider/SkeletonImage.js +0 -39
- package/lib-module/SkeletonProvider/SkeletonProvider.js +0 -57
- package/lib-module/SkeletonProvider/SkeletonTypography.js +0 -38
- package/lib-module/SkeletonProvider/index.js +0 -2
- package/lib-module/Span/Span.js +0 -72
- package/lib-module/Span/index.js +0 -2
- package/lib-module/Spinner/Spinner.js +0 -215
- package/lib-module/Spinner/SpinnerContent.js +0 -94
- package/lib-module/Spinner/constants.js +0 -4
- package/lib-module/Spinner/index.js +0 -2
- package/lib-module/StoryCard/StoryCard.js +0 -212
- package/lib-module/StoryCard/index.js +0 -2
- package/lib-module/Table/Body.js +0 -17
- package/lib-module/Table/Cell.js +0 -176
- package/lib-module/Table/Header.js +0 -25
- package/lib-module/Table/Row.js +0 -19
- package/lib-module/Table/SubHeading.js +0 -23
- package/lib-module/Table/Table.js +0 -114
- package/lib-module/Table/index.js +0 -12
- package/lib-module/TermsAndConditions/ExpandCollapse.js +0 -153
- package/lib-module/TermsAndConditions/TermsAndConditions.js +0 -277
- package/lib-module/TermsAndConditions/dictionary.js +0 -16
- package/lib-module/TermsAndConditions/index.js +0 -1
- package/lib-module/Testimonial/Testimonial.js +0 -234
- package/lib-module/Testimonial/index.js +0 -2
- package/lib-module/Toast/Toast.js +0 -158
- package/lib-module/Toast/index.js +0 -2
- package/lib-module/Video/ControlBar/ControlBar.js +0 -288
- package/lib-module/Video/ControlBar/Controls/VideoButton/VideoButton.js +0 -70
- package/lib-module/Video/ControlBar/Controls/VideoMenu/VideoMenu.js +0 -163
- package/lib-module/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +0 -203
- package/lib-module/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.js +0 -191
- package/lib-module/Video/MiddleControlButton/MiddleControlButton.js +0 -71
- package/lib-module/Video/Video.js +0 -959
- package/lib-module/Video/index.js +0 -2
- package/lib-module/Video/videoText.js +0 -55
- package/lib-module/VideoPicker/VideoPicker.js +0 -190
- package/lib-module/VideoPicker/VideoPickerPlayer.js +0 -48
- package/lib-module/VideoPicker/VideoPickerThumbnail.js +0 -218
- package/lib-module/VideoPicker/VideoSlider.js +0 -82
- package/lib-module/VideoPicker/index.js +0 -2
- package/lib-module/VideoPicker/videoPropType.js +0 -10
- package/lib-module/WaffleGrid/WaffleGrid.js +0 -157
- package/lib-module/WaffleGrid/index.js +0 -2
- package/lib-module/WebVideo/WebVideo.js +0 -191
- package/lib-module/WebVideo/index.js +0 -2
- package/lib-module/WebVideo/utils/index.js +0 -50
- package/lib-module/baseExports.js +0 -19
- package/lib-module/index.js +0 -40
- package/lib-module/server.js +0 -5
- package/lib-module/shared/ConditionalWrapper/ConditionalWrapper.js +0 -22
- package/lib-module/shared/ConditionalWrapper/index.js +0 -2
- package/lib-module/shared/FullBleedContent/FullBleedContent.js +0 -101
- package/lib-module/shared/FullBleedContent/getFullBleedBorderRadius.js +0 -55
- package/lib-module/shared/FullBleedContent/index.js +0 -4
- package/lib-module/shared/FullBleedContent/useFullBleedContentProps.js +0 -55
- package/lib-module/shared/VideoSplash/SplashButton/SplashButton.js +0 -84
- package/lib-module/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +0 -223
- package/lib-module/shared/VideoSplash/VideoSplash.js +0 -65
- package/lib-module/shared/VideoSplash/helpers.js +0 -23
- package/lib-module/utils/index.js +0 -10
- package/lib-module/utils/isElementFocusable.js +0 -8
- package/lib-module/utils/logger.js +0 -18
- package/lib-module/utils/media.js +0 -39
- package/lib-module/utils/renderStructuredContent.js +0 -66
- package/lib-module/utils/ssr.js +0 -37
- package/lib-module/utils/theming/get-theme-from-server.js +0 -16
- package/lib-module/utils/theming/with-client-theme.js +0 -24
- package/lib-module/utils/theming/with-server-theme.js +0 -26
- package/lib-module/utils/transforms.js +0 -4
- package/lib-module/utils/useOverlaidPosition.js +0 -216
- package/lib-module/utils/useTypographyTheme.js +0 -24
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Box, Divider, PressableCardBase, selectSystemProps, Spacer, StackView, StackWrap, Typography, hrefAttrsProp, a11yProps, focusHandlerProps, viewProps, withLinkRouter, useThemeTokens, useThemeTokensCallback, getTokensPropType } from '@telus-uds/components-base';
|
|
4
|
-
import styled from 'styled-components';
|
|
5
|
-
import FullBleedContent, { getFullBleedBorderRadius, useFullBleedContentProps } from '../shared/FullBleedContent';
|
|
6
|
-
|
|
7
|
-
// Passes React Native-oriented system props through UDS PressableCardBase
|
|
8
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
-
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, focusHandlerProps, viewProps]);
|
|
11
|
-
|
|
12
|
-
// Stop changes to the card's inner border width causing the size and
|
|
13
|
-
// apparent position of the full bleed image to change.
|
|
14
|
-
const FullBleedOffsetOuter = /*#__PURE__*/styled.div.withConfig({
|
|
15
|
-
displayName: "StoryCard__FullBleedOffsetOuter",
|
|
16
|
-
componentId: "components-web__sc-yhvivu-0"
|
|
17
|
-
})(_ref => {
|
|
18
|
-
let {
|
|
19
|
-
borderOffset
|
|
20
|
-
} = _ref;
|
|
21
|
-
return {
|
|
22
|
-
overflow: 'hidden',
|
|
23
|
-
marginTop: borderOffset * 2
|
|
24
|
-
};
|
|
25
|
-
});
|
|
26
|
-
const FullBleedOffsetInner = /*#__PURE__*/styled.div.withConfig({
|
|
27
|
-
displayName: "StoryCard__FullBleedOffsetInner",
|
|
28
|
-
componentId: "components-web__sc-yhvivu-1"
|
|
29
|
-
})(_ref2 => {
|
|
30
|
-
let {
|
|
31
|
-
borderOffset
|
|
32
|
-
} = _ref2;
|
|
33
|
-
return {
|
|
34
|
-
position: 'relative',
|
|
35
|
-
margin: 0 - borderOffset
|
|
36
|
-
};
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Showcase and guide users to another page, offering a description of that page's story.
|
|
41
|
-
* Whole card is interactive, width expands based on column or container.
|
|
42
|
-
*
|
|
43
|
-
* - Use `tag` to show category of content
|
|
44
|
-
* - Use `date` to show when the story was published
|
|
45
|
-
* - Use `title` to show title of the story
|
|
46
|
-
* - Use `description` to show description of the story
|
|
47
|
-
* - Use `href` to set the target URL
|
|
48
|
-
* - Use `fullBleedContent` to set the thumbnail image
|
|
49
|
-
*/
|
|
50
|
-
const StoryCard = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
51
|
-
let {
|
|
52
|
-
tag,
|
|
53
|
-
date,
|
|
54
|
-
title,
|
|
55
|
-
description,
|
|
56
|
-
fullBleedImage,
|
|
57
|
-
fullBleedContent = fullBleedImage,
|
|
58
|
-
onPress,
|
|
59
|
-
href,
|
|
60
|
-
tokens,
|
|
61
|
-
variant = {},
|
|
62
|
-
...rest
|
|
63
|
-
} = _ref3;
|
|
64
|
-
const {
|
|
65
|
-
fullBleedContentPosition,
|
|
66
|
-
contentStackDirection,
|
|
67
|
-
fullBleedContentProps
|
|
68
|
-
} = useFullBleedContentProps({
|
|
69
|
-
...fullBleedContent,
|
|
70
|
-
position: 'bottom'
|
|
71
|
-
});
|
|
72
|
-
const generalTokens = useThemeTokens('StoryCard', tokens, variant);
|
|
73
|
-
const getTokens = useThemeTokensCallback('StoryCard', tokens, variant);
|
|
74
|
-
const getPressableCardTokens = cardState => getTokens(cardState);
|
|
75
|
-
const {
|
|
76
|
-
hrefAttrs,
|
|
77
|
-
rest: unusedRest
|
|
78
|
-
} = hrefAttrsProp.bundle(rest);
|
|
79
|
-
return /*#__PURE__*/_jsx(PressableCardBase, {
|
|
80
|
-
ref: ref,
|
|
81
|
-
onPress: onPress,
|
|
82
|
-
href: href,
|
|
83
|
-
hrefAttrs: hrefAttrs,
|
|
84
|
-
tokens: getPressableCardTokens,
|
|
85
|
-
...selectProps(unusedRest),
|
|
86
|
-
children: cardState => {
|
|
87
|
-
const {
|
|
88
|
-
borderRadius,
|
|
89
|
-
borderWidth
|
|
90
|
-
} = getPressableCardTokens(cardState);
|
|
91
|
-
|
|
92
|
-
// Stop content jumping around as border size changes
|
|
93
|
-
const borderOffset = borderWidth - generalTokens.borderWidth;
|
|
94
|
-
const fullBleedBorderRadius = getFullBleedBorderRadius(borderRadius + borderOffset, fullBleedContentPosition);
|
|
95
|
-
return /*#__PURE__*/_jsxs(StackView, {
|
|
96
|
-
direction: contentStackDirection,
|
|
97
|
-
tokens: {
|
|
98
|
-
justifyContent: 'space-between',
|
|
99
|
-
flexGrow: 1
|
|
100
|
-
},
|
|
101
|
-
children: [/*#__PURE__*/_jsxs(Box, {
|
|
102
|
-
horizontal: {
|
|
103
|
-
xs: 4,
|
|
104
|
-
lg: 5,
|
|
105
|
-
options: {
|
|
106
|
-
subtract: borderOffset
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
vertical: {
|
|
110
|
-
xs: 5,
|
|
111
|
-
lg: 7,
|
|
112
|
-
options: {
|
|
113
|
-
subtract: borderOffset
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
children: [/*#__PURE__*/_jsxs(StackWrap, {
|
|
117
|
-
space: 1,
|
|
118
|
-
tokens: {
|
|
119
|
-
justifyContent: 'space-between',
|
|
120
|
-
alignItems: 'baseline'
|
|
121
|
-
},
|
|
122
|
-
children: [Boolean(tag) && /*#__PURE__*/_jsx(Typography, {
|
|
123
|
-
variant: {
|
|
124
|
-
size: 'eyebrow'
|
|
125
|
-
},
|
|
126
|
-
children: tag
|
|
127
|
-
}), Boolean(date) &&
|
|
128
|
-
/*#__PURE__*/
|
|
129
|
-
// TODO: get user locale and apply date formatting: "MMM DD, YYYY" for `en` and "YYYY-MM-DD" for `fr`
|
|
130
|
-
// Get locale based on decision of https://github.com/telus/universal-design-system/issues/715
|
|
131
|
-
_jsx(Typography, {
|
|
132
|
-
variant: {
|
|
133
|
-
size: 'small'
|
|
134
|
-
},
|
|
135
|
-
children: date
|
|
136
|
-
})]
|
|
137
|
-
}), /*#__PURE__*/_jsx(Spacer, {
|
|
138
|
-
space: 2
|
|
139
|
-
}), /*#__PURE__*/_jsx(Divider, {
|
|
140
|
-
variant: {
|
|
141
|
-
decorative: true
|
|
142
|
-
}
|
|
143
|
-
}), /*#__PURE__*/_jsx(Spacer, {
|
|
144
|
-
space: 3
|
|
145
|
-
}), /*#__PURE__*/_jsx(Typography, {
|
|
146
|
-
variant: {
|
|
147
|
-
size: 'h3'
|
|
148
|
-
},
|
|
149
|
-
children: title
|
|
150
|
-
}), /*#__PURE__*/_jsx(Spacer, {
|
|
151
|
-
space: 2
|
|
152
|
-
}), /*#__PURE__*/_jsx(Typography, {
|
|
153
|
-
children: description
|
|
154
|
-
})]
|
|
155
|
-
}), Boolean(fullBleedContentProps.src || fullBleedContentProps.content) && /*#__PURE__*/_jsx(FullBleedOffsetOuter, {
|
|
156
|
-
borderOffset: borderOffset,
|
|
157
|
-
children: /*#__PURE__*/_jsx(FullBleedOffsetInner, {
|
|
158
|
-
borderOffset: borderOffset,
|
|
159
|
-
children: /*#__PURE__*/_jsx(FullBleedContent, {
|
|
160
|
-
borderRadius: fullBleedBorderRadius,
|
|
161
|
-
...fullBleedContentProps
|
|
162
|
-
})
|
|
163
|
-
})
|
|
164
|
-
})]
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
StoryCard.displayName = 'StoryCard';
|
|
170
|
-
StoryCard.propTypes = {
|
|
171
|
-
...selectedSystemPropTypes,
|
|
172
|
-
tokens: getTokensPropType('StoryCard'),
|
|
173
|
-
/**
|
|
174
|
-
* The URL of the story to be navigated to. Note that `Video` component does not play well when used within
|
|
175
|
-
* a `StoryCard` with `href` prop set (the volume and progress sliders can be clicked but are not draggable).
|
|
176
|
-
* Please use `onPress` prop instead `href` to organize navigation in cases like this.
|
|
177
|
-
*
|
|
178
|
-
* @see https://github.com/telus/allium-design-system/issues/6
|
|
179
|
-
*/
|
|
180
|
-
href: PropTypes.string,
|
|
181
|
-
/**
|
|
182
|
-
* Optional function to be called on press e.g. for within-page navigation.
|
|
183
|
-
*/
|
|
184
|
-
onPress: PropTypes.func,
|
|
185
|
-
/**
|
|
186
|
-
* Text stating the category of the content.
|
|
187
|
-
*/
|
|
188
|
-
tag: PropTypes.string,
|
|
189
|
-
/**
|
|
190
|
-
* Text stating the date a story was published.
|
|
191
|
-
*/
|
|
192
|
-
date: PropTypes.string.isRequired,
|
|
193
|
-
/**
|
|
194
|
-
* Text stating the title or headline of the story.
|
|
195
|
-
*/
|
|
196
|
-
title: PropTypes.string.isRequired,
|
|
197
|
-
/**
|
|
198
|
-
* Text giving a short description of the story. One paragraph of plain text.
|
|
199
|
-
*/
|
|
200
|
-
description: PropTypes.string.isRequired,
|
|
201
|
-
/**
|
|
202
|
-
* Full bleed image to be placed on the card, deprecated in favor of `fullBleedContent`.
|
|
203
|
-
*
|
|
204
|
-
* @deprecated
|
|
205
|
-
*/
|
|
206
|
-
fullBleedImage: PropTypes.exact(FullBleedContent.propTypes || {}),
|
|
207
|
-
/**
|
|
208
|
-
* Full bleed image to be placed on the card.
|
|
209
|
-
*/
|
|
210
|
-
fullBleedContent: PropTypes.exact(FullBleedContent.propTypes || {})
|
|
211
|
-
};
|
|
212
|
-
export default withLinkRouter(StoryCard);
|
package/lib-module/Table/Body.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
-
const Body = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
5
|
-
let {
|
|
6
|
-
children
|
|
7
|
-
} = _ref;
|
|
8
|
-
return /*#__PURE__*/_jsx("tbody", {
|
|
9
|
-
ref: ref,
|
|
10
|
-
children: children
|
|
11
|
-
});
|
|
12
|
-
});
|
|
13
|
-
Body.displayName = 'Body';
|
|
14
|
-
Body.propTypes = {
|
|
15
|
-
children: PropTypes.node
|
|
16
|
-
};
|
|
17
|
-
export default Body;
|
package/lib-module/Table/Cell.js
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import styled, { css } from 'styled-components';
|
|
4
|
-
import { Typography, useThemeTokens, applyShadowToken } from '@telus-uds/components-base';
|
|
5
|
-
import { useTableContext } from './Table';
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
const HEADER_TYPE = {
|
|
8
|
-
HEADING: 'heading',
|
|
9
|
-
SUBHEADING: 'subHeading',
|
|
10
|
-
ROWHEADING: 'rowHeading'
|
|
11
|
-
};
|
|
12
|
-
const stickyStyles = _ref => {
|
|
13
|
-
let {
|
|
14
|
-
cellStickyShadow,
|
|
15
|
-
stickyBackgroundColor,
|
|
16
|
-
type
|
|
17
|
-
} = _ref;
|
|
18
|
-
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);
|
|
19
|
-
};
|
|
20
|
-
const sharedStyles = /*#__PURE__*/css(["", ""], _ref2 => {
|
|
21
|
-
let {
|
|
22
|
-
isSticky,
|
|
23
|
-
align,
|
|
24
|
-
cellPaddingTop,
|
|
25
|
-
cellPaddingRight,
|
|
26
|
-
cellPaddingBottom,
|
|
27
|
-
cellPaddingLeft,
|
|
28
|
-
cellMinWidth,
|
|
29
|
-
cellBackground,
|
|
30
|
-
cellStickyShadow,
|
|
31
|
-
stickyBackgroundColor,
|
|
32
|
-
type
|
|
33
|
-
} = _ref2;
|
|
34
|
-
return css(["text-align:", ";min-width:", "px;padding:", "px ", "px ", "px ", "px;background-color:", ";", ";"], align, cellMinWidth, cellPaddingTop, cellPaddingRight, cellPaddingBottom, cellPaddingLeft, cellBackground, isSticky && stickyStyles({
|
|
35
|
-
type,
|
|
36
|
-
cellStickyShadow,
|
|
37
|
-
stickyBackgroundColor
|
|
38
|
-
}));
|
|
39
|
-
});
|
|
40
|
-
const createStyledCell = htmlElement => styled[htmlElement].withConfig({
|
|
41
|
-
displayName: "Cell__createStyledCell",
|
|
42
|
-
componentId: "components-web__sc-ltgfic-0"
|
|
43
|
-
})(["", ";box-shadow:", ";", ""], sharedStyles, _ref3 => {
|
|
44
|
-
let {
|
|
45
|
-
cellBoxShadowColor,
|
|
46
|
-
type
|
|
47
|
-
} = _ref3;
|
|
48
|
-
return type === HEADER_TYPE.HEADING ? `inset 0 1px 0 ${cellBoxShadowColor}, inset 0 -1px 0 ${cellBoxShadowColor}` : `inset 0 1px 0 ${cellBoxShadowColor}`;
|
|
49
|
-
}, _ref4 => {
|
|
50
|
-
let {
|
|
51
|
-
display
|
|
52
|
-
} = _ref4;
|
|
53
|
-
return display && `*:not(:empty) {
|
|
54
|
-
display: ${display};
|
|
55
|
-
}`;
|
|
56
|
-
});
|
|
57
|
-
const StyledHeaderCell = createStyledCell('th');
|
|
58
|
-
const StyledDataCell = createStyledCell('td');
|
|
59
|
-
const Cell = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
|
|
60
|
-
let {
|
|
61
|
-
children,
|
|
62
|
-
isFirstInRow,
|
|
63
|
-
align = 'left',
|
|
64
|
-
tokens: cellTokens,
|
|
65
|
-
type = 'default'
|
|
66
|
-
} = _ref5;
|
|
67
|
-
const {
|
|
68
|
-
text,
|
|
69
|
-
isScrollable: isTableScrollable,
|
|
70
|
-
tokens: tableTokens,
|
|
71
|
-
spacing
|
|
72
|
-
} = useTableContext();
|
|
73
|
-
const themeTokens = {
|
|
74
|
-
...tableTokens,
|
|
75
|
-
...cellTokens
|
|
76
|
-
};
|
|
77
|
-
const {
|
|
78
|
-
cellMinWidth,
|
|
79
|
-
cellBoxShadowColor,
|
|
80
|
-
cellBackground,
|
|
81
|
-
cellStickyShadow,
|
|
82
|
-
cellPaddingTop,
|
|
83
|
-
cellPaddingRight,
|
|
84
|
-
cellPaddingLeft,
|
|
85
|
-
cellPaddingBottom,
|
|
86
|
-
fontName,
|
|
87
|
-
fontWeight,
|
|
88
|
-
fontSize,
|
|
89
|
-
lineHeight,
|
|
90
|
-
stickyBackgroundColor,
|
|
91
|
-
fontColor,
|
|
92
|
-
display
|
|
93
|
-
} = useThemeTokens('Table', themeTokens, {
|
|
94
|
-
spacing,
|
|
95
|
-
type,
|
|
96
|
-
text
|
|
97
|
-
});
|
|
98
|
-
const sharedProps = {
|
|
99
|
-
align,
|
|
100
|
-
isSticky: isTableScrollable && isFirstInRow,
|
|
101
|
-
cellBackground,
|
|
102
|
-
cellMinWidth,
|
|
103
|
-
cellStickyShadow: applyShadowToken(cellStickyShadow).boxShadow,
|
|
104
|
-
cellPaddingTop,
|
|
105
|
-
cellPaddingRight,
|
|
106
|
-
cellPaddingLeft,
|
|
107
|
-
cellPaddingBottom,
|
|
108
|
-
stickyBackgroundColor,
|
|
109
|
-
cellBoxShadowColor,
|
|
110
|
-
display,
|
|
111
|
-
ref
|
|
112
|
-
};
|
|
113
|
-
const typographyTokens = {
|
|
114
|
-
fontName,
|
|
115
|
-
fontWeight,
|
|
116
|
-
fontSize,
|
|
117
|
-
lineHeight,
|
|
118
|
-
color: fontColor
|
|
119
|
-
};
|
|
120
|
-
switch (type) {
|
|
121
|
-
case HEADER_TYPE.HEADING:
|
|
122
|
-
return /*#__PURE__*/_jsx(StyledHeaderCell, {
|
|
123
|
-
scope: "col",
|
|
124
|
-
...sharedProps,
|
|
125
|
-
type: type,
|
|
126
|
-
children: /*#__PURE__*/_jsx(Typography, {
|
|
127
|
-
tokens: typographyTokens,
|
|
128
|
-
children: children
|
|
129
|
-
})
|
|
130
|
-
});
|
|
131
|
-
case HEADER_TYPE.SUBHEADING:
|
|
132
|
-
return /*#__PURE__*/_jsx(StyledHeaderCell, {
|
|
133
|
-
scope: "col",
|
|
134
|
-
...sharedProps,
|
|
135
|
-
type: type,
|
|
136
|
-
children: /*#__PURE__*/_jsx(Typography, {
|
|
137
|
-
tokens: typographyTokens,
|
|
138
|
-
children: children
|
|
139
|
-
})
|
|
140
|
-
});
|
|
141
|
-
case HEADER_TYPE.ROWHEADING:
|
|
142
|
-
return /*#__PURE__*/_jsx(StyledHeaderCell, {
|
|
143
|
-
scope: "row",
|
|
144
|
-
...sharedProps,
|
|
145
|
-
type: type,
|
|
146
|
-
children: /*#__PURE__*/_jsx(Typography, {
|
|
147
|
-
tokens: typographyTokens,
|
|
148
|
-
children: children
|
|
149
|
-
})
|
|
150
|
-
});
|
|
151
|
-
default:
|
|
152
|
-
return /*#__PURE__*/_jsx(StyledDataCell, {
|
|
153
|
-
...sharedProps,
|
|
154
|
-
children: /*#__PURE__*/_jsx(Typography, {
|
|
155
|
-
tokens: typographyTokens,
|
|
156
|
-
children: children
|
|
157
|
-
})
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
Cell.displayName = 'Cell';
|
|
162
|
-
Cell.propTypes = {
|
|
163
|
-
type: PropTypes.oneOf(['default', 'heading', 'subHeading', 'rowHeading']),
|
|
164
|
-
tokens: PropTypes.object,
|
|
165
|
-
children: PropTypes.node,
|
|
166
|
-
/**
|
|
167
|
-
* @ignore
|
|
168
|
-
* Used internally for making the first column sticky
|
|
169
|
-
*/
|
|
170
|
-
isFirstInRow: PropTypes.bool,
|
|
171
|
-
/**
|
|
172
|
-
* Defines the text alignment within the cell
|
|
173
|
-
*/
|
|
174
|
-
align: PropTypes.oneOf(['left', 'center', 'right'])
|
|
175
|
-
};
|
|
176
|
-
export default Cell;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import Row from './Row';
|
|
4
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
const Header = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
6
|
-
let {
|
|
7
|
-
children
|
|
8
|
-
} = _ref;
|
|
9
|
-
return /*#__PURE__*/_jsx("thead", {
|
|
10
|
-
ref: ref,
|
|
11
|
-
children: /*#__PURE__*/_jsx(Row, {
|
|
12
|
-
children: React.Children.map(children, child =>
|
|
13
|
-
/*#__PURE__*/
|
|
14
|
-
// TO DO: pass type as a variant instead of prop
|
|
15
|
-
React.cloneElement(child, {
|
|
16
|
-
type: 'heading'
|
|
17
|
-
}))
|
|
18
|
-
})
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
Header.displayName = 'Header';
|
|
22
|
-
Header.propTypes = {
|
|
23
|
-
children: PropTypes.node
|
|
24
|
-
};
|
|
25
|
-
export default Header;
|
package/lib-module/Table/Row.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
-
const Row = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
5
|
-
let {
|
|
6
|
-
children
|
|
7
|
-
} = _ref;
|
|
8
|
-
return /*#__PURE__*/_jsx("tr", {
|
|
9
|
-
ref: ref,
|
|
10
|
-
children: React.Children.map(children, (child, index) => /*#__PURE__*/React.cloneElement(child, {
|
|
11
|
-
isFirstInRow: index === 0
|
|
12
|
-
}))
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
Row.displayName = 'Row';
|
|
16
|
-
Row.propTypes = {
|
|
17
|
-
children: PropTypes.node
|
|
18
|
-
};
|
|
19
|
-
export default Row;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import Row from './Row';
|
|
4
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
const Header = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
6
|
-
let {
|
|
7
|
-
children
|
|
8
|
-
} = _ref;
|
|
9
|
-
return /*#__PURE__*/_jsx(Row, {
|
|
10
|
-
ref: ref,
|
|
11
|
-
children: React.Children.map(children, child =>
|
|
12
|
-
/*#__PURE__*/
|
|
13
|
-
// TO DO: pass type as a variant instead of prop
|
|
14
|
-
React.cloneElement(child, {
|
|
15
|
-
type: 'subHeading'
|
|
16
|
-
}))
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
Header.displayName = 'Header';
|
|
20
|
-
Header.propTypes = {
|
|
21
|
-
children: PropTypes.node
|
|
22
|
-
};
|
|
23
|
-
export default Header;
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { selectSystemProps, useSafeLayoutEffect, useThemeTokens, getTokensPropType } from '@telus-uds/components-base';
|
|
5
|
-
import throttle from 'lodash.throttle';
|
|
6
|
-
import { htmlAttrs } from '../utils';
|
|
7
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
9
|
-
const StyledContainer = /*#__PURE__*/styled.div.withConfig({
|
|
10
|
-
displayName: "Table__StyledContainer",
|
|
11
|
-
componentId: "components-web__sc-10d9q3m-0"
|
|
12
|
-
})(["overflow:auto;padding-bottom:", ";"], props => props.isScrollable ? `${props.tablePaddingBottom}px` : 0);
|
|
13
|
-
const StyledTable = /*#__PURE__*/styled.table.withConfig({
|
|
14
|
-
displayName: "Table__StyledTable",
|
|
15
|
-
componentId: "components-web__sc-10d9q3m-1"
|
|
16
|
-
})(["margin:0;padding:0;width:", ";border:", ";"], _ref => {
|
|
17
|
-
let {
|
|
18
|
-
fullWidth,
|
|
19
|
-
tableWidth
|
|
20
|
-
} = _ref;
|
|
21
|
-
return fullWidth ? '100%' : `${tableWidth}px`;
|
|
22
|
-
}, props => `${props.borderWidth}px solid ${props.borderColor}`);
|
|
23
|
-
const TableContext = /*#__PURE__*/React.createContext({});
|
|
24
|
-
export const useTableContext = () => React.useContext(TableContext);
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Use `Table` to display tabular data.
|
|
28
|
-
*
|
|
29
|
-
* - Takes an optional `spacing` variant (compact)
|
|
30
|
-
* - Available in 2 text styles (medium, small)
|
|
31
|
-
* - When `Table` exceeds viewport, the first column becomes sticky, enabling horizontal scrolling
|
|
32
|
-
* - Right-align prices and numbers that display decimal points
|
|
33
|
-
*
|
|
34
|
-
* ### Building up a `Table`
|
|
35
|
-
* - Use `Table.Header` and `Table.Body` as direct children of `Table`
|
|
36
|
-
* - Use `Table.SubHeading` to render an intermediate data heading row
|
|
37
|
-
* - Use `Table.Row` and `Table.Cell` to build up the tabular data
|
|
38
|
-
* - Use `Cell`'s `type` prop to visually mark it as a row heading (`type="rowHeading"`)
|
|
39
|
-
*/
|
|
40
|
-
const Table = _ref2 => {
|
|
41
|
-
let {
|
|
42
|
-
children,
|
|
43
|
-
spacing = 'default',
|
|
44
|
-
fullWidth = true,
|
|
45
|
-
text = 'medium',
|
|
46
|
-
tokens,
|
|
47
|
-
variant,
|
|
48
|
-
...rest
|
|
49
|
-
} = _ref2;
|
|
50
|
-
const {
|
|
51
|
-
tablePaddingBottom,
|
|
52
|
-
borderColor,
|
|
53
|
-
borderWidth
|
|
54
|
-
} = useThemeTokens('Table', tokens, variant);
|
|
55
|
-
const containerRef = React.useRef();
|
|
56
|
-
const tableRef = React.useRef();
|
|
57
|
-
const [containerWidth, setContainerWidth] = React.useState(0);
|
|
58
|
-
const [tableWidth, setTableWidth] = React.useState(0);
|
|
59
|
-
useSafeLayoutEffect(() => {
|
|
60
|
-
const updateDimensions = () => {
|
|
61
|
-
var _containerRef$current, _tableRef$current;
|
|
62
|
-
const containerClientWidth = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.clientWidth;
|
|
63
|
-
const responsiveTableWidth = fullWidth ? containerClientWidth : (_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.clientWidth;
|
|
64
|
-
setContainerWidth(containerClientWidth);
|
|
65
|
-
setTableWidth(responsiveTableWidth);
|
|
66
|
-
};
|
|
67
|
-
const throttledUpdateDimensions = throttle(updateDimensions, 100, {
|
|
68
|
-
leading: false
|
|
69
|
-
});
|
|
70
|
-
updateDimensions();
|
|
71
|
-
|
|
72
|
-
// a pretty naive way of repeating the measurement after the fonts are loaded
|
|
73
|
-
window.addEventListener('load', updateDimensions);
|
|
74
|
-
window.addEventListener('resize', throttledUpdateDimensions);
|
|
75
|
-
return () => {
|
|
76
|
-
window.removeEventListener('load', updateDimensions);
|
|
77
|
-
window.removeEventListener('resize', throttledUpdateDimensions);
|
|
78
|
-
};
|
|
79
|
-
}, []);
|
|
80
|
-
const isScrollable = tableWidth > containerWidth;
|
|
81
|
-
return /*#__PURE__*/_jsx(StyledContainer, {
|
|
82
|
-
ref: containerRef,
|
|
83
|
-
isScrollable: isScrollable,
|
|
84
|
-
tablePaddingBottom: tablePaddingBottom,
|
|
85
|
-
children: /*#__PURE__*/_jsx(TableContext.Provider, {
|
|
86
|
-
value: {
|
|
87
|
-
text,
|
|
88
|
-
isScrollable,
|
|
89
|
-
tokens,
|
|
90
|
-
spacing
|
|
91
|
-
},
|
|
92
|
-
children: /*#__PURE__*/_jsx(StyledTable, {
|
|
93
|
-
borderColor: borderColor,
|
|
94
|
-
borderWidth: borderWidth,
|
|
95
|
-
tableWidth: tableWidth,
|
|
96
|
-
cellSpacing: 0,
|
|
97
|
-
ref: tableRef,
|
|
98
|
-
fullWidth: fullWidth,
|
|
99
|
-
...selectProps(rest),
|
|
100
|
-
children: children
|
|
101
|
-
})
|
|
102
|
-
})
|
|
103
|
-
});
|
|
104
|
-
};
|
|
105
|
-
Table.propTypes = {
|
|
106
|
-
...selectedSystemPropTypes,
|
|
107
|
-
tokens: getTokensPropType('Table'),
|
|
108
|
-
children: PropTypes.node,
|
|
109
|
-
/**
|
|
110
|
-
* Sets text style
|
|
111
|
-
*/
|
|
112
|
-
text: PropTypes.oneOf(['medium', 'small'])
|
|
113
|
-
};
|
|
114
|
-
export default Table;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import Table from './Table';
|
|
2
|
-
import Header from './Header';
|
|
3
|
-
import Body from './Body';
|
|
4
|
-
import Row from './Row';
|
|
5
|
-
import SubHeading from './SubHeading';
|
|
6
|
-
import Cell from './Cell';
|
|
7
|
-
Table.Header = Header;
|
|
8
|
-
Table.Body = Body;
|
|
9
|
-
Table.Row = Row;
|
|
10
|
-
Table.SubHeading = SubHeading;
|
|
11
|
-
Table.Cell = Cell;
|
|
12
|
-
export default Table;
|