@telus-uds/components-web 3.2.0 → 3.3.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.
Files changed (119) hide show
  1. package/CHANGELOG.md +31 -2
  2. package/lib/Badge/Badge.js +19 -11
  3. package/lib/BlockQuote/BlockQuote.js +31 -17
  4. package/lib/Breadcrumbs/Breadcrumbs.js +23 -17
  5. package/lib/Breadcrumbs/Item/Item.js +6 -10
  6. package/lib/Callout/Callout.js +5 -6
  7. package/lib/Card/Card.js +5 -5
  8. package/lib/Card/CardContent.js +5 -6
  9. package/lib/Card/CardFooter.js +5 -6
  10. package/lib/Countdown/Countdown.js +5 -6
  11. package/lib/Countdown/Segment.js +6 -6
  12. package/lib/DatePicker/CalendarContainer.js +5 -5
  13. package/lib/DatePicker/DatePicker.js +26 -28
  14. package/lib/DatePicker/reactDatesCss.js +829 -2
  15. package/lib/Disclaimer/Disclaimer.js +5 -6
  16. package/lib/Footnote/Footnote.js +15 -39
  17. package/lib/Footnote/FootnoteLink.js +5 -6
  18. package/lib/NavigationBar/NavigationBar.js +5 -6
  19. package/lib/NavigationBar/NavigationItem.js +5 -6
  20. package/lib/OrderedList/Item.js +7 -11
  21. package/lib/OrderedList/ItemBase.js +5 -5
  22. package/lib/OrderedList/OrderedList.js +5 -6
  23. package/lib/OrderedList/OrderedListBase.js +5 -5
  24. package/lib/Paragraph/Paragraph.js +16 -8
  25. package/lib/PreviewCard/PreviewCard.js +7 -10
  26. package/lib/PriceLockup/PriceLockup.js +90 -64
  27. package/lib/PriceLockup/tokens.js +6 -2
  28. package/lib/Progress/ProgressBar.js +6 -6
  29. package/lib/QuantitySelector/styles.js +18 -9
  30. package/lib/Ribbon/Ribbon.js +57 -31
  31. package/lib/Span/Span.js +6 -7
  32. package/lib/Spinner/Spinner.js +8 -18
  33. package/lib/Spinner/SpinnerContent.js +5 -6
  34. package/lib/StoryCard/StoryCard.js +7 -10
  35. package/lib/Table/Cell.js +43 -12
  36. package/lib/Table/Table.js +15 -11
  37. package/lib/TermsAndConditions/ExpandCollapse.js +7 -13
  38. package/lib/TermsAndConditions/TermsAndConditions.js +9 -22
  39. package/lib/Testimonial/Testimonial.js +10 -26
  40. package/lib/Toast/Toast.js +64 -13
  41. package/lib/Video/ControlBar/ControlBar.js +8 -18
  42. package/lib/Video/ControlBar/Controls/VideoButton/VideoButton.js +5 -6
  43. package/lib/Video/ControlBar/Controls/VideoMenu/VideoMenu.js +7 -14
  44. package/lib/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +7 -14
  45. package/lib/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.js +6 -10
  46. package/lib/Video/MiddleControlButton/MiddleControlButton.js +5 -6
  47. package/lib/Video/Video.js +10 -26
  48. package/lib/VideoPicker/VideoPicker.js +44 -20
  49. package/lib/VideoPicker/VideoPickerThumbnail.js +52 -18
  50. package/lib/WaffleGrid/WaffleGrid.js +7 -14
  51. package/lib/WebVideo/WebVideo.js +9 -14
  52. package/lib/index.js +1 -1
  53. package/lib/shared/FullBleedContent/FullBleedContent.js +5 -5
  54. package/lib/shared/VideoSplash/SplashButton/SplashButton.js +6 -9
  55. package/lib/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +8 -17
  56. package/lib/shared/VideoSplash/VideoSplash.js +5 -6
  57. package/lib/utils/index.js +2 -1
  58. package/lib/utils/ssr.js +4 -1
  59. package/lib/utils/theming/styled-components.js +26 -0
  60. package/package.json +3 -3
  61. package/src/Badge/Badge.jsx +3 -2
  62. package/src/BlockQuote/BlockQuote.jsx +3 -2
  63. package/src/Breadcrumbs/Breadcrumbs.jsx +23 -13
  64. package/src/Breadcrumbs/Item/Item.jsx +3 -2
  65. package/src/Callout/Callout.jsx +3 -2
  66. package/src/Card/Card.jsx +3 -1
  67. package/src/Card/CardContent.jsx +3 -2
  68. package/src/Card/CardFooter.jsx +3 -2
  69. package/src/Countdown/Countdown.jsx +3 -2
  70. package/src/Countdown/Segment.jsx +3 -1
  71. package/src/DatePicker/CalendarContainer.jsx +3 -1
  72. package/src/DatePicker/DatePicker.jsx +22 -13
  73. package/src/DatePicker/reactDatesCss.js +3 -1
  74. package/src/Disclaimer/Disclaimer.jsx +3 -2
  75. package/src/Footnote/Footnote.jsx +9 -2
  76. package/src/Footnote/FootnoteLink.jsx +3 -2
  77. package/src/NavigationBar/NavigationBar.jsx +3 -2
  78. package/src/NavigationBar/NavigationItem.jsx +3 -2
  79. package/src/OrderedList/Item.jsx +4 -3
  80. package/src/OrderedList/ItemBase.jsx +3 -1
  81. package/src/OrderedList/OrderedList.jsx +3 -2
  82. package/src/OrderedList/OrderedListBase.jsx +3 -1
  83. package/src/Paragraph/Paragraph.jsx +3 -2
  84. package/src/PreviewCard/PreviewCard.jsx +3 -1
  85. package/src/PriceLockup/PriceLockup.jsx +15 -4
  86. package/src/PriceLockup/tokens.js +15 -3
  87. package/src/Progress/ProgressBar.jsx +3 -1
  88. package/src/QuantitySelector/styles.js +3 -1
  89. package/src/Ribbon/Ribbon.jsx +3 -2
  90. package/src/Span/Span.jsx +3 -2
  91. package/src/Spinner/Spinner.jsx +3 -2
  92. package/src/Spinner/SpinnerContent.jsx +3 -2
  93. package/src/StoryCard/StoryCard.jsx +3 -1
  94. package/src/Table/Cell.jsx +3 -1
  95. package/src/Table/Table.jsx +3 -2
  96. package/src/TermsAndConditions/ExpandCollapse.jsx +3 -1
  97. package/src/TermsAndConditions/TermsAndConditions.jsx +3 -2
  98. package/src/Testimonial/Testimonial.jsx +3 -2
  99. package/src/Toast/Toast.jsx +3 -2
  100. package/src/Video/ControlBar/ControlBar.jsx +3 -3
  101. package/src/Video/ControlBar/Controls/VideoButton/VideoButton.jsx +4 -3
  102. package/src/Video/ControlBar/Controls/VideoMenu/VideoMenu.jsx +3 -3
  103. package/src/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.jsx +3 -3
  104. package/src/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.jsx +3 -3
  105. package/src/Video/MiddleControlButton/MiddleControlButton.jsx +4 -3
  106. package/src/Video/Video.jsx +3 -2
  107. package/src/VideoPicker/VideoPicker.jsx +3 -2
  108. package/src/VideoPicker/VideoPickerThumbnail.jsx +3 -1
  109. package/src/WaffleGrid/WaffleGrid.jsx +3 -2
  110. package/src/WebVideo/WebVideo.jsx +4 -3
  111. package/src/index.js +1 -1
  112. package/src/shared/FullBleedContent/FullBleedContent.jsx +3 -2
  113. package/src/shared/VideoSplash/SplashButton/SplashButton.jsx +3 -1
  114. package/src/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.jsx +4 -2
  115. package/src/shared/VideoSplash/VideoSplash.jsx +3 -2
  116. package/src/utils/index.js +3 -1
  117. package/src/utils/ssr.js +2 -1
  118. package/src/utils/theming/styled-components.js +23 -0
  119. package/types/common.d.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -1,12 +1,41 @@
