@spaced-out/ui-design-system 0.0.49 → 0.0.51
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 +21 -0
- package/README.md +1 -1
- package/lib/components/Button/Button.js +1 -1
- package/lib/components/Button/Button.js.flow +1 -1
- package/lib/components/Dialog/Dialog.js +7 -4
- package/lib/components/Dialog/Dialog.js.flow +15 -5
- package/lib/components/Modal/Modal.js +3 -3
- package/lib/components/Modal/Modal.js.flow +11 -4
- package/lib/components/Panel/Panel.js +7 -5
- package/lib/components/Panel/Panel.js.flow +31 -13
- package/lib/components/SubMenu/SubMenu.js +4 -3
- package/lib/components/SubMenu/SubMenu.js.flow +62 -53
- package/lib/components/Text/Text.js +9 -2
- package/lib/components/Text/Text.js.flow +11 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.0.51](https://github.com/spaced-out/ui-design-system/compare/v0.0.50...v0.0.51) (2023-03-20)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* text highlighting now supports array of string ([bc7604f](https://github.com/spaced-out/ui-design-system/commit/bc7604fc552ec1e61275d93f792ea9a8267279a5))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* button right icon only type fix ([#81](https://github.com/spaced-out/ui-design-system/issues/81)) ([3e8b819](https://github.com/spaced-out/ui-design-system/commit/3e8b819be701fd31746a944b7be32ed739dfd632))
|
|
16
|
+
* updated picker usage ([9344611](https://github.com/spaced-out/ui-design-system/commit/934461138f750c2e748c1be146204350cfad9041))
|
|
17
|
+
|
|
18
|
+
### [0.0.50](https://github.com/spaced-out/ui-design-system/compare/v0.0.49...v0.0.50) (2023-03-13)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* classnames for footer in dialog panel and modal and ref to submenuitem ([#80](https://github.com/spaced-out/ui-design-system/issues/80)) ([aba3660](https://github.com/spaced-out/ui-design-system/commit/aba3660917928d55fc1209ddb76602713a6888c2))
|
|
24
|
+
* classNames for modal and panel ([2cbb16e](https://github.com/spaced-out/ui-design-system/commit/2cbb16eba7818b526903e21b4458567caef1b2ba))
|
|
25
|
+
|
|
5
26
|
### [0.0.49](https://github.com/spaced-out/ui-design-system/compare/v0.0.48...v0.0.49) (2023-03-13)
|
|
6
27
|
|
|
7
28
|
|
package/README.md
CHANGED
|
@@ -89,7 +89,7 @@ CSS use:
|
|
|
89
89
|
JS use:
|
|
90
90
|
|
|
91
91
|
```js
|
|
92
|
-
import size2 from "@spaced-out/ui-design-system/lib/styles/variables/_size.js";
|
|
92
|
+
import {size2} from "@spaced-out/ui-design-system/lib/styles/variables/_size.js";
|
|
93
93
|
import * as SIZES from "@spaced-out/ui-design-system/lib/styles/variables/_size.js";
|
|
94
94
|
```
|
|
95
95
|
|
|
@@ -104,7 +104,7 @@ const Button = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
104
104
|
name: iconLeftName || iconRightName,
|
|
105
105
|
color: disabled ? 'disabled' : ButtonTypeToIconColorMap[type],
|
|
106
106
|
size: size === 'medium' ? 'medium' : 'small',
|
|
107
|
-
type: iconLeftType
|
|
107
|
+
type: iconLeftName ? iconLeftType : iconRightType,
|
|
108
108
|
className: classNames?.icon
|
|
109
109
|
}) :
|
|
110
110
|
// has icon _and_ child
|
|
@@ -153,7 +153,7 @@ export const Button: React$AbstractComponent<ButtonProps, HTMLButtonElement> =
|
|
|
153
153
|
name={iconLeftName || iconRightName}
|
|
154
154
|
color={disabled ? 'disabled' : ButtonTypeToIconColorMap[type]}
|
|
155
155
|
size={size === 'medium' ? 'medium' : 'small'}
|
|
156
|
-
type={iconLeftType
|
|
156
|
+
type={iconLeftName ? iconLeftType : iconRightType}
|
|
157
157
|
className={classNames?.icon}
|
|
158
158
|
/>
|
|
159
159
|
) : (
|
|
@@ -91,12 +91,12 @@ exports.DialogBody = DialogBody;
|
|
|
91
91
|
const DialogFooter = _ref4 => {
|
|
92
92
|
let {
|
|
93
93
|
children,
|
|
94
|
-
|
|
94
|
+
classNames
|
|
95
95
|
} = _ref4;
|
|
96
96
|
return /*#__PURE__*/React.createElement(React.Fragment, null, React.Children.count(children) > 0 && /*#__PURE__*/React.createElement("div", {
|
|
97
|
-
className: (0, _classify.default)(_DialogModule.default.dialogFooter,
|
|
97
|
+
className: (0, _classify.default)(_DialogModule.default.dialogFooter, classNames?.wrapper)
|
|
98
98
|
}, /*#__PURE__*/React.createElement("div", {
|
|
99
|
-
className: _DialogModule.default.dialogFooterActions
|
|
99
|
+
className: (0, _classify.default)(_DialogModule.default.dialogFooterActions, classNames?.actions)
|
|
100
100
|
}, children)));
|
|
101
101
|
};
|
|
102
102
|
exports.DialogFooter = DialogFooter;
|
|
@@ -109,6 +109,7 @@ const Dialog = _ref5 => {
|
|
|
109
109
|
tapOutsideToClose = false,
|
|
110
110
|
iconName = '',
|
|
111
111
|
semantic = 'neutral',
|
|
112
|
+
classNames,
|
|
112
113
|
...restDialogProps
|
|
113
114
|
} = _ref5;
|
|
114
115
|
return /*#__PURE__*/React.createElement(_Modal.Modal, _extends({
|
|
@@ -118,7 +119,9 @@ const Dialog = _ref5 => {
|
|
|
118
119
|
tapOutsideToClose: tapOutsideToClose
|
|
119
120
|
}, restDialogProps, {
|
|
120
121
|
classNames: {
|
|
121
|
-
content: (0, _classify.default)(_DialogModule.default.dialog)
|
|
122
|
+
content: (0, _classify.default)(_DialogModule.default.dialog, classNames?.content),
|
|
123
|
+
container: (0, _classify.default)(classNames?.container),
|
|
124
|
+
backdrop: (0, _classify.default)(classNames?.backdrop)
|
|
122
125
|
}
|
|
123
126
|
}), /*#__PURE__*/React.createElement("div", {
|
|
124
127
|
className: _DialogModule.default.topBlock
|
|
@@ -11,6 +11,11 @@ import {Modal} from '../Modal';
|
|
|
11
11
|
import css from './Dialog.module.css';
|
|
12
12
|
|
|
13
13
|
|
|
14
|
+
type FooterClassNames = $ReadOnly<{
|
|
15
|
+
wrapper?: string,
|
|
16
|
+
actions?: string,
|
|
17
|
+
}>;
|
|
18
|
+
|
|
14
19
|
export const DIALOG_SEMANTIC = Object.freeze({
|
|
15
20
|
neutral: 'neutral',
|
|
16
21
|
success: 'success',
|
|
@@ -28,7 +33,7 @@ export type DialogHeaderProps = {
|
|
|
28
33
|
|
|
29
34
|
export type DialogFooterProps = {
|
|
30
35
|
children?: React.Node,
|
|
31
|
-
|
|
36
|
+
classNames?: FooterClassNames,
|
|
32
37
|
};
|
|
33
38
|
|
|
34
39
|
export type DialogBodyProps = {
|
|
@@ -131,12 +136,14 @@ export const DialogBody = ({
|
|
|
131
136
|
|
|
132
137
|
export const DialogFooter = ({
|
|
133
138
|
children,
|
|
134
|
-
|
|
139
|
+
classNames,
|
|
135
140
|
}: DialogFooterProps): React.Node => (
|
|
136
141
|
<>
|
|
137
142
|
{React.Children.count(children) > 0 && (
|
|
138
|
-
<div className={classify(css.dialogFooter,
|
|
139
|
-
<div className={css.dialogFooterActions}>
|
|
143
|
+
<div className={classify(css.dialogFooter, classNames?.wrapper)}>
|
|
144
|
+
<div className={classify(css.dialogFooterActions, classNames?.actions)}>
|
|
145
|
+
{children}
|
|
146
|
+
</div>
|
|
140
147
|
</div>
|
|
141
148
|
)}
|
|
142
149
|
</>
|
|
@@ -150,6 +157,7 @@ export const Dialog = ({
|
|
|
150
157
|
tapOutsideToClose = false,
|
|
151
158
|
iconName = '',
|
|
152
159
|
semantic = 'neutral',
|
|
160
|
+
classNames,
|
|
153
161
|
...restDialogProps
|
|
154
162
|
}: DialogProps): React.Node => (
|
|
155
163
|
<Modal
|
|
@@ -159,7 +167,9 @@ export const Dialog = ({
|
|
|
159
167
|
tapOutsideToClose={tapOutsideToClose}
|
|
160
168
|
{...restDialogProps}
|
|
161
169
|
classNames={{
|
|
162
|
-
content: classify(css.dialog),
|
|
170
|
+
content: classify(css.dialog, classNames?.content),
|
|
171
|
+
container: classify(classNames?.container),
|
|
172
|
+
backdrop: classify(classNames?.backdrop),
|
|
163
173
|
}}
|
|
164
174
|
>
|
|
165
175
|
<div className={css.topBlock}>
|
|
@@ -51,12 +51,12 @@ exports.ModalBody = ModalBody;
|
|
|
51
51
|
const ModalFooter = _ref3 => {
|
|
52
52
|
let {
|
|
53
53
|
children,
|
|
54
|
-
|
|
54
|
+
classNames
|
|
55
55
|
} = _ref3;
|
|
56
56
|
return /*#__PURE__*/React.createElement(React.Fragment, null, React.Children.count(children) > 0 && /*#__PURE__*/React.createElement("div", {
|
|
57
|
-
className: (0, _classify.default)(_ModalModule.default.modalFooter,
|
|
57
|
+
className: (0, _classify.default)(_ModalModule.default.modalFooter, classNames?.wrapper)
|
|
58
58
|
}, /*#__PURE__*/React.createElement("div", {
|
|
59
|
-
className: _ModalModule.default.modalFooterActions
|
|
59
|
+
className: (0, _classify.default)(_ModalModule.default.modalFooterActions, classNames?.actions)
|
|
60
60
|
}, children)));
|
|
61
61
|
};
|
|
62
62
|
exports.ModalFooter = ModalFooter;
|
|
@@ -25,6 +25,11 @@ type ClassNames = $ReadOnly<{
|
|
|
25
25
|
backdrop?: string,
|
|
26
26
|
}>;
|
|
27
27
|
|
|
28
|
+
type FooterClassNames = $ReadOnly<{
|
|
29
|
+
wrapper?: string,
|
|
30
|
+
actions?: string,
|
|
31
|
+
}>;
|
|
32
|
+
|
|
28
33
|
export type ModalProps = {
|
|
29
34
|
classNames?: ClassNames,
|
|
30
35
|
children?: React.Node,
|
|
@@ -45,7 +50,7 @@ export type ModalHeaderProps = {
|
|
|
45
50
|
|
|
46
51
|
export type ModalFooterProps = {
|
|
47
52
|
children?: React.Node,
|
|
48
|
-
|
|
53
|
+
classNames?: FooterClassNames,
|
|
49
54
|
};
|
|
50
55
|
|
|
51
56
|
export type ModalBodyProps = {
|
|
@@ -87,12 +92,14 @@ export const ModalBody = ({
|
|
|
87
92
|
|
|
88
93
|
export const ModalFooter = ({
|
|
89
94
|
children,
|
|
90
|
-
|
|
95
|
+
classNames,
|
|
91
96
|
}: ModalFooterProps): React.Node => (
|
|
92
97
|
<>
|
|
93
98
|
{React.Children.count(children) > 0 && (
|
|
94
|
-
<div className={classify(css.modalFooter,
|
|
95
|
-
<div className={css.modalFooterActions}>
|
|
99
|
+
<div className={classify(css.modalFooter, classNames?.wrapper)}>
|
|
100
|
+
<div className={classify(css.modalFooterActions, classNames?.actions)}>
|
|
101
|
+
{children}
|
|
102
|
+
</div>
|
|
96
103
|
</div>
|
|
97
104
|
)}
|
|
98
105
|
</>
|
|
@@ -48,12 +48,12 @@ exports.PanelBody = PanelBody;
|
|
|
48
48
|
const PanelFooter = _ref3 => {
|
|
49
49
|
let {
|
|
50
50
|
children,
|
|
51
|
-
|
|
51
|
+
classNames
|
|
52
52
|
} = _ref3;
|
|
53
53
|
return /*#__PURE__*/React.createElement(React.Fragment, null, React.Children.count(children) > 0 && /*#__PURE__*/React.createElement("div", {
|
|
54
|
-
className: (0, _classify.default)(_PanelModule.default.panelFooter,
|
|
54
|
+
className: (0, _classify.default)(_PanelModule.default.panelFooter, classNames?.wrapper)
|
|
55
55
|
}, /*#__PURE__*/React.createElement("div", {
|
|
56
|
-
className: _PanelModule.default.panelFooterActions
|
|
56
|
+
className: (0, _classify.default)(_PanelModule.default.panelFooterActions, classNames?.actions)
|
|
57
57
|
}, children)));
|
|
58
58
|
};
|
|
59
59
|
exports.PanelFooter = PanelFooter;
|
|
@@ -65,6 +65,7 @@ const Panel = _ref4 => {
|
|
|
65
65
|
anchor = 'left',
|
|
66
66
|
onClose,
|
|
67
67
|
hideBackdrop = true,
|
|
68
|
+
classNames,
|
|
68
69
|
...restPanelProps
|
|
69
70
|
} = _ref4;
|
|
70
71
|
const isTransitioning = (0, _useMountTransition.default)(isOpen, parseInt(_motion.motionDurationNormal));
|
|
@@ -77,12 +78,13 @@ const Panel = _ref4 => {
|
|
|
77
78
|
container: (0, _classify.default)(_PanelModule.default.panelContainer, {
|
|
78
79
|
[_PanelModule.default.in]: isTransitioning,
|
|
79
80
|
[_PanelModule.default.open]: isOpen
|
|
80
|
-
}),
|
|
81
|
+
}, classNames?.container),
|
|
81
82
|
content: (0, _classify.default)(_PanelModule.default.panel, _PanelModule.default[anchor], {
|
|
82
83
|
[_PanelModule.default.medium]: size === 'medium',
|
|
83
84
|
[_PanelModule.default.small]: size === 'small',
|
|
84
85
|
[_PanelModule.default.large]: size === 'large'
|
|
85
|
-
})
|
|
86
|
+
}, classNames?.content),
|
|
87
|
+
backdrop: (0, _classify.default)(classNames?.backdrop)
|
|
86
88
|
}
|
|
87
89
|
}), children);
|
|
88
90
|
};
|
|
@@ -23,9 +23,14 @@ export type PanelHeaderProps = {
|
|
|
23
23
|
className?: string,
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
+
type FooterClassNames = $ReadOnly<{
|
|
27
|
+
wrapper?: string,
|
|
28
|
+
actions?: string,
|
|
29
|
+
}>;
|
|
30
|
+
|
|
26
31
|
export type PanelFooterProps = {
|
|
27
32
|
children?: React.Node,
|
|
28
|
-
|
|
33
|
+
classNames?: FooterClassNames,
|
|
29
34
|
};
|
|
30
35
|
|
|
31
36
|
export type PanelBodyProps = {
|
|
@@ -73,12 +78,14 @@ export const PanelBody = ({
|
|
|
73
78
|
|
|
74
79
|
export const PanelFooter = ({
|
|
75
80
|
children,
|
|
76
|
-
|
|
81
|
+
classNames,
|
|
77
82
|
}: PanelFooterProps): React.Node => (
|
|
78
83
|
<>
|
|
79
84
|
{React.Children.count(children) > 0 && (
|
|
80
|
-
<div className={classify(css.panelFooter,
|
|
81
|
-
<div className={css.panelFooterActions}>
|
|
85
|
+
<div className={classify(css.panelFooter, classNames?.wrapper)}>
|
|
86
|
+
<div className={classify(css.panelFooterActions, classNames?.actions)}>
|
|
87
|
+
{children}
|
|
88
|
+
</div>
|
|
82
89
|
</div>
|
|
83
90
|
)}
|
|
84
91
|
</>
|
|
@@ -91,6 +98,7 @@ export const Panel = ({
|
|
|
91
98
|
anchor = 'left',
|
|
92
99
|
onClose,
|
|
93
100
|
hideBackdrop = true,
|
|
101
|
+
classNames,
|
|
94
102
|
...restPanelProps
|
|
95
103
|
}: PanelProps): React.Node => {
|
|
96
104
|
const isTransitioning = useMountTransition(
|
|
@@ -105,15 +113,25 @@ export const Panel = ({
|
|
|
105
113
|
hideBackdrop={hideBackdrop}
|
|
106
114
|
{...restPanelProps}
|
|
107
115
|
classNames={{
|
|
108
|
-
container: classify(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
116
|
+
container: classify(
|
|
117
|
+
css.panelContainer,
|
|
118
|
+
{
|
|
119
|
+
[css.in]: isTransitioning,
|
|
120
|
+
[css.open]: isOpen,
|
|
121
|
+
},
|
|
122
|
+
classNames?.container,
|
|
123
|
+
),
|
|
124
|
+
content: classify(
|
|
125
|
+
css.panel,
|
|
126
|
+
css[anchor],
|
|
127
|
+
{
|
|
128
|
+
[css.medium]: size === 'medium',
|
|
129
|
+
[css.small]: size === 'small',
|
|
130
|
+
[css.large]: size === 'large',
|
|
131
|
+
},
|
|
132
|
+
classNames?.content,
|
|
133
|
+
),
|
|
134
|
+
backdrop: classify(classNames?.backdrop),
|
|
117
135
|
}}
|
|
118
136
|
>
|
|
119
137
|
{children}
|
|
@@ -51,7 +51,7 @@ const SubMenuItemAction = _ref3 => {
|
|
|
51
51
|
};
|
|
52
52
|
exports.SubMenuItemAction = SubMenuItemAction;
|
|
53
53
|
SubMenuItemAction.displayName = 'SubMenuItemAction';
|
|
54
|
-
const SubMenuItem = _ref4 => {
|
|
54
|
+
const SubMenuItem = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
|
|
55
55
|
let {
|
|
56
56
|
children,
|
|
57
57
|
selectedMenuKey,
|
|
@@ -88,11 +88,12 @@ const SubMenuItem = _ref4 => {
|
|
|
88
88
|
[_SubMenuModule.default.selected]: selected,
|
|
89
89
|
[_SubMenuModule.default.disabled]: disabled
|
|
90
90
|
}, classNames?.wrapper),
|
|
91
|
-
onClick: onChangeHandler
|
|
91
|
+
onClick: onChangeHandler,
|
|
92
|
+
ref: ref
|
|
92
93
|
}), /*#__PURE__*/React.createElement("div", {
|
|
93
94
|
className: _SubMenuModule.default.menuIconName
|
|
94
95
|
}, getNamedComp('SubMenuItemIcon'), getNamedComp('SubMenuItemText')), getNamedComp('SubMenuItemAction'));
|
|
95
|
-
};
|
|
96
|
+
});
|
|
96
97
|
exports.SubMenuItem = SubMenuItem;
|
|
97
98
|
const SubMenuGroup = _ref5 => {
|
|
98
99
|
let {
|
|
@@ -75,63 +75,72 @@ export type SubMenuItemProps = {
|
|
|
75
75
|
...
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
-
export const SubMenuItem
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
78
|
+
export const SubMenuItem: React$AbstractComponent<
|
|
79
|
+
SubMenuItemProps,
|
|
80
|
+
HTMLElement,
|
|
81
|
+
> = React.forwardRef(
|
|
82
|
+
(
|
|
83
|
+
{
|
|
84
|
+
children,
|
|
85
|
+
selectedMenuKey,
|
|
86
|
+
disabled,
|
|
87
|
+
classNames,
|
|
88
|
+
onChange,
|
|
89
|
+
menuKey,
|
|
90
|
+
...props
|
|
91
|
+
}: SubMenuItemProps,
|
|
92
|
+
ref,
|
|
93
|
+
): React.Node => {
|
|
94
|
+
const onChangeHandler = () => {
|
|
95
|
+
if (!disabled) {
|
|
96
|
+
onChange && onChange(menuKey);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const selected = selectedMenuKey === menuKey;
|
|
101
|
+
|
|
102
|
+
const getNamedComp = (comp: string) => {
|
|
103
|
+
const childrenArray = React.Children.toArray(children);
|
|
104
|
+
if (childrenArray.length) {
|
|
105
|
+
const nodes: React.Node[] = [];
|
|
106
|
+
for (const child of childrenArray) {
|
|
107
|
+
if (child?.type?.displayName === comp) {
|
|
108
|
+
nodes.push(
|
|
109
|
+
React.cloneElement(child, {
|
|
110
|
+
selected,
|
|
111
|
+
disabled,
|
|
112
|
+
}),
|
|
113
|
+
);
|
|
114
|
+
}
|
|
107
115
|
}
|
|
116
|
+
return nodes.length > 1 ? nodes : nodes[0];
|
|
108
117
|
}
|
|
109
|
-
return
|
|
110
|
-
}
|
|
111
|
-
return null;
|
|
112
|
-
};
|
|
118
|
+
return null;
|
|
119
|
+
};
|
|
113
120
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
{
|
|
129
|
-
|
|
121
|
+
return (
|
|
122
|
+
<div
|
|
123
|
+
{...props}
|
|
124
|
+
className={classify(
|
|
125
|
+
css.menuItem,
|
|
126
|
+
{
|
|
127
|
+
[css.selected]: selected,
|
|
128
|
+
[css.disabled]: disabled,
|
|
129
|
+
},
|
|
130
|
+
classNames?.wrapper,
|
|
131
|
+
)}
|
|
132
|
+
onClick={onChangeHandler}
|
|
133
|
+
ref={ref}
|
|
134
|
+
>
|
|
135
|
+
<div className={css.menuIconName}>
|
|
136
|
+
{getNamedComp('SubMenuItemIcon')}
|
|
137
|
+
{getNamedComp('SubMenuItemText')}
|
|
138
|
+
</div>
|
|
139
|
+
{getNamedComp('SubMenuItemAction')}
|
|
130
140
|
</div>
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
};
|
|
141
|
+
);
|
|
142
|
+
},
|
|
143
|
+
);
|
|
135
144
|
|
|
136
145
|
type SubMenuGroupClassNames = $ReadOnly<{
|
|
137
146
|
wrapper?: string,
|
|
@@ -21,8 +21,15 @@ const HighlightText = _ref => {
|
|
|
21
21
|
highlightWithBackground
|
|
22
22
|
} = _ref;
|
|
23
23
|
// Split text on highlight term, include term itself into parts, ignore case
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
let highlights = '';
|
|
25
|
+
if (Array.isArray(highlight)) {
|
|
26
|
+
highlights = highlight.join('|');
|
|
27
|
+
} else {
|
|
28
|
+
highlights = highlight;
|
|
29
|
+
}
|
|
30
|
+
const parts = text.split(new RegExp(`(${highlights})`, caseSensitiveHighlighting ? '' : 'gi'));
|
|
31
|
+
return /*#__PURE__*/React.createElement("span", null, parts.map(part => highlights.toLowerCase().includes(part.toLowerCase()) ? /*#__PURE__*/React.createElement("span", {
|
|
32
|
+
key: part,
|
|
26
33
|
className: (0, _classify.default)(_typographyModule.default.highlightText, {
|
|
27
34
|
[_typographyModule.default.bgHighlighting]: highlightWithBackground
|
|
28
35
|
}, highlightClassName)
|
|
@@ -14,7 +14,7 @@ export type TextProps = {
|
|
|
14
14
|
children?: React.Node,
|
|
15
15
|
className?: string,
|
|
16
16
|
highlightedTextClassName?: string,
|
|
17
|
-
highlightString?: string,
|
|
17
|
+
highlightString?: string | string[],
|
|
18
18
|
caseSensitiveHighlighting?: boolean,
|
|
19
19
|
highlightWithBackground?: boolean,
|
|
20
20
|
...
|
|
@@ -22,7 +22,7 @@ export type TextProps = {
|
|
|
22
22
|
|
|
23
23
|
export type HighlightTextProps = {
|
|
24
24
|
text: string,
|
|
25
|
-
highlight: string,
|
|
25
|
+
highlight: string | string[],
|
|
26
26
|
highlightClassName?: string,
|
|
27
27
|
caseSensitiveHighlighting?: boolean,
|
|
28
28
|
highlightWithBackground?: boolean,
|
|
@@ -36,14 +36,21 @@ const HighlightText = ({
|
|
|
36
36
|
highlightWithBackground,
|
|
37
37
|
}: HighlightTextProps) => {
|
|
38
38
|
// Split text on highlight term, include term itself into parts, ignore case
|
|
39
|
+
let highlights = '';
|
|
40
|
+
if (Array.isArray(highlight)) {
|
|
41
|
+
highlights = highlight.join('|');
|
|
42
|
+
} else {
|
|
43
|
+
highlights = highlight;
|
|
44
|
+
}
|
|
39
45
|
const parts = text.split(
|
|
40
|
-
new RegExp(`(${
|
|
46
|
+
new RegExp(`(${highlights})`, caseSensitiveHighlighting ? '' : 'gi'),
|
|
41
47
|
);
|
|
42
48
|
return (
|
|
43
49
|
<span>
|
|
44
50
|
{parts.map((part) =>
|
|
45
|
-
|
|
51
|
+
highlights.toLowerCase().includes(part.toLowerCase()) ? (
|
|
46
52
|
<span
|
|
53
|
+
key={part}
|
|
47
54
|
className={classify(
|
|
48
55
|
css.highlightText,
|
|
49
56
|
{
|