@telus-uds/components-web 1.8.0 → 1.9.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 +27 -2
- package/lib/Autocomplete/Autocomplete.js +393 -0
- package/lib/Autocomplete/Loading.js +51 -0
- package/lib/Autocomplete/Suggestions.js +81 -0
- package/lib/Autocomplete/constants.js +19 -0
- package/lib/Autocomplete/dictionary.js +19 -0
- package/lib/Autocomplete/index.js +13 -0
- package/lib/Callout/Callout.js +3 -0
- package/lib/Card/Card.js +180 -0
- package/lib/Card/CardContent.js +110 -0
- package/lib/Card/CardFooter.js +98 -0
- package/lib/Card/index.js +13 -0
- package/lib/Countdown/Countdown.js +189 -0
- package/lib/Countdown/Segment.js +111 -0
- package/lib/Countdown/constants.js +14 -0
- package/lib/Countdown/dictionary.js +29 -0
- package/lib/Countdown/index.js +13 -0
- package/lib/Countdown/types.js +39 -0
- package/lib/Countdown/useCountdown.js +40 -0
- package/lib/Modal/ModalContent.js +11 -4
- package/lib/OptimizeImage/OptimizeImage.js +127 -0
- package/lib/OptimizeImage/index.js +13 -0
- package/lib/OptimizeImage/utils/getFallbackUrl.js +18 -0
- package/lib/OptimizeImage/utils/getOptimizedUrl.js +32 -0
- package/lib/OptimizeImage/utils/hasWebpSupport.js +38 -0
- package/lib/OptimizeImage/utils/index.js +31 -0
- package/lib/OptimizeImage/utils/isSvgUrl.js +10 -0
- package/lib/QuantitySelector/QuantitySelector.js +253 -0
- package/lib/QuantitySelector/dictionary.js +33 -0
- package/lib/QuantitySelector/index.js +13 -0
- package/lib/QuantitySelector/styles.js +40 -0
- package/lib/StoryCard/StoryCard.js +244 -0
- package/lib/StoryCard/index.js +13 -0
- package/lib/TermsAndConditions/ExpandCollapse.js +141 -0
- package/lib/TermsAndConditions/TermsAndConditions.js +221 -0
- package/lib/TermsAndConditions/dictionary.js +19 -0
- package/lib/TermsAndConditions/index.js +15 -0
- package/lib/Testimonial/Testimonial.js +226 -0
- package/lib/Testimonial/index.js +13 -0
- package/lib/Video/ControlBar/ControlBar.js +315 -0
- package/lib/Video/ControlBar/Controls/VideoButton/VideoButton.js +91 -0
- package/lib/Video/ControlBar/Controls/VideoMenu/VideoMenu.js +186 -0
- package/lib/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +221 -0
- package/lib/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.js +213 -0
- package/lib/Video/MiddleControlButton/MiddleControlButton.js +89 -0
- package/lib/Video/Video.js +1072 -0
- package/lib/Video/index.js +13 -0
- package/lib/Video/videoText.js +62 -0
- package/lib/WebVideo/WebVideo.js +170 -0
- package/lib/WebVideo/index.js +13 -0
- package/lib/baseExports.js +0 -6
- package/lib/index.js +91 -1
- package/lib/shared/VideoSplash/SplashButton/SplashButton.js +102 -0
- package/lib/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +234 -0
- package/lib/shared/VideoSplash/VideoSplash.js +86 -0
- package/lib/shared/VideoSplash/helpers.js +38 -0
- package/lib/utils/index.js +8 -0
- package/lib-module/Autocomplete/Autocomplete.js +369 -0
- package/lib-module/Autocomplete/Loading.js +38 -0
- package/lib-module/Autocomplete/Suggestions.js +64 -0
- package/lib-module/Autocomplete/constants.js +5 -0
- package/lib-module/Autocomplete/dictionary.js +12 -0
- package/lib-module/Autocomplete/index.js +2 -0
- package/lib-module/Callout/Callout.js +3 -0
- package/lib-module/Card/Card.js +158 -0
- package/lib-module/Card/CardContent.js +92 -0
- package/lib-module/Card/CardFooter.js +80 -0
- package/lib-module/Card/index.js +2 -0
- package/lib-module/Countdown/Countdown.js +165 -0
- package/lib-module/Countdown/Segment.js +94 -0
- package/lib-module/Countdown/constants.js +4 -0
- package/lib-module/Countdown/dictionary.js +22 -0
- package/lib-module/Countdown/index.js +2 -0
- package/lib-module/Countdown/types.js +23 -0
- package/lib-module/Countdown/useCountdown.js +32 -0
- package/lib-module/Modal/ModalContent.js +10 -4
- package/lib-module/OptimizeImage/OptimizeImage.js +106 -0
- package/lib-module/OptimizeImage/index.js +2 -0
- package/lib-module/OptimizeImage/utils/getFallbackUrl.js +8 -0
- package/lib-module/OptimizeImage/utils/getOptimizedUrl.js +22 -0
- package/lib-module/OptimizeImage/utils/hasWebpSupport.js +32 -0
- package/lib-module/OptimizeImage/utils/index.js +4 -0
- package/lib-module/OptimizeImage/utils/isSvgUrl.js +3 -0
- package/lib-module/QuantitySelector/QuantitySelector.js +232 -0
- package/lib-module/QuantitySelector/dictionary.js +26 -0
- package/lib-module/QuantitySelector/index.js +2 -0
- package/lib-module/QuantitySelector/styles.js +21 -0
- package/lib-module/StoryCard/StoryCard.js +220 -0
- package/lib-module/StoryCard/index.js +2 -0
- package/lib-module/TermsAndConditions/ExpandCollapse.js +120 -0
- package/lib-module/TermsAndConditions/TermsAndConditions.js +193 -0
- package/lib-module/TermsAndConditions/dictionary.js +12 -0
- package/lib-module/TermsAndConditions/index.js +1 -0
- package/lib-module/Testimonial/Testimonial.js +204 -0
- package/lib-module/Testimonial/index.js +2 -0
- package/lib-module/Video/ControlBar/ControlBar.js +292 -0
- package/lib-module/Video/ControlBar/Controls/VideoButton/VideoButton.js +74 -0
- package/lib-module/Video/ControlBar/Controls/VideoMenu/VideoMenu.js +167 -0
- package/lib-module/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +201 -0
- package/lib-module/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.js +193 -0
- package/lib-module/Video/MiddleControlButton/MiddleControlButton.js +72 -0
- package/lib-module/Video/Video.js +1042 -0
- package/lib-module/Video/index.js +2 -0
- package/lib-module/Video/videoText.js +55 -0
- package/lib-module/WebVideo/WebVideo.js +144 -0
- package/lib-module/WebVideo/index.js +2 -0
- package/lib-module/baseExports.js +1 -1
- package/lib-module/index.js +10 -0
- package/lib-module/shared/VideoSplash/SplashButton/SplashButton.js +85 -0
- package/lib-module/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +216 -0
- package/lib-module/shared/VideoSplash/VideoSplash.js +65 -0
- package/lib-module/shared/VideoSplash/helpers.js +23 -0
- package/lib-module/utils/index.js +2 -1
- package/package.json +7 -5
- package/src/Autocomplete/Autocomplete.jsx +354 -0
- package/src/Autocomplete/Loading.jsx +18 -0
- package/src/Autocomplete/Suggestions.jsx +52 -0
- package/src/Autocomplete/constants.js +6 -0
- package/src/Autocomplete/dictionary.js +12 -0
- package/src/Autocomplete/index.js +3 -0
- package/src/Callout/Callout.jsx +1 -1
- package/src/Card/Card.jsx +170 -0
- package/src/Card/CardContent.jsx +88 -0
- package/src/Card/CardFooter.jsx +70 -0
- package/src/Card/index.js +3 -0
- package/src/Countdown/Countdown.jsx +144 -0
- package/src/Countdown/Segment.jsx +69 -0
- package/src/Countdown/constants.js +4 -0
- package/src/Countdown/dictionary.js +22 -0
- package/src/Countdown/index.js +3 -0
- package/src/Countdown/types.js +23 -0
- package/src/Countdown/useCountdown.js +34 -0
- package/src/Modal/ModalContent.jsx +8 -4
- package/src/OptimizeImage/OptimizeImage.jsx +131 -0
- package/src/OptimizeImage/index.js +3 -0
- package/src/OptimizeImage/utils/getFallbackUrl.js +9 -0
- package/src/OptimizeImage/utils/getOptimizedUrl.js +30 -0
- package/src/OptimizeImage/utils/hasWebpSupport.js +33 -0
- package/src/OptimizeImage/utils/index.js +5 -0
- package/src/OptimizeImage/utils/isSvgUrl.js +3 -0
- package/src/QuantitySelector/QuantitySelector.jsx +245 -0
- package/src/QuantitySelector/dictionary.js +27 -0
- package/src/QuantitySelector/index.js +3 -0
- package/src/QuantitySelector/styles.js +83 -0
- package/src/StoryCard/StoryCard.jsx +198 -0
- package/src/StoryCard/index.js +3 -0
- package/src/TermsAndConditions/ExpandCollapse.jsx +106 -0
- package/src/TermsAndConditions/TermsAndConditions.jsx +161 -0
- package/src/TermsAndConditions/dictionary.js +12 -0
- package/src/TermsAndConditions/index.js +1 -0
- package/src/Testimonial/Testimonial.jsx +169 -0
- package/src/Testimonial/index.js +3 -0
- package/src/Video/ControlBar/ControlBar.jsx +261 -0
- package/src/Video/ControlBar/Controls/VideoButton/VideoButton.jsx +61 -0
- package/src/Video/ControlBar/Controls/VideoMenu/VideoMenu.jsx +159 -0
- package/src/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.jsx +185 -0
- package/src/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.jsx +184 -0
- package/src/Video/MiddleControlButton/MiddleControlButton.jsx +64 -0
- package/src/Video/Video.jsx +988 -0
- package/src/Video/index.js +3 -0
- package/src/Video/videoText.js +58 -0
- package/src/WebVideo/WebVideo.jsx +131 -0
- package/src/WebVideo/index.js +3 -0
- package/src/baseExports.js +0 -1
- package/src/index.js +10 -0
- package/src/shared/VideoSplash/SplashButton/SplashButton.jsx +64 -0
- package/src/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.jsx +128 -0
- package/src/shared/VideoSplash/VideoSplash.jsx +50 -0
- package/src/shared/VideoSplash/helpers.js +27 -0
- package/src/utils/index.js +10 -1
- package/types/Autocomplete.d.ts +32 -0
- package/types/Card.d.ts +45 -0
- package/types/ControlBar.d.ts +59 -0
- package/types/MiddleControlButton.d.ts +15 -0
- package/types/Video.d.ts +39 -0
- package/types/VideoButton.d.ts +14 -0
- package/types/VideoMenu.d.ts +16 -0
- package/types/VideoProgressBar.d.ts +17 -0
- package/types/VolumeSlider.d.ts +20 -0
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _componentsBase = require("@telus-uds/components-base");
|
|
13
|
+
|
|
14
|
+
var _IconButton = _interopRequireDefault(require("../IconButton"));
|
|
15
|
+
|
|
16
|
+
var _styles = require("./styles");
|
|
17
|
+
|
|
18
|
+
var _dictionary = _interopRequireDefault(require("./dictionary"));
|
|
19
|
+
|
|
20
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
+
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
|
|
24
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
|
+
|
|
26
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
|
+
|
|
28
|
+
const {
|
|
29
|
+
isNaN
|
|
30
|
+
} = Number;
|
|
31
|
+
|
|
32
|
+
const isNumber = value => {
|
|
33
|
+
return typeof value === 'number' && !isNaN(value);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const QuantitySelector = _ref => {
|
|
37
|
+
let {
|
|
38
|
+
id,
|
|
39
|
+
minNumber,
|
|
40
|
+
maxNumber,
|
|
41
|
+
defaultValue,
|
|
42
|
+
label,
|
|
43
|
+
hint,
|
|
44
|
+
hintPosition,
|
|
45
|
+
tooltip,
|
|
46
|
+
onChange,
|
|
47
|
+
dictionary = _dictionary.default,
|
|
48
|
+
accessibilityLabel,
|
|
49
|
+
copy,
|
|
50
|
+
variant,
|
|
51
|
+
tokens,
|
|
52
|
+
testID
|
|
53
|
+
} = _ref;
|
|
54
|
+
const {
|
|
55
|
+
components: {
|
|
56
|
+
QuantitySelector: componentTheme
|
|
57
|
+
}
|
|
58
|
+
} = (0, _componentsBase.useTheme)();
|
|
59
|
+
const {
|
|
60
|
+
leftIcon,
|
|
61
|
+
rightIcon,
|
|
62
|
+
padding
|
|
63
|
+
} = (0, _componentsBase.useThemeTokens)('QuantitySelector', tokens, variant);
|
|
64
|
+
const [error, setError] = (0, _react.useState)('');
|
|
65
|
+
const {
|
|
66
|
+
alternative
|
|
67
|
+
} = variant;
|
|
68
|
+
const getCopy = (0, _componentsBase.useCopy)({
|
|
69
|
+
dictionary,
|
|
70
|
+
copy
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const getValidatedNumber = numberToEvaluate => {
|
|
74
|
+
if (isNaN(numberToEvaluate)) return null;
|
|
75
|
+
if (isNumber(minNumber) && numberToEvaluate < minNumber) throw getCopy('errors').numberIsTooSmall(minNumber);
|
|
76
|
+
if (isNumber(maxNumber) && numberToEvaluate > maxNumber) throw getCopy('errors').numberIsTooBig(maxNumber);
|
|
77
|
+
return numberToEvaluate;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const initialValue = getValidatedNumber(defaultValue);
|
|
81
|
+
const {
|
|
82
|
+
currentValue: number,
|
|
83
|
+
setValue: setNumber
|
|
84
|
+
} = (0, _componentsBase.useInputValue)({
|
|
85
|
+
value: undefined,
|
|
86
|
+
initialValue,
|
|
87
|
+
onChange
|
|
88
|
+
});
|
|
89
|
+
const isDecreaseEnabled = !isNumber(minNumber) || number > minNumber;
|
|
90
|
+
const isIncreaseEnabled = !isNumber(maxNumber) || number < maxNumber;
|
|
91
|
+
const inputValue = isNumber(number) ? number.toString() : '';
|
|
92
|
+
|
|
93
|
+
const updateNumber = (newNumber, originalInputEvent) => {
|
|
94
|
+
try {
|
|
95
|
+
const validatedNumber = getValidatedNumber(newNumber);
|
|
96
|
+
setNumber(validatedNumber, originalInputEvent);
|
|
97
|
+
setError('');
|
|
98
|
+
} catch (e) {
|
|
99
|
+
setError(e);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const inputChangeHandler = (textInputValue, event) => {
|
|
104
|
+
if (textInputValue === '') setNumber(null);
|
|
105
|
+
const numberFromTextInput = Number(textInputValue);
|
|
106
|
+
|
|
107
|
+
if (isNumber(numberFromTextInput)) {
|
|
108
|
+
updateNumber(numberFromTextInput, event);
|
|
109
|
+
} else {
|
|
110
|
+
setError(getCopy('errors').invalidCharacters);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const renderLabel = () => label ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.InputLabel, {
|
|
115
|
+
forId: id,
|
|
116
|
+
label: label,
|
|
117
|
+
hint: hint,
|
|
118
|
+
hintPosition: hintPosition,
|
|
119
|
+
tooltip: tooltip
|
|
120
|
+
}) : null;
|
|
121
|
+
|
|
122
|
+
const renderTextInput = () => /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.TextInput, {
|
|
123
|
+
nativeID: id,
|
|
124
|
+
value: inputValue,
|
|
125
|
+
tokens: textInputState => {
|
|
126
|
+
const {
|
|
127
|
+
inputBorderColor,
|
|
128
|
+
inputBackgroundColor
|
|
129
|
+
} = (0, _componentsBase.getThemeTokens)(componentTheme, tokens, variant, textInputState);
|
|
130
|
+
return {
|
|
131
|
+
borderRadius: 0,
|
|
132
|
+
margin: 0,
|
|
133
|
+
padding: 0,
|
|
134
|
+
borderColor: inputBorderColor,
|
|
135
|
+
backgroundColor: inputBackgroundColor
|
|
136
|
+
};
|
|
137
|
+
},
|
|
138
|
+
onChange: inputChangeHandler // Using title as an accessibility workaround
|
|
139
|
+
// given that accessibilityLabel is not available
|
|
140
|
+
,
|
|
141
|
+
keyboardType: "numeric",
|
|
142
|
+
accessibilityLabel: accessibilityLabel ?? getCopy('accessibility').a11yLabel,
|
|
143
|
+
accessibilityRole: "spinbutton",
|
|
144
|
+
accessibilityValueMax: maxNumber,
|
|
145
|
+
accessibilityValueMin: minNumber,
|
|
146
|
+
accessibilityValueNow: number
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
const getButtonTokens = isEnabled => buttonState => {
|
|
150
|
+
const disabled = !isEnabled;
|
|
151
|
+
const { ...buttonTokens
|
|
152
|
+
} = (0, _componentsBase.getThemeTokens)(componentTheme, tokens, variant, { ...buttonState,
|
|
153
|
+
disabled
|
|
154
|
+
});
|
|
155
|
+
return { ...buttonTokens,
|
|
156
|
+
outerBorderGap: 0,
|
|
157
|
+
padding
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const renderLeftButton = () => {
|
|
162
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
163
|
+
icon: leftIcon,
|
|
164
|
+
tokens: getButtonTokens(isDecreaseEnabled),
|
|
165
|
+
onPress: event => updateNumber(number - 1, event),
|
|
166
|
+
onDoubleClick: event => updateNumber(number - 1, event),
|
|
167
|
+
accessibilityLabel: getCopy('accessibility').decreaseButton,
|
|
168
|
+
accessibilityDisabled: !isDecreaseEnabled
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const renderRightButton = () => /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
173
|
+
icon: rightIcon,
|
|
174
|
+
tokens: getButtonTokens(isIncreaseEnabled),
|
|
175
|
+
onPress: () => updateNumber(number + 1),
|
|
176
|
+
onDoubleClick: () => updateNumber(number + 1),
|
|
177
|
+
accessibilityLabel: getCopy('accessibility').increaseButton,
|
|
178
|
+
accessibilityDisabled: !isIncreaseEnabled
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_componentsBase.Box, {
|
|
182
|
+
space: 2,
|
|
183
|
+
testID: testID,
|
|
184
|
+
children: [renderLabel(), /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Spacer, {
|
|
185
|
+
space: 2
|
|
186
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.InputWrapper, {
|
|
187
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.InputField, {
|
|
188
|
+
className: `${alternative ? 'alternative' : ''}`,
|
|
189
|
+
children: renderTextInput()
|
|
190
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.RightButtonWrapper, {
|
|
191
|
+
className: `${alternative ? 'alternative' : ''}`,
|
|
192
|
+
children: renderRightButton()
|
|
193
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.LeftButtonWrapper, {
|
|
194
|
+
className: `${alternative ? 'alternative' : ''}`,
|
|
195
|
+
children: renderLeftButton()
|
|
196
|
+
})]
|
|
197
|
+
}), error ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Box, {
|
|
198
|
+
vertical: 2,
|
|
199
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Feedback, {
|
|
200
|
+
validation: "error",
|
|
201
|
+
children: error
|
|
202
|
+
})
|
|
203
|
+
}) : null]
|
|
204
|
+
});
|
|
205
|
+
}; // If a language dictionary entry is provided, it must contain every key
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
const dictionaryContentShape = _propTypes.default.shape({
|
|
209
|
+
accessibility: _propTypes.default.shape({
|
|
210
|
+
a11yLabel: _propTypes.default.string.isRequired,
|
|
211
|
+
increaseButton: _propTypes.default.string.isRequired,
|
|
212
|
+
decreaseButton: _propTypes.default.string.isRequired
|
|
213
|
+
}).isRequired,
|
|
214
|
+
errors: _propTypes.default.shape({
|
|
215
|
+
numberIsTooSmall: _propTypes.default.func.isRequired,
|
|
216
|
+
numberIsTooBig: _propTypes.default.func.isRequired,
|
|
217
|
+
invalidCharacters: _propTypes.default.string.isRequired
|
|
218
|
+
}).isRequired
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
QuantitySelector.propTypes = {
|
|
222
|
+
id: _propTypes.default.string,
|
|
223
|
+
minNumber: _propTypes.default.number,
|
|
224
|
+
maxNumber: _propTypes.default.number,
|
|
225
|
+
onChange: _propTypes.default.func,
|
|
226
|
+
defaultValue: _propTypes.default.number,
|
|
227
|
+
label: _propTypes.default.string,
|
|
228
|
+
hint: _propTypes.default.string,
|
|
229
|
+
hintPosition: _propTypes.default.oneOf(['inline', 'below']),
|
|
230
|
+
tooltip: _propTypes.default.string,
|
|
231
|
+
accessibilityLabel: _propTypes.default.string,
|
|
232
|
+
dictionary: _propTypes.default.shape({
|
|
233
|
+
en: dictionaryContentShape,
|
|
234
|
+
fr: dictionaryContentShape
|
|
235
|
+
}),
|
|
236
|
+
copy: _propTypes.default.oneOfType([_propTypes.default.oneOf(['en', 'fr'])]),
|
|
237
|
+
variant: _propTypes.default.exact({
|
|
238
|
+
alternative: _propTypes.default.bool
|
|
239
|
+
}),
|
|
240
|
+
tokens: _propTypes.default.oneOf([_propTypes.default.object, _propTypes.default.func]),
|
|
241
|
+
testID: _propTypes.default.string
|
|
242
|
+
};
|
|
243
|
+
QuantitySelector.defaultProps = {
|
|
244
|
+
id: 'quantity-selector',
|
|
245
|
+
hintPosition: 'inline',
|
|
246
|
+
copy: 'en',
|
|
247
|
+
variant: {
|
|
248
|
+
alternative: false
|
|
249
|
+
},
|
|
250
|
+
testID: 'quantity-selector-testid'
|
|
251
|
+
};
|
|
252
|
+
var _default = QuantitySelector;
|
|
253
|
+
exports.default = _default;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _default = {
|
|
8
|
+
en: {
|
|
9
|
+
accessibility: {
|
|
10
|
+
a11yLabel: 'Quantity Selector control',
|
|
11
|
+
increaseButton: 'Increase quantity button',
|
|
12
|
+
decreaseButton: 'Decrease quantity button'
|
|
13
|
+
},
|
|
14
|
+
errors: {
|
|
15
|
+
numberIsTooSmall: minNumber => `Number must be equal or greater than ${minNumber}`,
|
|
16
|
+
numberIsTooBig: maxNumber => `Number must be equal or less than ${maxNumber}`,
|
|
17
|
+
invalidCharacters: 'This control does not allow alphabetical or symbol characters. Try using numbers only'
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
fr: {
|
|
21
|
+
accessibility: {
|
|
22
|
+
a11yLabel: 'Contrôleur de sélection de nombre',
|
|
23
|
+
increaseButton: `Bouton d'augmentation de quantité`,
|
|
24
|
+
decreaseButton: `Bouton de diminution de quantité`
|
|
25
|
+
},
|
|
26
|
+
errors: {
|
|
27
|
+
numberIsTooSmall: minNumber => `Le nombre doit être plus grand ou égal que ${minNumber}`,
|
|
28
|
+
numberIsTooBig: maxNumber => `Le nombre doit être plus petit ou égal que ${maxNumber}`,
|
|
29
|
+
invalidCharacters: `Ce champ ne supporte pas les caractères alphabétiques ni les symboles. Essayez d'utiliser des chiffres uniquement`
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
exports.default = _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _QuantitySelector = _interopRequireDefault(require("./QuantitySelector"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
var _default = _QuantitySelector.default;
|
|
13
|
+
exports.default = _default;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.RightButtonWrapper = exports.LeftButtonWrapper = exports.InputWrapper = exports.InputField = void 0;
|
|
7
|
+
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
const InputField = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
13
|
+
displayName: "styles__InputField",
|
|
14
|
+
componentId: "components-web__sc-1lrz1xk-0"
|
|
15
|
+
})(["order:2;min-width:3.5rem;max-width:5 rem;height:28px;padding:0;width:64px;text-align:center;z-index:10;input{text-align:center;}&.alternative{input{height:40px;}}"]);
|
|
16
|
+
|
|
17
|
+
exports.InputField = InputField;
|
|
18
|
+
|
|
19
|
+
const ButtonWrapper = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
20
|
+
displayName: "styles__ButtonWrapper",
|
|
21
|
+
componentId: "components-web__sc-1lrz1xk-1"
|
|
22
|
+
})(["&.alternative{div[role='button']{height:42px;> div{height:40px;> div{padding:12px 16px;}}}}"]);
|
|
23
|
+
|
|
24
|
+
const LeftButtonWrapper = /*#__PURE__*/(0, _styledComponents.default)(ButtonWrapper).withConfig({
|
|
25
|
+
displayName: "styles__LeftButtonWrapper",
|
|
26
|
+
componentId: "components-web__sc-1lrz1xk-2"
|
|
27
|
+
})(["order:0;div[role='button']{border-radius:4px 0px 0px 4px !important;> div{border-right:none;border-radius:4px 0px 0px 4px !important;}}&.alternative{div[role='button']{border-radius:36px 0px 0px 36px !important;> div{border-radius:24px 0px 0px 24px !important;}}}"]);
|
|
28
|
+
exports.LeftButtonWrapper = LeftButtonWrapper;
|
|
29
|
+
const RightButtonWrapper = /*#__PURE__*/(0, _styledComponents.default)(ButtonWrapper).withConfig({
|
|
30
|
+
displayName: "styles__RightButtonWrapper",
|
|
31
|
+
componentId: "components-web__sc-1lrz1xk-3"
|
|
32
|
+
})(["order:3;div[role='button']{border-radius:0px 4px 4px 0px !important;> div{border-left:none;border-radius:0px 4px 4px 0px !important;}}&.alternative{div[role='button']{border-radius:0px 36px 36px 0px !important;> div{border-radius:0px 36px 36px 0px !important;}}}"]);
|
|
33
|
+
exports.RightButtonWrapper = RightButtonWrapper;
|
|
34
|
+
|
|
35
|
+
const InputWrapper = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
36
|
+
displayName: "styles__InputWrapper",
|
|
37
|
+
componentId: "components-web__sc-1lrz1xk-4"
|
|
38
|
+
})(["textalign:start;display:flex;flexdirection:row;flexwrap:nowrap;justifycontent:center;"]);
|
|
39
|
+
|
|
40
|
+
exports.InputWrapper = InputWrapper;
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _componentsBase = require("@telus-uds/components-base");
|
|
13
|
+
|
|
14
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
15
|
+
|
|
16
|
+
var _FullBleedContent = _interopRequireWildcard(require("../shared/FullBleedContent"));
|
|
17
|
+
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
|
|
22
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
+
|
|
24
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
+
|
|
26
|
+
/* eslint-disable react/require-default-props */
|
|
27
|
+
// Passes React Native-oriented system props through UDS PressableCardBase
|
|
28
|
+
const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_componentsBase.a11yProps, _componentsBase.focusHandlerProps, _componentsBase.viewProps]); // Stop changes to the card's inner border width causing the size and
|
|
29
|
+
// apparent position of the full bleed image to change.
|
|
30
|
+
|
|
31
|
+
const FullBleedOffsetOuter = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
32
|
+
displayName: "StoryCard__FullBleedOffsetOuter",
|
|
33
|
+
componentId: "components-web__sc-yhvivu-0"
|
|
34
|
+
})(_ref => {
|
|
35
|
+
let {
|
|
36
|
+
borderOffset
|
|
37
|
+
} = _ref;
|
|
38
|
+
return {
|
|
39
|
+
overflow: 'hidden',
|
|
40
|
+
marginTop: borderOffset * 2
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const FullBleedOffsetInner = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
45
|
+
displayName: "StoryCard__FullBleedOffsetInner",
|
|
46
|
+
componentId: "components-web__sc-yhvivu-1"
|
|
47
|
+
})(_ref2 => {
|
|
48
|
+
let {
|
|
49
|
+
borderOffset
|
|
50
|
+
} = _ref2;
|
|
51
|
+
return {
|
|
52
|
+
position: 'relative',
|
|
53
|
+
margin: 0 - borderOffset
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
/**
|
|
57
|
+
* Showcase and guide users to another page, offering a description of that page's story.
|
|
58
|
+
* Whole card is interactive, width expands based on column or container.
|
|
59
|
+
*
|
|
60
|
+
* - Use `tag` to show category of content
|
|
61
|
+
* - Use `date` to show when the story was published
|
|
62
|
+
* - Use `title` to show title of the story
|
|
63
|
+
* - Use `description` to show description of the story
|
|
64
|
+
* - Use `href` to set the target URL
|
|
65
|
+
* - Use `fullBleedContent` to set the thumbnail image
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
const StoryCard = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
|
|
70
|
+
let {
|
|
71
|
+
tag,
|
|
72
|
+
date,
|
|
73
|
+
title,
|
|
74
|
+
description,
|
|
75
|
+
fullBleedImage,
|
|
76
|
+
fullBleedContent = fullBleedImage,
|
|
77
|
+
onPress,
|
|
78
|
+
href,
|
|
79
|
+
tokens,
|
|
80
|
+
variant = {},
|
|
81
|
+
...rest
|
|
82
|
+
} = _ref3;
|
|
83
|
+
const {
|
|
84
|
+
fullBleedContentPosition,
|
|
85
|
+
contentStackDirection,
|
|
86
|
+
fullBleedContentProps
|
|
87
|
+
} = (0, _FullBleedContent.useFullBleedContentProps)({ ...fullBleedContent,
|
|
88
|
+
position: 'bottom'
|
|
89
|
+
});
|
|
90
|
+
const generalTokens = (0, _componentsBase.useThemeTokens)('StoryCard', tokens, variant);
|
|
91
|
+
const getTokens = (0, _componentsBase.useThemeTokensCallback)('StoryCard', tokens, variant);
|
|
92
|
+
|
|
93
|
+
const getPressableCardTokens = cardState => getTokens(cardState);
|
|
94
|
+
|
|
95
|
+
const {
|
|
96
|
+
hrefAttrs,
|
|
97
|
+
rest: unusedRest
|
|
98
|
+
} = _componentsBase.hrefAttrsProp.bundle(rest);
|
|
99
|
+
|
|
100
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.PressableCardBase, {
|
|
101
|
+
ref: ref,
|
|
102
|
+
onPress: onPress,
|
|
103
|
+
href: href,
|
|
104
|
+
hrefAttrs: hrefAttrs,
|
|
105
|
+
tokens: getPressableCardTokens,
|
|
106
|
+
...selectProps(unusedRest),
|
|
107
|
+
children: cardState => {
|
|
108
|
+
const {
|
|
109
|
+
borderRadius,
|
|
110
|
+
borderWidth
|
|
111
|
+
} = getPressableCardTokens(cardState); // Stop content jumping around as border size changes
|
|
112
|
+
|
|
113
|
+
const borderOffset = borderWidth - generalTokens.borderWidth;
|
|
114
|
+
const fullBleedBorderRadius = (0, _FullBleedContent.getFullBleedBorderRadius)(borderRadius + borderOffset, fullBleedContentPosition);
|
|
115
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_componentsBase.StackView, {
|
|
116
|
+
direction: contentStackDirection,
|
|
117
|
+
tokens: {
|
|
118
|
+
justifyContent: 'space-between',
|
|
119
|
+
flexGrow: 1
|
|
120
|
+
},
|
|
121
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_componentsBase.Box, {
|
|
122
|
+
horizontal: {
|
|
123
|
+
xs: 4,
|
|
124
|
+
lg: 5,
|
|
125
|
+
options: {
|
|
126
|
+
subtract: borderOffset
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
vertical: {
|
|
130
|
+
xs: 5,
|
|
131
|
+
lg: 7,
|
|
132
|
+
options: {
|
|
133
|
+
subtract: borderOffset
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_componentsBase.StackWrap, {
|
|
137
|
+
space: 1,
|
|
138
|
+
tokens: {
|
|
139
|
+
justifyContent: 'space-between',
|
|
140
|
+
alignItems: 'baseline'
|
|
141
|
+
},
|
|
142
|
+
children: [Boolean(tag) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
|
|
143
|
+
variant: {
|
|
144
|
+
size: 'eyebrow',
|
|
145
|
+
colour: 'secondary'
|
|
146
|
+
},
|
|
147
|
+
children: tag
|
|
148
|
+
}), Boolean(date) &&
|
|
149
|
+
/*#__PURE__*/
|
|
150
|
+
// TODO: get user locale and apply date formatting: "MMM DD, YYYY" for `en` and "YYYY-MM-DD" for `fr`
|
|
151
|
+
// Get locale based on decision of https://github.com/telus/universal-design-system/issues/715
|
|
152
|
+
(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
|
|
153
|
+
variant: {
|
|
154
|
+
size: 'small',
|
|
155
|
+
colour: 'secondary'
|
|
156
|
+
},
|
|
157
|
+
children: date
|
|
158
|
+
})]
|
|
159
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Spacer, {
|
|
160
|
+
space: 2
|
|
161
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Divider, {
|
|
162
|
+
variant: {
|
|
163
|
+
decorative: true
|
|
164
|
+
}
|
|
165
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Spacer, {
|
|
166
|
+
space: 3
|
|
167
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
|
|
168
|
+
variant: {
|
|
169
|
+
size: 'h3',
|
|
170
|
+
colour: 'secondary'
|
|
171
|
+
},
|
|
172
|
+
children: title
|
|
173
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Spacer, {
|
|
174
|
+
space: 2
|
|
175
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
|
|
176
|
+
children: description
|
|
177
|
+
})]
|
|
178
|
+
}), Boolean(fullBleedContentProps.src || fullBleedContentProps.content) && /*#__PURE__*/(0, _jsxRuntime.jsx)(FullBleedOffsetOuter, {
|
|
179
|
+
borderOffset: borderOffset,
|
|
180
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(FullBleedOffsetInner, {
|
|
181
|
+
borderOffset: borderOffset,
|
|
182
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullBleedContent.default, {
|
|
183
|
+
borderRadius: fullBleedBorderRadius,
|
|
184
|
+
...fullBleedContentProps
|
|
185
|
+
})
|
|
186
|
+
})
|
|
187
|
+
})]
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
StoryCard.displayName = 'StoryCard';
|
|
193
|
+
StoryCard.propTypes = { ...selectedSystemPropTypes,
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* The URL of the story to be navigated to. Note that `Video` component does not play well when used within
|
|
197
|
+
* a `StoryCard` with `href` prop set (the volume and progress sliders can be clicked but are not draggable).
|
|
198
|
+
* Please use `onPress` prop instead `href` to organize navigation in cases like this.
|
|
199
|
+
*
|
|
200
|
+
* @see https://github.com/telus/allium-design-system/issues/6
|
|
201
|
+
*/
|
|
202
|
+
href: _propTypes.default.string,
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Optional function to be called on press e.g. for within-page navigation.
|
|
206
|
+
*/
|
|
207
|
+
onPress: _propTypes.default.func,
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Text stating the category of the content.
|
|
211
|
+
*/
|
|
212
|
+
tag: _propTypes.default.string,
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Text stating the date a story was published.
|
|
216
|
+
*/
|
|
217
|
+
date: _propTypes.default.string.isRequired,
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Text stating the title or headline of the story.
|
|
221
|
+
*/
|
|
222
|
+
title: _propTypes.default.string.isRequired,
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Text giving a short description of the story. One paragraph of plain text.
|
|
226
|
+
*/
|
|
227
|
+
description: _propTypes.default.string.isRequired,
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Full bleed image to be placed on the card, deprecated in favor of `fullBleedContent`.
|
|
231
|
+
*
|
|
232
|
+
* @deprecated
|
|
233
|
+
*/
|
|
234
|
+
fullBleedImage: _propTypes.default.exact(_FullBleedContent.default.propTypes || {}),
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Full bleed image to be placed on the card.
|
|
238
|
+
*/
|
|
239
|
+
fullBleedContent: _propTypes.default.exact(_FullBleedContent.default.propTypes || {})
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
var _default = (0, _componentsBase.withLinkRouter)(StoryCard);
|
|
243
|
+
|
|
244
|
+
exports.default = _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _StoryCard = _interopRequireDefault(require("./StoryCard"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
var _default = _StoryCard.default;
|
|
13
|
+
exports.default = _default;
|