1
1
  # Change Log - @telus-uds/components-web
2
2
 
3
- <!-- This log was last generated on Fri, 06 Dec 2024 02:03:26 GMT and should not be manually modified. -->
3
+ This log was last generated on Fri, 10 Jan 2025 21:41:25 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 3.3.0
8
+
9
+ Fri, 10 Jan 2025 21:41:25 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - "Search: iconLeftGap value added in the testTheme file for TextInput in Search" (35577399+JoshHC@users.noreply.github.com)
14
+ - `Docs`: fixed camelcase and hardcoded path for components (kristina.kirpichnikova@telus.com)
15
+ - `DatePicker`: update component to enable custom date formats (eduardo.pereira1@telus.com)
16
+ - `PriceLockup`: new tokens `centsPaddingTop` and `currencySymbolPaddingTop` added to the component to match with Koodo design in the micro variant (35577399+JoshHC@users.noreply.github.com)
17
+ - Bump @telus-uds/components-base to v2.4.0
18
+ - Bump @telus-uds/system-theme-tokens to v3.3.0
19
+
20
+ ### Patches
21
+
22
+ - "`DatePicker`: calendar position issue rendered incorrectly fixed" (35577399+JoshHC@users.noreply.github.com)
23
+
24
+ ## 3.2.1
25
+
26
+ Thu, 19 Dec 2024 05:02:20 GMT
27
+
28
+ ### Patches
29
+
30
+ - `List`: fix TELUS, Koodo & Public Mobile styles (sergio.ramirez@telus.com)
31
+ - `Breadcrumbs`: fix layout shift due to performance issues (guillermo.peitzner@telus.com)
32
+ - `styled-components` may break SSR in Next.js Pages Router app (shahzaibkhalidmalik@outlook.com)
33
+ - Bump @telus-uds/components-base to v2.3.0
34
+ - Bump @telus-uds/system-theme-tokens to v3.2.0
35
+
7
36
  ## 3.2.0
