@telus-uds/components-base 1.19.0 → 1.19.1
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 +2 -2
- package/lib/ActivityIndicator/Spinner.js +7 -7
- package/lib/ActivityIndicator/Spinner.native.js +2 -2
- package/lib/BaseProvider/HydrationContext.js +1 -1
- package/lib/BaseProvider/TamaguiProvider.js +30 -0
- package/lib/Button/ButtonBase.js +2 -2
- package/lib/Button/ButtonDropdown.js +207 -0
- package/lib/Button/ButtonGroup.js +1 -1
- package/lib/Carousel/Carousel.js +2 -4
- package/lib/Carousel/CarouselContext.js +1 -1
- package/lib/Carousel/CarouselFirstFocus/CarouselFirstFocus.js +1 -1
- package/lib/Carousel/CarouselThumbnail.js +2 -2
- package/lib/Checkbox/Checkbox.js +1 -1
- package/lib/Checkbox/CheckboxGroup.js +2 -2
- package/lib/Divider/Divider.js +2 -2
- package/lib/FlexGrid/Col/Col.js +1 -1
- package/lib/Icon/Icon.js +1 -1
- package/lib/MultiSelectFilter/ModalOverlay.js +136 -0
- package/lib/MultiSelectFilter/MultiSelectFilter.js +314 -0
- package/lib/MultiSelectFilter/dictionary.js +19 -0
- package/lib/MultiSelectFilter/index.js +13 -0
- package/lib/Pagination/PageButton.js +2 -2
- package/lib/Pagination/Pagination.js +3 -5
- package/lib/Pagination/usePagination.js +2 -2
- package/lib/Progress/ProgressBar.js +3 -3
- package/lib/Progress/ProgressBarBackground.js +3 -3
- package/lib/QuickLinksFeature/QuickLinksFeature.js +91 -0
- package/lib/QuickLinksFeature/QuickLinksFeatureItem.js +157 -0
- package/lib/QuickLinksFeature/index.js +16 -0
- package/lib/Radio/Radio.js +2 -2
- package/lib/Radio/RadioGroup.js +2 -2
- package/lib/RadioCard/RadioCard.js +1 -1
- package/lib/RadioCard/RadioCardGroup.js +2 -2
- package/lib/Search/Search.js +1 -1
- package/lib/Select/constants.js +15 -0
- package/lib/SideNav/SideNav.js +2 -2
- package/lib/Skeleton/Skeleton.js +1 -1
- package/lib/Skeleton/skeletonWebAnimation.js +1 -1
- package/lib/StackView/StackWrap.js +1 -3
- package/lib/StackView/getStackedContent.js +2 -2
- package/lib/Tabs/Tabs.js +2 -4
- package/lib/Tags/Tags.js +1 -1
- package/lib/TextInput/dictionary.js +19 -0
- package/lib/ThemeProvider/utils/styles.js +3 -3
- package/lib/ThemeProvider/utils/theme-tokens.js +9 -7
- package/lib/Timeline/Timeline.js +1 -1
- package/lib/ToggleSwitch/ToggleSwitch.js +1 -1
- package/lib/ToggleSwitch/ToggleSwitchGroup.js +1 -1
- package/lib/Tooltip/Backdrop.js +10 -2
- package/lib/Tooltip/Tooltip.native.js +357 -0
- package/lib/Tooltip/shared.js +39 -0
- package/lib/Validator/Validator.js +271 -0
- package/lib/Validator/index.js +13 -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/animation/useVerticalExpandAnimation.js +1 -1
- package/lib/utils/children.js +2 -2
- package/lib/utils/floating-ui/index.js +43 -0
- package/lib/utils/floating-ui/index.native.js +43 -0
- package/lib/utils/input.js +12 -6
- package/lib/utils/props/componentPropType.js +3 -3
- package/lib/utils/props/selectSystemProps.js +2 -2
- package/lib/utils/props/tokens.js +2 -2
- package/lib/utils/useOverlaidPosition.js +243 -0
- package/lib/utils/useSpacingScale.js +1 -3
- package/lib/utils/useUniqueId.js +1 -1
- package/lib-module/ActivityIndicator/Spinner.js +7 -7
- package/lib-module/ActivityIndicator/Spinner.native.js +2 -2
- package/lib-module/BaseProvider/HydrationContext.js +1 -1
- package/lib-module/BaseProvider/TamaguiProvider.js +22 -0
- package/lib-module/Button/ButtonBase.js +2 -2
- package/lib-module/Button/ButtonDropdown.js +181 -0
- package/lib-module/Button/ButtonGroup.js +1 -1
- package/lib-module/Carousel/Carousel.js +2 -4
- package/lib-module/Carousel/CarouselContext.js +1 -1
- package/lib-module/Carousel/CarouselFirstFocus/CarouselFirstFocus.js +1 -1
- package/lib-module/Carousel/CarouselThumbnail.js +2 -2
- package/lib-module/Checkbox/Checkbox.js +1 -1
- package/lib-module/Checkbox/CheckboxGroup.js +2 -2
- package/lib-module/Divider/Divider.js +2 -2
- package/lib-module/FlexGrid/Col/Col.js +1 -1
- package/lib-module/Icon/Icon.js +1 -1
- package/lib-module/MultiSelectFilter/ModalOverlay.js +112 -0
- package/lib-module/MultiSelectFilter/MultiSelectFilter.js +286 -0
- package/lib-module/MultiSelectFilter/dictionary.js +12 -0
- package/lib-module/MultiSelectFilter/index.js +2 -0
- package/lib-module/Pagination/PageButton.js +2 -2
- package/lib-module/Pagination/Pagination.js +3 -5
- package/lib-module/Pagination/usePagination.js +2 -2
- package/lib-module/Progress/ProgressBar.js +3 -3
- package/lib-module/Progress/ProgressBarBackground.js +3 -3
- package/lib-module/QuickLinksFeature/QuickLinksFeature.js +69 -0
- package/lib-module/QuickLinksFeature/QuickLinksFeatureItem.js +130 -0
- package/lib-module/QuickLinksFeature/index.js +4 -0
- package/lib-module/Radio/Radio.js +2 -2
- package/lib-module/Radio/RadioGroup.js +2 -2
- package/lib-module/RadioCard/RadioCard.js +1 -1
- package/lib-module/RadioCard/RadioCardGroup.js +2 -2
- package/lib-module/Search/Search.js +1 -1
- package/lib-module/Select/constants.js +5 -0
- package/lib-module/SideNav/SideNav.js +2 -2
- package/lib-module/Skeleton/Skeleton.js +1 -1
- package/lib-module/Skeleton/skeletonWebAnimation.js +1 -1
- package/lib-module/StackView/StackWrap.js +1 -3
- package/lib-module/StackView/getStackedContent.js +2 -2
- package/lib-module/Tabs/Tabs.js +2 -4
- package/lib-module/Tags/Tags.js +1 -1
- package/lib-module/TextInput/dictionary.js +12 -0
- package/lib-module/ThemeProvider/utils/styles.js +3 -3
- package/lib-module/ThemeProvider/utils/theme-tokens.js +9 -7
- package/lib-module/Timeline/Timeline.js +1 -1
- package/lib-module/ToggleSwitch/ToggleSwitch.js +1 -1
- package/lib-module/ToggleSwitch/ToggleSwitchGroup.js +1 -1
- package/lib-module/Tooltip/Backdrop.js +10 -2
- package/lib-module/Tooltip/Tooltip.native.js +326 -0
- package/lib-module/Tooltip/shared.js +27 -0
- package/lib-module/Validator/Validator.js +245 -0
- package/lib-module/Validator/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/animation/useVerticalExpandAnimation.js +1 -1
- package/lib-module/utils/children.js +2 -2
- package/lib-module/utils/floating-ui/index.js +1 -0
- package/lib-module/utils/floating-ui/index.native.js +1 -0
- package/lib-module/utils/input.js +12 -6
- package/lib-module/utils/props/componentPropType.js +3 -3
- package/lib-module/utils/props/selectSystemProps.js +2 -2
- package/lib-module/utils/props/tokens.js +2 -2
- package/lib-module/utils/useOverlaidPosition.js +232 -0
- package/lib-module/utils/useSpacingScale.js +1 -3
- package/lib-module/utils/useUniqueId.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,314 @@
|
|
|
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 _ThemeProvider = require("../ThemeProvider");
|
|
13
|
+
|
|
14
|
+
var _utils = require("../utils");
|
|
15
|
+
|
|
16
|
+
var _dictionary = _interopRequireDefault(require("./dictionary"));
|
|
17
|
+
|
|
18
|
+
var _Box = _interopRequireDefault(require("../Box"));
|
|
19
|
+
|
|
20
|
+
var _Button = require("../Button");
|
|
21
|
+
|
|
22
|
+
var _Checkbox = require("../Checkbox");
|
|
23
|
+
|
|
24
|
+
var _Divider = _interopRequireDefault(require("../Divider"));
|
|
25
|
+
|
|
26
|
+
var _FlexGrid = _interopRequireDefault(require("../FlexGrid"));
|
|
27
|
+
|
|
28
|
+
var _Spacer = _interopRequireDefault(require("../Spacer"));
|
|
29
|
+
|
|
30
|
+
var _StackView = _interopRequireDefault(require("../StackView"));
|
|
31
|
+
|
|
32
|
+
var _Typography = _interopRequireDefault(require("../Typography"));
|
|
33
|
+
|
|
34
|
+
var _Link = require("../Link");
|
|
35
|
+
|
|
36
|
+
var _ModalOverlay = _interopRequireDefault(require("./ModalOverlay"));
|
|
37
|
+
|
|
38
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
39
|
+
|
|
40
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
41
|
+
|
|
42
|
+
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); }
|
|
43
|
+
|
|
44
|
+
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; }
|
|
45
|
+
|
|
46
|
+
const {
|
|
47
|
+
Col,
|
|
48
|
+
Row
|
|
49
|
+
} = _FlexGrid.default;
|
|
50
|
+
|
|
51
|
+
const selectSubTitleTokens = _ref => {
|
|
52
|
+
let {
|
|
53
|
+
subtitleColor
|
|
54
|
+
} = _ref;
|
|
55
|
+
return {
|
|
56
|
+
color: subtitleColor
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const selectDividerToknes = _ref2 => {
|
|
61
|
+
let {
|
|
62
|
+
dividerColor,
|
|
63
|
+
width,
|
|
64
|
+
decorative = true,
|
|
65
|
+
weight = 'thin'
|
|
66
|
+
} = _ref2;
|
|
67
|
+
return {
|
|
68
|
+
color: dividerColor,
|
|
69
|
+
width,
|
|
70
|
+
decorative,
|
|
71
|
+
weight
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const MultiSelectFilter = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
|
|
76
|
+
let {
|
|
77
|
+
label,
|
|
78
|
+
subtitle,
|
|
79
|
+
id = label,
|
|
80
|
+
variant,
|
|
81
|
+
tokens,
|
|
82
|
+
items = [],
|
|
83
|
+
values,
|
|
84
|
+
initialValues,
|
|
85
|
+
maxValues,
|
|
86
|
+
onChange,
|
|
87
|
+
copy = 'en',
|
|
88
|
+
readOnly = false,
|
|
89
|
+
inactive = false,
|
|
90
|
+
rowLimit = 12,
|
|
91
|
+
...rest
|
|
92
|
+
} = _ref3;
|
|
93
|
+
const {
|
|
94
|
+
currentValues,
|
|
95
|
+
setValues
|
|
96
|
+
} = (0, _utils.useMultipleInputValues)({
|
|
97
|
+
initialValues,
|
|
98
|
+
values,
|
|
99
|
+
maxValues,
|
|
100
|
+
onChange,
|
|
101
|
+
readOnly
|
|
102
|
+
});
|
|
103
|
+
const themeTokens = (0, _ThemeProvider.useThemeTokens)('ButtonDropdown', tokens, variant);
|
|
104
|
+
const getItemTokens = (0, _ThemeProvider.useThemeTokensCallback)('ButtonDropdown', tokens, variant);
|
|
105
|
+
|
|
106
|
+
const getButtonTokens = buttonState => (0, _utils.selectTokens)('Button', getItemTokens(buttonState));
|
|
107
|
+
|
|
108
|
+
const getCopy = (0, _utils.useCopy)({
|
|
109
|
+
dictionary: _dictionary.default,
|
|
110
|
+
copy
|
|
111
|
+
});
|
|
112
|
+
const [isOpen, setIsOpen] = (0, _react.useState)(false);
|
|
113
|
+
const [checkedIds, setCheckedIds] = (0, _react.useState)(currentValues ?? []);
|
|
114
|
+
const colSize = items.length > rowLimit ? 2 : 1;
|
|
115
|
+
const isSelected = currentValues.length > 0;
|
|
116
|
+
const uniqueFields = ['id', 'label'];
|
|
117
|
+
|
|
118
|
+
if (!(0, _utils.containUniqueFields)(items, uniqueFields)) {
|
|
119
|
+
throw new Error(`MultiSelectFilter items must have unique ${uniqueFields.join(', ')}`);
|
|
120
|
+
} // Pass an object of relevant component state as first argument for any passed-in press handlers
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
const pressHandlers = (0, _utils.getPressHandlersWithArgs)(rest, [{
|
|
124
|
+
id,
|
|
125
|
+
label,
|
|
126
|
+
currentValues
|
|
127
|
+
}]);
|
|
128
|
+
|
|
129
|
+
const handleChange = event => {
|
|
130
|
+
if (pressHandlers.onPress) pressHandlers === null || pressHandlers === void 0 ? void 0 : pressHandlers.onPress(event);
|
|
131
|
+
setIsOpen(!isOpen);
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const onApply = e => {
|
|
135
|
+
setValues(e);
|
|
136
|
+
setIsOpen(false);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
140
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.ButtonDropdown, {
|
|
141
|
+
ref: ref,
|
|
142
|
+
...pressHandlers,
|
|
143
|
+
value: isOpen,
|
|
144
|
+
selected: isSelected,
|
|
145
|
+
label: label,
|
|
146
|
+
onChange: handleChange,
|
|
147
|
+
tokens: getButtonTokens,
|
|
148
|
+
inactive: inactive
|
|
149
|
+
}, id), isOpen && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ModalOverlay.default, {
|
|
150
|
+
variant: {
|
|
151
|
+
width: colSize > 1 ? 'size576' : 's'
|
|
152
|
+
},
|
|
153
|
+
onClose: () => setIsOpen(false),
|
|
154
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
155
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
156
|
+
variant: {
|
|
157
|
+
size: 'h4'
|
|
158
|
+
},
|
|
159
|
+
children: getCopy('filterByLabel').replace(/%\{filterCategory\}/g, label.toLowerCase())
|
|
160
|
+
})
|
|
161
|
+
}), subtitle && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
162
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Spacer.default, {
|
|
163
|
+
space: 5
|
|
164
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
165
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
166
|
+
variant: {
|
|
167
|
+
size: 'h5'
|
|
168
|
+
},
|
|
169
|
+
tokens: selectSubTitleTokens(themeTokens),
|
|
170
|
+
children: subtitle
|
|
171
|
+
})
|
|
172
|
+
})]
|
|
173
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spacer.default, {
|
|
174
|
+
space: 4
|
|
175
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
176
|
+
scroll: true,
|
|
177
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
178
|
+
distribute: "between",
|
|
179
|
+
children: [...Array(colSize).keys()].map(i => /*#__PURE__*/(0, _jsxRuntime.jsxs)(Col, {
|
|
180
|
+
xs: 12 / colSize,
|
|
181
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Checkbox.CheckboxGroup, {
|
|
182
|
+
items: items.slice(i * rowLimit, (i + 1) * rowLimit),
|
|
183
|
+
checkedIds: checkedIds,
|
|
184
|
+
onChange: e => setCheckedIds(e, i)
|
|
185
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spacer.default, {
|
|
186
|
+
size: 4
|
|
187
|
+
})]
|
|
188
|
+
}, i))
|
|
189
|
+
})
|
|
190
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Divider.default, {
|
|
191
|
+
variant: selectDividerToknes({ ...themeTokens,
|
|
192
|
+
width: 'full'
|
|
193
|
+
}),
|
|
194
|
+
space: 4
|
|
195
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
196
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_StackView.default, {
|
|
197
|
+
direction: "row",
|
|
198
|
+
space: 3,
|
|
199
|
+
tokens: {
|
|
200
|
+
alignItems: 'center'
|
|
201
|
+
},
|
|
202
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.Button, {
|
|
203
|
+
onPress: () => onApply(checkedIds),
|
|
204
|
+
variant: {
|
|
205
|
+
size: 'small',
|
|
206
|
+
priority: 'high'
|
|
207
|
+
},
|
|
208
|
+
children: getCopy('applyButtonLabel')
|
|
209
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
210
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Link.TextButton, {
|
|
211
|
+
onPress: () => setCheckedIds([]),
|
|
212
|
+
children: getCopy('clearButtonLabel')
|
|
213
|
+
})
|
|
214
|
+
})]
|
|
215
|
+
})
|
|
216
|
+
})]
|
|
217
|
+
})]
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
MultiSelectFilter.displayName = 'MultiSelectFilter';
|
|
221
|
+
MultiSelectFilter.propTypes = {
|
|
222
|
+
/**
|
|
223
|
+
* The text displayed to the user in a ButtonDropdown.
|
|
224
|
+
*/
|
|
225
|
+
label: _propTypes.default.string.isRequired,
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* The text for the subtitle
|
|
229
|
+
*/
|
|
230
|
+
subtitle: _propTypes.default.string,
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* An optional unique string may be provided to identify the ButtonDropdown.
|
|
234
|
+
* If not provided, the label is used.
|
|
235
|
+
*/
|
|
236
|
+
id: _propTypes.default.string,
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Sets the variant for ButtonDropdown element.
|
|
240
|
+
*/
|
|
241
|
+
variant: _utils.variantProp.propType,
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Sets the tokens for ButtonDropdown element.
|
|
245
|
+
*/
|
|
246
|
+
tokens: (0, _utils.getTokensPropType)('ButtonDropdown'),
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* The options a user may select.
|
|
250
|
+
*/
|
|
251
|
+
items: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
252
|
+
/**
|
|
253
|
+
* The text displayed to the user with a checkbox, describing this option.
|
|
254
|
+
*/
|
|
255
|
+
label: _propTypes.default.string.isRequired,
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* An optional unique string may be provided to identify this option.
|
|
259
|
+
* If not provided, the label is used.
|
|
260
|
+
*/
|
|
261
|
+
id: _propTypes.default.string
|
|
262
|
+
})),
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* If the selected item(s) in the checkbox group(s) are to be controlled externally by
|
|
266
|
+
* a parent component, pass an array of strings as well as an `onChange` handler.
|
|
267
|
+
* Passing an array for "values" makes the MultiSelectFilter a "controlled" component that
|
|
268
|
+
* expects its state to be handled via `onChange` and so doesn't handle it itself.
|
|
269
|
+
*/
|
|
270
|
+
values: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* If `values` is not passed, making the MultiSelectFilter an "uncontrolled" component
|
|
274
|
+
* managing its own selected state, a default set of selections may be provided.
|
|
275
|
+
* Changing the `initialValues` does not change the user's selections.
|
|
276
|
+
*/
|
|
277
|
+
initialValues: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* If provided, sets a maximum number of items a user may select at once.
|
|
281
|
+
*/
|
|
282
|
+
maxValues: _propTypes.default.number,
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* If provided, this function is called when the current selection is changed
|
|
286
|
+
* and is passed an array of the `id`s of all currently selected `items`.
|
|
287
|
+
*/
|
|
288
|
+
onChange: _propTypes.default.func,
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Select English or French copy for the accessible label.
|
|
292
|
+
*/
|
|
293
|
+
copy: _propTypes.default.oneOf(['en', 'fr']),
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* If true, the ButtonDropdown cannot be selected by the user and simply show their current state.
|
|
297
|
+
*/
|
|
298
|
+
readOnly: _propTypes.default.string,
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* If true, the MultiSelectFilter cannot be interacted with, ButtonDropdown is
|
|
302
|
+
* set as `disabled` and if the theme supports `inactive` appearances rules, these
|
|
303
|
+
* are applied.
|
|
304
|
+
*/
|
|
305
|
+
inactive: _propTypes.default.string,
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Sets the maximum number of items in one column. If number of items are more
|
|
309
|
+
* than the `rowLimit`, they will be rendered in 2 columns.
|
|
310
|
+
*/
|
|
311
|
+
rowLimit: _propTypes.default.number
|
|
312
|
+
};
|
|
313
|
+
var _default = MultiSelectFilter;
|
|
314
|
+
exports.default = _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _default = {
|
|
8
|
+
en: {
|
|
9
|
+
filterByLabel: 'Filter by %{filterCategory}:',
|
|
10
|
+
applyButtonLabel: 'Apply',
|
|
11
|
+
clearButtonLabel: 'Clear'
|
|
12
|
+
},
|
|
13
|
+
fr: {
|
|
14
|
+
filterByLabel: 'Filtrer par %{filterCategory}:',
|
|
15
|
+
applyButtonLabel: 'Appliquer',
|
|
16
|
+
clearButtonLabel: 'Effacer'
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
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 _MultiSelectFilter = _interopRequireDefault(require("./MultiSelectFilter"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
var _default = _MultiSelectFilter.default;
|
|
13
|
+
exports.default = _default;
|
|
@@ -54,8 +54,8 @@ const PageButton = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
54
54
|
key: 'active-item'
|
|
55
55
|
} : {};
|
|
56
56
|
const accessibilityRole = href !== undefined ? 'link' : 'button';
|
|
57
|
-
const activeLabel = isActive ?
|
|
58
|
-
const accessibilityLabel =
|
|
57
|
+
const activeLabel = isActive ? ` ${getCopy('currentLabel')}` : '';
|
|
58
|
+
const accessibilityLabel = `${getCopy('goToLabel')} ${label}${activeLabel}`;
|
|
59
59
|
|
|
60
60
|
const {
|
|
61
61
|
hrefAttrs,
|
|
@@ -110,11 +110,9 @@ const Pagination = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
110
110
|
LinkRouter: LinkRouter,
|
|
111
111
|
linkRouterProps: linkRouterProps
|
|
112
112
|
}), ...items.map((_child, itemIndex) => {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const buttonLabel = "".concat(itemIndex + 1);
|
|
113
|
+
const buttonLabel = `${itemIndex + 1}`;
|
|
116
114
|
const itemProps = getItemProps(itemIndex);
|
|
117
|
-
const ItemLinkRouter =
|
|
115
|
+
const ItemLinkRouter = itemProps.LinkRouter ?? LinkRouter;
|
|
118
116
|
const itemLinkRouterProps = { ...linkRouterProps,
|
|
119
117
|
...itemProps.linkRouterProps
|
|
120
118
|
};
|
|
@@ -151,7 +149,7 @@ const Pagination = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
151
149
|
ref: ref,
|
|
152
150
|
...selectProps(rest),
|
|
153
151
|
children: buttons // keep the keys in-line with the page numbers regardless of which buttons are actually rendered
|
|
154
|
-
.map((element, index) => [element,
|
|
152
|
+
.map((element, index) => [element, `page-${index + 1}`]).filter(_ref3 => {
|
|
155
153
|
let [element] = _ref3;
|
|
156
154
|
return element !== null;
|
|
157
155
|
}).map(_ref4 => {
|
|
@@ -21,7 +21,7 @@ function usePagination(_ref) {
|
|
|
21
21
|
);
|
|
22
22
|
|
|
23
23
|
const getItemProps = index => {
|
|
24
|
-
var _items$index
|
|
24
|
+
var _items$index;
|
|
25
25
|
|
|
26
26
|
const {
|
|
27
27
|
onPress,
|
|
@@ -29,7 +29,7 @@ function usePagination(_ref) {
|
|
|
29
29
|
hrefAttrs,
|
|
30
30
|
variant,
|
|
31
31
|
tokens
|
|
32
|
-
} = (
|
|
32
|
+
} = ((_items$index = items[index]) === null || _items$index === void 0 ? void 0 : _items$index.props) ?? {};
|
|
33
33
|
return {
|
|
34
34
|
onPress,
|
|
35
35
|
href,
|
|
@@ -43,7 +43,7 @@ const selectBarStyles = (_ref, percentage) => {
|
|
|
43
43
|
borderRadius,
|
|
44
44
|
outlineWidth,
|
|
45
45
|
outlineColor,
|
|
46
|
-
width:
|
|
46
|
+
width: `${percentage}%`
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
49
|
/**
|
|
@@ -104,7 +104,7 @@ const ProgressBar = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
104
104
|
min: 0,
|
|
105
105
|
max: 100,
|
|
106
106
|
now: percentage,
|
|
107
|
-
text:
|
|
107
|
+
text: `${percentage}%`
|
|
108
108
|
},
|
|
109
109
|
...rest
|
|
110
110
|
});
|
|
@@ -112,7 +112,7 @@ const ProgressBar = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
112
112
|
ref: ref,
|
|
113
113
|
style: [staticStyles.bar, selectBarStyles(themeTokens, percentage)],
|
|
114
114
|
...selectedProps,
|
|
115
|
-
children: children
|
|
115
|
+
children: children ?? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProgressBarBackground.default, {
|
|
116
116
|
variant: variant
|
|
117
117
|
})
|
|
118
118
|
}) : null;
|
|
@@ -21,8 +21,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
21
21
|
|
|
22
22
|
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; }
|
|
23
23
|
|
|
24
|
-
const inactiveBackground =
|
|
25
|
-
const negativeBackground =
|
|
24
|
+
const inactiveBackground = `%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='24'%3E%3Cdefs%3E%3Cpattern id='DisabledProgress7' patternUnits='userSpaceOnUse' width='8' height='8'%3E%3Crect width='8' height='8' fill='%23B2B9BF'%3E%3C/rect%3E%3Ccircle cx='4' cy='4' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='0' cy='0' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='0' cy='8' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='8' cy='0' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='8' cy='8' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3C/pattern%3E%3C/defs%3E%3Cpath d='M 0 0 L 0 140 L 2000 2000 L 2000 0 Z' style='fill: url("%23DisabledProgress7");'%3E%3C/path%3E%3C/svg%3E`;
|
|
25
|
+
const negativeBackground = `%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='24'%3E%3Cdefs%3E%3Cpattern id='NegativeProgress6' patternUnits='userSpaceOnUse' width='8' height='8'%3E%3Crect width='8' height='8' fill='%23C12335'%3E%3C/rect%3E%3Cpath d='M 0,8 l 8,-8 M -2,2 l 4,-4 M 6,10 l 4,-4' stroke-width='2' shape-rendering='auto' stroke='%23e7adb4' stroke-linecap='square'%3E%3C/path%3E%3C/pattern%3E%3C/defs%3E%3Cpath d='M 0 0 L 0 140 L 2000 2000 L 2000 0 Z' style='fill: url("%23NegativeProgress6");'%3E%3C/path%3E%3C/svg%3E`;
|
|
26
26
|
const ProgressBarBackground = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
27
27
|
let {
|
|
28
28
|
variant
|
|
@@ -40,7 +40,7 @@ const ProgressBarBackground = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) =>
|
|
|
40
40
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageBackground.default, {
|
|
41
41
|
ref: ref,
|
|
42
42
|
source: {
|
|
43
|
-
uri:
|
|
43
|
+
uri: `data:image/svg+xml,${source}`
|
|
44
44
|
},
|
|
45
45
|
style: staticStyles.imageBackground
|
|
46
46
|
});
|
|
@@ -0,0 +1,91 @@
|
|
|
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 _StackView = require("../StackView");
|
|
13
|
+
|
|
14
|
+
var _ThemeProvider = require("../ThemeProvider");
|
|
15
|
+
|
|
16
|
+
var _utils = require("../utils");
|
|
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
|
+
// pass through and type relevant system props - add more sets for interactive components
|
|
27
|
+
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]);
|
|
28
|
+
|
|
29
|
+
const isQuickListItem = element => {
|
|
30
|
+
var _element$type, _element$type2;
|
|
31
|
+
|
|
32
|
+
const elementName = (element === null || element === void 0 ? void 0 : (_element$type = element.type) === null || _element$type === void 0 ? void 0 : _element$type.displayName) || (element === null || element === void 0 ? void 0 : (_element$type2 = element.type) === null || _element$type2 === void 0 ? void 0 : _element$type2.name);
|
|
33
|
+
return Boolean(elementName.match(/QuickLinksFeatureItem/));
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* QuickLinksFeature renders a list of interactive items.
|
|
37
|
+
* - This is the base component that is used as a wrapper and accepts a List of `QuickLinksFeature.Item`
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
const QuickLinksFeature = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
42
|
+
let {
|
|
43
|
+
tokens,
|
|
44
|
+
variant,
|
|
45
|
+
tag = 'ul',
|
|
46
|
+
children,
|
|
47
|
+
...rest
|
|
48
|
+
} = _ref;
|
|
49
|
+
const {
|
|
50
|
+
stackGap,
|
|
51
|
+
stackJustify,
|
|
52
|
+
stackSpace
|
|
53
|
+
} = (0, _ThemeProvider.useThemeTokens)('QuickLinksFeature', tokens, variant);
|
|
54
|
+
|
|
55
|
+
const items = _react.Children.map(children, child => {
|
|
56
|
+
if (isQuickListItem(child)) {
|
|
57
|
+
return /*#__PURE__*/(0, _react.cloneElement)(child, child.props);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return null;
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_StackView.StackWrap, {
|
|
64
|
+
space: stackSpace,
|
|
65
|
+
gap: stackGap,
|
|
66
|
+
tokens: {
|
|
67
|
+
justifyContent: stackJustify
|
|
68
|
+
},
|
|
69
|
+
tag: tag,
|
|
70
|
+
ref: ref,
|
|
71
|
+
...selectProps(rest),
|
|
72
|
+
children: items
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
QuickLinksFeature.displayName = 'QuickLinksFeature';
|
|
76
|
+
QuickLinksFeature.propTypes = { ...selectedSystemPropTypes,
|
|
77
|
+
tokens: (0, _utils.getTokensPropType)('QuickLinksFeature'),
|
|
78
|
+
variant: _utils.variantProp.propType,
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Default wrapper tag, by default it's "ul"
|
|
82
|
+
*/
|
|
83
|
+
tag: _propTypes.default.string,
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* QuickLinksFeature.Item component
|
|
87
|
+
*/
|
|
88
|
+
children: _propTypes.default.node
|
|
89
|
+
};
|
|
90
|
+
var _default = QuickLinksFeature;
|
|
91
|
+
exports.default = _default;
|