@telus-uds/components-base 1.18.1 → 1.20.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 +42 -2
- package/__tests17__/ThemeProvider/ThemeProvider.test.jsx +2 -1
- package/component-docs.json +1035 -231
- package/jest.config-android.js +17 -0
- package/jest.config-ios.js +18 -0
- package/jest.config-web.js +31 -0
- package/lib/BaseProvider/index.js +2 -1
- package/lib/Box/Box.js +14 -1
- package/lib/Button/ButtonBase.js +6 -2
- package/lib/Button/ButtonDropdown.js +207 -0
- package/lib/Button/index.js +8 -0
- package/lib/Carousel/Carousel.js +34 -6
- package/lib/Carousel/CarouselItem/CarouselItem.js +7 -1
- package/lib/Carousel/CarouselTabs/CarouselTabsPanel.js +22 -14
- package/lib/FlexGrid/Col/Col.js +1 -3
- package/lib/FlexGrid/FlexGrid.js +3 -5
- package/lib/FlexGrid/Row/Row.js +3 -3
- package/lib/IconButton/IconButton.js +12 -4
- package/lib/MultiSelectFilter/MultiSelectFilter.js +276 -0
- package/lib/MultiSelectFilter/dictionary.js +19 -0
- package/lib/MultiSelectFilter/index.js +13 -0
- package/lib/Pagination/SideButton.js +6 -4
- package/lib/Responsive/Responsive.js +58 -0
- package/lib/Responsive/index.js +13 -0
- package/lib/Search/Search.js +33 -63
- package/lib/Select/Picker.native.js +16 -13
- package/lib/Select/Select.js +7 -1
- package/lib/Select/constants.js +15 -0
- package/lib/StepTracker/Step.js +2 -1
- package/lib/Tags/Tags.js +10 -4
- package/lib/TextInput/TextInput.js +9 -2
- package/lib/TextInput/TextInputBase.js +98 -20
- package/lib/TextInput/dictionary.js +15 -0
- package/lib/ThemeProvider/ThemeProvider.js +6 -1
- package/lib/index.js +18 -0
- package/lib/utils/BaseView/BaseView.js +64 -0
- package/lib/utils/BaseView/BaseView.native.js +16 -0
- package/lib/utils/BaseView/index.js +13 -0
- package/lib/utils/index.js +10 -1
- package/lib/utils/input.js +11 -3
- package/lib/utils/props/handlerProps.js +5 -0
- package/lib-module/BaseProvider/index.js +2 -1
- package/lib-module/Box/Box.js +14 -1
- package/lib-module/Button/ButtonBase.js +6 -2
- package/lib-module/Button/ButtonDropdown.js +181 -0
- package/lib-module/Button/index.js +2 -1
- package/lib-module/Carousel/Carousel.js +34 -6
- package/lib-module/Carousel/CarouselItem/CarouselItem.js +8 -2
- package/lib-module/Carousel/CarouselTabs/CarouselTabsPanel.js +24 -16
- package/lib-module/FlexGrid/Col/Col.js +2 -3
- package/lib-module/FlexGrid/FlexGrid.js +2 -3
- package/lib-module/FlexGrid/Row/Row.js +2 -2
- package/lib-module/IconButton/IconButton.js +14 -4
- package/lib-module/MultiSelectFilter/MultiSelectFilter.js +248 -0
- package/lib-module/MultiSelectFilter/dictionary.js +12 -0
- package/lib-module/MultiSelectFilter/index.js +2 -0
- package/lib-module/Pagination/SideButton.js +6 -4
- package/lib-module/Responsive/Responsive.js +45 -0
- package/lib-module/Responsive/index.js +2 -0
- package/lib-module/Search/Search.js +33 -61
- package/lib-module/Select/Picker.native.js +15 -13
- package/lib-module/Select/Select.js +6 -1
- package/lib-module/Select/constants.js +5 -0
- package/lib-module/StepTracker/Step.js +2 -1
- package/lib-module/Tags/Tags.js +10 -4
- package/lib-module/TextInput/TextInput.js +6 -0
- package/lib-module/TextInput/TextInputBase.js +96 -21
- package/lib-module/TextInput/dictionary.js +8 -0
- package/lib-module/ThemeProvider/ThemeProvider.js +6 -1
- package/lib-module/index.js +2 -0
- package/lib-module/utils/BaseView/BaseView.js +43 -0
- package/lib-module/utils/BaseView/BaseView.native.js +6 -0
- package/lib-module/utils/BaseView/index.js +2 -0
- package/lib-module/utils/index.js +2 -1
- package/lib-module/utils/input.js +11 -3
- package/lib-module/utils/props/handlerProps.js +5 -0
- package/package.json +6 -3
- package/src/BaseProvider/index.jsx +4 -1
- package/src/Box/Box.jsx +14 -1
- package/src/Button/ButtonBase.jsx +4 -2
- package/src/Button/ButtonDropdown.jsx +179 -0
- package/src/Button/index.js +2 -1
- package/src/Carousel/Carousel.jsx +48 -13
- package/src/Carousel/CarouselItem/CarouselItem.jsx +9 -2
- package/src/Carousel/CarouselTabs/CarouselTabsPanel.jsx +19 -15
- package/src/FlexGrid/Col/Col.jsx +4 -4
- package/src/FlexGrid/FlexGrid.jsx +11 -10
- package/src/FlexGrid/Row/Row.jsx +4 -3
- package/src/IconButton/IconButton.jsx +3 -1
- package/src/MultiSelectFilter/MultiSelectFilter.jsx +227 -0
- package/src/MultiSelectFilter/dictionary.js +12 -0
- package/src/MultiSelectFilter/index.js +3 -0
- package/src/Pagination/SideButton.jsx +5 -5
- package/src/Responsive/Responsive.jsx +33 -0
- package/src/Responsive/index.js +3 -0
- package/src/Search/Search.jsx +19 -33
- package/src/Select/Picker.native.jsx +29 -14
- package/src/Select/Select.jsx +7 -1
- package/src/Select/constants.js +5 -0
- package/src/StepTracker/Step.jsx +5 -1
- package/src/Tags/Tags.jsx +46 -33
- package/src/TextInput/TextInput.jsx +5 -0
- package/src/TextInput/TextInputBase.jsx +85 -20
- package/src/TextInput/dictionary.js +8 -0
- package/src/ThemeProvider/ThemeProvider.jsx +5 -1
- package/src/index.js +2 -0
- package/src/utils/BaseView/BaseView.jsx +38 -0
- package/src/utils/BaseView/BaseView.native.jsx +6 -0
- package/src/utils/BaseView/index.js +3 -0
- package/src/utils/index.js +1 -0
- package/src/utils/input.js +9 -4
- package/src/utils/props/handlerProps.js +4 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ANDROID_VALIDATION_ICON_CONTAINER_OFFSET = exports.ANDROID_HORIZONTAL_PADDING_OFFSET = exports.ANDROID_HEIGHT_OFFSET = exports.ANDROID_DEFAULT_PADDING = void 0;
|
|
7
|
+
// Because Android
|
|
8
|
+
const ANDROID_VALIDATION_ICON_CONTAINER_OFFSET = 5;
|
|
9
|
+
exports.ANDROID_VALIDATION_ICON_CONTAINER_OFFSET = ANDROID_VALIDATION_ICON_CONTAINER_OFFSET;
|
|
10
|
+
const ANDROID_HEIGHT_OFFSET = 12;
|
|
11
|
+
exports.ANDROID_HEIGHT_OFFSET = ANDROID_HEIGHT_OFFSET;
|
|
12
|
+
const ANDROID_HORIZONTAL_PADDING_OFFSET = 8;
|
|
13
|
+
exports.ANDROID_HORIZONTAL_PADDING_OFFSET = ANDROID_HORIZONTAL_PADDING_OFFSET;
|
|
14
|
+
const ANDROID_DEFAULT_PADDING = 0;
|
|
15
|
+
exports.ANDROID_DEFAULT_PADDING = ANDROID_DEFAULT_PADDING;
|
package/lib/StepTracker/Step.js
CHANGED
|
@@ -203,7 +203,8 @@ const Step = _ref7 => {
|
|
|
203
203
|
space: 0,
|
|
204
204
|
tokens: {
|
|
205
205
|
alignItems: 'center',
|
|
206
|
-
flexGrow: 0
|
|
206
|
+
flexGrow: 0,
|
|
207
|
+
justifyContent: 'center'
|
|
207
208
|
},
|
|
208
209
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
209
210
|
style: [staticStyles.connector, !isFirst && selectConnectorStyles(themeTokens, isActive)]
|
package/lib/Tags/Tags.js
CHANGED
|
@@ -42,7 +42,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
42
42
|
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]);
|
|
43
43
|
const [selectItemProps, selectedItemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.focusHandlerProps, _utils.pressProps, _utils.viewProps]);
|
|
44
44
|
|
|
45
|
-
const
|
|
45
|
+
const separateIconTextTokens = (_ref, returnRest) => {
|
|
46
46
|
let {
|
|
47
47
|
icon,
|
|
48
48
|
iconPosition,
|
|
@@ -54,9 +54,10 @@ const selectIconTextTokens = _ref => {
|
|
|
54
54
|
iconAlignSelf,
|
|
55
55
|
iconPadding,
|
|
56
56
|
iconTranslateX,
|
|
57
|
-
iconTranslateY
|
|
57
|
+
iconTranslateY,
|
|
58
|
+
...rest
|
|
58
59
|
} = _ref;
|
|
59
|
-
return {
|
|
60
|
+
return returnRest ? rest : {
|
|
60
61
|
icon,
|
|
61
62
|
iconPosition,
|
|
62
63
|
iconSpace,
|
|
@@ -81,6 +82,10 @@ const selectIconTextTokens = _ref => {
|
|
|
81
82
|
};
|
|
82
83
|
};
|
|
83
84
|
|
|
85
|
+
const selectIconTextTokens = tokens => separateIconTextTokens(tokens, false);
|
|
86
|
+
|
|
87
|
+
const selectNonIconTextTokens = tokens => separateIconTextTokens(tokens, true);
|
|
88
|
+
|
|
84
89
|
const Tags = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
85
90
|
let {
|
|
86
91
|
variant,
|
|
@@ -109,7 +114,8 @@ const Tags = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
109
114
|
} = themeTokens;
|
|
110
115
|
const getItemTokens = (0, _ThemeProvider.useThemeTokensCallback)('TagsItem', tokens, variant);
|
|
111
116
|
|
|
112
|
-
const getButtonTokens = buttonState =>
|
|
117
|
+
const getButtonTokens = buttonState => // Remove icon-text-related tokens, since we want to handle them ourselves, not use ButtonBase's handling
|
|
118
|
+
(0, _utils.selectTokens)('Button', selectNonIconTextTokens(getItemTokens(buttonState)));
|
|
113
119
|
|
|
114
120
|
const {
|
|
115
121
|
currentValues,
|
|
@@ -7,13 +7,15 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
10
12
|
var _utils = require("../utils");
|
|
11
13
|
|
|
12
14
|
var _InputSupports = _interopRequireDefault(require("../InputSupports"));
|
|
13
15
|
|
|
14
16
|
var _TextInputBase = _interopRequireDefault(require("./TextInputBase"));
|
|
15
17
|
|
|
16
|
-
var
|
|
18
|
+
var _propTypes2 = _interopRequireDefault(require("./propTypes"));
|
|
17
19
|
|
|
18
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
21
|
|
|
@@ -79,7 +81,12 @@ const TextInput = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
79
81
|
});
|
|
80
82
|
TextInput.displayName = 'TextInput';
|
|
81
83
|
TextInput.propTypes = { ...selectedSystemPropTypes,
|
|
82
|
-
...
|
|
84
|
+
..._propTypes2.default,
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* A callback which if provided will get a clear button rendered and will be called whenever that button gets pressed.
|
|
88
|
+
*/
|
|
89
|
+
onClear: _propTypes.default.func,
|
|
83
90
|
tokens: (0, _utils.getTokensPropType)('TextInput'),
|
|
84
91
|
variant: _utils.variantProp.propType
|
|
85
92
|
};
|
|
@@ -7,6 +7,8 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
10
12
|
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
11
13
|
|
|
12
14
|
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
@@ -15,12 +17,16 @@ var _TextInput = _interopRequireDefault(require("react-native-web/dist/cjs/expor
|
|
|
15
17
|
|
|
16
18
|
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
17
19
|
|
|
18
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
19
|
-
|
|
20
20
|
var _ThemeProvider = require("../ThemeProvider");
|
|
21
21
|
|
|
22
|
+
var _StackView = _interopRequireDefault(require("../StackView"));
|
|
23
|
+
|
|
24
|
+
var _IconButton = _interopRequireDefault(require("../IconButton"));
|
|
25
|
+
|
|
22
26
|
var _utils = require("../utils");
|
|
23
27
|
|
|
28
|
+
var _dictionary = _interopRequireDefault(require("./dictionary"));
|
|
29
|
+
|
|
24
30
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
31
|
|
|
26
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -133,35 +139,49 @@ const selectIconTokens = _ref3 => {
|
|
|
133
139
|
};
|
|
134
140
|
};
|
|
135
141
|
|
|
136
|
-
const selectIconContainerStyles = _ref4 => {
|
|
142
|
+
const selectIconContainerStyles = (_ref4, buttonCount) => {
|
|
137
143
|
let {
|
|
144
|
+
buttonSize,
|
|
145
|
+
buttonsGapSize,
|
|
138
146
|
paddingRight,
|
|
139
147
|
paddingBottom
|
|
140
148
|
} = _ref4;
|
|
141
149
|
return {
|
|
142
|
-
paddingRight,
|
|
150
|
+
paddingRight: paddingRight + buttonCount * (buttonSize + buttonsGapSize),
|
|
143
151
|
paddingBottom
|
|
144
152
|
};
|
|
145
153
|
};
|
|
146
154
|
|
|
147
|
-
const
|
|
155
|
+
const selectButtonsContainerStyle = _ref5 => {
|
|
148
156
|
let {
|
|
149
|
-
|
|
157
|
+
buttonsPaddingRight
|
|
158
|
+
} = _ref5;
|
|
159
|
+
return {
|
|
160
|
+
paddingRight: buttonsPaddingRight
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const TextInputBase = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
|
|
165
|
+
let {
|
|
166
|
+
buttons = [],
|
|
167
|
+
copy = 'en',
|
|
150
168
|
height,
|
|
151
|
-
initialValue,
|
|
152
169
|
inactive,
|
|
153
|
-
|
|
170
|
+
initialValue,
|
|
171
|
+
onBlur,
|
|
154
172
|
onChange,
|
|
155
173
|
onChangeText,
|
|
174
|
+
onClear,
|
|
156
175
|
onFocus,
|
|
157
|
-
onBlur,
|
|
158
|
-
onMouseOver,
|
|
159
176
|
onMouseOut,
|
|
177
|
+
onMouseOver,
|
|
160
178
|
pattern,
|
|
179
|
+
readOnly,
|
|
161
180
|
tokens,
|
|
181
|
+
value,
|
|
162
182
|
variant = {},
|
|
163
183
|
...rest
|
|
164
|
-
} =
|
|
184
|
+
} = _ref6;
|
|
165
185
|
const [isFocused, setIsFocused] = (0, _react.useState)(false);
|
|
166
186
|
|
|
167
187
|
const handleFocus = event => {
|
|
@@ -186,17 +206,22 @@ const TextInputBase = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
186
206
|
if (typeof onMouseOut === 'function') onMouseOut(event);
|
|
187
207
|
};
|
|
188
208
|
|
|
209
|
+
const defaultRef = (0, _react.useRef)();
|
|
210
|
+
const inputRef = ref !== null && ref !== void 0 ? ref : defaultRef;
|
|
189
211
|
const {
|
|
190
212
|
currentValue,
|
|
213
|
+
resetValue,
|
|
191
214
|
setValue,
|
|
192
|
-
isControlled
|
|
215
|
+
isControlled,
|
|
216
|
+
isDirty
|
|
193
217
|
} = (0, _utils.useInputValue)({
|
|
194
218
|
value,
|
|
195
219
|
initialValue,
|
|
220
|
+
inputRef,
|
|
196
221
|
onChange,
|
|
197
222
|
readOnly
|
|
198
223
|
});
|
|
199
|
-
const element =
|
|
224
|
+
const element = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current;
|
|
200
225
|
(0, _react.useEffect)(() => {
|
|
201
226
|
if (_Platform.default.OS === 'web' && pattern && element) {
|
|
202
227
|
// React Native Web doesn't support `pattern`, so we have to attach it via a ref,
|
|
@@ -220,8 +245,35 @@ const TextInputBase = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
220
245
|
};
|
|
221
246
|
const themeTokens = (0, _ThemeProvider.useThemeTokens)('TextInput', tokens, variant, states);
|
|
222
247
|
const {
|
|
248
|
+
buttonsGap,
|
|
249
|
+
clearButtonIcon: ClearButtonIcon,
|
|
223
250
|
icon: IconComponent
|
|
224
251
|
} = themeTokens;
|
|
252
|
+
const buttonsGapSize = (0, _utils.useSpacingScale)(buttonsGap);
|
|
253
|
+
const getCopy = (0, _utils.useCopy)({
|
|
254
|
+
dictionary: _dictionary.default,
|
|
255
|
+
copy
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
if (onClear && isDirty) {
|
|
259
|
+
const handleClear = event => {
|
|
260
|
+
var _inputRef$current;
|
|
261
|
+
|
|
262
|
+
onClear === null || onClear === void 0 ? void 0 : onClear(event);
|
|
263
|
+
resetValue(event);
|
|
264
|
+
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
buttons === null || buttons === void 0 ? void 0 : buttons.unshift( /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
268
|
+
accessibilityLabel: getCopy('clearButtonAccessibilityLabel'),
|
|
269
|
+
icon: ClearButtonIcon,
|
|
270
|
+
onPress: handleClear,
|
|
271
|
+
variant: {
|
|
272
|
+
compact: true
|
|
273
|
+
}
|
|
274
|
+
}, "clear"));
|
|
275
|
+
}
|
|
276
|
+
|
|
225
277
|
const inputProps = { ...selectProps(rest),
|
|
226
278
|
editable: !inactive,
|
|
227
279
|
onFocus: handleFocus,
|
|
@@ -243,38 +295,64 @@ const TextInputBase = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
243
295
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
244
296
|
style: selectOuterBorderStyles(themeTokens),
|
|
245
297
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TextInput.default, {
|
|
246
|
-
ref:
|
|
298
|
+
ref: inputRef,
|
|
247
299
|
style: nativeInputStyle,
|
|
248
300
|
...inputProps
|
|
249
301
|
}), IconComponent && /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
250
302
|
pointerEvents: "none" // avoid hijacking input press events
|
|
251
303
|
,
|
|
252
|
-
style: [staticStyles.iconContainer, selectIconContainerStyles(themeTokens
|
|
304
|
+
style: [staticStyles.iconContainer, selectIconContainerStyles({ ...themeTokens,
|
|
305
|
+
buttonsGapSize
|
|
306
|
+
}, buttons === null || buttons === void 0 ? void 0 : buttons.length)],
|
|
253
307
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, { ...selectIconTokens(themeTokens)
|
|
254
308
|
})
|
|
309
|
+
}), (buttons === null || buttons === void 0 ? void 0 : buttons.length) > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
310
|
+
style: [staticStyles.buttonsContainer, selectButtonsContainerStyle(themeTokens)],
|
|
311
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_StackView.default, {
|
|
312
|
+
direction: "row",
|
|
313
|
+
space: buttonsGap,
|
|
314
|
+
children: buttons
|
|
315
|
+
})
|
|
255
316
|
})]
|
|
256
317
|
});
|
|
257
318
|
});
|
|
258
319
|
TextInputBase.displayName = 'TextInputBase';
|
|
259
320
|
TextInputBase.propTypes = { ...selectedSystemPropTypes,
|
|
260
|
-
|
|
321
|
+
buttons: _propTypes.default.arrayOf(_propTypes.default.node),
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Select English or French copy for the accessible labels.
|
|
325
|
+
* You may also pass in a custom dictionary object.
|
|
326
|
+
*/
|
|
327
|
+
copy: _propTypes.default.oneOfType([_propTypes.default.oneOf(['en', 'fr']), _propTypes.default.shape({
|
|
328
|
+
clearButtonAccessibilityLabel: _propTypes.default.string
|
|
329
|
+
})]),
|
|
261
330
|
height: _propTypes.default.number,
|
|
262
|
-
initialValue: _propTypes.default.string,
|
|
263
331
|
inactive: _propTypes.default.bool,
|
|
264
|
-
|
|
332
|
+
initialValue: _propTypes.default.string,
|
|
333
|
+
onBlur: _propTypes.default.func,
|
|
265
334
|
onChange: _propTypes.default.func,
|
|
266
335
|
onChangeText: _propTypes.default.func,
|
|
336
|
+
onClear: _propTypes.default.func,
|
|
267
337
|
onFocus: _propTypes.default.func,
|
|
268
|
-
onBlur: _propTypes.default.func,
|
|
269
|
-
onMouseOver: _propTypes.default.func,
|
|
270
338
|
onMouseOut: _propTypes.default.func,
|
|
339
|
+
onMouseOver: _propTypes.default.func,
|
|
340
|
+
readOnly: _propTypes.default.bool,
|
|
271
341
|
tokens: (0, _utils.getTokensPropType)('TextInput', 'TextArea'),
|
|
342
|
+
value: _propTypes.default.string,
|
|
272
343
|
variant: _utils.variantProp.propType
|
|
273
344
|
};
|
|
274
345
|
var _default = TextInputBase;
|
|
275
346
|
exports.default = _default;
|
|
276
347
|
|
|
277
348
|
const staticStyles = _StyleSheet.default.create({
|
|
349
|
+
buttonsContainer: {
|
|
350
|
+
position: 'absolute',
|
|
351
|
+
right: 0,
|
|
352
|
+
top: 0,
|
|
353
|
+
bottom: 0,
|
|
354
|
+
justifyContent: 'center'
|
|
355
|
+
},
|
|
278
356
|
iconContainer: {
|
|
279
357
|
position: 'absolute',
|
|
280
358
|
right: 0,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _default = {
|
|
8
|
+
en: {
|
|
9
|
+
clearButtonAccessibilityLabel: 'Clear'
|
|
10
|
+
},
|
|
11
|
+
fr: {
|
|
12
|
+
clearButtonAccessibilityLabel: 'Effacer'
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
exports.default = _default;
|
|
@@ -33,8 +33,10 @@ const ThemeProvider = _ref => {
|
|
|
33
33
|
children,
|
|
34
34
|
defaultTheme,
|
|
35
35
|
// TODO: switch `forceAbsoluteFontSizing` to be false by default in the next major version
|
|
36
|
+
// TODO: switch `forceZIndex` to be false by default in the next major version
|
|
36
37
|
themeOptions = {
|
|
37
|
-
forceAbsoluteFontSizing: true
|
|
38
|
+
forceAbsoluteFontSizing: true,
|
|
39
|
+
forceZIndex: true
|
|
38
40
|
}
|
|
39
41
|
} = _ref;
|
|
40
42
|
const [theme, setTheme] = (0, _react.useState)(defaultTheme); // Validate the theme tokens version on every render.
|
|
@@ -69,9 +71,12 @@ ThemeProvider.propTypes = {
|
|
|
69
71
|
* relative sizing (in `rem`, scales depending on the browser settings)
|
|
70
72
|
* - `contentMaxWidth`: allows configuration of the content max width to be used in components
|
|
71
73
|
* such as Footnote and Notification to avoid content to stretch width more then the page's width
|
|
74
|
+
* - `forceZIndex`: available on web only, when set to false, sets zIndex on `View` to be `auto`
|
|
75
|
+
* and when true, sets zIndex to be `0` (the default from `react-native-web`)
|
|
72
76
|
*/
|
|
73
77
|
themeOptions: _propTypes.default.shape({
|
|
74
78
|
forceAbsoluteFontSizing: _propTypes.default.bool,
|
|
79
|
+
forceZIndex: _propTypes.default.bool,
|
|
75
80
|
contentMaxWidth: _responsiveProps.default.getTypeOptionallyByViewport(_propTypes.default.number)
|
|
76
81
|
})
|
|
77
82
|
};
|
package/lib/index.js
CHANGED
|
@@ -25,12 +25,14 @@ var _exportNames = {
|
|
|
25
25
|
ListItem: true,
|
|
26
26
|
ListBase: true,
|
|
27
27
|
Modal: true,
|
|
28
|
+
MultiSelectFilter: true,
|
|
28
29
|
Notification: true,
|
|
29
30
|
Pagination: true,
|
|
30
31
|
Progress: true,
|
|
31
32
|
QuickLinks: true,
|
|
32
33
|
Radio: true,
|
|
33
34
|
RadioCard: true,
|
|
35
|
+
Responsive: true,
|
|
34
36
|
Search: true,
|
|
35
37
|
Select: true,
|
|
36
38
|
SideNav: true,
|
|
@@ -193,6 +195,12 @@ Object.defineProperty(exports, "Modal", {
|
|
|
193
195
|
return _Modal.default;
|
|
194
196
|
}
|
|
195
197
|
});
|
|
198
|
+
Object.defineProperty(exports, "MultiSelectFilter", {
|
|
199
|
+
enumerable: true,
|
|
200
|
+
get: function () {
|
|
201
|
+
return _MultiSelectFilter.default;
|
|
202
|
+
}
|
|
203
|
+
});
|
|
196
204
|
Object.defineProperty(exports, "Notification", {
|
|
197
205
|
enumerable: true,
|
|
198
206
|
get: function () {
|
|
@@ -241,6 +249,12 @@ Object.defineProperty(exports, "RadioCard", {
|
|
|
241
249
|
return _RadioCard.default;
|
|
242
250
|
}
|
|
243
251
|
});
|
|
252
|
+
Object.defineProperty(exports, "Responsive", {
|
|
253
|
+
enumerable: true,
|
|
254
|
+
get: function () {
|
|
255
|
+
return _Responsive.default;
|
|
256
|
+
}
|
|
257
|
+
});
|
|
244
258
|
Object.defineProperty(exports, "Search", {
|
|
245
259
|
enumerable: true,
|
|
246
260
|
get: function () {
|
|
@@ -510,6 +524,8 @@ var _List = _interopRequireWildcard(require("./List"));
|
|
|
510
524
|
|
|
511
525
|
var _Modal = _interopRequireDefault(require("./Modal"));
|
|
512
526
|
|
|
527
|
+
var _MultiSelectFilter = _interopRequireDefault(require("./MultiSelectFilter"));
|
|
528
|
+
|
|
513
529
|
var _Notification = _interopRequireDefault(require("./Notification"));
|
|
514
530
|
|
|
515
531
|
var _Pagination = _interopRequireDefault(require("./Pagination"));
|
|
@@ -546,6 +562,8 @@ Object.keys(_RadioCard).forEach(function (key) {
|
|
|
546
562
|
});
|
|
547
563
|
});
|
|
548
564
|
|
|
565
|
+
var _Responsive = _interopRequireDefault(require("./Responsive"));
|
|
566
|
+
|
|
549
567
|
var _Search = _interopRequireDefault(require("./Search"));
|
|
550
568
|
|
|
551
569
|
var _Select = _interopRequireDefault(require("./Select"));
|
|
@@ -0,0 +1,64 @@
|
|
|
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 _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
11
|
+
|
|
12
|
+
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
13
|
+
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
+
|
|
16
|
+
var _ThemeProvider = require("../../ThemeProvider");
|
|
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
|
+
/**
|
|
27
|
+
* Identical to React Native's View and supporting all the same props, but with:
|
|
28
|
+
* - a zIndex: 'auto' style added to prevent unexpectedly causing children to overlap other elements from other stacking contexts
|
|
29
|
+
*/
|
|
30
|
+
const BaseView = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
31
|
+
let {
|
|
32
|
+
children,
|
|
33
|
+
style,
|
|
34
|
+
...rest
|
|
35
|
+
} = _ref;
|
|
36
|
+
const {
|
|
37
|
+
themeOptions
|
|
38
|
+
} = (0, _ThemeProvider.useTheme)();
|
|
39
|
+
const styleProp = Array.isArray(style) ? [...style] : [style];
|
|
40
|
+
|
|
41
|
+
if (!themeOptions.forceZIndex) {
|
|
42
|
+
styleProp.unshift(styles.resetZIndex);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, { ...rest,
|
|
46
|
+
style: styleProp,
|
|
47
|
+
ref: ref,
|
|
48
|
+
children: children
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
BaseView.displayName = 'BaseView';
|
|
52
|
+
|
|
53
|
+
const styles = _StyleSheet.default.create({
|
|
54
|
+
resetZIndex: {
|
|
55
|
+
zIndex: 'auto'
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
BaseView.propTypes = {
|
|
60
|
+
children: _propTypes.default.node,
|
|
61
|
+
style: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.array])
|
|
62
|
+
};
|
|
63
|
+
var _default = BaseView;
|
|
64
|
+
exports.default = _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Android crashes on non-standard style properties like `zIndex` so adding a `BaseView` for native platforms
|
|
14
|
+
*/
|
|
15
|
+
var _default = _View.default;
|
|
16
|
+
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 _BaseView = _interopRequireDefault(require("./BaseView"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
var _default = _BaseView.default;
|
|
13
|
+
exports.default = _default;
|
package/lib/utils/index.js
CHANGED
|
@@ -13,8 +13,15 @@ var _exportNames = {
|
|
|
13
13
|
useScrollBlocking: true,
|
|
14
14
|
useUniqueId: true,
|
|
15
15
|
withLinkRouter: true,
|
|
16
|
-
containUniqueFields: true
|
|
16
|
+
containUniqueFields: true,
|
|
17
|
+
BaseView: true
|
|
17
18
|
};
|
|
19
|
+
Object.defineProperty(exports, "BaseView", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return _BaseView.default;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
18
25
|
Object.defineProperty(exports, "containUniqueFields", {
|
|
19
26
|
enumerable: true,
|
|
20
27
|
get: function () {
|
|
@@ -206,6 +213,8 @@ Object.keys(_ssr).forEach(function (key) {
|
|
|
206
213
|
|
|
207
214
|
var _containUniqueFields = _interopRequireDefault(require("./containUniqueFields"));
|
|
208
215
|
|
|
216
|
+
var _BaseView = _interopRequireDefault(require("./BaseView"));
|
|
217
|
+
|
|
209
218
|
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); }
|
|
210
219
|
|
|
211
220
|
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; }
|
package/lib/utils/input.js
CHANGED
|
@@ -84,6 +84,7 @@ const useInputValue = function () {
|
|
|
84
84
|
const {
|
|
85
85
|
value,
|
|
86
86
|
initialValue,
|
|
87
|
+
inputRef,
|
|
87
88
|
onChange,
|
|
88
89
|
readOnly = false
|
|
89
90
|
} = props;
|
|
@@ -97,19 +98,26 @@ const useInputValue = function () {
|
|
|
97
98
|
}); // Make current value accessible inside useCallback without rememoizing every time the value changes
|
|
98
99
|
|
|
99
100
|
valueRef.current.value = currentValue;
|
|
101
|
+
const isDirty = currentValue !== valueRef.current.initial;
|
|
100
102
|
const setValue = (0, _react.useCallback)((arg, event) => {
|
|
101
103
|
if (readOnly) return;
|
|
102
104
|
const newValue = typeof arg === 'function' ? arg(valueRef.current.value) : arg;
|
|
103
|
-
|
|
105
|
+
|
|
106
|
+
if (!isControlled) {
|
|
107
|
+
setOwnValue(newValue);
|
|
108
|
+
if (inputRef !== null && inputRef !== void 0 && inputRef.current) inputRef.current.value = newValue !== null && newValue !== void 0 ? newValue : '';
|
|
109
|
+
} // Call onChange handler if there's something for it to handle (event or a changed value)
|
|
110
|
+
|
|
104
111
|
|
|
105
112
|
if (onChange && (event || valueRef.current.value !== newValue)) onChange(newValue, event);
|
|
106
|
-
}, [isControlled, onChange, readOnly]);
|
|
113
|
+
}, [inputRef, isControlled, onChange, readOnly]);
|
|
107
114
|
const resetValue = (0, _react.useCallback)(event => setValue(valueRef.current.initial, event), [setValue]);
|
|
108
115
|
return {
|
|
109
116
|
currentValue,
|
|
110
117
|
setValue,
|
|
111
118
|
resetValue,
|
|
112
|
-
isControlled
|
|
119
|
+
isControlled,
|
|
120
|
+
isDirty
|
|
113
121
|
};
|
|
114
122
|
};
|
|
115
123
|
/**
|
|
@@ -34,7 +34,8 @@ BaseProvider.propTypes = {
|
|
|
34
34
|
children: PropTypes.node.isRequired,
|
|
35
35
|
defaultTheme: (_ThemeProvider$propTy = ThemeProvider.propTypes) === null || _ThemeProvider$propTy === void 0 ? void 0 : _ThemeProvider$propTy.defaultTheme,
|
|
36
36
|
themeOptions: PropTypes.shape({
|
|
37
|
-
forceAbsoluteFontSizing: PropTypes.bool
|
|
37
|
+
forceAbsoluteFontSizing: PropTypes.bool,
|
|
38
|
+
forceZIndex: PropTypes.bool
|
|
38
39
|
})
|
|
39
40
|
};
|
|
40
41
|
export default BaseProvider;
|
package/lib-module/Box/Box.js
CHANGED
|
@@ -14,9 +14,22 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, vie
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
const selectBoxStyles = tokens => {
|
|
17
|
-
|
|
17
|
+
let styles = {
|
|
18
18
|
backgroundColor: tokens.backgroundColor
|
|
19
19
|
};
|
|
20
|
+
|
|
21
|
+
if (tokens.gradient) {
|
|
22
|
+
const {
|
|
23
|
+
gradient: {
|
|
24
|
+
angle,
|
|
25
|
+
stops: [stopOne, stopTwo]
|
|
26
|
+
}
|
|
27
|
+
} = tokens;
|
|
28
|
+
styles = { ...styles,
|
|
29
|
+
backgroundImage: "linear-gradient(".concat(angle, "deg, ").concat(stopOne.color, ", 75% , ").concat(stopTwo.color, ")")
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
20
33
|
const paddings = ['paddingLeft', 'paddingRight', 'paddingTop', 'paddingBottom']; // Only set on styles if token provided because we spread this object after the spacing scale values
|
|
21
34
|
|
|
22
35
|
paddings.forEach(side => {
|
|
@@ -139,7 +139,9 @@ const selectTextStyles = (_ref6, themeOptions) => {
|
|
|
139
139
|
lineHeight,
|
|
140
140
|
fontName,
|
|
141
141
|
fontWeight,
|
|
142
|
-
textAlign
|
|
142
|
+
textAlign,
|
|
143
|
+
textLine,
|
|
144
|
+
textLineStyle
|
|
143
145
|
} = _ref6;
|
|
144
146
|
return applyTextStyles({
|
|
145
147
|
fontSize,
|
|
@@ -148,7 +150,9 @@ const selectTextStyles = (_ref6, themeOptions) => {
|
|
|
148
150
|
fontName,
|
|
149
151
|
fontWeight,
|
|
150
152
|
themeOptions,
|
|
151
|
-
textAlign
|
|
153
|
+
textAlign,
|
|
154
|
+
textDecorationLine: textLine,
|
|
155
|
+
textDecorationStyle: textLineStyle
|
|
152
156
|
});
|
|
153
157
|
};
|
|
154
158
|
|