8
37
 
9
- Fri, 06 Dec 2024 02:03:26 GMT
38
+ Fri, 06 Dec 2024 02:06:03 GMT
10
39
 
11
40
  ### Minor changes
12
41
 
@@ -1,34 +1,41 @@
1
1
  import React from 'react';
2
- import styled from 'styled-components';
3
2
  import PropTypes from 'prop-types';
4
3
  import { selectSystemProps, Typography, getTokensPropType, useThemeTokens } from '@telus-uds/components-base';
5
- import { htmlAttrs, transformGradient } from '../utils';
4
+ import { htmlAttrs, transformGradient, styledComponents } from '../utils';
6
5
  import { jsx as _jsx } from "react/jsx-runtime";
7
6
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
8
- const BadgeContainer = /*#__PURE__*/styled.div.withConfig({
9
- displayName: "Badge__BadgeContainer",
10
- componentId: "components-web__sc-tsiuo2-0"
11
- })(["background:", ";border:", ";display:inline-flex;justify-content:center;padding:", ";border-radius:", ";width:fit-content;", ""], _ref => {
7
+ const {
8
+ styled
9
+ } = styledComponents;
10
+ const BadgeContainer = styled.div`
11
+ background: ${_ref => {
12
12
  let {
13
13
  background
14
14
  } = _ref;
15
15
  return background;
16
- }, _ref2 => {
16
+ }};
17
+ border: ${_ref2 => {
17
18
  let {
18
19
  border
19
20
  } = _ref2;
20
21
  return border;
21
- }, _ref3 => {
22
+ }};
23
+ display: inline-flex;
24
+ justify-content: center;
25
+ padding: ${_ref3 => {
22
26
  let {
23
27
  padding
24
28
  } = _ref3;
25
29
  return padding;
26
- }, _ref4 => {
30
+ }};
31
+ border-radius: ${_ref4 => {
27
32
  let {
28
33
  radius
29
34
  } = _ref4;
30
35
  return radius;
31
- }, _ref5 => {
36
+ }};
37
+ width: fit-content;
38
+ ${_ref5 => {
32
39
  let {
33
40
  isOutlineOffer,
34
41
  isAlternative,
@@ -40,7 +47,8 @@ const BadgeContainer = /*#__PURE__*/styled.div.withConfig({
40
47
  -webkit-background-clip: text;
41
48
  ${gradient && '-webkit-text-fill-color: transparent;'}
42
49
  }`;
43
- });
50
+ }}
51
+ `;
44
52
  const fontSizeMapping = {
45
53
  12: 'micro',
46
54
  14: 'small',
@@ -1,53 +1,67 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Link, selectSystemProps, StackView, Typography, useTheme, useThemeTokens, useResponsiveThemeTokens, createMediaQueryStyles, withLinkRouter, useViewport, getTokensPropType, StyleSheet } from '@telus-uds/components-base';
4
- import styled from 'styled-components';
5
- import { htmlAttrs, transformGradient } from '../utils';
4
+ import { htmlAttrs, transformGradient, styledComponents } from '../utils';
6
5
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
6
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
8
- const BlockQuoteContainer = /*#__PURE__*/styled.blockquote.withConfig({
9
- displayName: "BlockQuote__BlockQuoteContainer",
10
- componentId: "components-web__sc-vals3u-0"
11
- })(["margin:0;position:relative;padding-left:", ";padding-right:", ";padding-bottom:", ";padding-top:", ";&::before{content:'';left:0;top:0;position:absolute;height:100%;width:", ";background:", ";}"], _ref => {
7
+ const {
8
+ styled
9
+ } = styledComponents;
10
+ const BlockQuoteContainer = styled.blockquote`
11
+ margin: 0;
12
+ position: relative;
13
+ padding-left: ${_ref => {
12
14
  let {
13
15
  paddingLeft
14
16
  } = _ref;
15
17
  return `${paddingLeft}px`;
16
- }, _ref2 => {
18
+ }};
19
+ padding-right: ${_ref2 => {
17
20
  let {
18
21
  paddingRight
19
22
  } = _ref2;
20
23
  return `${paddingRight}px`;
21
- }, _ref3 => {
24
+ }};
25
+ padding-bottom: ${_ref3 => {
22
26
  let {
23
27
  paddingBottom
24
28
  } = _ref3;
25
29
  return `${paddingBottom}px`;
26
- }, _ref4 => {
30
+ }};
31
+ padding-top: ${_ref4 => {
27
32
  let {
28
33
  paddingTop
29
34
  } = _ref4;
30
35
  return `${paddingTop}px`;
31
- }, _ref5 => {
36
+ }};
37
+ &::before {
38
+ content: '';
39
+ left: 0;
40
+ top: 0;
41
+ position: absolute;
42
+ height: 100%;
43
+ width: ${_ref5 => {
32
44
  let {
33
45
  width
34
46
  } = _ref5;
35
47
  return `${width}px`;
36
- }, _ref6 => {
48
+ }};
49
+ background: ${_ref6 => {
37
50
  let {
38
51
  backgroundGradient
39
52
  } = _ref6;
40
53
  return backgroundGradient && transformGradient(backgroundGradient);
41
- });
42
- const QuoteContainer = /*#__PURE__*/styled.div.withConfig({
43
- displayName: "BlockQuote__QuoteContainer",
44
- componentId: "components-web__sc-vals3u-1"
45
- })(["margin-bottom:", ";"], _ref7 => {
54
+ }};
55
+ }
56
+ `;
57
+ const QuoteContainer = styled.div`
58
+ margin-bottom: ${_ref7 => {
46
59
  let {
47
60
  marginBottom
48
61
  } = _ref7;
49
62
  return `${marginBottom}px`;
50
- });
63
+ }};
64
+ `;
51
65
  const selectTitleHeadingTokens = themeTokens => ({
52
66
  fontSize: themeTokens.titleHeadingFontSize,
53
67
  fontName: themeTokens.titleHeadingFontName,
@@ -1,17 +1,16 @@
1
1
  import React, { createElement as _createElement } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import styled from 'styled-components';
4
3
  import { Helmet, HelmetProvider } from 'react-helmet-async';
5
4
  import { isEqual } from 'lodash';
6
5
  import { componentPropType, selectSystemProps, unpackFragment, withLinkRouter, getTokensPropType, useThemeTokens, useViewport } from '@telus-uds/components-base';
7
- import { htmlAttrs } from '../utils';
6
+ import { htmlAttrs, styledComponents } from '../utils';
8
7
  import Item from './Item/Item';
9
8
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
9
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
11
- const StyledList = /*#__PURE__*/styled.ol.withConfig({
12
- displayName: "Breadcrumbs__StyledList",
13
- componentId: "components-web__sc-gwwxrc-0"
14
- })({
10
+ const {
11
+ styled
12
+ } = styledComponents;
13
+ const StyledList = styled.ol({
15
14
  display: 'flex',
16
15
  flexDirection: 'row',
17
16
  flexWrap: 'wrap',
@@ -135,15 +134,9 @@ const Breadcrumbs = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
135
134
  const [optionsHidden, setOptionsHidden] = React.useState(false);
136
135
  const [itemsToBeRendered, setItemsToBeRendered] = React.useState([]);
137
136
  const viewport = useViewport();
138
- React.useEffect(() => {
139
- if (optionsHidden) {
140
- if (viewport !== 'xs' && !isEqual(itemsToBeRendered, activeRoutes)) {
141
- setItemsToBeRendered(activeRoutes);
142
- }
143
- return;
144
- }
137
+ const newItems = React.useMemo(() => {
145
138
  if (viewport === 'xs' && activeRoutes.length >= MAX_ITEMS_ON_XS_VIEWPORT) {
146
- const newItems = [...activeRoutes.slice(0, 2), {
139
+ return [...activeRoutes.slice(0, 2), {
147
140
  path: '#',
148
141
  breadcrumbName: '...',
149
142
  onPress: event => {
@@ -152,12 +145,25 @@ const Breadcrumbs = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
152
145
  },
153
146
  isExpander: true
154
147
  }, activeRoutes[activeRoutes.length - 1]];
155
- setItemsToBeRendered(newItems);
156
- setOptionsHidden(true);
148
+ }
149
+ return activeRoutes;
150
+ }, [viewport, activeRoutes]);
151
+ React.useEffect(() => {
152
+ if (optionsHidden) {
153
+ if (viewport !== 'xs' && !isEqual(itemsToBeRendered, activeRoutes)) {
154
+ setItemsToBeRendered(activeRoutes);
155
+ }
156
+ return;
157
+ }
158
+ if (viewport === 'xs' && activeRoutes.length >= MAX_ITEMS_ON_XS_VIEWPORT) {
159
+ if (!isEqual(itemsToBeRendered, newItems)) {
160
+ setItemsToBeRendered(newItems);
161
+ setOptionsHidden(true);
162
+ }
157
163
  } else if (!isEqual(itemsToBeRendered, activeRoutes)) {
158
164
  setItemsToBeRendered(activeRoutes);
159
165
  }
160
- }, [viewport, activeRoutes, optionsHidden, itemsToBeRendered]);
166
+ }, [viewport, activeRoutes, optionsHidden, itemsToBeRendered, newItems]);
161
167
  const items = getItems(itemsToBeRendered, params, !children);
162
168
  const themeTokens = useThemeTokens('Breadcrumbs', tokens, variant);
163
169
  const metadata = /*#__PURE__*/_jsx(HelmetProvider, {
@@ -1,14 +1,13 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import styled from 'styled-components';
4
3
  import { Link, Typography, applyTextStyles, clickProps, selectSystemProps, useThemeTokens } from '@telus-uds/components-base';
5
- import { htmlAttrs } from '../../utils';
4
+ import { htmlAttrs, styledComponents } from '../../utils';
6
5
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
7
6
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
8
- const StyledItemContainer = /*#__PURE__*/styled.li.withConfig({
9
- displayName: "Item__StyledItemContainer",
10
- componentId: "components-web__sc-1rfdaul-0"
11
- })({
7
+ const {
8
+ styled
9
+ } = styledComponents;
10
+ const StyledItemContainer = styled.li({
12
11
  display: 'inline-block',
13
12
  paddingLeft: _ref => {
14
13
  let {
@@ -25,10 +24,7 @@ const StyledItemContainer = /*#__PURE__*/styled.li.withConfig({
25
24
  },
26
25
  marginBottom: '8px'
27
26
  });
28
- const IconContainer = /*#__PURE__*/styled.span.withConfig({
29
- displayName: "Item__IconContainer",
30
- componentId: "components-web__sc-1rfdaul-1"
31
- })({
27
+ const IconContainer = styled.span({
32
28
  display: 'inline-block',
33
29
  paddingLeft: _ref3 => {
34
30
  let {
@@ -1,10 +1,12 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import styled from 'styled-components';
4
3
  import { Icon, selectSystemProps, Typography, useThemeTokens, getTokensPropType } from '@telus-uds/components-base';
5
- import { htmlAttrs } from '../utils';
4
+ import { htmlAttrs, styledComponents } from '../utils';
6
5
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
6
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
7
+ const {
8
+ styled
9
+ } = styledComponents;
8
10
  const getAlignment = (rounded, textAlignToFlex) => {
9
11
  if (textAlignToFlex) {
10
12
  switch (textAlignToFlex) {
@@ -30,10 +32,7 @@ const verticalAlignToFlex = verticalAlign => {
30
32
  return 'top';
31
33
  }
32
34
  };
33
- const CalloutContainer = /*#__PURE__*/styled.div.withConfig({
34
- displayName: "Callout__CalloutContainer",
35
- componentId: "components-web__sc-1a7ptx-0"
36
- })(_ref => {
35
+ const CalloutContainer = styled.div(_ref => {
37
36
  let {
38
37
  rounded,
39
38
  verticalAlign,
package/lib/Card/Card.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Card as CardBase, getTokensPropType, paddingProp, responsiveProps, selectSystemProps, StackView, useThemeTokens, useThemeTokensCallback, variantProp, a11yProps, viewProps, PressableCardBase, useResponsiveProp } from '@telus-uds/components-base';
4
- import styled from 'styled-components';
4
+ import { styledComponents } from '../utils';
5
5
  import CardContent from './CardContent';
6
6
  import CardFooter from './CardFooter';
7
7
  import FullBleedContent, { getFullBleedBorderRadius, useFullBleedContentProps } from '../shared/FullBleedContent';
@@ -10,6 +10,9 @@ import ConditionalWrapper from '../shared/ConditionalWrapper';
10
10
  // Passes React Native-oriented system props through UDS Card
11
11
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
12
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
13
+ const {
14
+ styled
15
+ } = styledComponents;
13
16
 
14
17
  /**
15
18
  * A basic card component, unstyled by default.
@@ -40,10 +43,7 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, vie
40
43
  * ## Accessibility
41
44
  * `Card` component accepts all the standard accessibility props.
42
45
  */
43
- const DynamicWidthContainer = /*#__PURE__*/styled.div.withConfig({
44
- displayName: "Card__DynamicWidthContainer",
45
- componentId: "components-web__sc-1elbtwd-0"
46
- })(_ref => {
46
+ const DynamicWidthContainer = styled.div(_ref => {
47
47
  let {
48
48
  width,
49
49
  display,
@@ -1,14 +1,13 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { getTokensPropType, selectSystemProps, useThemeTokens, useViewport, variantProp } from '@telus-uds/components-base';
4
- import styled from 'styled-components';
5
- import { htmlAttrs } from '../utils';
4
+ import { htmlAttrs, styledComponents } from '../utils';
6
5
  import { jsx as _jsx } from "react/jsx-runtime";
7
6
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
8
- const CardContentContainer = /*#__PURE__*/styled.div.withConfig({
9
- displayName: "CardContent__CardContentContainer",
10
- componentId: "components-web__sc-1k2501q-0"
11
- })(_ref => {
7
+ const {
8
+ styled
9
+ } = styledComponents;
10
+ const CardContentContainer = styled.div(_ref => {
12
11
  let {
13
12
  borderRadius,
14
13
  paddingBottom,
@@ -1,14 +1,13 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { getTokensPropType, paddingProp, selectSystemProps, useThemeTokens, useViewport, variantProp } from '@telus-uds/components-base';
4
- import styled from 'styled-components';
5
- import { htmlAttrs } from '../utils';
4
+ import { htmlAttrs, styledComponents } from '../utils';
6
5
  import { jsx as _jsx } from "react/jsx-runtime";
7
6
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
8
- const CardFooterContainer = /*#__PURE__*/styled.div.withConfig({
9
- displayName: "CardFooter__CardFooterContainer",
10
- componentId: "components-web__sc-pm6vns-0"
11
- })(_ref => {
7
+ const {
8
+ styled
9
+ } = styledComponents;
10
+ const CardFooterContainer = styled.div(_ref => {
12
11
  let {
13
12
  backgroundColor,
14
13
  borderRadius,
@@ -2,19 +2,18 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Spacer, StackView, Typography, selectSystemProps, useViewport, useTheme, useThemeTokens, useResponsiveThemeTokens, createMediaQueryStyles, applyTextStyles, getTokensPropType, StyleSheet } from '@telus-uds/components-base';
4
4
  import { viewports } from '@telus-uds/system-constants';
5
- import styled from 'styled-components';
6
5
  // Reading these from the RN palette since they will be used to generate
7
6
  // the `Typography` tokens
8
- import { htmlAttrs, transformGradient } from '../utils';
7
+ import { htmlAttrs, transformGradient, styledComponents } from '../utils';
9
8
  import Segment from './Segment';
10
9
  import useCountdown from './useCountdown';
11
10
  import { countdownVariantPropType, dictionaryContentShape } from './types';
12
11
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
12
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
14
- const Container = /*#__PURE__*/styled.div.withConfig({
15
- displayName: "Countdown__Container",
16
- componentId: "components-web__sc-18tqcb2-0"
17
- })(_ref => {
13
+ const {
14
+ styled
15
+ } = styledComponents;
16
+ const Container = styled.div(_ref => {
18
17
  let {
19
18
  variant: {
20
19
  feature,
@@ -1,22 +1,22 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { StackView, Typography, useCopy } from '@telus-uds/components-base';
4
- import styled from 'styled-components';
4
+ import { styledComponents } from '../utils';
5
5
  import dictionary from './dictionary';
6
6
  import { countdownVariantPropType, dictionaryContentShape } from './types';
7
7
  // !TODO: put this back
8
8
  import { SEGMENT_WIDTH_TO_FONT_SIZE_RATIO } from './constants';
9
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
+ const {
11
+ styled
12
+ } = styledComponents;
9
13
 
10
14
  // Pads with zeros on the left if it's a single digit number
11
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
15
  const pad = function (number) {
13
16
  let segmentWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
14
17
  return String(number).padStart(segmentWidth, '0');
15
18
  };
16
- const Container = /*#__PURE__*/styled.div.withConfig({
17
- displayName: "Segment__Container",
18
- componentId: "components-web__sc-yrh35y-0"
19
- })(_ref => {
19
+ const Container = styled.div(_ref => {
20
20
  let {
21
21
  segmentFontSize,
22
22
  segmentWidth = 2,
@@ -1,13 +1,13 @@
1
- import styled from 'styled-components';
1
+ import { styledComponents } from '../utils';
2
2
  import defaultReactDatesCss from './reactDatesCss';
3
3
 
4
4
  // calendarDayDefaultHeight and calendarDayDefaultWidth
5
5
  // refer to circle size when selected, focused, or hovered and is passed with getResponsiveCircleSize in DatePicker
6
6
 
7
- const CalendarContainer = /*#__PURE__*/styled.div.withConfig({
8
- displayName: "CalendarContainer",
9
- componentId: "components-web__sc-qdc1tg-0"
10
- })(_ref => {
7
+ const {
8
+ styled
9
+ } = styledComponents;
10
+ const CalendarContainer = styled.div(_ref => {
11
11
  let {
12
12
  daySize,
13
13
  remainingTokens,
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import styled from 'styled-components';
4
3
  import momentPropTypes from 'react-moment-proptypes';
5
4
  import 'react-dates/initialize';
6
5
  import { SingleDatePicker, DayPickerSingleDateController } from 'react-dates';
@@ -9,11 +8,12 @@ import moment from 'moment';
9
8
  import { isUndefined, throttle } from 'lodash';
10
9
  import CalendarContainer from './CalendarContainer';
11
10
  import dictionary from './dictionary';
12
- import { htmlAttrs } from '../utils';
11
+ import { htmlAttrs, styledComponents } from '../utils';
13
12
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
+ const {
14
+ styled
15
+ } = styledComponents;
14
16
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
15
- const dateFormat = 'DD / MM / YYYY';
16
- const dateFormatWithoutSpaces = 'DD/MM/YYYY';
17
17
  const getResponsiveDaySize = function () {
18
18
  let inline = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
19
19
  let viewport = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'md';
@@ -30,24 +30,15 @@ const getResponsiveCircleSize = function () {
30
30
  }
31
31
  return inline ? 44 : 26;
32
32
  };
33
- const MonthCenterContainer = /*#__PURE__*/styled.div.withConfig({
34
- displayName: "DatePicker__MonthCenterContainer",
35
- componentId: "components-web__sc-mz8fi3-0"
36
- })({
33
+ const MonthCenterContainer = styled.div({
37
34
  display: 'flex',
38
35
  justifyContent: 'center'
39
36
  });
40
- const DateInputWrapper = /*#__PURE__*/styled.div.withConfig({
41
- displayName: "DatePicker__DateInputWrapper",
42
- componentId: "components-web__sc-mz8fi3-1"
43
- })({
37
+ const DateInputWrapper = styled.div({
44
38
  display: 'flex',
45
39
  flexDirection: 'column'
46
40
  });
47
- const PortalPositionedContainer = /*#__PURE__*/styled.div.withConfig({
48
- displayName: "DatePicker__PortalPositionedContainer",
49
- componentId: "components-web__sc-mz8fi3-2"
50
- })({
41
+ const PortalPositionedContainer = styled.div({
51
42
  position: 'absolute',
52
43
  left: _ref => {
53
44
  let {
@@ -62,7 +53,6 @@ const PortalPositionedContainer = /*#__PURE__*/styled.div.withConfig({
62
53
  return `${top}px`;
63
54
  }
64
55
  });
65
- const validDatePattern = /^([0-2][0-9]|3[0-1])(\/)(0[1-9]|1[0-2])\2(\d{4})$/;
66
56
  const getInitialVisibleMonth = (initialVisibleMonth, inputDate) => {
67
57
  if (initialVisibleMonth === '' || inputDate instanceof moment) {
68
58
  return null;
@@ -97,6 +87,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
97
87
  copy = 'en',
98
88
  id,
99
89
  date,
90
+ dateFormat = 'DD / MM / YYYY',
100
91
  feedback,
101
92
  inline = false,
102
93
  isDayDisabled,
@@ -111,12 +102,13 @@ const DatePicker = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
111
102
  disabled = false,
112
103
  prevTestID = '',
113
104
  nextTestID = '',
114
- placeholder = 'DD / MM / YYYY',
105
+ placeholder = dateFormat,
115
106
  initialVisibleMonth = '',
116
107
  ...rest
117
108
  } = _ref3;
118
109
  const [inputDate, setInputDate] = React.useState(date instanceof moment ? date : undefined);
119
110
  const [inputText, setInputText] = React.useState(date instanceof moment ? date.format(dateFormat) : '');
111
+ const dateFormatWithoutSpaces = dateFormat.replace(/\s/g, '');
120
112
  const textInputRef = React.useRef();
121
113
  const prevButtonRef = React.useRef();
122
114
  const [datePickerPosition, setDatePickerPosition] = React.useState({
@@ -143,7 +135,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
143
135
  });
144
136
 
145
137
  // Initial call to set the position
146
- updateDatePickerPosition();
138
+ throttledUpdate();
147
139
 
148
140
  // Register event listeners
149
141
  window.addEventListener('resize', throttledUpdate);
@@ -172,7 +164,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
172
164
  setInputDate(date);
173
165
  setInputText(date instanceof moment ? date.format(dateFormat) : '');
174
166
  }
175
- }, [date, inputDate]);
167
+ }, [date, inputDate, dateFormat]);
176
168
  React.useEffect(() => {
177
169
  let timeoutId;
178
170
  if (prevButtonRef.current && isFocused) {
@@ -241,7 +233,9 @@ const DatePicker = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
241
233
  }
242
234
  };
243
235
  const handleValidation = inputValidation => {
244
- if (validDatePattern.test(inputText.replace(/\s+/g, '')) === false && inputText !== '') {
236
+ const momentDate = moment(inputText, dateFormat, true);
237
+ const isValidDate = momentDate.isValid();
238
+ if (!isValidDate && inputText !== '') {
245
239
  return 'error';
246
240
  }
247
241
  if (inputValidation === 'error' || inputValidation === 'success') {
@@ -252,10 +246,11 @@ const DatePicker = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
252
246
  const viewport = useViewport();
253
247
  const daySize = getResponsiveDaySize(inline, viewport);
254
248
  const circleSize = getResponsiveCircleSize(inline, viewport);
255
- const HiddenInputFieldContainer = /*#__PURE__*/styled.div.withConfig({
256
- displayName: "DatePicker__HiddenInputFieldContainer",
257
- componentId: "components-web__sc-mz8fi3-3"
258
- })(["height:", ";width:", ";overflow:hidden;"], props => props.height, props => props.width);
249
+ const HiddenInputFieldContainer = styled.div`
250
+ height: ${props => props.height};
251
+ width: ${props => props.width};
252
+ overflow: hidden;
253
+ `;
259
254
  const {
260
255
  hiddenInputFieldContainerHeight,
261
256
  hiddenInputFieldContainerWidth,
@@ -449,8 +444,11 @@ DatePicker.propTypes = {
449
444
  */
450
445
  date: momentPropTypes.momentObj,
451
446
  /**
452
- * A detailed description of validation error/success or additional instructions.
453
- * Visual variant is determined based on the `validation` prop.
447
+ * A Moment instance representing the currently selected date, i.e. `moment()`
448
+ */
449
+ dateFormat: PropTypes.string,
450
+ /**
451
+ * Optional date format for the date input. If not set, the default value will be `DD / MM / YYYY`
454
452
  */
455
453
  feedback: PropTypes.string,
456
454
  /**
@@ -505,7 +503,7 @@ DatePicker.propTypes = {
505
503
  */
506
504
  nextTestID: PropTypes.string,
507
505
  /**
508
- * Optional placeholder for the date input. If not set the default value will be `DD / MM / YYYY`
506
+ * Optional placeholder for the date input. If not set, the default value will be equal to the `dateFormat` prop
509
507
  */
510
508
  placeholder: PropTypes.string,
511
509
  /**