@telus-uds/components-base 1.53.0 → 1.54.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 +20 -2
- package/component-docs.json +143 -20
- package/lib/Button/ButtonBase.js +17 -5
- package/lib/ExpandCollapse/Panel.js +65 -8
- package/lib/Modal/Modal.js +9 -3
- package/lib/SkipLink/SkipLink.js +19 -15
- package/lib/TooltipButton/TooltipButton.js +3 -1
- package/lib/Typography/Typography.js +11 -2
- package/lib-module/Button/ButtonBase.js +17 -5
- package/lib-module/ExpandCollapse/Panel.js +64 -8
- package/lib-module/Modal/Modal.js +8 -3
- package/lib-module/SkipLink/SkipLink.js +19 -15
- package/lib-module/TooltipButton/TooltipButton.js +3 -1
- package/lib-module/Typography/Typography.js +10 -2
- package/package.json +2 -2
- package/src/Button/ButtonBase.jsx +11 -1
- package/src/ExpandCollapse/Panel.jsx +55 -8
- package/src/Modal/Modal.jsx +8 -3
- package/src/SkipLink/SkipLink.jsx +12 -12
- package/src/TooltipButton/TooltipButton.jsx +9 -1
- package/src/Typography/Typography.jsx +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,30 @@
|
|
|
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, 07 Jul 2023 19:17:02 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.54.0
|
|
8
|
+
|
|
9
|
+
Fri, 07 Jul 2023 19:17:02 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- Koodo changes to nav bar (akshay.pandey1@telus.com)
|
|
14
|
+
- Home Pro Icon added to telus (akshay.pandey1@telus.com)
|
|
15
|
+
- Added "content" prop to ExpandCollapsePanel (wlsdud194@hotmail.com)
|
|
16
|
+
- added capability to adjust superscript sizing with theme tokens (kyle.king2@telus.com)
|
|
17
|
+
- Standardized SkipLink (wlsdud194@hotmail.com)
|
|
18
|
+
- Bump @telus-uds/system-theme-tokens to v2.37.0
|
|
19
|
+
|
|
20
|
+
### Patches
|
|
21
|
+
|
|
22
|
+
- Fix an issue where `Modal` may crash on Android devices and also may not render longer content (shahzaibkhalidmalik@outlook.com)
|
|
23
|
+
- Tooltip margin adjusted to encompass the whole component (jislaseng@gmail.com)
|
|
24
|
+
|
|
7
25
|
## 1.53.0
|
|
8
26
|
|
|
9
|
-
Wed, 28 Jun 2023 23:
|
|
27
|
+
Wed, 28 Jun 2023 23:27:23 GMT
|
|
10
28
|
|
|
11
29
|
### Minor changes
|
|
12
30
|
|
package/component-docs.json
CHANGED
|
@@ -36,7 +36,11 @@
|
|
|
36
36
|
"pressableBorderTopColor": "color",
|
|
37
37
|
"pressablePaddingBottom": "size",
|
|
38
38
|
"titleColor": "color",
|
|
39
|
-
"subTitleColor": "color"
|
|
39
|
+
"subTitleColor": "color",
|
|
40
|
+
"outerBorderColor": "color",
|
|
41
|
+
"outerBorderGap": "size",
|
|
42
|
+
"outerBorderRadius": "radius",
|
|
43
|
+
"outerBorderWidth": "border"
|
|
40
44
|
},
|
|
41
45
|
"VideoPickerSlider": {
|
|
42
46
|
"previousIcon": "icon",
|
|
@@ -59,14 +63,10 @@
|
|
|
59
63
|
"lineHeight": "lineHeight"
|
|
60
64
|
},
|
|
61
65
|
"Table": {
|
|
62
|
-
"tablePaddingBottom": "size",
|
|
63
66
|
"cellMinWidth": "size",
|
|
64
|
-
"
|
|
65
|
-
"cellHeadingBoxShadowColor": "color",
|
|
67
|
+
"tablePaddingBottom": "size",
|
|
66
68
|
"cellBoxShadowColor": "color",
|
|
67
|
-
"cellSubheadingBackground": "color",
|
|
68
69
|
"cellBackground": "color",
|
|
69
|
-
"cellRowHeadingBackground": "color",
|
|
70
70
|
"cellStickyShadow": "shadow",
|
|
71
71
|
"cellPaddingTop": "size",
|
|
72
72
|
"cellPaddingRight": "size",
|
|
@@ -74,7 +74,9 @@
|
|
|
74
74
|
"cellPaddingBottom": "size",
|
|
75
75
|
"fontWeight": "fontWeight",
|
|
76
76
|
"fontName": "fontName",
|
|
77
|
-
"fontSize": "fontSize"
|
|
77
|
+
"fontSize": "fontSize",
|
|
78
|
+
"lineHeight": "lineHeight",
|
|
79
|
+
"stickyBackgroundColor": "color"
|
|
78
80
|
},
|
|
79
81
|
"Image": {
|
|
80
82
|
"borderRadius": "radius"
|
|
@@ -646,7 +648,19 @@
|
|
|
646
648
|
"borderRadius": "radius",
|
|
647
649
|
"borderWidth": "border",
|
|
648
650
|
"expandDividerColor": "color",
|
|
649
|
-
"expandDividerWidth": "size"
|
|
651
|
+
"expandDividerWidth": "size",
|
|
652
|
+
"contentPanelBackgroundColor": "color",
|
|
653
|
+
"contentPanelPaddingLeft": "size",
|
|
654
|
+
"contentPanelPaddingRight": "size",
|
|
655
|
+
"contentPanelPaddingTop": "size",
|
|
656
|
+
"contentPanelPaddingBottom": "size",
|
|
657
|
+
"contentPanelBorderWidth": "border",
|
|
658
|
+
"contentPanelBorderColor": "color",
|
|
659
|
+
"contentPanelFontName": "fontName",
|
|
660
|
+
"contentPanelFontSize": "fontSize",
|
|
661
|
+
"contentPanelFontColor": "color",
|
|
662
|
+
"contentPanelFontWeight": "fontWeight",
|
|
663
|
+
"contentPanelLineHeight": "lineHeight"
|
|
650
664
|
},
|
|
651
665
|
"Feedback": {
|
|
652
666
|
"backgroundColor": "color",
|
|
@@ -1399,7 +1413,12 @@
|
|
|
1399
1413
|
"outlineWidth": "border",
|
|
1400
1414
|
"paddingHorizontal": "size",
|
|
1401
1415
|
"paddingVertical": "size",
|
|
1402
|
-
"borderRadius": "radius"
|
|
1416
|
+
"borderRadius": "radius",
|
|
1417
|
+
"textLine": "textLine",
|
|
1418
|
+
"fontName": "fontName",
|
|
1419
|
+
"fontWeight": "fontWeight",
|
|
1420
|
+
"fontSize": "fontSize",
|
|
1421
|
+
"lineHeight": "lineHeight"
|
|
1403
1422
|
},
|
|
1404
1423
|
"StoryCard": {
|
|
1405
1424
|
"outerBorderColor": "color",
|
|
@@ -1511,6 +1530,8 @@
|
|
|
1511
1530
|
"TermsAndConditions": {
|
|
1512
1531
|
"contentPaddingBottom": "size",
|
|
1513
1532
|
"contentPaddingLeft": "size",
|
|
1533
|
+
"contentBorderColor": "color",
|
|
1534
|
+
"contentMarginBottom": "size",
|
|
1514
1535
|
"mdContentPaddingBottom": "size",
|
|
1515
1536
|
"mdContentPaddingLeft": "size",
|
|
1516
1537
|
"orderedPadding": "size",
|
|
@@ -1537,13 +1558,20 @@
|
|
|
1537
1558
|
"expandTitleColor": "color",
|
|
1538
1559
|
"expandTitleFontSize": "size",
|
|
1539
1560
|
"expandTitleLineHeight": "lineHeight",
|
|
1561
|
+
"expandTitleFontName": "fontName",
|
|
1562
|
+
"expandTitleFontWeight": "fontWeight",
|
|
1540
1563
|
"expandTitleMarginX": "size",
|
|
1541
1564
|
"expandTitleMarginY": "size",
|
|
1565
|
+
"expandTitlePaddingLeft": "size",
|
|
1566
|
+
"expandTitleBorder": "border",
|
|
1567
|
+
"expandTitleBorderColor": "color",
|
|
1568
|
+
"expandTitleUnderline": "textLine",
|
|
1542
1569
|
"expandBaseBorderWidth": "border",
|
|
1543
1570
|
"expandContentPaddingBottom": "size",
|
|
1544
1571
|
"expandContentPaddingLeft": "size",
|
|
1545
1572
|
"expandContentPaddingRight": "size",
|
|
1546
1573
|
"expandContentPaddingTop": "size",
|
|
1574
|
+
"dividerColor": "color",
|
|
1547
1575
|
"icon": "icon"
|
|
1548
1576
|
},
|
|
1549
1577
|
"TextArea": {
|
|
@@ -1704,6 +1732,7 @@
|
|
|
1704
1732
|
},
|
|
1705
1733
|
"Typography": {
|
|
1706
1734
|
"fontName": "fontName",
|
|
1735
|
+
"superScriptFontSize": "fontSize",
|
|
1707
1736
|
"fontWeight": "fontWeight",
|
|
1708
1737
|
"fontSize": "fontSize",
|
|
1709
1738
|
"color": "color",
|
|
@@ -3153,6 +3182,45 @@
|
|
|
3153
3182
|
"type": "state"
|
|
3154
3183
|
}
|
|
3155
3184
|
},
|
|
3185
|
+
"VideoPickerThumbnail": {
|
|
3186
|
+
"focus": {
|
|
3187
|
+
"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.",
|
|
3188
|
+
"values": [
|
|
3189
|
+
true,
|
|
3190
|
+
false
|
|
3191
|
+
],
|
|
3192
|
+
"type": "state",
|
|
3193
|
+
"platforms": [
|
|
3194
|
+
"rn"
|
|
3195
|
+
]
|
|
3196
|
+
},
|
|
3197
|
+
"hover": {
|
|
3198
|
+
"description": "Currently web only. Applies when an interactive component's hover handler is triggered, such as on mouseover.",
|
|
3199
|
+
"values": [
|
|
3200
|
+
true,
|
|
3201
|
+
false
|
|
3202
|
+
],
|
|
3203
|
+
"type": "state",
|
|
3204
|
+
"platforms": [
|
|
3205
|
+
"rn"
|
|
3206
|
+
]
|
|
3207
|
+
},
|
|
3208
|
+
"pressed": {
|
|
3209
|
+
"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.",
|
|
3210
|
+
"values": [
|
|
3211
|
+
true,
|
|
3212
|
+
false
|
|
3213
|
+
],
|
|
3214
|
+
"type": "state"
|
|
3215
|
+
},
|
|
3216
|
+
"selected": {
|
|
3217
|
+
"description": "Applies while an interactive component is the currently selected one in a set of states or components, for example a button in a `ButtonGroup`.",
|
|
3218
|
+
"values": [
|
|
3219
|
+
true
|
|
3220
|
+
],
|
|
3221
|
+
"type": "state"
|
|
3222
|
+
}
|
|
3223
|
+
},
|
|
3156
3224
|
"SkipLink": {
|
|
3157
3225
|
"focus": {
|
|
3158
3226
|
"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.",
|
|
@@ -3164,6 +3232,14 @@
|
|
|
3164
3232
|
"platforms": [
|
|
3165
3233
|
"rn"
|
|
3166
3234
|
]
|
|
3235
|
+
},
|
|
3236
|
+
"pressed": {
|
|
3237
|
+
"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.",
|
|
3238
|
+
"values": [
|
|
3239
|
+
true,
|
|
3240
|
+
false
|
|
3241
|
+
],
|
|
3242
|
+
"type": "state"
|
|
3167
3243
|
}
|
|
3168
3244
|
}
|
|
3169
3245
|
},
|
|
@@ -3219,8 +3295,11 @@
|
|
|
3219
3295
|
},
|
|
3220
3296
|
"fontSize": {
|
|
3221
3297
|
"default": 16,
|
|
3222
|
-
"nullable":
|
|
3223
|
-
"type": "Number"
|
|
3298
|
+
"nullable": true,
|
|
3299
|
+
"type": "Number|String|null",
|
|
3300
|
+
"values": {
|
|
3301
|
+
"none": null
|
|
3302
|
+
}
|
|
3224
3303
|
},
|
|
3225
3304
|
"lineHeight": {
|
|
3226
3305
|
"default": 1,
|
|
@@ -3604,7 +3683,19 @@
|
|
|
3604
3683
|
"borderRadius": "radius",
|
|
3605
3684
|
"borderWidth": "border",
|
|
3606
3685
|
"expandDividerColor": "color",
|
|
3607
|
-
"expandDividerWidth": "size"
|
|
3686
|
+
"expandDividerWidth": "size",
|
|
3687
|
+
"contentPanelBackgroundColor": "color",
|
|
3688
|
+
"contentPanelPaddingLeft": "size",
|
|
3689
|
+
"contentPanelPaddingRight": "size",
|
|
3690
|
+
"contentPanelPaddingTop": "size",
|
|
3691
|
+
"contentPanelPaddingBottom": "size",
|
|
3692
|
+
"contentPanelBorderWidth": "border",
|
|
3693
|
+
"contentPanelBorderColor": "color",
|
|
3694
|
+
"contentPanelFontName": "fontName",
|
|
3695
|
+
"contentPanelFontSize": "fontSize",
|
|
3696
|
+
"contentPanelFontColor": "color",
|
|
3697
|
+
"contentPanelFontWeight": "fontWeight",
|
|
3698
|
+
"contentPanelLineHeight": "lineHeight"
|
|
3608
3699
|
}
|
|
3609
3700
|
},
|
|
3610
3701
|
"required": false,
|
|
@@ -3621,7 +3712,7 @@
|
|
|
3621
3712
|
"type": {
|
|
3622
3713
|
"name": "func"
|
|
3623
3714
|
},
|
|
3624
|
-
"required":
|
|
3715
|
+
"required": false,
|
|
3625
3716
|
"description": "Function to call on pressing the panel's control, which should open or close the panel.\nIf Panel is a direct child of `ExpandCollapse`, this prop will be provided by the ExpandCollapse parent."
|
|
3626
3717
|
},
|
|
3627
3718
|
"onPress": {
|
|
@@ -3649,10 +3740,10 @@
|
|
|
3649
3740
|
"control": {
|
|
3650
3741
|
"type": {
|
|
3651
3742
|
"name": "custom",
|
|
3652
|
-
"raw": "ExpandCollapseControl.propTypes.children
|
|
3743
|
+
"raw": "ExpandCollapseControl.propTypes.children"
|
|
3653
3744
|
},
|
|
3654
3745
|
"required": false,
|
|
3655
|
-
"description": "The content inside the
|
|
3746
|
+
"description": "The content inside the control element that opens and closes the ExpandCollapse when pressed."
|
|
3656
3747
|
},
|
|
3657
3748
|
"controlTokens": {
|
|
3658
3749
|
"type": {
|
|
@@ -3690,6 +3781,13 @@
|
|
|
3690
3781
|
},
|
|
3691
3782
|
"required": false,
|
|
3692
3783
|
"description": "An optional ref to be attached to the control"
|
|
3784
|
+
},
|
|
3785
|
+
"content": {
|
|
3786
|
+
"type": {
|
|
3787
|
+
"name": "bool"
|
|
3788
|
+
},
|
|
3789
|
+
"required": false,
|
|
3790
|
+
"description": "A boolean prop to determine if the panel is a content panel or not. If true, the panel will not have a control"
|
|
3693
3791
|
}
|
|
3694
3792
|
},
|
|
3695
3793
|
"attributes": {
|
|
@@ -4548,7 +4646,19 @@
|
|
|
4548
4646
|
"borderRadius": "radius",
|
|
4549
4647
|
"borderWidth": "border",
|
|
4550
4648
|
"expandDividerColor": "color",
|
|
4551
|
-
"expandDividerWidth": "size"
|
|
4649
|
+
"expandDividerWidth": "size",
|
|
4650
|
+
"contentPanelBackgroundColor": "color",
|
|
4651
|
+
"contentPanelPaddingLeft": "size",
|
|
4652
|
+
"contentPanelPaddingRight": "size",
|
|
4653
|
+
"contentPanelPaddingTop": "size",
|
|
4654
|
+
"contentPanelPaddingBottom": "size",
|
|
4655
|
+
"contentPanelBorderWidth": "border",
|
|
4656
|
+
"contentPanelBorderColor": "color",
|
|
4657
|
+
"contentPanelFontName": "fontName",
|
|
4658
|
+
"contentPanelFontSize": "fontSize",
|
|
4659
|
+
"contentPanelFontColor": "color",
|
|
4660
|
+
"contentPanelFontWeight": "fontWeight",
|
|
4661
|
+
"contentPanelLineHeight": "lineHeight"
|
|
4552
4662
|
}
|
|
4553
4663
|
},
|
|
4554
4664
|
"required": false,
|
|
@@ -4565,7 +4675,7 @@
|
|
|
4565
4675
|
"type": {
|
|
4566
4676
|
"name": "func"
|
|
4567
4677
|
},
|
|
4568
|
-
"required":
|
|
4678
|
+
"required": false,
|
|
4569
4679
|
"description": "Function to call on pressing the panel's control, which should open or close the panel.\nIf Panel is a direct child of `ExpandCollapse`, this prop will be provided by the ExpandCollapse parent."
|
|
4570
4680
|
},
|
|
4571
4681
|
"onPress": {
|
|
@@ -4593,10 +4703,10 @@
|
|
|
4593
4703
|
"control": {
|
|
4594
4704
|
"type": {
|
|
4595
4705
|
"name": "custom",
|
|
4596
|
-
"raw": "ExpandCollapseControl.propTypes.children
|
|
4706
|
+
"raw": "ExpandCollapseControl.propTypes.children"
|
|
4597
4707
|
},
|
|
4598
4708
|
"required": false,
|
|
4599
|
-
"description": "The content inside the
|
|
4709
|
+
"description": "The content inside the control element that opens and closes the ExpandCollapse when pressed."
|
|
4600
4710
|
},
|
|
4601
4711
|
"controlTokens": {
|
|
4602
4712
|
"type": {
|
|
@@ -4634,6 +4744,13 @@
|
|
|
4634
4744
|
},
|
|
4635
4745
|
"required": false,
|
|
4636
4746
|
"description": "An optional ref to be attached to the control"
|
|
4747
|
+
},
|
|
4748
|
+
"content": {
|
|
4749
|
+
"type": {
|
|
4750
|
+
"name": "bool"
|
|
4751
|
+
},
|
|
4752
|
+
"required": false,
|
|
4753
|
+
"description": "A boolean prop to determine if the panel is a content panel or not. If true, the panel will not have a control"
|
|
4637
4754
|
}
|
|
4638
4755
|
},
|
|
4639
4756
|
"attributes": {
|
|
@@ -9516,7 +9633,12 @@
|
|
|
9516
9633
|
"outlineWidth": "border",
|
|
9517
9634
|
"paddingHorizontal": "size",
|
|
9518
9635
|
"paddingVertical": "size",
|
|
9519
|
-
"borderRadius": "radius"
|
|
9636
|
+
"borderRadius": "radius",
|
|
9637
|
+
"textLine": "textLine",
|
|
9638
|
+
"fontName": "fontName",
|
|
9639
|
+
"fontWeight": "fontWeight",
|
|
9640
|
+
"fontSize": "fontSize",
|
|
9641
|
+
"lineHeight": "lineHeight"
|
|
9520
9642
|
}
|
|
9521
9643
|
},
|
|
9522
9644
|
"required": false,
|
|
@@ -10943,6 +11065,7 @@
|
|
|
10943
11065
|
"name": "custom",
|
|
10944
11066
|
"raw": {
|
|
10945
11067
|
"fontName": "fontName",
|
|
11068
|
+
"superScriptFontSize": "fontSize",
|
|
10946
11069
|
"fontWeight": "fontWeight",
|
|
10947
11070
|
"fontSize": "fontSize",
|
|
10948
11071
|
"color": "color",
|
package/lib/Button/ButtonBase.js
CHANGED
|
@@ -232,19 +232,29 @@ const selectWebOnlyStyles = (inactive, themeTokens, _ref8) => {
|
|
|
232
232
|
});
|
|
233
233
|
};
|
|
234
234
|
|
|
235
|
-
const
|
|
235
|
+
const selectButtonStyles = _ref9 => {
|
|
236
|
+
let {
|
|
237
|
+
textAlign
|
|
238
|
+
} = _ref9;
|
|
239
|
+
return {
|
|
240
|
+
flexDirection: 'row',
|
|
241
|
+
justifyContent: textAlign
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
const selectItemIconTokens = _ref10 => {
|
|
236
246
|
let {
|
|
237
247
|
color,
|
|
238
248
|
iconColor,
|
|
239
249
|
iconSize
|
|
240
|
-
} =
|
|
250
|
+
} = _ref10;
|
|
241
251
|
return {
|
|
242
252
|
size: iconSize,
|
|
243
253
|
color: iconColor || color
|
|
244
254
|
};
|
|
245
255
|
};
|
|
246
256
|
|
|
247
|
-
const ButtonBase = /*#__PURE__*/(0, _react.forwardRef)((
|
|
257
|
+
const ButtonBase = /*#__PURE__*/(0, _react.forwardRef)((_ref11, ref) => {
|
|
248
258
|
let {
|
|
249
259
|
id,
|
|
250
260
|
href,
|
|
@@ -259,7 +269,7 @@ const ButtonBase = /*#__PURE__*/(0, _react.forwardRef)((_ref10, ref) => {
|
|
|
259
269
|
iconPosition = icon ? 'left' : undefined,
|
|
260
270
|
iconProps,
|
|
261
271
|
...rawRest
|
|
262
|
-
} =
|
|
272
|
+
} = _ref11;
|
|
263
273
|
|
|
264
274
|
const {
|
|
265
275
|
onPress,
|
|
@@ -308,6 +318,7 @@ const ButtonBase = /*#__PURE__*/(0, _react.forwardRef)((_ref10, ref) => {
|
|
|
308
318
|
|
|
309
319
|
const stretchStyles = themeTokens.width ? staticStyles.stretch : staticStyles.align;
|
|
310
320
|
const IconComponent = icon || themeTokens.icon;
|
|
321
|
+
const rowStyles = selectButtonStyles(themeTokens);
|
|
311
322
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
312
323
|
id: id,
|
|
313
324
|
style: [containerStyles, borderStyles, stretchStyles, staticStyles.row, _Platform.default.select({
|
|
@@ -315,7 +326,8 @@ const ButtonBase = /*#__PURE__*/(0, _react.forwardRef)((_ref10, ref) => {
|
|
|
315
326
|
maxWidth: '100%',
|
|
316
327
|
// ensure overflowing content wraps
|
|
317
328
|
// TODO: https://github.com/telus/universal-design-system/issues/487
|
|
318
|
-
transition: 'background-color 200ms, border-color 200ms'
|
|
329
|
+
transition: 'background-color 200ms, border-color 200ms',
|
|
330
|
+
...rowStyles
|
|
319
331
|
}
|
|
320
332
|
})],
|
|
321
333
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.IconText, {
|
|
@@ -13,6 +13,8 @@ var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/export
|
|
|
13
13
|
|
|
14
14
|
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
15
15
|
|
|
16
|
+
var _Text = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Text"));
|
|
17
|
+
|
|
16
18
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
19
|
|
|
18
20
|
var _airbnbPropTypes = _interopRequireDefault(require("airbnb-prop-types"));
|
|
@@ -44,7 +46,50 @@ const selectContainerStyles = _ref => {
|
|
|
44
46
|
paddingLeft: contentPaddingLeft,
|
|
45
47
|
paddingRight: contentPaddingRight,
|
|
46
48
|
paddingTop: contentPaddingTop,
|
|
47
|
-
paddingBottom: contentPaddingBottom
|
|
49
|
+
paddingBottom: contentPaddingBottom,
|
|
50
|
+
flex: 1
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const selectTextStyles = _ref2 => {
|
|
55
|
+
let {
|
|
56
|
+
contentPanelFontSize,
|
|
57
|
+
contentPanelFontName,
|
|
58
|
+
contentPanelFontColor,
|
|
59
|
+
contentPanelFontWeight,
|
|
60
|
+
contentPanelLineHeight
|
|
61
|
+
} = _ref2;
|
|
62
|
+
return {
|
|
63
|
+
fontSize: contentPanelFontSize,
|
|
64
|
+
fontFamily: `${contentPanelFontName}${contentPanelFontWeight}normal`,
|
|
65
|
+
lineHeight: contentPanelFontSize * contentPanelLineHeight,
|
|
66
|
+
color: contentPanelFontColor
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const selectContentPanelStyles = _ref3 => {
|
|
71
|
+
let {
|
|
72
|
+
contentPanelBackgroundColor,
|
|
73
|
+
contentPanelPaddingTop,
|
|
74
|
+
contentPanelPaddingBottom,
|
|
75
|
+
contentPanelPaddingLeft,
|
|
76
|
+
contentPanelPaddingRight,
|
|
77
|
+
contentPanelBorderWidth,
|
|
78
|
+
contentPanelBorderColor,
|
|
79
|
+
borderRadius,
|
|
80
|
+
marginBottom
|
|
81
|
+
} = _ref3;
|
|
82
|
+
return {
|
|
83
|
+
backgroundColor: contentPanelBackgroundColor,
|
|
84
|
+
paddingTop: contentPanelPaddingTop,
|
|
85
|
+
paddingBottom: contentPanelPaddingBottom,
|
|
86
|
+
paddingLeft: contentPanelPaddingLeft,
|
|
87
|
+
paddingRight: contentPanelPaddingRight,
|
|
88
|
+
borderWidth: contentPanelBorderWidth,
|
|
89
|
+
borderColor: contentPanelBorderColor,
|
|
90
|
+
borderStyle: 'solid',
|
|
91
|
+
borderRadius,
|
|
92
|
+
marginBottom
|
|
48
93
|
};
|
|
49
94
|
};
|
|
50
95
|
/**
|
|
@@ -59,7 +104,7 @@ const selectContainerStyles = _ref => {
|
|
|
59
104
|
*/
|
|
60
105
|
|
|
61
106
|
|
|
62
|
-
const ExpandCollapsePanel = /*#__PURE__*/(0, _react.forwardRef)((
|
|
107
|
+
const ExpandCollapsePanel = /*#__PURE__*/(0, _react.forwardRef)((_ref4, ref) => {
|
|
63
108
|
let {
|
|
64
109
|
openIds = [],
|
|
65
110
|
panelId,
|
|
@@ -71,8 +116,9 @@ const ExpandCollapsePanel = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
71
116
|
tokens,
|
|
72
117
|
variant,
|
|
73
118
|
controlRef,
|
|
119
|
+
content,
|
|
74
120
|
...rest
|
|
75
|
-
} =
|
|
121
|
+
} = _ref4;
|
|
76
122
|
const [containerHeight, setContainerHeight] = (0, _react.useState)(null);
|
|
77
123
|
const isExpanded = openIds.includes(panelId);
|
|
78
124
|
const selectedProps = selectProps({ ...rest,
|
|
@@ -107,7 +153,13 @@ const ExpandCollapsePanel = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
107
153
|
tokens: themeTokens
|
|
108
154
|
});
|
|
109
155
|
const focusabilityProps = isExpanded ? {} : _utils.a11yProps.nonFocusableProps;
|
|
110
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
156
|
+
return content ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
157
|
+
style: selectContentPanelStyles(themeTokens),
|
|
158
|
+
children: typeof children === 'string' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
159
|
+
style: selectTextStyles(themeTokens),
|
|
160
|
+
children: children
|
|
161
|
+
}) : children
|
|
162
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
111
163
|
ref: ref,
|
|
112
164
|
style: themeTokens,
|
|
113
165
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Control.default, { ...selectedProps,
|
|
@@ -157,7 +209,7 @@ ExpandCollapsePanel.propTypes = { ...selectedSystemPropTypes,
|
|
|
157
209
|
* Function to call on pressing the panel's control, which should open or close the panel.
|
|
158
210
|
* If Panel is a direct child of `ExpandCollapse`, this prop will be provided by the ExpandCollapse parent.
|
|
159
211
|
*/
|
|
160
|
-
onToggle: _propTypes.default.func
|
|
212
|
+
onToggle: _propTypes.default.func,
|
|
161
213
|
|
|
162
214
|
/**
|
|
163
215
|
* Optional function to call on pressing the panel's control, in addition to opening or closing the panel.
|
|
@@ -171,9 +223,9 @@ ExpandCollapsePanel.propTypes = { ...selectedSystemPropTypes,
|
|
|
171
223
|
children: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.node]),
|
|
172
224
|
|
|
173
225
|
/**
|
|
174
|
-
* The content inside the
|
|
226
|
+
* The content inside the control element that opens and closes the ExpandCollapse when pressed.
|
|
175
227
|
*/
|
|
176
|
-
control: _Control.default.propTypes.children
|
|
228
|
+
control: _Control.default.propTypes.children,
|
|
177
229
|
|
|
178
230
|
/**
|
|
179
231
|
* Optional theme token overrides that may be passed to the ExpandCollapseControl element.
|
|
@@ -183,7 +235,12 @@ ExpandCollapsePanel.propTypes = { ...selectedSystemPropTypes,
|
|
|
183
235
|
/**
|
|
184
236
|
* An optional ref to be attached to the control
|
|
185
237
|
*/
|
|
186
|
-
controlRef: _airbnbPropTypes.default.ref()
|
|
238
|
+
controlRef: _airbnbPropTypes.default.ref(),
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* A boolean prop to determine if the panel is a content panel or not. If true, the panel will not have a control
|
|
242
|
+
*/
|
|
243
|
+
content: _propTypes.default.bool
|
|
187
244
|
};
|
|
188
245
|
var _default = ExpandCollapsePanel;
|
|
189
246
|
exports.default = _default;
|
package/lib/Modal/Modal.js
CHANGED
|
@@ -13,6 +13,8 @@ var _TouchableWithoutFeedback = _interopRequireDefault(require("react-native-web
|
|
|
13
13
|
|
|
14
14
|
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
15
15
|
|
|
16
|
+
var _ScrollView = _interopRequireDefault(require("react-native-web/dist/cjs/exports/ScrollView"));
|
|
17
|
+
|
|
16
18
|
var _Modal = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Modal"));
|
|
17
19
|
|
|
18
20
|
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
@@ -166,8 +168,8 @@ const Modal = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
166
168
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Modal.default, {
|
|
167
169
|
transparent: true,
|
|
168
170
|
...selectProps(rest),
|
|
169
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
170
|
-
|
|
171
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ScrollView.default, {
|
|
172
|
+
contentContainerStyle: [staticStyles.positioningContainer],
|
|
171
173
|
ref: modalRef,
|
|
172
174
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
173
175
|
style: [staticStyles.sizingContainer, selectContainerStyles(themeTokens)],
|
|
@@ -258,7 +260,11 @@ const staticStyles = _StyleSheet.default.create({
|
|
|
258
260
|
modal: {
|
|
259
261
|
maxHeight: '100%',
|
|
260
262
|
// so that the modal can expand vertically up to the sizing container's height (exclusive of its vertical padding)
|
|
261
|
-
|
|
263
|
+
..._Platform.default.select({
|
|
264
|
+
web: {
|
|
265
|
+
overflow: 'auto'
|
|
266
|
+
}
|
|
267
|
+
})
|
|
262
268
|
},
|
|
263
269
|
closeButtonContainer: {
|
|
264
270
|
position: 'absolute',
|
package/lib/SkipLink/SkipLink.js
CHANGED
|
@@ -56,10 +56,19 @@ const selectStyles = _ref => {
|
|
|
56
56
|
|
|
57
57
|
const selectTextStyles = _ref2 => {
|
|
58
58
|
let {
|
|
59
|
-
color
|
|
59
|
+
color,
|
|
60
|
+
textLine,
|
|
61
|
+
fontName,
|
|
62
|
+
fontSize,
|
|
63
|
+
fontWeight,
|
|
64
|
+
lineHeight
|
|
60
65
|
} = _ref2;
|
|
61
66
|
return {
|
|
62
|
-
color
|
|
67
|
+
color,
|
|
68
|
+
textDecorationLine: textLine,
|
|
69
|
+
fontFamily: `${fontName}${fontWeight}normal`,
|
|
70
|
+
lineHeight: fontSize * lineHeight,
|
|
71
|
+
fontSize
|
|
63
72
|
};
|
|
64
73
|
};
|
|
65
74
|
/**
|
|
@@ -134,9 +143,6 @@ const SkipLink = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
|
|
|
134
143
|
} = _utils.clickProps.toPressProps(rawRest);
|
|
135
144
|
|
|
136
145
|
const getTokens = (0, _ThemeProvider.useThemeTokensCallback)('SkipLink', tokens, variant);
|
|
137
|
-
const defaultTokens = getTokens();
|
|
138
|
-
|
|
139
|
-
const resolveLinkTokens = pressState => (0, _utils.resolvePressableTokens)(defaultTokens, pressState);
|
|
140
146
|
|
|
141
147
|
const handlePress = event => {
|
|
142
148
|
if (typeof onPress === 'function') onPress(event); // TODO - support native apps with something based on refs and/or setAccessibilityFocus
|
|
@@ -147,19 +153,17 @@ const SkipLink = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
|
|
|
147
153
|
accessibilityRole: "link",
|
|
148
154
|
onPress: handlePress,
|
|
149
155
|
href: href,
|
|
150
|
-
style:
|
|
151
|
-
|
|
152
|
-
focused: focus
|
|
153
|
-
} = _ref4;
|
|
154
|
-
const themeTokens = getTokens({
|
|
155
|
-
focus
|
|
156
|
-
});
|
|
156
|
+
style: pressableState => {
|
|
157
|
+
const themeTokens = (0, _utils.resolvePressableTokens)(getTokens, pressableState);
|
|
157
158
|
const skipLinkStyle = selectStyles(themeTokens);
|
|
158
|
-
|
|
159
|
+
const {
|
|
160
|
+
focused
|
|
161
|
+
} = pressableState;
|
|
162
|
+
return [staticStyles.absolute, skipLinkStyle, !focused && staticStyles.hidden];
|
|
159
163
|
},
|
|
160
164
|
...selectProps(rest),
|
|
161
|
-
children:
|
|
162
|
-
const themeTokens =
|
|
165
|
+
children: pressableState => {
|
|
166
|
+
const themeTokens = (0, _utils.resolvePressableTokens)(getTokens, pressableState);
|
|
163
167
|
const textStyles = selectTextStyles(themeTokens);
|
|
164
168
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
165
169
|
style: [textStyles, staticStyles.baseline],
|
|
@@ -65,7 +65,9 @@ const TooltipButton = _ref3 => {
|
|
|
65
65
|
icon: IconComponent
|
|
66
66
|
} = themeTokens;
|
|
67
67
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
68
|
-
style: (0, _ThemeProvider.applyOuterBorder)(themeTokens),
|
|
68
|
+
style: [(0, _ThemeProvider.applyOuterBorder)(themeTokens), themeTokens.outerBorderWidth && {
|
|
69
|
+
margin: -themeTokens.outerBorderWidth
|
|
70
|
+
}],
|
|
69
71
|
...selectProps(rest),
|
|
70
72
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
71
73
|
style: selectInnerContainerStyles(themeTokens),
|
|
@@ -75,7 +75,10 @@ const Typography = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
75
75
|
...rest
|
|
76
76
|
} = _ref2;
|
|
77
77
|
const viewport = (0, _ViewportProvider.useViewport)();
|
|
78
|
-
const
|
|
78
|
+
const {
|
|
79
|
+
superScriptFontSize,
|
|
80
|
+
...themeTokens
|
|
81
|
+
} = (0, _ThemeProvider.useThemeTokens)('Typography', tokens, variant, {
|
|
79
82
|
viewport
|
|
80
83
|
});
|
|
81
84
|
const {
|
|
@@ -98,8 +101,14 @@ const Typography = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
98
101
|
if (typeof child === 'object' && ((child === null || child === void 0 ? void 0 : child.type) === 'sub' || (child === null || child === void 0 ? void 0 : child.type) === 'sup')) {
|
|
99
102
|
var _child$props;
|
|
100
103
|
|
|
104
|
+
const childStyles = (child === null || child === void 0 ? void 0 : (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.style) || {};
|
|
105
|
+
const supFontSize = childStyles.fontSize ?? superScriptFontSize;
|
|
106
|
+
|
|
101
107
|
const sanitizedChild = /*#__PURE__*/_react.default.cloneElement(child, {
|
|
102
|
-
style: { ...
|
|
108
|
+
style: { ...childStyles,
|
|
109
|
+
...(supFontSize ? {
|
|
110
|
+
fontSize: supFontSize
|
|
111
|
+
} : {}),
|
|
103
112
|
lineHeight: 0
|
|
104
113
|
}
|
|
105
114
|
});
|
|
@@ -208,19 +208,29 @@ const selectWebOnlyStyles = (inactive, themeTokens, _ref8) => {
|
|
|
208
208
|
});
|
|
209
209
|
};
|
|
210
210
|
|
|
211
|
-
const
|
|
211
|
+
const selectButtonStyles = _ref9 => {
|
|
212
|
+
let {
|
|
213
|
+
textAlign
|
|
214
|
+
} = _ref9;
|
|
215
|
+
return {
|
|
216
|
+
flexDirection: 'row',
|
|
217
|
+
justifyContent: textAlign
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
const selectItemIconTokens = _ref10 => {
|
|
212
222
|
let {
|
|
213
223
|
color,
|
|
214
224
|
iconColor,
|
|
215
225
|
iconSize
|
|
216
|
-
} =
|
|
226
|
+
} = _ref10;
|
|
217
227
|
return {
|
|
218
228
|
size: iconSize,
|
|
219
229
|
color: iconColor || color
|
|
220
230
|
};
|
|
221
231
|
};
|
|
222
232
|
|
|
223
|
-
const ButtonBase = /*#__PURE__*/forwardRef((
|
|
233
|
+
const ButtonBase = /*#__PURE__*/forwardRef((_ref11, ref) => {
|
|
224
234
|
let {
|
|
225
235
|
id,
|
|
226
236
|
href,
|
|
@@ -235,7 +245,7 @@ const ButtonBase = /*#__PURE__*/forwardRef((_ref10, ref) => {
|
|
|
235
245
|
iconPosition = icon ? 'left' : undefined,
|
|
236
246
|
iconProps,
|
|
237
247
|
...rawRest
|
|
238
|
-
} =
|
|
248
|
+
} = _ref11;
|
|
239
249
|
const {
|
|
240
250
|
onPress,
|
|
241
251
|
...rest
|
|
@@ -282,6 +292,7 @@ const ButtonBase = /*#__PURE__*/forwardRef((_ref10, ref) => {
|
|
|
282
292
|
|
|
283
293
|
const stretchStyles = themeTokens.width ? staticStyles.stretch : staticStyles.align;
|
|
284
294
|
const IconComponent = icon || themeTokens.icon;
|
|
295
|
+
const rowStyles = selectButtonStyles(themeTokens);
|
|
285
296
|
return /*#__PURE__*/_jsx(View, {
|
|
286
297
|
id: id,
|
|
287
298
|
style: [containerStyles, borderStyles, stretchStyles, staticStyles.row, Platform.select({
|
|
@@ -289,7 +300,8 @@ const ButtonBase = /*#__PURE__*/forwardRef((_ref10, ref) => {
|
|
|
289
300
|
maxWidth: '100%',
|
|
290
301
|
// ensure overflowing content wraps
|
|
291
302
|
// TODO: https://github.com/telus/universal-design-system/issues/487
|
|
292
|
-
transition: 'background-color 200ms, border-color 200ms'
|
|
303
|
+
transition: 'background-color 200ms, border-color 200ms',
|
|
304
|
+
...rowStyles
|
|
293
305
|
}
|
|
294
306
|
})],
|
|
295
307
|
children: /*#__PURE__*/_jsx(IconText, {
|
|
@@ -2,6 +2,7 @@ import React, { forwardRef, useState } from 'react';
|
|
|
2
2
|
import Animated from "react-native-web/dist/exports/Animated";
|
|
3
3
|
import Platform from "react-native-web/dist/exports/Platform";
|
|
4
4
|
import View from "react-native-web/dist/exports/View";
|
|
5
|
+
import Text from "react-native-web/dist/exports/Text";
|
|
5
6
|
import PropTypes from 'prop-types';
|
|
6
7
|
import ABBPropTypes from 'airbnb-prop-types';
|
|
7
8
|
import ExpandCollapseControl from './Control';
|
|
@@ -22,7 +23,50 @@ const selectContainerStyles = _ref => {
|
|
|
22
23
|
paddingLeft: contentPaddingLeft,
|
|
23
24
|
paddingRight: contentPaddingRight,
|
|
24
25
|
paddingTop: contentPaddingTop,
|
|
25
|
-
paddingBottom: contentPaddingBottom
|
|
26
|
+
paddingBottom: contentPaddingBottom,
|
|
27
|
+
flex: 1
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const selectTextStyles = _ref2 => {
|
|
32
|
+
let {
|
|
33
|
+
contentPanelFontSize,
|
|
34
|
+
contentPanelFontName,
|
|
35
|
+
contentPanelFontColor,
|
|
36
|
+
contentPanelFontWeight,
|
|
37
|
+
contentPanelLineHeight
|
|
38
|
+
} = _ref2;
|
|
39
|
+
return {
|
|
40
|
+
fontSize: contentPanelFontSize,
|
|
41
|
+
fontFamily: `${contentPanelFontName}${contentPanelFontWeight}normal`,
|
|
42
|
+
lineHeight: contentPanelFontSize * contentPanelLineHeight,
|
|
43
|
+
color: contentPanelFontColor
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const selectContentPanelStyles = _ref3 => {
|
|
48
|
+
let {
|
|
49
|
+
contentPanelBackgroundColor,
|
|
50
|
+
contentPanelPaddingTop,
|
|
51
|
+
contentPanelPaddingBottom,
|
|
52
|
+
contentPanelPaddingLeft,
|
|
53
|
+
contentPanelPaddingRight,
|
|
54
|
+
contentPanelBorderWidth,
|
|
55
|
+
contentPanelBorderColor,
|
|
56
|
+
borderRadius,
|
|
57
|
+
marginBottom
|
|
58
|
+
} = _ref3;
|
|
59
|
+
return {
|
|
60
|
+
backgroundColor: contentPanelBackgroundColor,
|
|
61
|
+
paddingTop: contentPanelPaddingTop,
|
|
62
|
+
paddingBottom: contentPanelPaddingBottom,
|
|
63
|
+
paddingLeft: contentPanelPaddingLeft,
|
|
64
|
+
paddingRight: contentPanelPaddingRight,
|
|
65
|
+
borderWidth: contentPanelBorderWidth,
|
|
66
|
+
borderColor: contentPanelBorderColor,
|
|
67
|
+
borderStyle: 'solid',
|
|
68
|
+
borderRadius,
|
|
69
|
+
marginBottom
|
|
26
70
|
};
|
|
27
71
|
};
|
|
28
72
|
/**
|
|
@@ -37,7 +81,7 @@ const selectContainerStyles = _ref => {
|
|
|
37
81
|
*/
|
|
38
82
|
|
|
39
83
|
|
|
40
|
-
const ExpandCollapsePanel = /*#__PURE__*/forwardRef((
|
|
84
|
+
const ExpandCollapsePanel = /*#__PURE__*/forwardRef((_ref4, ref) => {
|
|
41
85
|
let {
|
|
42
86
|
openIds = [],
|
|
43
87
|
panelId,
|
|
@@ -49,8 +93,9 @@ const ExpandCollapsePanel = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
49
93
|
tokens,
|
|
50
94
|
variant,
|
|
51
95
|
controlRef,
|
|
96
|
+
content,
|
|
52
97
|
...rest
|
|
53
|
-
} =
|
|
98
|
+
} = _ref4;
|
|
54
99
|
const [containerHeight, setContainerHeight] = useState(null);
|
|
55
100
|
const isExpanded = openIds.includes(panelId);
|
|
56
101
|
const selectedProps = selectProps({ ...rest,
|
|
@@ -85,7 +130,13 @@ const ExpandCollapsePanel = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
85
130
|
tokens: themeTokens
|
|
86
131
|
});
|
|
87
132
|
const focusabilityProps = isExpanded ? {} : a11yProps.nonFocusableProps;
|
|
88
|
-
return /*#__PURE__*/
|
|
133
|
+
return content ? /*#__PURE__*/_jsx(View, {
|
|
134
|
+
style: selectContentPanelStyles(themeTokens),
|
|
135
|
+
children: typeof children === 'string' ? /*#__PURE__*/_jsx(Text, {
|
|
136
|
+
style: selectTextStyles(themeTokens),
|
|
137
|
+
children: children
|
|
138
|
+
}) : children
|
|
139
|
+
}) : /*#__PURE__*/_jsxs(View, {
|
|
89
140
|
ref: ref,
|
|
90
141
|
style: themeTokens,
|
|
91
142
|
children: [/*#__PURE__*/_jsx(ExpandCollapseControl, { ...selectedProps,
|
|
@@ -135,7 +186,7 @@ ExpandCollapsePanel.propTypes = { ...selectedSystemPropTypes,
|
|
|
135
186
|
* Function to call on pressing the panel's control, which should open or close the panel.
|
|
136
187
|
* If Panel is a direct child of `ExpandCollapse`, this prop will be provided by the ExpandCollapse parent.
|
|
137
188
|
*/
|
|
138
|
-
onToggle: PropTypes.func
|
|
189
|
+
onToggle: PropTypes.func,
|
|
139
190
|
|
|
140
191
|
/**
|
|
141
192
|
* Optional function to call on pressing the panel's control, in addition to opening or closing the panel.
|
|
@@ -149,9 +200,9 @@ ExpandCollapsePanel.propTypes = { ...selectedSystemPropTypes,
|
|
|
149
200
|
children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
|
|
150
201
|
|
|
151
202
|
/**
|
|
152
|
-
* The content inside the
|
|
203
|
+
* The content inside the control element that opens and closes the ExpandCollapse when pressed.
|
|
153
204
|
*/
|
|
154
|
-
control: ExpandCollapseControl.propTypes.children
|
|
205
|
+
control: ExpandCollapseControl.propTypes.children,
|
|
155
206
|
|
|
156
207
|
/**
|
|
157
208
|
* Optional theme token overrides that may be passed to the ExpandCollapseControl element.
|
|
@@ -161,6 +212,11 @@ ExpandCollapsePanel.propTypes = { ...selectedSystemPropTypes,
|
|
|
161
212
|
/**
|
|
162
213
|
* An optional ref to be attached to the control
|
|
163
214
|
*/
|
|
164
|
-
controlRef: ABBPropTypes.ref()
|
|
215
|
+
controlRef: ABBPropTypes.ref(),
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* A boolean prop to determine if the panel is a content panel or not. If true, the panel will not have a control
|
|
219
|
+
*/
|
|
220
|
+
content: PropTypes.bool
|
|
165
221
|
};
|
|
166
222
|
export default ExpandCollapsePanel;
|
|
@@ -2,6 +2,7 @@ import React, { forwardRef } from 'react';
|
|
|
2
2
|
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
3
3
|
import TouchableWithoutFeedback from "react-native-web/dist/exports/TouchableWithoutFeedback";
|
|
4
4
|
import View from "react-native-web/dist/exports/View";
|
|
5
|
+
import ScrollView from "react-native-web/dist/exports/ScrollView";
|
|
5
6
|
import NativeModal from "react-native-web/dist/exports/Modal";
|
|
6
7
|
import Platform from "react-native-web/dist/exports/Platform";
|
|
7
8
|
import PropTypes from 'prop-types';
|
|
@@ -140,8 +141,8 @@ const Modal = /*#__PURE__*/forwardRef((_ref5, ref) => {
|
|
|
140
141
|
return /*#__PURE__*/_jsx(NativeModal, {
|
|
141
142
|
transparent: true,
|
|
142
143
|
...selectProps(rest),
|
|
143
|
-
children: /*#__PURE__*/_jsxs(
|
|
144
|
-
|
|
144
|
+
children: /*#__PURE__*/_jsxs(ScrollView, {
|
|
145
|
+
contentContainerStyle: [staticStyles.positioningContainer],
|
|
145
146
|
ref: modalRef,
|
|
146
147
|
children: [/*#__PURE__*/_jsx(View, {
|
|
147
148
|
style: [staticStyles.sizingContainer, selectContainerStyles(themeTokens)],
|
|
@@ -230,7 +231,11 @@ const staticStyles = StyleSheet.create({
|
|
|
230
231
|
modal: {
|
|
231
232
|
maxHeight: '100%',
|
|
232
233
|
// so that the modal can expand vertically up to the sizing container's height (exclusive of its vertical padding)
|
|
233
|
-
|
|
234
|
+
...Platform.select({
|
|
235
|
+
web: {
|
|
236
|
+
overflow: 'auto'
|
|
237
|
+
}
|
|
238
|
+
})
|
|
234
239
|
},
|
|
235
240
|
closeButtonContainer: {
|
|
236
241
|
position: 'absolute',
|
|
@@ -34,10 +34,19 @@ const selectStyles = _ref => {
|
|
|
34
34
|
|
|
35
35
|
const selectTextStyles = _ref2 => {
|
|
36
36
|
let {
|
|
37
|
-
color
|
|
37
|
+
color,
|
|
38
|
+
textLine,
|
|
39
|
+
fontName,
|
|
40
|
+
fontSize,
|
|
41
|
+
fontWeight,
|
|
42
|
+
lineHeight
|
|
38
43
|
} = _ref2;
|
|
39
44
|
return {
|
|
40
|
-
color
|
|
45
|
+
color,
|
|
46
|
+
textDecorationLine: textLine,
|
|
47
|
+
fontFamily: `${fontName}${fontWeight}normal`,
|
|
48
|
+
lineHeight: fontSize * lineHeight,
|
|
49
|
+
fontSize
|
|
41
50
|
};
|
|
42
51
|
};
|
|
43
52
|
/**
|
|
@@ -110,9 +119,6 @@ const SkipLink = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
|
110
119
|
...rest
|
|
111
120
|
} = clickProps.toPressProps(rawRest);
|
|
112
121
|
const getTokens = useThemeTokensCallback('SkipLink', tokens, variant);
|
|
113
|
-
const defaultTokens = getTokens();
|
|
114
|
-
|
|
115
|
-
const resolveLinkTokens = pressState => resolvePressableTokens(defaultTokens, pressState);
|
|
116
122
|
|
|
117
123
|
const handlePress = event => {
|
|
118
124
|
if (typeof onPress === 'function') onPress(event); // TODO - support native apps with something based on refs and/or setAccessibilityFocus
|
|
@@ -123,19 +129,17 @@ const SkipLink = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
|
123
129
|
accessibilityRole: "link",
|
|
124
130
|
onPress: handlePress,
|
|
125
131
|
href: href,
|
|
126
|
-
style:
|
|
127
|
-
|
|
128
|
-
focused: focus
|
|
129
|
-
} = _ref4;
|
|
130
|
-
const themeTokens = getTokens({
|
|
131
|
-
focus
|
|
132
|
-
});
|
|
132
|
+
style: pressableState => {
|
|
133
|
+
const themeTokens = resolvePressableTokens(getTokens, pressableState);
|
|
133
134
|
const skipLinkStyle = selectStyles(themeTokens);
|
|
134
|
-
|
|
135
|
+
const {
|
|
136
|
+
focused
|
|
137
|
+
} = pressableState;
|
|
138
|
+
return [staticStyles.absolute, skipLinkStyle, !focused && staticStyles.hidden];
|
|
135
139
|
},
|
|
136
140
|
...selectProps(rest),
|
|
137
|
-
children:
|
|
138
|
-
const themeTokens =
|
|
141
|
+
children: pressableState => {
|
|
142
|
+
const themeTokens = resolvePressableTokens(getTokens, pressableState);
|
|
139
143
|
const textStyles = selectTextStyles(themeTokens);
|
|
140
144
|
return /*#__PURE__*/_jsx(Text, {
|
|
141
145
|
style: [textStyles, staticStyles.baseline],
|
|
@@ -49,7 +49,9 @@ const TooltipButton = _ref3 => {
|
|
|
49
49
|
icon: IconComponent
|
|
50
50
|
} = themeTokens;
|
|
51
51
|
return /*#__PURE__*/_jsx(View, {
|
|
52
|
-
style: applyOuterBorder(themeTokens),
|
|
52
|
+
style: [applyOuterBorder(themeTokens), themeTokens.outerBorderWidth && {
|
|
53
|
+
margin: -themeTokens.outerBorderWidth
|
|
54
|
+
}],
|
|
53
55
|
...selectProps(rest),
|
|
54
56
|
children: /*#__PURE__*/_jsx(View, {
|
|
55
57
|
style: selectInnerContainerStyles(themeTokens),
|
|
@@ -54,7 +54,10 @@ const Typography = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
54
54
|
...rest
|
|
55
55
|
} = _ref2;
|
|
56
56
|
const viewport = useViewport();
|
|
57
|
-
const
|
|
57
|
+
const {
|
|
58
|
+
superScriptFontSize,
|
|
59
|
+
...themeTokens
|
|
60
|
+
} = useThemeTokens('Typography', tokens, variant, {
|
|
58
61
|
viewport
|
|
59
62
|
});
|
|
60
63
|
const {
|
|
@@ -77,8 +80,13 @@ const Typography = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
77
80
|
if (typeof child === 'object' && ((child === null || child === void 0 ? void 0 : child.type) === 'sub' || (child === null || child === void 0 ? void 0 : child.type) === 'sup')) {
|
|
78
81
|
var _child$props;
|
|
79
82
|
|
|
83
|
+
const childStyles = (child === null || child === void 0 ? void 0 : (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.style) || {};
|
|
84
|
+
const supFontSize = childStyles.fontSize ?? superScriptFontSize;
|
|
80
85
|
const sanitizedChild = /*#__PURE__*/React.cloneElement(child, {
|
|
81
|
-
style: { ...
|
|
86
|
+
style: { ...childStyles,
|
|
87
|
+
...(supFontSize ? {
|
|
88
|
+
fontSize: supFontSize
|
|
89
|
+
} : {}),
|
|
82
90
|
lineHeight: 0
|
|
83
91
|
}
|
|
84
92
|
});
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"@floating-ui/react-native": "^0.8.1",
|
|
12
12
|
"@gorhom/portal": "^1.0.14",
|
|
13
13
|
"@telus-uds/system-constants": "^1.2.1",
|
|
14
|
-
"@telus-uds/system-theme-tokens": "^2.
|
|
14
|
+
"@telus-uds/system-theme-tokens": "^2.37.0",
|
|
15
15
|
"airbnb-prop-types": "^2.16.0",
|
|
16
16
|
"lodash.debounce": "^4.0.8",
|
|
17
17
|
"lodash.merge": "^4.6.2",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"standard-engine": {
|
|
73
73
|
"skip": true
|
|
74
74
|
},
|
|
75
|
-
"version": "1.
|
|
75
|
+
"version": "1.54.0"
|
|
76
76
|
}
|
|
@@ -173,6 +173,13 @@ const selectWebOnlyStyles = (inactive, themeTokens, { accessibilityRole }) => {
|
|
|
173
173
|
})
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
+
const selectButtonStyles = ({ textAlign }) => {
|
|
177
|
+
return {
|
|
178
|
+
flexDirection: 'row',
|
|
179
|
+
justifyContent: textAlign
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
176
183
|
const selectItemIconTokens = ({ color, iconColor, iconSize }) => ({
|
|
177
184
|
size: iconSize,
|
|
178
185
|
color: iconColor || color
|
|
@@ -237,6 +244,8 @@ const ButtonBase = forwardRef(
|
|
|
237
244
|
const stretchStyles = themeTokens.width ? staticStyles.stretch : staticStyles.align
|
|
238
245
|
const IconComponent = icon || themeTokens.icon
|
|
239
246
|
|
|
247
|
+
const rowStyles = selectButtonStyles(themeTokens)
|
|
248
|
+
|
|
240
249
|
return (
|
|
241
250
|
<View
|
|
242
251
|
id={id}
|
|
@@ -249,7 +258,8 @@ const ButtonBase = forwardRef(
|
|
|
249
258
|
web: {
|
|
250
259
|
maxWidth: '100%', // ensure overflowing content wraps
|
|
251
260
|
// TODO: https://github.com/telus/universal-design-system/issues/487
|
|
252
|
-
transition: 'background-color 200ms, border-color 200ms'
|
|
261
|
+
transition: 'background-color 200ms, border-color 200ms',
|
|
262
|
+
...rowStyles
|
|
253
263
|
}
|
|
254
264
|
})
|
|
255
265
|
]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { forwardRef, useState } from 'react'
|
|
2
|
-
import { Animated, Platform, View } from 'react-native'
|
|
2
|
+
import { Animated, Platform, View, Text } from 'react-native'
|
|
3
3
|
import PropTypes from 'prop-types'
|
|
4
4
|
import ABBPropTypes from 'airbnb-prop-types'
|
|
5
5
|
|
|
@@ -26,7 +26,42 @@ const selectContainerStyles = ({
|
|
|
26
26
|
paddingLeft: contentPaddingLeft,
|
|
27
27
|
paddingRight: contentPaddingRight,
|
|
28
28
|
paddingTop: contentPaddingTop,
|
|
29
|
-
paddingBottom: contentPaddingBottom
|
|
29
|
+
paddingBottom: contentPaddingBottom,
|
|
30
|
+
flex: 1
|
|
31
|
+
})
|
|
32
|
+
const selectTextStyles = ({
|
|
33
|
+
contentPanelFontSize,
|
|
34
|
+
contentPanelFontName,
|
|
35
|
+
contentPanelFontColor,
|
|
36
|
+
contentPanelFontWeight,
|
|
37
|
+
contentPanelLineHeight
|
|
38
|
+
}) => ({
|
|
39
|
+
fontSize: contentPanelFontSize,
|
|
40
|
+
fontFamily: `${contentPanelFontName}${contentPanelFontWeight}normal`,
|
|
41
|
+
lineHeight: contentPanelFontSize * contentPanelLineHeight,
|
|
42
|
+
color: contentPanelFontColor
|
|
43
|
+
})
|
|
44
|
+
const selectContentPanelStyles = ({
|
|
45
|
+
contentPanelBackgroundColor,
|
|
46
|
+
contentPanelPaddingTop,
|
|
47
|
+
contentPanelPaddingBottom,
|
|
48
|
+
contentPanelPaddingLeft,
|
|
49
|
+
contentPanelPaddingRight,
|
|
50
|
+
contentPanelBorderWidth,
|
|
51
|
+
contentPanelBorderColor,
|
|
52
|
+
borderRadius,
|
|
53
|
+
marginBottom
|
|
54
|
+
}) => ({
|
|
55
|
+
backgroundColor: contentPanelBackgroundColor,
|
|
56
|
+
paddingTop: contentPanelPaddingTop,
|
|
57
|
+
paddingBottom: contentPanelPaddingBottom,
|
|
58
|
+
paddingLeft: contentPanelPaddingLeft,
|
|
59
|
+
paddingRight: contentPanelPaddingRight,
|
|
60
|
+
borderWidth: contentPanelBorderWidth,
|
|
61
|
+
borderColor: contentPanelBorderColor,
|
|
62
|
+
borderStyle: 'solid',
|
|
63
|
+
borderRadius,
|
|
64
|
+
marginBottom
|
|
30
65
|
})
|
|
31
66
|
|
|
32
67
|
/**
|
|
@@ -52,6 +87,7 @@ const ExpandCollapsePanel = forwardRef(
|
|
|
52
87
|
tokens,
|
|
53
88
|
variant,
|
|
54
89
|
controlRef,
|
|
90
|
+
content,
|
|
55
91
|
...rest
|
|
56
92
|
},
|
|
57
93
|
ref
|
|
@@ -90,8 +126,15 @@ const ExpandCollapsePanel = forwardRef(
|
|
|
90
126
|
})
|
|
91
127
|
|
|
92
128
|
const focusabilityProps = isExpanded ? {} : a11yProps.nonFocusableProps
|
|
93
|
-
|
|
94
|
-
|
|
129
|
+
return content ? (
|
|
130
|
+
<View style={selectContentPanelStyles(themeTokens)}>
|
|
131
|
+
{typeof children === 'string' ? (
|
|
132
|
+
<Text style={selectTextStyles(themeTokens)}>{children}</Text>
|
|
133
|
+
) : (
|
|
134
|
+
children
|
|
135
|
+
)}
|
|
136
|
+
</View>
|
|
137
|
+
) : (
|
|
95
138
|
<View ref={ref} style={themeTokens}>
|
|
96
139
|
<ExpandCollapseControl
|
|
97
140
|
{...selectedProps}
|
|
@@ -140,7 +183,7 @@ ExpandCollapsePanel.propTypes = {
|
|
|
140
183
|
* Function to call on pressing the panel's control, which should open or close the panel.
|
|
141
184
|
* If Panel is a direct child of `ExpandCollapse`, this prop will be provided by the ExpandCollapse parent.
|
|
142
185
|
*/
|
|
143
|
-
onToggle: PropTypes.func
|
|
186
|
+
onToggle: PropTypes.func,
|
|
144
187
|
/**
|
|
145
188
|
* Optional function to call on pressing the panel's control, in addition to opening or closing the panel.
|
|
146
189
|
*/
|
|
@@ -151,9 +194,9 @@ ExpandCollapsePanel.propTypes = {
|
|
|
151
194
|
*/
|
|
152
195
|
children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
|
|
153
196
|
/**
|
|
154
|
-
* The content inside the
|
|
197
|
+
* The content inside the control element that opens and closes the ExpandCollapse when pressed.
|
|
155
198
|
*/
|
|
156
|
-
control: ExpandCollapseControl.propTypes.children
|
|
199
|
+
control: ExpandCollapseControl.propTypes.children,
|
|
157
200
|
/**
|
|
158
201
|
* Optional theme token overrides that may be passed to the ExpandCollapseControl element.
|
|
159
202
|
*/
|
|
@@ -161,7 +204,11 @@ ExpandCollapsePanel.propTypes = {
|
|
|
161
204
|
/**
|
|
162
205
|
* An optional ref to be attached to the control
|
|
163
206
|
*/
|
|
164
|
-
controlRef: ABBPropTypes.ref()
|
|
207
|
+
controlRef: ABBPropTypes.ref(),
|
|
208
|
+
/**
|
|
209
|
+
* A boolean prop to determine if the panel is a content panel or not. If true, the panel will not have a control
|
|
210
|
+
*/
|
|
211
|
+
content: PropTypes.bool
|
|
165
212
|
}
|
|
166
213
|
|
|
167
214
|
export default ExpandCollapsePanel
|
package/src/Modal/Modal.jsx
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
StyleSheet,
|
|
4
4
|
TouchableWithoutFeedback,
|
|
5
5
|
View,
|
|
6
|
+
ScrollView,
|
|
6
7
|
Modal as NativeModal,
|
|
7
8
|
Platform
|
|
8
9
|
} from 'react-native'
|
|
@@ -114,7 +115,7 @@ const Modal = forwardRef(
|
|
|
114
115
|
|
|
115
116
|
return (
|
|
116
117
|
<NativeModal transparent {...selectProps(rest)}>
|
|
117
|
-
<
|
|
118
|
+
<ScrollView contentContainerStyle={[staticStyles.positioningContainer]} ref={modalRef}>
|
|
118
119
|
<View
|
|
119
120
|
style={[staticStyles.sizingContainer, selectContainerStyles(themeTokens)]}
|
|
120
121
|
pointerEvents="box-none" // don't capture backdrop press events
|
|
@@ -149,7 +150,7 @@ const Modal = forwardRef(
|
|
|
149
150
|
<TouchableWithoutFeedback onPress={handleClose}>
|
|
150
151
|
<View style={[staticStyles.backdrop, selectBackdropStyles(themeTokens)]} />
|
|
151
152
|
</TouchableWithoutFeedback>
|
|
152
|
-
</
|
|
153
|
+
</ScrollView>
|
|
153
154
|
</NativeModal>
|
|
154
155
|
)
|
|
155
156
|
}
|
|
@@ -210,7 +211,11 @@ const staticStyles = StyleSheet.create({
|
|
|
210
211
|
},
|
|
211
212
|
modal: {
|
|
212
213
|
maxHeight: '100%', // so that the modal can expand vertically up to the sizing container's height (exclusive of its vertical padding)
|
|
213
|
-
|
|
214
|
+
...Platform.select({
|
|
215
|
+
web: {
|
|
216
|
+
overflow: 'auto'
|
|
217
|
+
}
|
|
218
|
+
})
|
|
214
219
|
},
|
|
215
220
|
closeButtonContainer: {
|
|
216
221
|
position: 'absolute',
|
|
@@ -37,8 +37,12 @@ const selectStyles = ({
|
|
|
37
37
|
borderRadius
|
|
38
38
|
})
|
|
39
39
|
|
|
40
|
-
const selectTextStyles = ({ color }) => ({
|
|
41
|
-
color
|
|
40
|
+
const selectTextStyles = ({ color, textLine, fontName, fontSize, fontWeight, lineHeight }) => ({
|
|
41
|
+
color,
|
|
42
|
+
textDecorationLine: textLine,
|
|
43
|
+
fontFamily: `${fontName}${fontWeight}normal`,
|
|
44
|
+
lineHeight: fontSize * lineHeight,
|
|
45
|
+
fontSize
|
|
42
46
|
})
|
|
43
47
|
|
|
44
48
|
/**
|
|
@@ -100,9 +104,6 @@ const SkipLink = forwardRef(({ tokens, variant, href, children, ...rawRest }, re
|
|
|
100
104
|
const { onPress, ...rest } = clickProps.toPressProps(rawRest)
|
|
101
105
|
|
|
102
106
|
const getTokens = useThemeTokensCallback('SkipLink', tokens, variant)
|
|
103
|
-
const defaultTokens = getTokens()
|
|
104
|
-
|
|
105
|
-
const resolveLinkTokens = (pressState) => resolvePressableTokens(defaultTokens, pressState)
|
|
106
107
|
|
|
107
108
|
const handlePress = (event) => {
|
|
108
109
|
if (typeof onPress === 'function') onPress(event)
|
|
@@ -115,18 +116,17 @@ const SkipLink = forwardRef(({ tokens, variant, href, children, ...rawRest }, re
|
|
|
115
116
|
accessibilityRole="link"
|
|
116
117
|
onPress={handlePress}
|
|
117
118
|
href={href}
|
|
118
|
-
style={(
|
|
119
|
-
const themeTokens = getTokens
|
|
119
|
+
style={(pressableState) => {
|
|
120
|
+
const themeTokens = resolvePressableTokens(getTokens, pressableState)
|
|
120
121
|
const skipLinkStyle = selectStyles(themeTokens)
|
|
121
|
-
|
|
122
|
-
return [staticStyles.absolute, skipLinkStyle, !
|
|
122
|
+
const { focused } = pressableState
|
|
123
|
+
return [staticStyles.absolute, skipLinkStyle, !focused && staticStyles.hidden]
|
|
123
124
|
}}
|
|
124
125
|
{...selectProps(rest)}
|
|
125
126
|
>
|
|
126
|
-
{(
|
|
127
|
-
const themeTokens =
|
|
127
|
+
{(pressableState) => {
|
|
128
|
+
const themeTokens = resolvePressableTokens(getTokens, pressableState)
|
|
128
129
|
const textStyles = selectTextStyles(themeTokens)
|
|
129
|
-
|
|
130
130
|
return <Text style={[textStyles, staticStyles.baseline]}>{children}</Text>
|
|
131
131
|
}}
|
|
132
132
|
</Pressable>
|
|
@@ -26,7 +26,15 @@ const TooltipButton = ({ pressableState, tokens, variant, ...rest }) => {
|
|
|
26
26
|
const { icon: IconComponent } = themeTokens
|
|
27
27
|
|
|
28
28
|
return (
|
|
29
|
-
<View
|
|
29
|
+
<View
|
|
30
|
+
style={[
|
|
31
|
+
applyOuterBorder(themeTokens),
|
|
32
|
+
themeTokens.outerBorderWidth && {
|
|
33
|
+
margin: -themeTokens.outerBorderWidth
|
|
34
|
+
}
|
|
35
|
+
]}
|
|
36
|
+
{...selectProps(rest)}
|
|
37
|
+
>
|
|
30
38
|
<View style={selectInnerContainerStyles(themeTokens)}>
|
|
31
39
|
{IconComponent && <Icon icon={IconComponent} tokens={selectIconTokens(themeTokens)} />}
|
|
32
40
|
</View>
|
|
@@ -59,7 +59,9 @@ const Typography = forwardRef(
|
|
|
59
59
|
ref
|
|
60
60
|
) => {
|
|
61
61
|
const viewport = useViewport()
|
|
62
|
-
const themeTokens = useThemeTokens('Typography', tokens, variant, {
|
|
62
|
+
const { superScriptFontSize, ...themeTokens } = useThemeTokens('Typography', tokens, variant, {
|
|
63
|
+
viewport
|
|
64
|
+
})
|
|
63
65
|
const { themeOptions } = useTheme()
|
|
64
66
|
|
|
65
67
|
const resolvedTextProps = {
|
|
@@ -80,9 +82,12 @@ const Typography = forwardRef(
|
|
|
80
82
|
|
|
81
83
|
const resetTagStyling = (child) => {
|
|
82
84
|
if (typeof child === 'object' && (child?.type === 'sub' || child?.type === 'sup')) {
|
|
85
|
+
const childStyles = child?.props?.style || {}
|
|
86
|
+
const supFontSize = childStyles.fontSize ?? superScriptFontSize
|
|
83
87
|
const sanitizedChild = React.cloneElement(child, {
|
|
84
88
|
style: {
|
|
85
|
-
...
|
|
89
|
+
...childStyles,
|
|
90
|
+
...(supFontSize ? { fontSize: supFontSize } : {}),
|
|
86
91
|
lineHeight: 0
|
|
87
92
|
}
|
|
88
93
|
})
|