@telus-uds/components-base 1.71.0 → 1.73.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 +37 -2
- package/lib/Box/Box.js +17 -6
- package/lib/ColourToggle/ColourBubble.js +135 -0
- package/lib/ColourToggle/ColourToggle.js +101 -0
- package/lib/ColourToggle/index.js +10 -0
- package/lib/FlexGrid/Col/Col.js +42 -19
- package/lib/FlexGrid/FlexGrid.js +40 -17
- package/lib/FlexGrid/Row/Row.js +45 -22
- package/lib/Listbox/ListboxGroup.js +7 -1
- package/lib/Modal/ModalContent.js +4 -6
- package/lib/MultiSelectFilter/MultiSelectFilter.js +1 -0
- package/lib/Notification/Notification.js +13 -5
- package/lib/OrderedList/Item.js +180 -0
- package/lib/OrderedList/ItemBase.js +54 -0
- package/lib/OrderedList/OrderedList.js +71 -0
- package/lib/OrderedList/OrderedListBase.js +47 -0
- package/lib/OrderedList/index.js +10 -0
- package/lib/Responsive/Responsive.js +24 -14
- package/lib/Responsive/ResponsiveProp.js +46 -0
- package/lib/Responsive/ResponsiveWithMediaQueryStyleSheet.js +72 -0
- package/lib/ThemeProvider/ThemeProvider.js +5 -2
- package/lib/ThemeProvider/index.js +9 -1
- package/lib/ThemeProvider/useResponsiveThemeTokens.js +89 -0
- package/lib/Typography/Typography.js +48 -22
- package/lib/index.js +16 -0
- package/lib/server.js +40 -0
- package/lib/utils/ssr-media-query/create-stylesheet/create-stylesheet-mobile.js +56 -0
- package/lib/utils/ssr-media-query/create-stylesheet/index.android.js +10 -0
- package/lib/utils/ssr-media-query/create-stylesheet/index.ios.js +10 -0
- package/lib/utils/ssr-media-query/create-stylesheet/index.js +44 -0
- package/lib/utils/ssr-media-query/utils/create-media-query-styles.js +39 -6
- package/lib-module/Box/Box.js +17 -6
- package/lib-module/ColourToggle/ColourBubble.js +125 -0
- package/lib-module/ColourToggle/ColourToggle.js +92 -0
- package/lib-module/ColourToggle/index.js +2 -0
- package/lib-module/FlexGrid/Col/Col.js +42 -19
- package/lib-module/FlexGrid/FlexGrid.js +40 -17
- package/lib-module/FlexGrid/Row/Row.js +45 -22
- package/lib-module/Listbox/ListboxGroup.js +7 -1
- package/lib-module/Modal/ModalContent.js +4 -6
- package/lib-module/MultiSelectFilter/MultiSelectFilter.js +1 -0
- package/lib-module/Notification/Notification.js +13 -5
- package/lib-module/OrderedList/Item.js +171 -0
- package/lib-module/OrderedList/ItemBase.js +43 -0
- package/lib-module/OrderedList/OrderedList.js +61 -0
- package/lib-module/OrderedList/OrderedListBase.js +36 -0
- package/lib-module/OrderedList/index.js +2 -0
- package/lib-module/Responsive/Responsive.js +24 -15
- package/lib-module/Responsive/ResponsiveProp.js +39 -0
- package/lib-module/Responsive/ResponsiveWithMediaQueryStyleSheet.js +64 -0
- package/lib-module/ThemeProvider/ThemeProvider.js +5 -2
- package/lib-module/ThemeProvider/index.js +1 -0
- package/lib-module/ThemeProvider/useResponsiveThemeTokens.js +81 -0
- package/lib-module/Typography/Typography.js +50 -24
- package/lib-module/index.js +2 -0
- package/lib-module/server.js +4 -0
- package/lib-module/utils/ssr-media-query/create-stylesheet/create-stylesheet-mobile.js +48 -0
- package/lib-module/utils/ssr-media-query/create-stylesheet/index.android.js +2 -0
- package/lib-module/utils/ssr-media-query/create-stylesheet/index.ios.js +2 -0
- package/lib-module/utils/ssr-media-query/create-stylesheet/index.js +36 -0
- package/lib-module/utils/ssr-media-query/utils/create-media-query-styles.js +36 -6
- package/package.json +13 -2
- package/src/Box/Box.jsx +35 -17
- package/src/ColourToggle/ColourBubble.jsx +111 -0
- package/src/ColourToggle/ColourToggle.jsx +83 -0
- package/src/ColourToggle/index.js +3 -0
- package/src/FlexGrid/Col/Col.jsx +42 -13
- package/src/FlexGrid/FlexGrid.jsx +40 -11
- package/src/FlexGrid/Row/Row.jsx +40 -16
- package/src/Listbox/ListboxGroup.jsx +9 -2
- package/src/Modal/ModalContent.jsx +4 -6
- package/src/MultiSelectFilter/MultiSelectFilter.jsx +2 -0
- package/src/Notification/Notification.jsx +15 -3
- package/src/OrderedList/Item.jsx +152 -0
- package/src/OrderedList/ItemBase.jsx +43 -0
- package/src/OrderedList/OrderedList.jsx +61 -0
- package/src/OrderedList/OrderedListBase.jsx +33 -0
- package/src/OrderedList/index.js +3 -0
- package/src/Responsive/Responsive.jsx +24 -11
- package/src/Responsive/ResponsiveProp.jsx +33 -0
- package/src/Responsive/ResponsiveWithMediaQueryStyleSheet.jsx +58 -0
- package/src/ThemeProvider/ThemeProvider.jsx +5 -2
- package/src/ThemeProvider/index.js +1 -0
- package/src/ThemeProvider/useResponsiveThemeTokens.js +85 -0
- package/src/Typography/Typography.jsx +72 -24
- package/src/index.js +2 -0
- package/src/server.js +4 -0
- package/src/utils/ssr-media-query/create-stylesheet/create-stylesheet-mobile.js +41 -0
- package/src/utils/ssr-media-query/create-stylesheet/index.android.js +3 -0
- package/src/utils/ssr-media-query/create-stylesheet/index.ios.js +3 -0
- package/src/utils/ssr-media-query/create-stylesheet/index.js +33 -0
- package/src/utils/ssr-media-query/utils/create-media-query-styles.js +21 -6
- package/types/Badge.d.ts +28 -0
- package/types/Box.d.ts +52 -0
- package/types/ChevronLink.d.ts +47 -0
- package/types/Common.d.ts +106 -0
- package/types/Divider.d.ts +19 -0
- package/types/ExpandCollapse.d.ts +65 -0
- package/types/HorizontalScrollButton.d.ts +16 -0
- package/types/Icon.d.ts +21 -0
- package/types/Link.d.ts +48 -0
- package/types/List.d.ts +48 -0
- package/types/Search.d.ts +38 -0
- package/types/Select.d.ts +57 -0
- package/types/Spacer.d.ts +5 -0
- package/types/StackView.d.ts +28 -0
- package/types/Tabs.d.ts +46 -0
- package/types/TextButton.d.ts +11 -0
- package/types/ToggleSwitch.d.ts +54 -0
- package/types/ToolTip.d.ts +40 -0
- package/types/Typography.d.ts +39 -0
- package/types/index.d.ts +62 -0
- package/lib/utils/ssr-media-query/create-stylesheet.js +0 -76
- package/lib-module/utils/ssr-media-query/create-stylesheet.js +0 -68
- package/src/utils/ssr-media-query/create-stylesheet.js +0 -61
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import React, { forwardRef, useMemo } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import View from "react-native-web/dist/exports/View";
|
|
4
|
+
import Pressable from "react-native-web/dist/exports/Pressable";
|
|
5
|
+
import Platform from "react-native-web/dist/exports/Platform";
|
|
6
|
+
import { resolvePressableTokens } from '../utils/pressability';
|
|
7
|
+
import { applyShadowToken } from '../ThemeProvider';
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
const selectGeneralBubbleTokens = _ref => {
|
|
10
|
+
let {
|
|
11
|
+
outerBubbleHeight,
|
|
12
|
+
outerBubbleWidth,
|
|
13
|
+
outerBubbleContentAlignItems,
|
|
14
|
+
outerBubbleJustifyContent,
|
|
15
|
+
bubbleBorderColor,
|
|
16
|
+
bubbleBorderWidth,
|
|
17
|
+
bubbleBorderRadius
|
|
18
|
+
} = _ref;
|
|
19
|
+
return {
|
|
20
|
+
height: outerBubbleHeight,
|
|
21
|
+
width: outerBubbleWidth,
|
|
22
|
+
justifyContent: outerBubbleContentAlignItems,
|
|
23
|
+
alignItems: outerBubbleJustifyContent,
|
|
24
|
+
borderColor: bubbleBorderColor,
|
|
25
|
+
borderWidth: bubbleBorderWidth,
|
|
26
|
+
borderRadius: bubbleBorderRadius,
|
|
27
|
+
...Platform.select({
|
|
28
|
+
web: {
|
|
29
|
+
outline: 'none'
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
const selectInnerBubbleTokens = _ref2 => {
|
|
35
|
+
let {
|
|
36
|
+
innerBubbleHeight,
|
|
37
|
+
innerBubbleWidth,
|
|
38
|
+
innerBubbleBorderRadius,
|
|
39
|
+
borderColor,
|
|
40
|
+
borderWidth,
|
|
41
|
+
shadow
|
|
42
|
+
} = _ref2;
|
|
43
|
+
return {
|
|
44
|
+
height: innerBubbleHeight,
|
|
45
|
+
width: innerBubbleWidth,
|
|
46
|
+
borderRadius: innerBubbleBorderRadius,
|
|
47
|
+
borderColor,
|
|
48
|
+
borderWidth,
|
|
49
|
+
...applyShadowToken(shadow)
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
const selectBorderBubbleTokens = _ref3 => {
|
|
53
|
+
let {
|
|
54
|
+
bubbleBorderColor,
|
|
55
|
+
bubbleBorderWidth,
|
|
56
|
+
bubbleBorderRadius
|
|
57
|
+
} = _ref3;
|
|
58
|
+
return {
|
|
59
|
+
borderColor: bubbleBorderColor,
|
|
60
|
+
borderWidth: bubbleBorderWidth,
|
|
61
|
+
borderRadius: bubbleBorderRadius
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
const ColourBubble = /*#__PURE__*/forwardRef((_ref4, ref) => {
|
|
65
|
+
let {
|
|
66
|
+
tokens = {},
|
|
67
|
+
id,
|
|
68
|
+
colourHexCode,
|
|
69
|
+
colourName,
|
|
70
|
+
isSelected,
|
|
71
|
+
onPress
|
|
72
|
+
} = _ref4;
|
|
73
|
+
const defaultTokens = tokens({
|
|
74
|
+
selected: isSelected
|
|
75
|
+
});
|
|
76
|
+
const resolveColourBubbleTokens = pressState => resolvePressableTokens(tokens, pressState, {});
|
|
77
|
+
const themeTokens = useMemo(() => tokens(), [tokens]);
|
|
78
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
79
|
+
style: state => [selectGeneralBubbleTokens(resolveColourBubbleTokens(state)), isSelected && selectBorderBubbleTokens(defaultTokens)],
|
|
80
|
+
onPress: onPress,
|
|
81
|
+
accessible: true,
|
|
82
|
+
accessibilityRole: "radio",
|
|
83
|
+
accessibilityLabel: colourName,
|
|
84
|
+
accessibilityState: {
|
|
85
|
+
checked: isSelected
|
|
86
|
+
},
|
|
87
|
+
ref: ref,
|
|
88
|
+
testID: id,
|
|
89
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
90
|
+
style: [selectInnerBubbleTokens(themeTokens), {
|
|
91
|
+
backgroundColor: colourHexCode
|
|
92
|
+
}]
|
|
93
|
+
})
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
ColourBubble.displayName = 'ColourBubble';
|
|
97
|
+
ColourBubble.propTypes = {
|
|
98
|
+
/**
|
|
99
|
+
* Colour toggle tokens callback.
|
|
100
|
+
*/
|
|
101
|
+
tokens: PropTypes.func,
|
|
102
|
+
/**
|
|
103
|
+
* ID of each colour bubble
|
|
104
|
+
*/
|
|
105
|
+
id: PropTypes.string,
|
|
106
|
+
/**
|
|
107
|
+
* Hexadecimal code for the background of the colour bubble
|
|
108
|
+
*/
|
|
109
|
+
colourHexCode: PropTypes.string,
|
|
110
|
+
/**
|
|
111
|
+
* Name of the colour bubble
|
|
112
|
+
*/
|
|
113
|
+
colourName: PropTypes.string,
|
|
114
|
+
/**
|
|
115
|
+
* If the current colour bubble is selected
|
|
116
|
+
*/
|
|
117
|
+
isSelected: PropTypes.bool,
|
|
118
|
+
/**
|
|
119
|
+
* If provided, this function is called when the current selection
|
|
120
|
+
* of the color is changed of all currently `items`.
|
|
121
|
+
* Receives two parameters: item object selected and the event
|
|
122
|
+
*/
|
|
123
|
+
onPress: PropTypes.func
|
|
124
|
+
};
|
|
125
|
+
export default ColourBubble;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React, { forwardRef, useState } from 'react';
|
|
2
|
+
import View from "react-native-web/dist/exports/View";
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { useThemeTokensCallback } from '../ThemeProvider';
|
|
5
|
+
import { a11yProps, getTokensPropType, selectSystemProps, variantProp, viewProps } from '../utils';
|
|
6
|
+
import { StackWrap } from '../StackView';
|
|
7
|
+
import Typography from '../Typography';
|
|
8
|
+
import ColourBubble from './ColourBubble';
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
|
|
12
|
+
const ColourToggle = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
13
|
+
let {
|
|
14
|
+
tokens,
|
|
15
|
+
variant,
|
|
16
|
+
defaultColourId,
|
|
17
|
+
items,
|
|
18
|
+
onChange,
|
|
19
|
+
...rest
|
|
20
|
+
} = _ref;
|
|
21
|
+
const [currentColourId, setCurrentColourId] = useState(defaultColourId);
|
|
22
|
+
const getTokens = useThemeTokensCallback('ColourToggle', tokens, variant);
|
|
23
|
+
const {
|
|
24
|
+
space
|
|
25
|
+
} = getTokens();
|
|
26
|
+
const {
|
|
27
|
+
colourName: currentColourName = ''
|
|
28
|
+
} = items.find(item => item.id === currentColourId) || '';
|
|
29
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
30
|
+
ref: ref,
|
|
31
|
+
...selectProps(rest),
|
|
32
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
|
33
|
+
children: currentColourName
|
|
34
|
+
}), /*#__PURE__*/_jsx(StackWrap, {
|
|
35
|
+
space: space,
|
|
36
|
+
accessibilityRole: "radiogroup",
|
|
37
|
+
children: items.map((_ref2, index) => {
|
|
38
|
+
let {
|
|
39
|
+
id,
|
|
40
|
+
colourHexCode,
|
|
41
|
+
colourName
|
|
42
|
+
} = _ref2;
|
|
43
|
+
const colourBubbleId = id || `ColourBubble[${index}]`;
|
|
44
|
+
const handleChangeColour = event => {
|
|
45
|
+
setCurrentColourId(id);
|
|
46
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(event, {
|
|
47
|
+
id,
|
|
48
|
+
colourHexCode,
|
|
49
|
+
colourName
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
return /*#__PURE__*/_jsx(ColourBubble, {
|
|
53
|
+
id: colourBubbleId,
|
|
54
|
+
tokens: getTokens,
|
|
55
|
+
isSelected: id === currentColourId,
|
|
56
|
+
colourHexCode: colourHexCode,
|
|
57
|
+
colourName: colourName,
|
|
58
|
+
onPress: handleChangeColour
|
|
59
|
+
}, colourBubbleId);
|
|
60
|
+
})
|
|
61
|
+
})]
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
ColourToggle.displayName = 'ColourToggle';
|
|
65
|
+
ColourToggle.propTypes = {
|
|
66
|
+
...selectedSystemPropTypes,
|
|
67
|
+
/**
|
|
68
|
+
* Optional theme token overrides for the outer ColourToggle component
|
|
69
|
+
*/
|
|
70
|
+
tokens: getTokensPropType('ColourToggle'),
|
|
71
|
+
/**
|
|
72
|
+
* Colour toggle variant.
|
|
73
|
+
*/
|
|
74
|
+
variant: variantProp.propType,
|
|
75
|
+
/**
|
|
76
|
+
* Id of the selected color when component mounts
|
|
77
|
+
*/
|
|
78
|
+
defaultColourId: PropTypes.string,
|
|
79
|
+
/**
|
|
80
|
+
* Array of objects containing specifics for each ColourBubble to be rendered in the group.
|
|
81
|
+
*/
|
|
82
|
+
items: PropTypes.arrayOf(PropTypes.exact({
|
|
83
|
+
colourHexCode: PropTypes.string,
|
|
84
|
+
colourName: PropTypes.string,
|
|
85
|
+
id: PropTypes.string
|
|
86
|
+
})),
|
|
87
|
+
/**
|
|
88
|
+
* If provided, this function is called when the current selection of the color is changed of all currently `items`. Receives two parameters: item object selected and the event
|
|
89
|
+
*/
|
|
90
|
+
onChange: PropTypes.func
|
|
91
|
+
};
|
|
92
|
+
export default ColourToggle;
|
|
@@ -4,6 +4,8 @@ import Platform from "react-native-web/dist/exports/Platform";
|
|
|
4
4
|
import GutterContext from '../providers/GutterContext';
|
|
5
5
|
import applyInheritance from '../helpers';
|
|
6
6
|
import { responsiveProps, BaseView, StyleSheet, createMediaQueryStyles } from '../../utils';
|
|
7
|
+
import { useViewport } from '../../ViewportProvider';
|
|
8
|
+
import { useTheme } from '../../ThemeProvider';
|
|
7
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
10
|
const Col = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
9
11
|
let {
|
|
@@ -23,6 +25,12 @@ const Col = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
23
25
|
...viewProps
|
|
24
26
|
} = _ref;
|
|
25
27
|
const gutter = useContext(GutterContext);
|
|
28
|
+
const viewport = useViewport();
|
|
29
|
+
const {
|
|
30
|
+
themeOptions: {
|
|
31
|
+
enableMediaQueryStyleSheet
|
|
32
|
+
}
|
|
33
|
+
} = useTheme();
|
|
26
34
|
const hiddenLevels = applyInheritance([xs, sm, md, lg, xl]);
|
|
27
35
|
const getHorizontalAlignLevel = () => {
|
|
28
36
|
if (typeof horizontalAlign === 'object') {
|
|
@@ -86,7 +94,15 @@ const Col = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
86
94
|
lg: offsetsWithIheritance[3],
|
|
87
95
|
xl: offsetsWithIheritance[4]
|
|
88
96
|
};
|
|
89
|
-
const
|
|
97
|
+
const staticStyles = {
|
|
98
|
+
flexGrow: 1,
|
|
99
|
+
flexShrink: 0,
|
|
100
|
+
flexBasis: 'auto',
|
|
101
|
+
maxWidth: '100%',
|
|
102
|
+
paddingLeft: gutter ? 16 : 0,
|
|
103
|
+
paddingRight: gutter ? 16 : 0
|
|
104
|
+
};
|
|
105
|
+
const stylesByViewport = {
|
|
90
106
|
xs: {
|
|
91
107
|
display: hiddenLevels[0] === 0 ? 'none' : shown,
|
|
92
108
|
textAlign: horizontalAlignLevel[0],
|
|
@@ -117,27 +133,34 @@ const Col = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
117
133
|
...calculateWidth(sizes.xl),
|
|
118
134
|
...calculateOffset(offsets.xl)
|
|
119
135
|
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
|
|
136
|
+
};
|
|
137
|
+
let colStyles;
|
|
138
|
+
let mediaIds;
|
|
139
|
+
if (enableMediaQueryStyleSheet) {
|
|
140
|
+
const mediaQueryStyles = createMediaQueryStyles(stylesByViewport);
|
|
141
|
+
const {
|
|
142
|
+
ids,
|
|
143
|
+
styles
|
|
144
|
+
} = StyleSheet.create({
|
|
145
|
+
col: {
|
|
146
|
+
...staticStyles,
|
|
147
|
+
...mediaQueryStyles
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
colStyles = styles.col;
|
|
151
|
+
mediaIds = ids.col;
|
|
152
|
+
} else {
|
|
153
|
+
colStyles = {
|
|
154
|
+
...staticStyles,
|
|
155
|
+
...stylesByViewport[viewport]
|
|
156
|
+
};
|
|
157
|
+
}
|
|
135
158
|
return /*#__PURE__*/_jsx(BaseView, {
|
|
136
159
|
ref: ref,
|
|
137
160
|
...viewProps,
|
|
138
|
-
style:
|
|
139
|
-
dataSet: {
|
|
140
|
-
media:
|
|
161
|
+
style: colStyles,
|
|
162
|
+
dataSet: mediaIds && {
|
|
163
|
+
media: mediaIds
|
|
141
164
|
},
|
|
142
165
|
children: children
|
|
143
166
|
});
|
|
@@ -6,6 +6,8 @@ import Row from './Row';
|
|
|
6
6
|
import Col from './Col';
|
|
7
7
|
import GutterContext from './providers/GutterContext';
|
|
8
8
|
import applyInheritance from './helpers';
|
|
9
|
+
import { useTheme } from '../ThemeProvider';
|
|
10
|
+
import { useViewport } from '../ViewportProvider';
|
|
9
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
12
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
|
|
11
13
|
|
|
@@ -29,7 +31,15 @@ const FlexGrid = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
29
31
|
...rest
|
|
30
32
|
} = _ref;
|
|
31
33
|
const reverseLevel = applyInheritance([xsReverse, smReverse, mdReverse, lgReverse, xlReverse]);
|
|
32
|
-
const
|
|
34
|
+
const viewport = useViewport();
|
|
35
|
+
const {
|
|
36
|
+
themeOptions: {
|
|
37
|
+
enableMediaQueryStyleSheet
|
|
38
|
+
}
|
|
39
|
+
} = useTheme();
|
|
40
|
+
let flexgridStyles;
|
|
41
|
+
let mediaIds;
|
|
42
|
+
const stylesByViewport = {
|
|
33
43
|
xs: {
|
|
34
44
|
flexDirection: reverseLevel[0] ? 'column-reverse' : 'column'
|
|
35
45
|
},
|
|
@@ -49,19 +59,32 @@ const FlexGrid = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
49
59
|
maxWidth: limitWidth && viewports.map.get('xl'),
|
|
50
60
|
flexDirection: reverseLevel[4] ? 'column-reverse' : 'column'
|
|
51
61
|
}
|
|
52
|
-
}
|
|
53
|
-
const {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
};
|
|
63
|
+
const staticStyles = {
|
|
64
|
+
flexWrap: 'wrap',
|
|
65
|
+
width: outsideGutter ? '100%' : 'auto',
|
|
66
|
+
marginVertical: 0,
|
|
67
|
+
marginHorizontal: outsideGutter ? 'auto' : -16
|
|
68
|
+
};
|
|
69
|
+
if (enableMediaQueryStyleSheet) {
|
|
70
|
+
const mediaQueryStyles = createMediaQueryStyles(stylesByViewport);
|
|
71
|
+
const {
|
|
72
|
+
ids,
|
|
73
|
+
styles
|
|
74
|
+
} = StyleSheet.create({
|
|
75
|
+
flexgrid: {
|
|
76
|
+
...staticStyles,
|
|
77
|
+
...mediaQueryStyles
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
flexgridStyles = styles.flexgrid;
|
|
81
|
+
mediaIds = ids.flexgrid;
|
|
82
|
+
} else {
|
|
83
|
+
flexgridStyles = {
|
|
84
|
+
...staticStyles,
|
|
85
|
+
...stylesByViewport[viewport]
|
|
86
|
+
};
|
|
87
|
+
}
|
|
65
88
|
const props = {
|
|
66
89
|
accessibilityRole,
|
|
67
90
|
...getA11yPropsFromHtmlTag(tag, accessibilityRole),
|
|
@@ -72,9 +95,9 @@ const FlexGrid = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
72
95
|
children: /*#__PURE__*/_jsx(BaseView, {
|
|
73
96
|
ref: ref,
|
|
74
97
|
...props,
|
|
75
|
-
style:
|
|
76
|
-
dataSet: {
|
|
77
|
-
media:
|
|
98
|
+
style: flexgridStyles,
|
|
99
|
+
dataSet: mediaIds && {
|
|
100
|
+
media: mediaIds
|
|
78
101
|
},
|
|
79
102
|
children: children
|
|
80
103
|
})
|
|
@@ -2,6 +2,8 @@ import React, { forwardRef } from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import applyInheritance from '../helpers';
|
|
4
4
|
import { BaseView, StyleSheet, createMediaQueryStyles } from '../../utils';
|
|
5
|
+
import { useTheme } from '../../ThemeProvider';
|
|
6
|
+
import { useViewport } from '../../ViewportProvider';
|
|
5
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
8
|
const horizontalAlignStyles = horizontalAlign => {
|
|
7
9
|
switch (horizontalAlign) {
|
|
@@ -69,8 +71,25 @@ const Row = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
69
71
|
children,
|
|
70
72
|
...rest
|
|
71
73
|
} = _ref;
|
|
74
|
+
const {
|
|
75
|
+
themeOptions: {
|
|
76
|
+
enableMediaQueryStyleSheet
|
|
77
|
+
}
|
|
78
|
+
} = useTheme();
|
|
79
|
+
const viewport = useViewport();
|
|
80
|
+
const staticStyles = {
|
|
81
|
+
width: '100%',
|
|
82
|
+
marginVertical: 0,
|
|
83
|
+
marginHorizontal: 'auto',
|
|
84
|
+
flexGrow: 0,
|
|
85
|
+
flexShrink: 1,
|
|
86
|
+
flexBasis: 'auto',
|
|
87
|
+
...horizontalAlignStyles(horizontalAlign),
|
|
88
|
+
...verticalAlignStyles(verticalAlign),
|
|
89
|
+
...distributeStyles(distribute)
|
|
90
|
+
};
|
|
72
91
|
const reverseLevel = applyInheritance([xsReverse, smReverse, mdReverse, lgReverse, xlReverse]);
|
|
73
|
-
const
|
|
92
|
+
const stylesByViewport = {
|
|
74
93
|
xs: {
|
|
75
94
|
flexDirection: reverseLevel[0] ? 'row-reverse' : 'row',
|
|
76
95
|
flexWrap: reverseLevel[0] ? 'wrap-reverse' : 'wrap'
|
|
@@ -91,30 +110,34 @@ const Row = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
91
110
|
flexDirection: reverseLevel[4] ? 'row-reverse' : 'row',
|
|
92
111
|
flexWrap: reverseLevel[4] ? 'wrap-reverse' : 'wrap'
|
|
93
112
|
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
113
|
+
};
|
|
114
|
+
let rowStyles;
|
|
115
|
+
let mediaIds;
|
|
116
|
+
if (enableMediaQueryStyleSheet) {
|
|
117
|
+
const mediaQueryStyles = createMediaQueryStyles(stylesByViewport);
|
|
118
|
+
const {
|
|
119
|
+
ids,
|
|
120
|
+
styles
|
|
121
|
+
} = StyleSheet.create({
|
|
122
|
+
row: {
|
|
123
|
+
...staticStyles,
|
|
124
|
+
...mediaQueryStyles
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
rowStyles = styles.row;
|
|
128
|
+
mediaIds = ids.row;
|
|
129
|
+
} else {
|
|
130
|
+
rowStyles = {
|
|
131
|
+
...staticStyles,
|
|
132
|
+
...stylesByViewport[viewport]
|
|
133
|
+
};
|
|
134
|
+
}
|
|
112
135
|
return /*#__PURE__*/_jsx(BaseView, {
|
|
113
136
|
ref: ref,
|
|
114
137
|
...rest,
|
|
115
|
-
style:
|
|
116
|
-
dataSet: {
|
|
117
|
-
media:
|
|
138
|
+
style: rowStyles,
|
|
139
|
+
dataSet: mediaIds && {
|
|
140
|
+
media: mediaIds
|
|
118
141
|
},
|
|
119
142
|
children: children
|
|
120
143
|
});
|
|
@@ -3,6 +3,7 @@ import React, { forwardRef } from 'react';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import View from "react-native-web/dist/exports/View";
|
|
5
5
|
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
6
|
+
import Platform from "react-native-web/dist/exports/Platform";
|
|
6
7
|
import { withLinkRouter } from '../utils';
|
|
7
8
|
import ExpandCollapse from '../ExpandCollapse';
|
|
8
9
|
import ListboxItem from './ListboxItem';
|
|
@@ -20,6 +21,11 @@ const styles = StyleSheet.create({
|
|
|
20
21
|
padding: 0
|
|
21
22
|
}
|
|
22
23
|
});
|
|
24
|
+
const getAccessibilityRole = () => Platform.select({
|
|
25
|
+
ios: 'listitem',
|
|
26
|
+
android: 'none',
|
|
27
|
+
web: 'listitem'
|
|
28
|
+
});
|
|
23
29
|
const ListboxGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
24
30
|
let {
|
|
25
31
|
id,
|
|
@@ -40,7 +46,7 @@ const ListboxGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
40
46
|
return /*#__PURE__*/_jsx(View, {
|
|
41
47
|
id: "test",
|
|
42
48
|
style: styles.groupWrapper,
|
|
43
|
-
accessibilityRole:
|
|
49
|
+
accessibilityRole: getAccessibilityRole(),
|
|
44
50
|
children: /*#__PURE__*/_jsx(ExpandCollapse.Panel, {
|
|
45
51
|
panelId: id ?? label,
|
|
46
52
|
controlTokens: {
|
|
@@ -31,14 +31,16 @@ const ModalContent = _ref => {
|
|
|
31
31
|
children,
|
|
32
32
|
onCancel
|
|
33
33
|
} = _ref;
|
|
34
|
+
const viewport = useViewport();
|
|
34
35
|
const {
|
|
35
36
|
headingColor,
|
|
36
37
|
cancelButtonColor,
|
|
37
38
|
...themeTokens
|
|
38
|
-
} = useThemeTokens('Modal', tokens, variant
|
|
39
|
+
} = useThemeTokens('Modal', tokens, variant, {
|
|
40
|
+
viewport
|
|
41
|
+
});
|
|
39
42
|
const [scrollContainerHeight, setScrollContainerHeight] = useState(0);
|
|
40
43
|
const [scrollContentHeight, setScrollContentHeight] = useState(0);
|
|
41
|
-
const viewport = useViewport();
|
|
42
44
|
const handleContainerLayout = _ref2 => {
|
|
43
45
|
let {
|
|
44
46
|
nativeEvent: {
|
|
@@ -133,7 +135,6 @@ const ModalContent = _ref => {
|
|
|
133
135
|
onPress: onConfirm,
|
|
134
136
|
children: confirmButtonText
|
|
135
137
|
}), hasCancelButton ? /*#__PURE__*/_jsx(View, {
|
|
136
|
-
style: styles.styledTextButtonContainer,
|
|
137
138
|
children: /*#__PURE__*/_jsx(CancelButton, {
|
|
138
139
|
tokens: {
|
|
139
140
|
color: cancelButtonColor
|
|
@@ -150,9 +151,6 @@ const styles = StyleSheet.create({
|
|
|
150
151
|
flex: 1,
|
|
151
152
|
flexDirection: 'column',
|
|
152
153
|
minHeight: Platform.OS === 'web' ? '100%' : 'auto'
|
|
153
|
-
},
|
|
154
|
-
styledTextButtonContainer: {
|
|
155
|
-
flex: 1
|
|
156
154
|
}
|
|
157
155
|
});
|
|
158
156
|
ModalContent.propTypes = {
|
|
@@ -98,6 +98,7 @@ const MultiSelectFilter = _ref3 => {
|
|
|
98
98
|
if (colSize === 1) return setMaxWidth(false);
|
|
99
99
|
return colSize === 2 && setMaxWidth(true);
|
|
100
100
|
}, [colSize]);
|
|
101
|
+
useEffect(() => setCheckedIds(currentValues ?? []), [currentValues]);
|
|
101
102
|
const {
|
|
102
103
|
headerFontColor,
|
|
103
104
|
headerFontSize,
|
|
@@ -14,10 +14,18 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, vie
|
|
|
14
14
|
const selectContainerStyles = tokens => ({
|
|
15
15
|
...tokens
|
|
16
16
|
});
|
|
17
|
-
const selectTextStyles = (tokens, themeOptions) =>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
const selectTextStyles = (tokens, themeOptions, isDismissible) => {
|
|
18
|
+
const textTokens = selectTokens('Typography', tokens);
|
|
19
|
+
const styles = {
|
|
20
|
+
...textTokens,
|
|
21
|
+
themeOptions,
|
|
22
|
+
overflow: 'hidden'
|
|
23
|
+
};
|
|
24
|
+
if (!isDismissible) {
|
|
25
|
+
styles.flexShrink = 1;
|
|
26
|
+
}
|
|
27
|
+
return applyTextStyles(styles);
|
|
28
|
+
};
|
|
21
29
|
const selectIconProps = _ref => {
|
|
22
30
|
let {
|
|
23
31
|
iconSize,
|
|
@@ -138,7 +146,7 @@ const Notification = /*#__PURE__*/forwardRef((_ref5, ref) => {
|
|
|
138
146
|
if (isDismissed) {
|
|
139
147
|
return null;
|
|
140
148
|
}
|
|
141
|
-
const textStyles = selectTextStyles(themeTokens, themeOptions);
|
|
149
|
+
const textStyles = selectTextStyles(themeTokens, themeOptions, dismissible);
|
|
142
150
|
const content = wrapStringsInText(typeof children === 'function' ? children({
|
|
143
151
|
textStyles,
|
|
144
152
|
variant
|