@telus-uds/components-base 1.71.0 → 1.72.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 +19 -2
- package/lib/ColourToggle/ColourBubble.js +135 -0
- package/lib/ColourToggle/ColourToggle.js +101 -0
- package/lib/ColourToggle/index.js +10 -0
- package/lib/Modal/ModalContent.js +4 -6
- package/lib/OrderedList/Item.js +180 -0
- package/lib/OrderedList/ItemBase.js +48 -0
- package/lib/OrderedList/OrderedList.js +71 -0
- package/lib/OrderedList/OrderedListBase.js +47 -0
- package/lib/OrderedList/index.js +10 -0
- package/lib/index.js +16 -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-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/Modal/ModalContent.js +4 -6
- package/lib-module/OrderedList/Item.js +171 -0
- package/lib-module/OrderedList/ItemBase.js +37 -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/index.js +2 -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/package.json +2 -2
- package/src/ColourToggle/ColourBubble.jsx +111 -0
- package/src/ColourToggle/ColourToggle.jsx +83 -0
- package/src/ColourToggle/index.js +3 -0
- package/src/Modal/ModalContent.jsx +4 -6
- package/src/OrderedList/Item.jsx +152 -0
- package/src/OrderedList/ItemBase.jsx +31 -0
- package/src/OrderedList/OrderedList.jsx +61 -0
- package/src/OrderedList/OrderedListBase.jsx +33 -0
- package/src/OrderedList/index.js +3 -0
- package/src/index.js +2 -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/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
package/lib/index.js
CHANGED
|
@@ -15,6 +15,7 @@ var _exportNames = {
|
|
|
15
15
|
Checkbox: true,
|
|
16
16
|
CheckboxCard: true,
|
|
17
17
|
CheckboxCardGroup: true,
|
|
18
|
+
ColourToggle: true,
|
|
18
19
|
Divider: true,
|
|
19
20
|
ExpandCollapse: true,
|
|
20
21
|
Accordion: true,
|
|
@@ -32,6 +33,7 @@ var _exportNames = {
|
|
|
32
33
|
Modal: true,
|
|
33
34
|
MultiSelectFilter: true,
|
|
34
35
|
Notification: true,
|
|
36
|
+
OrderedList: true,
|
|
35
37
|
Pagination: true,
|
|
36
38
|
Progress: true,
|
|
37
39
|
QuickLinks: true,
|
|
@@ -144,6 +146,12 @@ Object.defineProperty(exports, "CheckboxCardGroup", {
|
|
|
144
146
|
return _CheckboxCardGroup.default;
|
|
145
147
|
}
|
|
146
148
|
});
|
|
149
|
+
Object.defineProperty(exports, "ColourToggle", {
|
|
150
|
+
enumerable: true,
|
|
151
|
+
get: function () {
|
|
152
|
+
return _ColourToggle.default;
|
|
153
|
+
}
|
|
154
|
+
});
|
|
147
155
|
Object.defineProperty(exports, "Divider", {
|
|
148
156
|
enumerable: true,
|
|
149
157
|
get: function () {
|
|
@@ -246,6 +254,12 @@ Object.defineProperty(exports, "Notification", {
|
|
|
246
254
|
return _Notification.default;
|
|
247
255
|
}
|
|
248
256
|
});
|
|
257
|
+
Object.defineProperty(exports, "OrderedList", {
|
|
258
|
+
enumerable: true,
|
|
259
|
+
get: function () {
|
|
260
|
+
return _OrderedList.default;
|
|
261
|
+
}
|
|
262
|
+
});
|
|
249
263
|
Object.defineProperty(exports, "Pagination", {
|
|
250
264
|
enumerable: true,
|
|
251
265
|
get: function () {
|
|
@@ -519,6 +533,7 @@ Object.keys(_Checkbox).forEach(function (key) {
|
|
|
519
533
|
});
|
|
520
534
|
var _CheckboxCard = _interopRequireDefault(require("./CheckboxCard"));
|
|
521
535
|
var _CheckboxCardGroup = _interopRequireDefault(require("./CheckboxCardGroup"));
|
|
536
|
+
var _ColourToggle = _interopRequireDefault(require("./ColourToggle"));
|
|
522
537
|
var _Divider = _interopRequireDefault(require("./Divider"));
|
|
523
538
|
var _ExpandCollapse = _interopRequireWildcard(require("./ExpandCollapse"));
|
|
524
539
|
var _Feedback = _interopRequireDefault(require("./Feedback"));
|
|
@@ -567,6 +582,7 @@ var _List = _interopRequireWildcard(require("./List"));
|
|
|
567
582
|
var _Modal = _interopRequireDefault(require("./Modal"));
|
|
568
583
|
var _MultiSelectFilter = _interopRequireDefault(require("./MultiSelectFilter"));
|
|
569
584
|
var _Notification = _interopRequireDefault(require("./Notification"));
|
|
585
|
+
var _OrderedList = _interopRequireDefault(require("./OrderedList"));
|
|
570
586
|
var _Pagination = _interopRequireDefault(require("./Pagination"));
|
|
571
587
|
var _Progress = _interopRequireDefault(require("./Progress"));
|
|
572
588
|
var _QuickLinks = _interopRequireDefault(require("./QuickLinks"));
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _cssMediaquery = _interopRequireDefault(require("css-mediaquery"));
|
|
8
|
+
var _Dimensions = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Dimensions"));
|
|
9
|
+
var _common = require("../utils/common");
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
const createStyleSheet = stylesWithQuery => {
|
|
12
|
+
if (!stylesWithQuery) return {
|
|
13
|
+
ids: {},
|
|
14
|
+
styles: {},
|
|
15
|
+
fullStyles: {}
|
|
16
|
+
};
|
|
17
|
+
let cleanStyles;
|
|
18
|
+
const ids = {};
|
|
19
|
+
Object.keys(stylesWithQuery).forEach(key => {
|
|
20
|
+
if (!(stylesWithQuery !== null && stylesWithQuery !== void 0 && stylesWithQuery[key])) return;
|
|
21
|
+
const mediaQueriesAndPseudoClasses = Object.keys(stylesWithQuery[key]).filter(_common.isMediaOrPseudo);
|
|
22
|
+
cleanStyles = JSON.parse(JSON.stringify(stylesWithQuery));
|
|
23
|
+
mediaQueriesAndPseudoClasses.forEach(str => {
|
|
24
|
+
if ((0, _common.isMedia)(str)) {
|
|
25
|
+
const mqStr = str.replace('@media', '');
|
|
26
|
+
const {
|
|
27
|
+
width,
|
|
28
|
+
height
|
|
29
|
+
} = _Dimensions.default.get('window');
|
|
30
|
+
const isMatchingMediaQuery = _cssMediaquery.default.match(mqStr, {
|
|
31
|
+
width,
|
|
32
|
+
height,
|
|
33
|
+
orientation: width > height ? 'landscape' : 'portrait',
|
|
34
|
+
'aspect-ratio': width / height
|
|
35
|
+
});
|
|
36
|
+
if (isMatchingMediaQuery) {
|
|
37
|
+
cleanStyles = {
|
|
38
|
+
...cleanStyles,
|
|
39
|
+
[key]: {
|
|
40
|
+
...cleanStyles[key],
|
|
41
|
+
...stylesWithQuery[key][str]
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
delete cleanStyles[key][str];
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
return {
|
|
50
|
+
ids,
|
|
51
|
+
styles: cleanStyles,
|
|
52
|
+
fullStyles: stylesWithQuery
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
var _default = createStyleSheet;
|
|
56
|
+
exports.default = _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _createStylesheetMobile = _interopRequireDefault(require("./create-stylesheet-mobile"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
var _default = _createStylesheetMobile.default;
|
|
10
|
+
exports.default = _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _createStylesheetMobile = _interopRequireDefault(require("./create-stylesheet-mobile"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
var _default = _createStylesheetMobile.default;
|
|
10
|
+
exports.default = _default;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _inject = require("../utils/inject");
|
|
8
|
+
var _createDeclarationBlock = _interopRequireDefault(require("../utils/create-declaration-block"));
|
|
9
|
+
var _hash = _interopRequireDefault(require("../hash"));
|
|
10
|
+
var _common = require("../utils/common");
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
const createStyleSheet = stylesWithQuery => {
|
|
13
|
+
if (!stylesWithQuery) return {
|
|
14
|
+
ids: {},
|
|
15
|
+
styles: {},
|
|
16
|
+
fullStyles: {}
|
|
17
|
+
};
|
|
18
|
+
let cleanStyles;
|
|
19
|
+
let ids = {};
|
|
20
|
+
Object.keys(stylesWithQuery).forEach(key => {
|
|
21
|
+
if (!(stylesWithQuery !== null && stylesWithQuery !== void 0 && stylesWithQuery[key])) return;
|
|
22
|
+
const mediaQueriesAndPseudoClasses = Object.keys(stylesWithQuery[key]).filter(_common.isMediaOrPseudo);
|
|
23
|
+
cleanStyles = (0, _common.deepClone)(stylesWithQuery);
|
|
24
|
+
mediaQueriesAndPseudoClasses.forEach(query => {
|
|
25
|
+
var _ids;
|
|
26
|
+
const css = (0, _createDeclarationBlock.default)(stylesWithQuery[key][query]);
|
|
27
|
+
const stringHash = `rnmq-${(0, _hash.default)(`${key}${query}${css}`)}`;
|
|
28
|
+
const rule = (0, _common.createCssRule)(query, stringHash, css);
|
|
29
|
+
(0, _inject.addCss)(`${stringHash}`, rule);
|
|
30
|
+
delete cleanStyles[key][query];
|
|
31
|
+
ids = {
|
|
32
|
+
...ids,
|
|
33
|
+
[key]: `${(_ids = ids) !== null && _ids !== void 0 && _ids[key] ? `${ids[key]} ` : ''}${stringHash}`
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
return {
|
|
38
|
+
ids,
|
|
39
|
+
styles: cleanStyles,
|
|
40
|
+
fullStyles: stylesWithQuery
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
var _default = createStyleSheet;
|
|
44
|
+
exports.default = _default;
|
|
@@ -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;
|
|
@@ -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 = {
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import View from "react-native-web/dist/exports/View";
|
|
4
|
+
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
5
|
+
import { getTokensPropType, htmlAttrs, selectSystemProps, variantProp, viewProps, wrapStringsInText } from '../utils';
|
|
6
|
+
import { applyTextStyles, useTheme, useThemeTokens } from '../ThemeProvider';
|
|
7
|
+
import StackView from '../StackView';
|
|
8
|
+
import Typography from '../Typography';
|
|
9
|
+
import ItemBase from './ItemBase';
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs, viewProps]);
|
|
13
|
+
const selectItemTextStyles = (_ref, themeOptions) => {
|
|
14
|
+
let {
|
|
15
|
+
itemFontHeight,
|
|
16
|
+
itemFontSize,
|
|
17
|
+
itemLineHeight,
|
|
18
|
+
itemFontName,
|
|
19
|
+
itemColor
|
|
20
|
+
} = _ref;
|
|
21
|
+
return applyTextStyles({
|
|
22
|
+
fontWeight: itemFontHeight,
|
|
23
|
+
fontSize: itemFontSize,
|
|
24
|
+
fontName: itemFontName,
|
|
25
|
+
color: itemColor,
|
|
26
|
+
themeOptions,
|
|
27
|
+
lineHeight: itemLineHeight
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
const selectItemCounterStyles = _ref2 => {
|
|
31
|
+
let {
|
|
32
|
+
itemBulletContainerWidth,
|
|
33
|
+
itemBulletContainerAlign,
|
|
34
|
+
itemFontWeight,
|
|
35
|
+
itemFontSize,
|
|
36
|
+
itemFontName,
|
|
37
|
+
itemLineHeight,
|
|
38
|
+
themeOptions,
|
|
39
|
+
listGutter,
|
|
40
|
+
itemColor
|
|
41
|
+
} = _ref2;
|
|
42
|
+
return {
|
|
43
|
+
color: itemColor,
|
|
44
|
+
width: itemBulletContainerWidth,
|
|
45
|
+
paddingRight: listGutter,
|
|
46
|
+
textAlign: itemBulletContainerAlign,
|
|
47
|
+
...applyTextStyles({
|
|
48
|
+
fontWeight: itemFontWeight,
|
|
49
|
+
fontSize: itemFontSize,
|
|
50
|
+
fontName: itemFontName,
|
|
51
|
+
themeOptions
|
|
52
|
+
}),
|
|
53
|
+
lineHeight: itemLineHeight * itemFontSize
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
const selectItemContentStyles = (_ref3, isLastChild) => {
|
|
57
|
+
let {
|
|
58
|
+
interItemMargin,
|
|
59
|
+
...themeTokens
|
|
60
|
+
} = _ref3;
|
|
61
|
+
return {
|
|
62
|
+
...themeTokens,
|
|
63
|
+
marginBottom: !isLastChild ? interItemMargin : 0
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
const Item = /*#__PURE__*/forwardRef((_ref4, ref) => {
|
|
67
|
+
let {
|
|
68
|
+
children,
|
|
69
|
+
index,
|
|
70
|
+
isLastChild,
|
|
71
|
+
title,
|
|
72
|
+
tokens,
|
|
73
|
+
variant,
|
|
74
|
+
...rest
|
|
75
|
+
} = _ref4;
|
|
76
|
+
const themeTokens = useThemeTokens('OrderedList', tokens, variant);
|
|
77
|
+
const headingTokens = title && {
|
|
78
|
+
lineHeight: themeTokens.itemLineHeight,
|
|
79
|
+
fontSize: themeTokens.itemFontSize,
|
|
80
|
+
color: themeTokens.itemColor,
|
|
81
|
+
fontName: themeTokens.headerFontName,
|
|
82
|
+
fontWeight: themeTokens.headerFontWeight
|
|
83
|
+
};
|
|
84
|
+
const {
|
|
85
|
+
themeOptions
|
|
86
|
+
} = useTheme();
|
|
87
|
+
const itemContent = wrapStringsInText(children, {
|
|
88
|
+
style: selectItemTextStyles(themeTokens, themeOptions)
|
|
89
|
+
});
|
|
90
|
+
const itemCounter = wrapStringsInText(`${index}.`, {
|
|
91
|
+
style: selectItemTextStyles(themeTokens, themeOptions)
|
|
92
|
+
});
|
|
93
|
+
return /*#__PURE__*/_jsxs(ItemBase, {
|
|
94
|
+
ref: ref,
|
|
95
|
+
style: {
|
|
96
|
+
...staticStyles.container,
|
|
97
|
+
...themeTokens
|
|
98
|
+
},
|
|
99
|
+
...selectProps(rest),
|
|
100
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
101
|
+
style: [staticStyles.itemCounter, selectItemCounterStyles(themeTokens)],
|
|
102
|
+
children: itemCounter
|
|
103
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
104
|
+
style: staticStyles.itemContent,
|
|
105
|
+
children: title ? /*#__PURE__*/_jsxs(StackView, {
|
|
106
|
+
tokens: {
|
|
107
|
+
flexShrink: 1
|
|
108
|
+
},
|
|
109
|
+
space: 0,
|
|
110
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
|
111
|
+
variant: {
|
|
112
|
+
size: 'h4'
|
|
113
|
+
},
|
|
114
|
+
tokens: headingTokens,
|
|
115
|
+
children: title
|
|
116
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
117
|
+
style: selectItemContentStyles(themeTokens, isLastChild),
|
|
118
|
+
children: itemContent
|
|
119
|
+
})]
|
|
120
|
+
}) : /*#__PURE__*/_jsx(View, {
|
|
121
|
+
style: selectItemContentStyles(themeTokens, isLastChild),
|
|
122
|
+
children: itemContent
|
|
123
|
+
})
|
|
124
|
+
})]
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
Item.propTypes = {
|
|
128
|
+
...selectedSystemPropTypes,
|
|
129
|
+
/**
|
|
130
|
+
* Item content
|
|
131
|
+
*/
|
|
132
|
+
children: PropTypes.node.isRequired,
|
|
133
|
+
/**
|
|
134
|
+
* Item index
|
|
135
|
+
*/
|
|
136
|
+
index: PropTypes.number,
|
|
137
|
+
/**
|
|
138
|
+
* If true, the item is the last one on the list
|
|
139
|
+
*/
|
|
140
|
+
isLastChild: PropTypes.bool,
|
|
141
|
+
/**
|
|
142
|
+
* Defines the title of the `OrderedList.Item`
|
|
143
|
+
*/
|
|
144
|
+
title: PropTypes.string,
|
|
145
|
+
/**
|
|
146
|
+
* Item tokens
|
|
147
|
+
*/
|
|
148
|
+
tokens: getTokensPropType('List'),
|
|
149
|
+
/**
|
|
150
|
+
* Item variant
|
|
151
|
+
*/
|
|
152
|
+
variant: variantProp.propType
|
|
153
|
+
};
|
|
154
|
+
Item.displayName = 'OrderedListItem';
|
|
155
|
+
Item.defaultProps = {
|
|
156
|
+
title: undefined,
|
|
157
|
+
tokens: {}
|
|
158
|
+
};
|
|
159
|
+
export default Item;
|
|
160
|
+
const staticStyles = StyleSheet.create({
|
|
161
|
+
container: {
|
|
162
|
+
flexDirection: 'row'
|
|
163
|
+
},
|
|
164
|
+
itemCounter: {
|
|
165
|
+
flexWrap: 'wrap'
|
|
166
|
+
},
|
|
167
|
+
itemContent: {
|
|
168
|
+
flexDirection: 'column',
|
|
169
|
+
marginLeft: 8
|
|
170
|
+
}
|
|
171
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* eslint-disable react-native-a11y/has-valid-accessibility-role */
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import View from "react-native-web/dist/exports/View";
|
|
5
|
+
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
const Item = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
8
|
+
let {
|
|
9
|
+
children,
|
|
10
|
+
style,
|
|
11
|
+
...rest
|
|
12
|
+
} = _ref;
|
|
13
|
+
return /*#__PURE__*/_jsx(View, {
|
|
14
|
+
accessibilityRole: "listitem",
|
|
15
|
+
ref: ref,
|
|
16
|
+
style: [staticStyles.container, style],
|
|
17
|
+
...rest,
|
|
18
|
+
children: children
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
Item.propTypes = {
|
|
22
|
+
/**
|
|
23
|
+
* Item content
|
|
24
|
+
*/
|
|
25
|
+
children: PropTypes.node.isRequired,
|
|
26
|
+
/**
|
|
27
|
+
* Item custom styles
|
|
28
|
+
*/
|
|
29
|
+
style: PropTypes.object
|
|
30
|
+
};
|
|
31
|
+
Item.displayName = 'OrderedListItem';
|
|
32
|
+
export default Item;
|
|
33
|
+
const staticStyles = StyleSheet.create({
|
|
34
|
+
container: {
|
|
35
|
+
display: 'flex'
|
|
36
|
+
}
|
|
37
|
+
});
|