@telus-uds/components-base 1.50.0 → 1.51.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 +14 -2
- package/component-docs.json +106 -8
- package/lib/Link/LinkBase.js +1 -1
- package/lib/MultiSelectFilter/ModalOverlay.js +24 -8
- package/lib/MultiSelectFilter/MultiSelectFilter.js +154 -21
- package/lib/QuickLinksFeature/QuickLinksFeatureItem.js +62 -41
- package/lib/StepTracker/Step.js +35 -14
- package/lib/StepTracker/StepTracker.js +5 -2
- package/lib/StepTracker/dictionary.js +24 -4
- package/lib-module/Link/LinkBase.js +1 -1
- package/lib-module/MultiSelectFilter/ModalOverlay.js +25 -9
- package/lib-module/MultiSelectFilter/MultiSelectFilter.js +154 -23
- package/lib-module/QuickLinksFeature/QuickLinksFeatureItem.js +64 -43
- package/lib-module/StepTracker/Step.js +35 -14
- package/lib-module/StepTracker/StepTracker.js +5 -2
- package/lib-module/StepTracker/dictionary.js +24 -4
- package/package.json +2 -2
- package/src/Link/LinkBase.jsx +3 -1
- package/src/MultiSelectFilter/ModalOverlay.jsx +30 -6
- package/src/MultiSelectFilter/MultiSelectFilter.jsx +142 -20
- package/src/QuickLinksFeature/QuickLinksFeatureItem.jsx +42 -35
- package/src/StepTracker/Step.jsx +34 -10
- package/src/StepTracker/StepTracker.jsx +11 -2
- package/src/StepTracker/dictionary.js +24 -4
- package/src/Typography/Typography.jsx +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
# Change Log - @telus-uds/components-base
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 16 Jun 2023 21:05:00 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.51.0
|
|
8
|
+
|
|
9
|
+
Fri, 16 Jun 2023 21:05:00 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- Change in tags due to multibrand standardization (35577399+JoshHC@users.noreply.github.com)
|
|
14
|
+
- feature:update MultiSelectFilter to follow design (samuraix221@hotmail.com)
|
|
15
|
+
- Adapt the tokens to the steptracker (mauricio.batresmontejo@telus.com)
|
|
16
|
+
- Update 'LinkBase' to pass Pressable state through to children (kyle.king2@telus.com)
|
|
17
|
+
- Bump @telus-uds/system-theme-tokens to v2.33.0
|
|
18
|
+
|
|
7
19
|
## 1.50.0
|
|
8
20
|
|
|
9
|
-
Wed, 14 Jun 2023 00:
|
|
21
|
+
Wed, 14 Jun 2023 00:06:30 GMT
|
|
10
22
|
|
|
11
23
|
### Minor changes
|
|
12
24
|
|
package/component-docs.json
CHANGED
|
@@ -198,7 +198,7 @@
|
|
|
198
198
|
"listPaddingLeft": "size",
|
|
199
199
|
"listItemMarkerFontSize": "size",
|
|
200
200
|
"listItemMarkerLineHeight": "lineHeight",
|
|
201
|
-
"headerLineHeight": "
|
|
201
|
+
"headerLineHeight": "lineHeight",
|
|
202
202
|
"headerFontSize": "size",
|
|
203
203
|
"headerFontName": "fontName",
|
|
204
204
|
"headerFontWeight": "fontWeight",
|
|
@@ -208,6 +208,7 @@
|
|
|
208
208
|
"listItemPaddingLeft": "size",
|
|
209
209
|
"closeButtonBorderSize": "border",
|
|
210
210
|
"closeButtonBorderColor": "color",
|
|
211
|
+
"closeButtonBackgroundColor": "color",
|
|
211
212
|
"closeButtonHeight": "size",
|
|
212
213
|
"closeButtonMarginTop": "size",
|
|
213
214
|
"closeButtonMarginLeft": "size",
|
|
@@ -833,6 +834,22 @@
|
|
|
833
834
|
"closeIconSize": "size",
|
|
834
835
|
"closePadding": "size"
|
|
835
836
|
},
|
|
837
|
+
"MultiSelectFilter": {
|
|
838
|
+
"headerFontColor": "color",
|
|
839
|
+
"headerFontSize": "fontSize",
|
|
840
|
+
"headerFontName": "fontName",
|
|
841
|
+
"headerFontWeight": "fontWeight",
|
|
842
|
+
"headerLineHeight": "lineHeight",
|
|
843
|
+
"maxHeightSize": "size",
|
|
844
|
+
"maxWidthSize": "size",
|
|
845
|
+
"minWidth": "size",
|
|
846
|
+
"minHeight": "size",
|
|
847
|
+
"subHeaderLineHeight": "lineHeight",
|
|
848
|
+
"subHeaderFontName": "fontName",
|
|
849
|
+
"subHeaderFontWeight": "fontWeight",
|
|
850
|
+
"subHeaderFontSize": "fontSize",
|
|
851
|
+
"buttonDirection": "direction"
|
|
852
|
+
},
|
|
836
853
|
"NavigationBar": {
|
|
837
854
|
"alignSelf": "flexAlign",
|
|
838
855
|
"backgroundColor": "color",
|
|
@@ -1060,8 +1077,12 @@
|
|
|
1060
1077
|
"contentDirection": "direction",
|
|
1061
1078
|
"contentSpace": "integer",
|
|
1062
1079
|
"contentAlignItems": "flexAlign",
|
|
1080
|
+
"gap": "size",
|
|
1063
1081
|
"textAlign": "textAlign",
|
|
1064
|
-
"outerBorderColor": "color"
|
|
1082
|
+
"outerBorderColor": "color",
|
|
1083
|
+
"fontWeight": "fontWeight",
|
|
1084
|
+
"fontName": "fontName",
|
|
1085
|
+
"fontSize": "fontSize"
|
|
1065
1086
|
},
|
|
1066
1087
|
"Radio": {
|
|
1067
1088
|
"checkedBackgroundColor": "color",
|
|
@@ -1330,7 +1351,13 @@
|
|
|
1330
1351
|
"labelPaddingRight": "size",
|
|
1331
1352
|
"showStepLabel": "show",
|
|
1332
1353
|
"showStepName": "show",
|
|
1333
|
-
"showStepTrackerLabel": "show"
|
|
1354
|
+
"showStepTrackerLabel": "show",
|
|
1355
|
+
"textStepTrackerLabel": "integer",
|
|
1356
|
+
"stepLabelColor": "color",
|
|
1357
|
+
"stepLabelFontSize": "fontSize",
|
|
1358
|
+
"stepLabelFontWeight": "fontWeight",
|
|
1359
|
+
"stepLabelFontName": "fontName",
|
|
1360
|
+
"stepLabelLineHeight": "lineHeight"
|
|
1334
1361
|
},
|
|
1335
1362
|
"SkipLink": {
|
|
1336
1363
|
"backgroundColor": "color",
|
|
@@ -1433,7 +1460,6 @@
|
|
|
1433
1460
|
"paddingRight": "size",
|
|
1434
1461
|
"paddingTop": "size",
|
|
1435
1462
|
"paddingBottom": "size",
|
|
1436
|
-
"width": "size",
|
|
1437
1463
|
"minWidth": "size",
|
|
1438
1464
|
"outerBorderColor": "color",
|
|
1439
1465
|
"outerBorderWidth": "border",
|
|
@@ -1534,7 +1560,9 @@
|
|
|
1534
1560
|
"animationColorBefore": "color",
|
|
1535
1561
|
"animationColorAfter": "color",
|
|
1536
1562
|
"animationDivColorBefore": "color",
|
|
1537
|
-
"animationDivColorAfter": "color"
|
|
1563
|
+
"animationDivColorAfter": "color",
|
|
1564
|
+
"chevronlinkFontWeight": "fontWeight",
|
|
1565
|
+
"chevronlinkFontName": "fontName"
|
|
1538
1566
|
},
|
|
1539
1567
|
"ToggleSwitch": {
|
|
1540
1568
|
"borderColor": "color",
|
|
@@ -1652,6 +1680,8 @@
|
|
|
1652
1680
|
"Countdown": {
|
|
1653
1681
|
"containerBorderRadius": "radius",
|
|
1654
1682
|
"containerGradient": "gradient",
|
|
1683
|
+
"containerBorderWidth": "border",
|
|
1684
|
+
"containerBorderColor": "color",
|
|
1655
1685
|
"containerInverseBorder": "border",
|
|
1656
1686
|
"containerInverseBorderColor": "color",
|
|
1657
1687
|
"containerPaddingBottomTop": "size",
|
|
@@ -1661,6 +1691,8 @@
|
|
|
1661
1691
|
"textFontSize": "fontSize",
|
|
1662
1692
|
"textLineHeight": "lineHeight",
|
|
1663
1693
|
"labelFontSize": "fontSize",
|
|
1694
|
+
"labelFontName": "fontName",
|
|
1695
|
+
"labelFontWeight": "fontWeight",
|
|
1664
1696
|
"labelLineHeight": "lineHeight",
|
|
1665
1697
|
"textTimerFontWeight": "fontWeight",
|
|
1666
1698
|
"textTimerFontName": "fontName"
|
|
@@ -2227,6 +2259,22 @@
|
|
|
2227
2259
|
"type": "state"
|
|
2228
2260
|
}
|
|
2229
2261
|
},
|
|
2262
|
+
"MultiSelectFilter": {
|
|
2263
|
+
"maxHeight": {
|
|
2264
|
+
"description": "Whether MultiselectFilter modal should expand responsively to content or a set maximu height",
|
|
2265
|
+
"values": [
|
|
2266
|
+
true
|
|
2267
|
+
],
|
|
2268
|
+
"type": "state"
|
|
2269
|
+
},
|
|
2270
|
+
"maxWidth": {
|
|
2271
|
+
"description": "Whether MultiselectFilter modal should expand to content or a set maximuh width",
|
|
2272
|
+
"values": [
|
|
2273
|
+
true
|
|
2274
|
+
],
|
|
2275
|
+
"type": "state"
|
|
2276
|
+
}
|
|
2277
|
+
},
|
|
2230
2278
|
"NavigationBar": {
|
|
2231
2279
|
"focus": {
|
|
2232
2280
|
"description": "Currently only web has good support for this. Applies when an interactive component's focus handler is triggered, such as keyboard tabbing or selection.",
|
|
@@ -2422,6 +2470,35 @@
|
|
|
2422
2470
|
"type": "state"
|
|
2423
2471
|
}
|
|
2424
2472
|
},
|
|
2473
|
+
"QuickLinksFeatureItem": {
|
|
2474
|
+
"hover": {
|
|
2475
|
+
"description": "Currently web only. Applies when an interactive component's hover handler is triggered, such as on mouseover.",
|
|
2476
|
+
"values": [
|
|
2477
|
+
true
|
|
2478
|
+
],
|
|
2479
|
+
"type": "state",
|
|
2480
|
+
"platforms": [
|
|
2481
|
+
"rn"
|
|
2482
|
+
]
|
|
2483
|
+
},
|
|
2484
|
+
"focus": {
|
|
2485
|
+
"description": "Currently only web has good support for this. Applies when an interactive component's focus handler is triggered, such as keyboard tabbing or selection.",
|
|
2486
|
+
"values": [
|
|
2487
|
+
true
|
|
2488
|
+
],
|
|
2489
|
+
"type": "state",
|
|
2490
|
+
"platforms": [
|
|
2491
|
+
"rn"
|
|
2492
|
+
]
|
|
2493
|
+
},
|
|
2494
|
+
"pressed": {
|
|
2495
|
+
"description": "Applies while an interactive component is being physically pressed. Most visible on touchscreen taps; in React Native Web, this is visible on web mouse clicks only if the pressable is held down.",
|
|
2496
|
+
"values": [
|
|
2497
|
+
true
|
|
2498
|
+
],
|
|
2499
|
+
"type": "state"
|
|
2500
|
+
}
|
|
2501
|
+
},
|
|
2425
2502
|
"QuantitySelector": {
|
|
2426
2503
|
"focus": {
|
|
2427
2504
|
"description": "Currently only web has good support for this. Applies when an interactive component's focus handler is triggered, such as keyboard tabbing or selection.",
|
|
@@ -6852,6 +6929,17 @@
|
|
|
6852
6929
|
"required": false,
|
|
6853
6930
|
"description": "The options a user may select."
|
|
6854
6931
|
},
|
|
6932
|
+
"maxHeight": {
|
|
6933
|
+
"defaultValue": {
|
|
6934
|
+
"value": "false",
|
|
6935
|
+
"computed": false
|
|
6936
|
+
},
|
|
6937
|
+
"type": {
|
|
6938
|
+
"name": "bool"
|
|
6939
|
+
},
|
|
6940
|
+
"required": false,
|
|
6941
|
+
"description": "If provided sets maxHeight to be active"
|
|
6942
|
+
},
|
|
6855
6943
|
"copy": {
|
|
6856
6944
|
"defaultValue": {
|
|
6857
6945
|
"value": "'en'",
|
|
@@ -7984,8 +8072,12 @@
|
|
|
7984
8072
|
"contentDirection": "direction",
|
|
7985
8073
|
"contentSpace": "integer",
|
|
7986
8074
|
"contentAlignItems": "flexAlign",
|
|
8075
|
+
"gap": "size",
|
|
7987
8076
|
"textAlign": "textAlign",
|
|
7988
|
-
"outerBorderColor": "color"
|
|
8077
|
+
"outerBorderColor": "color",
|
|
8078
|
+
"fontWeight": "fontWeight",
|
|
8079
|
+
"fontName": "fontName",
|
|
8080
|
+
"fontSize": "fontSize"
|
|
7989
8081
|
}
|
|
7990
8082
|
},
|
|
7991
8083
|
"required": false,
|
|
@@ -9625,7 +9717,7 @@
|
|
|
9625
9717
|
},
|
|
9626
9718
|
"dictionary": {
|
|
9627
9719
|
"defaultValue": {
|
|
9628
|
-
"value": "{\n en: {\n stepLabel: 'Step %{stepNumber}',\n stepTrackerLabel: 'Step %{stepNumber} of %{stepCount}: %{stepLabel}'\n },\n fr: {\n stepLabel: 'Étape %{stepNumber}',\n stepTrackerLabel: 'Étape %{stepNumber} sur %{stepCount}: %{stepLabel}'\n }\n}",
|
|
9720
|
+
"value": "{\n en: {\n 1: {\n stepLabel: 'Step %{stepNumber}',\n stepTrackerLabel: 'Step %{stepNumber} of %{stepCount}: %{stepLabel}'\n },\n 2: {\n stepLabel: '%{stepNumber}.',\n stepTrackerLabel: 'Step %{stepNumber} of %{stepCount}: %{stepLabel}'\n },\n 3: {\n stepLabel: 'Step %{stepNumber}',\n stepTrackerLabel: 'Step %{stepNumber} of %{stepCount}: %{stepLabel}'\n }\n },\n fr: {\n 1: {\n stepLabel: 'Étape %{stepNumber}',\n stepTrackerLabel: 'Étape %{stepNumber} sur %{stepCount}: %{stepLabel}'\n },\n 2: {\n stepLabel: '%{stepNumber}.',\n stepTrackerLabel: 'Étape %{stepNumber} sur %{stepCount}: %{stepLabel}'\n },\n 3: {\n stepLabel: 'Étape %{stepNumber}',\n stepTrackerLabel: 'Étape %{stepNumber} sur %{stepCount}: %{stepLabel}'\n }\n }\n}",
|
|
9629
9721
|
"computed": false
|
|
9630
9722
|
},
|
|
9631
9723
|
"type": {
|
|
@@ -9706,7 +9798,13 @@
|
|
|
9706
9798
|
"labelPaddingRight": "size",
|
|
9707
9799
|
"showStepLabel": "show",
|
|
9708
9800
|
"showStepName": "show",
|
|
9709
|
-
"showStepTrackerLabel": "show"
|
|
9801
|
+
"showStepTrackerLabel": "show",
|
|
9802
|
+
"textStepTrackerLabel": "integer",
|
|
9803
|
+
"stepLabelColor": "color",
|
|
9804
|
+
"stepLabelFontSize": "fontSize",
|
|
9805
|
+
"stepLabelFontWeight": "fontWeight",
|
|
9806
|
+
"stepLabelFontName": "fontName",
|
|
9807
|
+
"stepLabelLineHeight": "lineHeight"
|
|
9710
9808
|
}
|
|
9711
9809
|
},
|
|
9712
9810
|
"required": false,
|
package/lib/Link/LinkBase.js
CHANGED
|
@@ -229,7 +229,7 @@ const LinkBase = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
|
|
|
229
229
|
},
|
|
230
230
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
231
231
|
style: [textStyles, blockTextStyles, staticStyles.baseline],
|
|
232
|
-
children: children
|
|
232
|
+
children: typeof children === 'function' ? children(linkState) : children
|
|
233
233
|
})
|
|
234
234
|
});
|
|
235
235
|
}
|
|
@@ -40,7 +40,6 @@ const staticStyles = _StyleSheet.default.create({
|
|
|
40
40
|
flex: 1,
|
|
41
41
|
// Grow to maxWidth when possible, shrink when not possible
|
|
42
42
|
position: 'absolute',
|
|
43
|
-
height: 330,
|
|
44
43
|
zIndex: 10000 // Position on top of all the other overlays, including backdrops and modals
|
|
45
44
|
|
|
46
45
|
},
|
|
@@ -86,6 +85,11 @@ const ModalOverlay = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
|
|
|
86
85
|
let {
|
|
87
86
|
children,
|
|
88
87
|
isReady = false,
|
|
88
|
+
maxHeight,
|
|
89
|
+
maxHeightSize,
|
|
90
|
+
maxWidthSize,
|
|
91
|
+
minHeight,
|
|
92
|
+
minWidth,
|
|
89
93
|
overlaidPosition,
|
|
90
94
|
onLayout,
|
|
91
95
|
variant,
|
|
@@ -98,9 +102,18 @@ const ModalOverlay = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
|
|
|
98
102
|
viewport,
|
|
99
103
|
maxWidth: false
|
|
100
104
|
});
|
|
105
|
+
const containerWidthHeight = {
|
|
106
|
+
minWidth,
|
|
107
|
+
minHeight,
|
|
108
|
+
...(tokens.maxWidth && maxWidthSize && {
|
|
109
|
+
maxWidth: maxWidthSize
|
|
110
|
+
}),
|
|
111
|
+
...(maxHeight && maxHeightSize && {
|
|
112
|
+
maxHeight: maxHeightSize
|
|
113
|
+
})
|
|
114
|
+
};
|
|
101
115
|
const {
|
|
102
|
-
closeIcon: CloseIconComponent
|
|
103
|
-
maxWidth
|
|
116
|
+
closeIcon: CloseIconComponent
|
|
104
117
|
} = themeTokens;
|
|
105
118
|
const getCopy = (0, _utils.useCopy)({
|
|
106
119
|
dictionary: _dictionary.default,
|
|
@@ -111,9 +124,7 @@ const ModalOverlay = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
|
|
|
111
124
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
112
125
|
ref: ref,
|
|
113
126
|
onLayout: onLayout,
|
|
114
|
-
style: [overlaidPosition,
|
|
115
|
-
minWidth: maxWidth
|
|
116
|
-
}, staticStyles.positioner, !isReady && staticStyles.hidden],
|
|
127
|
+
style: [overlaidPosition, containerWidthHeight, staticStyles.positioner, !isReady && staticStyles.hidden],
|
|
117
128
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Card.default, {
|
|
118
129
|
tokens: selectPaddingContainerStyles(themeTokens),
|
|
119
130
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
@@ -122,8 +133,7 @@ const ModalOverlay = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
|
|
|
122
133
|
onPress: onClose,
|
|
123
134
|
icon: CloseIconComponent,
|
|
124
135
|
accessibilityRole: "button",
|
|
125
|
-
accessibilityLabel: closeLabel
|
|
126
|
-
tokens: (0, _utils.selectTokens)('IconButton', themeTokens, 'close')
|
|
136
|
+
accessibilityLabel: closeLabel
|
|
127
137
|
})
|
|
128
138
|
}), children]
|
|
129
139
|
})
|
|
@@ -139,6 +149,12 @@ ModalOverlay.propTypes = {
|
|
|
139
149
|
left: _propTypes.default.number,
|
|
140
150
|
width: _propTypes.default.number
|
|
141
151
|
}),
|
|
152
|
+
minWidth: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
153
|
+
minHeight: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
154
|
+
maxHeightSize: _propTypes.default.number,
|
|
155
|
+
maxWidthSize: _propTypes.default.number,
|
|
156
|
+
maxHeight: _propTypes.default.bool,
|
|
157
|
+
maxWidth: _propTypes.default.bool,
|
|
142
158
|
onLayout: _propTypes.default.func,
|
|
143
159
|
variant: _utils.variantProp.propType,
|
|
144
160
|
tokens: (0, _utils.getTokensPropType)('Modal'),
|
|
@@ -15,6 +15,8 @@ var _utils = require("../utils");
|
|
|
15
15
|
|
|
16
16
|
var _dictionary = _interopRequireDefault(require("./dictionary"));
|
|
17
17
|
|
|
18
|
+
var _ViewportProvider = require("../ViewportProvider");
|
|
19
|
+
|
|
18
20
|
var _Box = _interopRequireDefault(require("../Box"));
|
|
19
21
|
|
|
20
22
|
var _Button = require("../Button");
|
|
@@ -35,6 +37,8 @@ var _Link = require("../Link");
|
|
|
35
37
|
|
|
36
38
|
var _ModalOverlay = _interopRequireDefault(require("./ModalOverlay"));
|
|
37
39
|
|
|
40
|
+
var _Modal = _interopRequireDefault(require("../Modal"));
|
|
41
|
+
|
|
38
42
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
39
43
|
|
|
40
44
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -81,6 +85,7 @@ const MultiSelectFilter = _ref3 => {
|
|
|
81
85
|
tokens,
|
|
82
86
|
items = [],
|
|
83
87
|
values,
|
|
88
|
+
maxHeight = false,
|
|
84
89
|
initialValues,
|
|
85
90
|
maxValues,
|
|
86
91
|
onChange,
|
|
@@ -90,6 +95,7 @@ const MultiSelectFilter = _ref3 => {
|
|
|
90
95
|
rowLimit = 12,
|
|
91
96
|
...rest
|
|
92
97
|
} = _ref3;
|
|
98
|
+
const viewport = (0, _ViewportProvider.useViewport)();
|
|
93
99
|
const {
|
|
94
100
|
currentValues,
|
|
95
101
|
setValues
|
|
@@ -100,6 +106,9 @@ const MultiSelectFilter = _ref3 => {
|
|
|
100
106
|
onChange,
|
|
101
107
|
readOnly
|
|
102
108
|
});
|
|
109
|
+
const [isOpen, setIsOpen] = (0, _react.useState)(false);
|
|
110
|
+
const [checkedIds, setCheckedIds] = (0, _react.useState)(currentValues ?? []);
|
|
111
|
+
const [maxWidth, setMaxWidth] = (0, _react.useState)(false);
|
|
103
112
|
const themeTokens = (0, _ThemeProvider.useThemeTokens)('ButtonDropdown', tokens, variant);
|
|
104
113
|
const getItemTokens = (0, _ThemeProvider.useThemeTokensCallback)('ButtonDropdown', tokens, variant);
|
|
105
114
|
|
|
@@ -109,10 +118,34 @@ const MultiSelectFilter = _ref3 => {
|
|
|
109
118
|
dictionary: _dictionary.default,
|
|
110
119
|
copy
|
|
111
120
|
});
|
|
112
|
-
const
|
|
113
|
-
const
|
|
114
|
-
const
|
|
121
|
+
const colSizeNotMobile = items.length > rowLimit ? 2 : 1;
|
|
122
|
+
const colSize = viewport !== 'xs' ? colSizeNotMobile : 1;
|
|
123
|
+
const itemsLengthNotMobile = items.length > 24 ? items.length / 2 : rowLimit;
|
|
115
124
|
const isSelected = currentValues.length > 0;
|
|
125
|
+
const rowLength = viewport !== 'xs' ? itemsLengthNotMobile : items.length;
|
|
126
|
+
(0, _react.useEffect)(() => {
|
|
127
|
+
if (colSize === 1) return setMaxWidth(false);
|
|
128
|
+
return colSize === 2 && setMaxWidth(true);
|
|
129
|
+
}, [colSize]);
|
|
130
|
+
const {
|
|
131
|
+
headerFontColor,
|
|
132
|
+
headerFontSize,
|
|
133
|
+
buttonDirection,
|
|
134
|
+
headerFontWeight,
|
|
135
|
+
headerLineHeight,
|
|
136
|
+
subHeaderFontWeight,
|
|
137
|
+
subHeaderFontSize,
|
|
138
|
+
maxHeightSize,
|
|
139
|
+
maxWidthSize,
|
|
140
|
+
subHeaderLineHeight,
|
|
141
|
+
minHeight,
|
|
142
|
+
minWidth
|
|
143
|
+
} = (0, _ThemeProvider.useThemeTokens)('MultiSelectFilter', tokens, { ...variant,
|
|
144
|
+
maxHeight,
|
|
145
|
+
maxWidth
|
|
146
|
+
}, {
|
|
147
|
+
viewport
|
|
148
|
+
});
|
|
116
149
|
const uniqueFields = ['id', 'label'];
|
|
117
150
|
|
|
118
151
|
if (!(0, _utils.containUniqueFields)(items, uniqueFields)) {
|
|
@@ -136,6 +169,11 @@ const MultiSelectFilter = _ref3 => {
|
|
|
136
169
|
setIsOpen(false);
|
|
137
170
|
};
|
|
138
171
|
|
|
172
|
+
const onClear = () => {
|
|
173
|
+
setCheckedIds(() => []);
|
|
174
|
+
onApply([]);
|
|
175
|
+
};
|
|
176
|
+
|
|
139
177
|
const {
|
|
140
178
|
align,
|
|
141
179
|
offsets
|
|
@@ -143,9 +181,7 @@ const MultiSelectFilter = _ref3 => {
|
|
|
143
181
|
xs: {
|
|
144
182
|
align: {
|
|
145
183
|
top: 'top',
|
|
146
|
-
left: 'left'
|
|
147
|
-
bottom: 'bottom',
|
|
148
|
-
right: 'right'
|
|
184
|
+
left: 'left'
|
|
149
185
|
}
|
|
150
186
|
},
|
|
151
187
|
sm: {
|
|
@@ -158,6 +194,16 @@ const MultiSelectFilter = _ref3 => {
|
|
|
158
194
|
}
|
|
159
195
|
}
|
|
160
196
|
});
|
|
197
|
+
const headerStyles = (0, _ThemeProvider.applyTextStyles)({
|
|
198
|
+
fontSize: headerFontSize,
|
|
199
|
+
fontWeight: headerFontWeight,
|
|
200
|
+
fontColor: headerFontColor
|
|
201
|
+
});
|
|
202
|
+
const subeHeaderStyles = (0, _ThemeProvider.applyTextStyles)({
|
|
203
|
+
fontSize: subHeaderFontSize,
|
|
204
|
+
fontWeight: subHeaderFontWeight,
|
|
205
|
+
fontColor: selectSubTitleTokens(themeTokens)
|
|
206
|
+
});
|
|
161
207
|
const {
|
|
162
208
|
overlaidPosition,
|
|
163
209
|
onTargetLayout,
|
|
@@ -178,20 +224,96 @@ const MultiSelectFilter = _ref3 => {
|
|
|
178
224
|
onChange: handleChange,
|
|
179
225
|
tokens: getButtonTokens,
|
|
180
226
|
inactive: inactive
|
|
181
|
-
}, id), isOpen && /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
227
|
+
}, id), isOpen && viewport === 'xs' && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Modal.default, {
|
|
228
|
+
isOpen: isOpen,
|
|
229
|
+
onClose: () => setIsOpen(false),
|
|
230
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
231
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
232
|
+
tokens: { ...headerStyles,
|
|
233
|
+
lineHeight: headerLineHeight
|
|
234
|
+
},
|
|
235
|
+
children: getCopy('filterByLabel').replace(/%\{filterCategory\}/g, label.toLowerCase())
|
|
236
|
+
})
|
|
237
|
+
}), subtitle && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
238
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Spacer.default, {
|
|
239
|
+
space: 5
|
|
240
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
241
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
242
|
+
tokens: { ...subeHeaderStyles,
|
|
243
|
+
lineHeight: subHeaderLineHeight
|
|
244
|
+
},
|
|
245
|
+
children: subtitle
|
|
246
|
+
})
|
|
247
|
+
})]
|
|
248
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spacer.default, {
|
|
249
|
+
space: 4
|
|
250
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
251
|
+
scroll: true,
|
|
252
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
253
|
+
distribute: "between",
|
|
254
|
+
children: [...Array(colSize).keys()].map(i => /*#__PURE__*/(0, _jsxRuntime.jsxs)(Col, {
|
|
255
|
+
xs: 12 / colSize,
|
|
256
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Checkbox.CheckboxGroup, {
|
|
257
|
+
items: items.slice(i * rowLength, (i + 1) * rowLength),
|
|
258
|
+
checkedIds: checkedIds,
|
|
259
|
+
onChange: e => setCheckedIds(e, i)
|
|
260
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spacer.default, {
|
|
261
|
+
size: 4
|
|
262
|
+
})]
|
|
263
|
+
}, i))
|
|
264
|
+
})
|
|
265
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Divider.default, {
|
|
266
|
+
variant: selectDividerToknes({ ...themeTokens,
|
|
267
|
+
width: 'full'
|
|
268
|
+
}),
|
|
269
|
+
space: 4
|
|
270
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
271
|
+
horizontalAlign: buttonDirection === 'column' ? 'center' : 'start',
|
|
272
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_StackView.default, {
|
|
273
|
+
direction: buttonDirection,
|
|
274
|
+
space: 3,
|
|
275
|
+
tokens: {
|
|
276
|
+
alignItems: 'center',
|
|
277
|
+
...(viewport === 'xs' && {
|
|
278
|
+
flexGrow: 1
|
|
279
|
+
})
|
|
280
|
+
},
|
|
281
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.Button, {
|
|
282
|
+
onPress: () => onApply(checkedIds),
|
|
283
|
+
variant: {
|
|
284
|
+
size: 'small',
|
|
285
|
+
priority: 'high',
|
|
286
|
+
...(viewport === 'xs' && {
|
|
287
|
+
width: 'full'
|
|
288
|
+
})
|
|
289
|
+
},
|
|
290
|
+
children: getCopy('applyButtonLabel')
|
|
291
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
292
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Link.TextButton, {
|
|
293
|
+
onPress: () => onClear(),
|
|
294
|
+
children: getCopy('clearButtonLabel')
|
|
295
|
+
})
|
|
296
|
+
})]
|
|
297
|
+
})
|
|
298
|
+
})]
|
|
299
|
+
}), isOpen && viewport !== 'xs' && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ModalOverlay.default, {
|
|
182
300
|
overlaidPosition: overlaidPosition,
|
|
183
|
-
variant: {
|
|
184
|
-
width: colSize > 1 ? 'size576' : 's'
|
|
185
|
-
},
|
|
186
301
|
onClose: () => setIsOpen(false),
|
|
187
|
-
|
|
302
|
+
maxHeight: maxHeight,
|
|
303
|
+
maxHeightSize: maxHeightSize,
|
|
304
|
+
maxWidthSize: maxWidthSize,
|
|
305
|
+
minHeight: minHeight,
|
|
306
|
+
minWidth: minWidth,
|
|
307
|
+
tokens: { ...tokens,
|
|
308
|
+
maxWidth
|
|
309
|
+
},
|
|
188
310
|
copy: copy,
|
|
189
311
|
isReady: isReady,
|
|
190
312
|
onLayout: onTargetLayout,
|
|
191
313
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
192
314
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
193
|
-
|
|
194
|
-
|
|
315
|
+
tokens: { ...headerStyles,
|
|
316
|
+
lineHeight: headerLineHeight
|
|
195
317
|
},
|
|
196
318
|
children: getCopy('filterByLabel').replace(/%\{filterCategory\}/g, label.toLowerCase())
|
|
197
319
|
})
|
|
@@ -200,10 +322,9 @@ const MultiSelectFilter = _ref3 => {
|
|
|
200
322
|
space: 5
|
|
201
323
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
202
324
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
203
|
-
|
|
204
|
-
|
|
325
|
+
tokens: { ...subeHeaderStyles,
|
|
326
|
+
lineHeight: subHeaderLineHeight
|
|
205
327
|
},
|
|
206
|
-
tokens: selectSubTitleTokens(themeTokens),
|
|
207
328
|
children: subtitle
|
|
208
329
|
})
|
|
209
330
|
})]
|
|
@@ -216,7 +337,7 @@ const MultiSelectFilter = _ref3 => {
|
|
|
216
337
|
children: [...Array(colSize).keys()].map(i => /*#__PURE__*/(0, _jsxRuntime.jsxs)(Col, {
|
|
217
338
|
xs: 12 / colSize,
|
|
218
339
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Checkbox.CheckboxGroup, {
|
|
219
|
-
items: items.slice(i *
|
|
340
|
+
items: items.slice(i * rowLength, (i + 1) * rowLength),
|
|
220
341
|
checkedIds: checkedIds,
|
|
221
342
|
onChange: e => setCheckedIds(e, i)
|
|
222
343
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spacer.default, {
|
|
@@ -230,22 +351,29 @@ const MultiSelectFilter = _ref3 => {
|
|
|
230
351
|
}),
|
|
231
352
|
space: 4
|
|
232
353
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Row, {
|
|
354
|
+
horizontalAlign: buttonDirection === 'column' ? 'center' : 'start',
|
|
233
355
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_StackView.default, {
|
|
234
|
-
direction:
|
|
356
|
+
direction: buttonDirection,
|
|
235
357
|
space: 3,
|
|
236
358
|
tokens: {
|
|
237
|
-
alignItems: 'center'
|
|
359
|
+
alignItems: 'center',
|
|
360
|
+
...(viewport === 'xs' && {
|
|
361
|
+
flexGrow: 1
|
|
362
|
+
})
|
|
238
363
|
},
|
|
239
364
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.Button, {
|
|
240
365
|
onPress: () => onApply(checkedIds),
|
|
241
366
|
variant: {
|
|
242
367
|
size: 'small',
|
|
243
|
-
priority: 'high'
|
|
368
|
+
priority: 'high',
|
|
369
|
+
...(viewport === 'xs' && {
|
|
370
|
+
width: 'full'
|
|
371
|
+
})
|
|
244
372
|
},
|
|
245
373
|
children: getCopy('applyButtonLabel')
|
|
246
374
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
247
375
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Link.TextButton, {
|
|
248
|
-
onPress: () =>
|
|
376
|
+
onPress: () => onClear(),
|
|
249
377
|
children: getCopy('clearButtonLabel')
|
|
250
378
|
})
|
|
251
379
|
})]
|
|
@@ -319,6 +447,11 @@ MultiSelectFilter.propTypes = {
|
|
|
319
447
|
*/
|
|
320
448
|
maxValues: _propTypes.default.number,
|
|
321
449
|
|
|
450
|
+
/**
|
|
451
|
+
* If provided sets maxHeight to be active
|
|
452
|
+
*/
|
|
453
|
+
maxHeight: _propTypes.default.bool,
|
|
454
|
+
|
|
322
455
|
/**
|
|
323
456
|
* If provided, this function is called when the current selection is changed
|
|
324
457
|
* and is passed an array of the `id`s of all currently selected `items`.
|