@spaced-out/ui-design-system 0.1.65 → 0.1.67
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/.cspell/custom-words.txt +2 -0
- package/.github/workflows/publish_to_npm.yml +1 -1
- package/CHANGELOG.md +21 -0
- package/lib/components/Button/Button.js +2 -2
- package/lib/components/Button/Button.js.flow +3 -3
- package/lib/components/SideMenuLink/SideMenuLink.js +23 -34
- package/lib/components/SideMenuLink/SideMenuLink.js.flow +8 -19
- package/lib/components/Table/hooks.js +8 -6
- package/lib/components/Table/hooks.js.flow +8 -6
- package/lib/components/Tooltip/Tooltip.js +17 -3
- package/lib/components/Tooltip/Tooltip.js.flow +19 -2
- package/package.json +1 -1
package/.cspell/custom-words.txt
CHANGED
|
@@ -22,7 +22,7 @@ jobs:
|
|
|
22
22
|
- name: Check Permissions
|
|
23
23
|
id: check-permissions
|
|
24
24
|
env:
|
|
25
|
-
ALLOWED_USERS: superrover, Anant-Raj, nsfmc, ashwini-sensehq, aditya-kaushal
|
|
25
|
+
ALLOWED_USERS: superrover, Anant-Raj, nsfmc, ashwini-sensehq, aditya-kaushal, vish-sah
|
|
26
26
|
if: ${{ !contains(env.ALLOWED_USERS, github.actor) }}
|
|
27
27
|
run: |
|
|
28
28
|
echo "You don't have correct permissions to do this release"
|
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.1.67](https://github.com/spaced-out/ui-design-system/compare/v0.1.66...v0.1.67) (2023-11-10)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* tooltip now accepts elevation as an enum ([c2c2548](https://github.com/spaced-out/ui-design-system/commit/c2c254895e343cfcfe336b416d5341ac06d07ba6))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* add senseai to side menu link ([#151](https://github.com/spaced-out/ui-design-system/issues/151)) ([fec9cab](https://github.com/spaced-out/ui-design-system/commit/fec9cab34a2be35e89ce4c72968451ae6cac3444))
|
|
16
|
+
* button overflow fix ([#153](https://github.com/spaced-out/ui-design-system/issues/153)) ([932ea91](https://github.com/spaced-out/ui-design-system/commit/932ea91a5d75c3044998efb6bf4f0e27357dd8e9))
|
|
17
|
+
* table column fixes ([4aefc17](https://github.com/spaced-out/ui-design-system/commit/4aefc175d6f24b7fd6eea425f68f38712f478488))
|
|
18
|
+
|
|
19
|
+
### [0.1.66](https://github.com/spaced-out/ui-design-system/compare/v0.1.65...v0.1.66) (2023-11-06)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* enable case-insensitive sorting in table ([#152](https://github.com/spaced-out/ui-design-system/issues/152)) ([6e229a0](https://github.com/spaced-out/ui-design-system/commit/6e229a084b78964fc62e65a0ac09a367166ce03b))
|
|
25
|
+
|
|
5
26
|
### [0.1.65](https://github.com/spaced-out/ui-design-system/compare/v0.1.64...v0.1.65) (2023-10-31)
|
|
6
27
|
|
|
7
28
|
|
|
@@ -111,7 +111,7 @@ const Button = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
111
111
|
}), /*#__PURE__*/React.createElement("div", {
|
|
112
112
|
className: _ButtonModule.default.buttonRow
|
|
113
113
|
}, !(iconLeftName || iconRightName) ? /*#__PURE__*/React.createElement("div", {
|
|
114
|
-
className: _ButtonModule.default.textContainer
|
|
114
|
+
className: (0, _classify.classify)(_ButtonModule.default.textContainer, classNames?.text)
|
|
115
115
|
}, isLoading && /*#__PURE__*/React.createElement("div", {
|
|
116
116
|
className: _ButtonModule.default.loader
|
|
117
117
|
}, /*#__PURE__*/React.createElement(_CircularLoader.CircularLoader, {
|
|
@@ -147,7 +147,7 @@ const Button = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
147
147
|
[_ButtonModule.default.hidden]: isLoading
|
|
148
148
|
}, classNames?.icon)
|
|
149
149
|
}), /*#__PURE__*/React.createElement("div", {
|
|
150
|
-
className: _ButtonModule.default.textContainer
|
|
150
|
+
className: (0, _classify.classify)(_ButtonModule.default.textContainer, classNames?.text)
|
|
151
151
|
}, isLoading && /*#__PURE__*/React.createElement("div", {
|
|
152
152
|
className: _ButtonModule.default.loader
|
|
153
153
|
}, /*#__PURE__*/React.createElement(_CircularLoader.CircularLoader, {
|
|
@@ -11,7 +11,7 @@ import {Truncate} from '../Truncate';
|
|
|
11
11
|
import css from './Button.module.css';
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
type ClassNames = $ReadOnly<{wrapper?: string, icon?: string}>;
|
|
14
|
+
type ClassNames = $ReadOnly<{wrapper?: string, icon?: string, text?: string}>;
|
|
15
15
|
|
|
16
16
|
export const BUTTON_TYPES = Object.freeze({
|
|
17
17
|
primary: 'primary',
|
|
@@ -162,7 +162,7 @@ export const Button: React$AbstractComponent<ButtonProps, HTMLButtonElement> =
|
|
|
162
162
|
<div className={css.buttonRow}>
|
|
163
163
|
{/* Has no icon, only child */}
|
|
164
164
|
{!(iconLeftName || iconRightName) ? (
|
|
165
|
-
<div className={css.textContainer}>
|
|
165
|
+
<div className={classify(css.textContainer, classNames?.text)}>
|
|
166
166
|
{isLoading && (
|
|
167
167
|
<div className={css.loader}>
|
|
168
168
|
<CircularLoader
|
|
@@ -223,7 +223,7 @@ export const Button: React$AbstractComponent<ButtonProps, HTMLButtonElement> =
|
|
|
223
223
|
)}
|
|
224
224
|
/>
|
|
225
225
|
)}
|
|
226
|
-
<div className={css.textContainer}>
|
|
226
|
+
<div className={classify(css.textContainer, classNames?.text)}>
|
|
227
227
|
{isLoading && (
|
|
228
228
|
<div className={css.loader}>
|
|
229
229
|
<CircularLoader
|
|
@@ -17,98 +17,87 @@ const MENU_NAME_LIST = Object.freeze({
|
|
|
17
17
|
dashboard: {
|
|
18
18
|
title: 'Dashboard',
|
|
19
19
|
iconName: 'house',
|
|
20
|
-
iconType: 'duotone'
|
|
21
|
-
iconSwapOpacity: false
|
|
20
|
+
iconType: 'duotone'
|
|
22
21
|
},
|
|
23
22
|
engage: {
|
|
24
23
|
title: 'Engage',
|
|
25
24
|
iconName: 'bullseye-pointer',
|
|
26
|
-
iconType: 'duotone'
|
|
27
|
-
iconSwapOpacity: false
|
|
25
|
+
iconType: 'duotone'
|
|
28
26
|
},
|
|
29
27
|
trm: {
|
|
30
28
|
title: 'TRM',
|
|
31
29
|
iconName: 'screen-users',
|
|
32
|
-
iconType: 'duotone'
|
|
33
|
-
iconSwapOpacity: true
|
|
30
|
+
iconType: 'duotone'
|
|
34
31
|
},
|
|
35
32
|
analytics: {
|
|
36
33
|
title: 'Analytics',
|
|
37
34
|
iconName: 'chart-column',
|
|
38
|
-
iconType: 'duotone'
|
|
39
|
-
iconSwapOpacity: true
|
|
35
|
+
iconType: 'duotone'
|
|
40
36
|
},
|
|
41
37
|
messaging: {
|
|
42
38
|
title: 'Messaging',
|
|
43
39
|
iconName: 'messages',
|
|
44
|
-
iconType: 'duotone'
|
|
45
|
-
iconSwapOpacity: true
|
|
40
|
+
iconType: 'duotone'
|
|
46
41
|
},
|
|
47
42
|
chatbot: {
|
|
48
43
|
title: 'Chatbot',
|
|
49
44
|
iconName: 'message-bot',
|
|
50
|
-
iconType: 'duotone'
|
|
51
|
-
iconSwapOpacity: true
|
|
45
|
+
iconType: 'duotone'
|
|
52
46
|
},
|
|
53
47
|
referrals: {
|
|
54
48
|
title: 'Referrals',
|
|
55
49
|
iconName: 'user-check',
|
|
56
|
-
iconType: 'duotone'
|
|
57
|
-
iconSwapOpacity: true
|
|
50
|
+
iconType: 'duotone'
|
|
58
51
|
},
|
|
59
52
|
records: {
|
|
60
53
|
title: 'Records',
|
|
61
54
|
iconName: 'folder-open',
|
|
62
|
-
iconType: 'duotone'
|
|
63
|
-
iconSwapOpacity: true
|
|
55
|
+
iconType: 'duotone'
|
|
64
56
|
},
|
|
65
57
|
bulkCleanup: {
|
|
66
58
|
title: 'Bulk Cleanup',
|
|
67
59
|
iconName: 'retweet',
|
|
68
|
-
iconType: 'duotone'
|
|
69
|
-
iconSwapOpacity: true
|
|
60
|
+
iconType: 'duotone'
|
|
70
61
|
},
|
|
71
62
|
support: {
|
|
72
63
|
title: 'Support',
|
|
73
64
|
iconName: 'headset',
|
|
74
|
-
iconType: 'duotone'
|
|
75
|
-
iconSwapOpacity: true
|
|
65
|
+
iconType: 'duotone'
|
|
76
66
|
},
|
|
77
67
|
audit: {
|
|
78
68
|
title: 'Audit',
|
|
79
69
|
iconName: 'print-magnifying-glass',
|
|
80
|
-
iconType: 'duotone'
|
|
81
|
-
iconSwapOpacity: true
|
|
70
|
+
iconType: 'duotone'
|
|
82
71
|
},
|
|
83
72
|
timeline: {
|
|
84
73
|
title: 'Timeline',
|
|
85
74
|
iconName: 'timeline',
|
|
86
|
-
iconType: 'duotone'
|
|
87
|
-
iconSwapOpacity: true
|
|
75
|
+
iconType: 'duotone'
|
|
88
76
|
},
|
|
89
77
|
people: {
|
|
90
78
|
title: 'People',
|
|
91
79
|
iconName: 'people-group',
|
|
92
|
-
iconType: 'duotone'
|
|
93
|
-
iconSwapOpacity: true
|
|
80
|
+
iconType: 'duotone'
|
|
94
81
|
},
|
|
95
82
|
contacts: {
|
|
96
83
|
title: 'Contacts',
|
|
97
84
|
iconName: 'address-card',
|
|
98
|
-
iconType: 'duotone'
|
|
99
|
-
iconSwapOpacity: true
|
|
85
|
+
iconType: 'duotone'
|
|
100
86
|
},
|
|
101
87
|
contacts2: {
|
|
102
88
|
title: 'Contacts',
|
|
103
89
|
iconName: 'calendars',
|
|
104
|
-
iconType: 'duotone'
|
|
105
|
-
iconSwapOpacity: true
|
|
90
|
+
iconType: 'duotone'
|
|
106
91
|
},
|
|
107
92
|
contacts3: {
|
|
108
93
|
title: 'Contacts',
|
|
109
94
|
iconName: 'browser',
|
|
110
|
-
iconType: 'duotone'
|
|
111
|
-
|
|
95
|
+
iconType: 'duotone'
|
|
96
|
+
},
|
|
97
|
+
senseai: {
|
|
98
|
+
title: 'AI Copilot',
|
|
99
|
+
iconName: 'sparkles',
|
|
100
|
+
iconType: 'duotone'
|
|
112
101
|
}
|
|
113
102
|
});
|
|
114
103
|
exports.MENU_NAME_LIST = MENU_NAME_LIST;
|
|
@@ -122,8 +111,8 @@ const SideMenuLink = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
122
111
|
onChange
|
|
123
112
|
} = _ref;
|
|
124
113
|
const selected = selectedValue === pageNameKey;
|
|
125
|
-
const onChangeHandler =
|
|
126
|
-
onChange && onChange(pageNameKey);
|
|
114
|
+
const onChangeHandler = e => {
|
|
115
|
+
onChange && onChange(e, pageNameKey);
|
|
127
116
|
};
|
|
128
117
|
return /*#__PURE__*/React.createElement("div", {
|
|
129
118
|
className: (0, _classify.default)(_SideMenuLinkModule.default.linkWrapper, {
|
|
@@ -14,97 +14,86 @@ export const MENU_NAME_LIST = Object.freeze({
|
|
|
14
14
|
title: 'Dashboard',
|
|
15
15
|
iconName: 'house',
|
|
16
16
|
iconType: 'duotone',
|
|
17
|
-
iconSwapOpacity: false,
|
|
18
17
|
},
|
|
19
18
|
engage: {
|
|
20
19
|
title: 'Engage',
|
|
21
20
|
iconName: 'bullseye-pointer',
|
|
22
21
|
iconType: 'duotone',
|
|
23
|
-
iconSwapOpacity: false,
|
|
24
22
|
},
|
|
25
23
|
trm: {
|
|
26
24
|
title: 'TRM',
|
|
27
25
|
iconName: 'screen-users',
|
|
28
26
|
iconType: 'duotone',
|
|
29
|
-
iconSwapOpacity: true,
|
|
30
27
|
},
|
|
31
28
|
analytics: {
|
|
32
29
|
title: 'Analytics',
|
|
33
30
|
iconName: 'chart-column',
|
|
34
31
|
iconType: 'duotone',
|
|
35
|
-
iconSwapOpacity: true,
|
|
36
32
|
},
|
|
37
33
|
messaging: {
|
|
38
34
|
title: 'Messaging',
|
|
39
35
|
iconName: 'messages',
|
|
40
36
|
iconType: 'duotone',
|
|
41
|
-
iconSwapOpacity: true,
|
|
42
37
|
},
|
|
43
38
|
chatbot: {
|
|
44
39
|
title: 'Chatbot',
|
|
45
40
|
iconName: 'message-bot',
|
|
46
41
|
iconType: 'duotone',
|
|
47
|
-
iconSwapOpacity: true,
|
|
48
42
|
},
|
|
49
43
|
referrals: {
|
|
50
44
|
title: 'Referrals',
|
|
51
45
|
iconName: 'user-check',
|
|
52
46
|
iconType: 'duotone',
|
|
53
|
-
iconSwapOpacity: true,
|
|
54
47
|
},
|
|
55
48
|
records: {
|
|
56
49
|
title: 'Records',
|
|
57
50
|
iconName: 'folder-open',
|
|
58
51
|
iconType: 'duotone',
|
|
59
|
-
iconSwapOpacity: true,
|
|
60
52
|
},
|
|
61
53
|
bulkCleanup: {
|
|
62
54
|
title: 'Bulk Cleanup',
|
|
63
55
|
iconName: 'retweet',
|
|
64
56
|
iconType: 'duotone',
|
|
65
|
-
iconSwapOpacity: true,
|
|
66
57
|
},
|
|
67
58
|
support: {
|
|
68
59
|
title: 'Support',
|
|
69
60
|
iconName: 'headset',
|
|
70
61
|
iconType: 'duotone',
|
|
71
|
-
iconSwapOpacity: true,
|
|
72
62
|
},
|
|
73
63
|
audit: {
|
|
74
64
|
title: 'Audit',
|
|
75
65
|
iconName: 'print-magnifying-glass',
|
|
76
66
|
iconType: 'duotone',
|
|
77
|
-
iconSwapOpacity: true,
|
|
78
67
|
},
|
|
79
68
|
timeline: {
|
|
80
69
|
title: 'Timeline',
|
|
81
70
|
iconName: 'timeline',
|
|
82
71
|
iconType: 'duotone',
|
|
83
|
-
iconSwapOpacity: true,
|
|
84
72
|
},
|
|
85
73
|
people: {
|
|
86
74
|
title: 'People',
|
|
87
75
|
iconName: 'people-group',
|
|
88
76
|
iconType: 'duotone',
|
|
89
|
-
iconSwapOpacity: true,
|
|
90
77
|
},
|
|
91
78
|
contacts: {
|
|
92
79
|
title: 'Contacts',
|
|
93
80
|
iconName: 'address-card',
|
|
94
81
|
iconType: 'duotone',
|
|
95
|
-
iconSwapOpacity: true,
|
|
96
82
|
},
|
|
97
83
|
contacts2: {
|
|
98
84
|
title: 'Contacts',
|
|
99
85
|
iconName: 'calendars',
|
|
100
86
|
iconType: 'duotone',
|
|
101
|
-
iconSwapOpacity: true,
|
|
102
87
|
},
|
|
103
88
|
contacts3: {
|
|
104
89
|
title: 'Contacts',
|
|
105
90
|
iconName: 'browser',
|
|
106
91
|
iconType: 'duotone',
|
|
107
|
-
|
|
92
|
+
},
|
|
93
|
+
senseai: {
|
|
94
|
+
title: 'AI Copilot',
|
|
95
|
+
iconName: 'sparkles',
|
|
96
|
+
iconType: 'duotone',
|
|
108
97
|
},
|
|
109
98
|
});
|
|
110
99
|
|
|
@@ -118,7 +107,7 @@ export type SideMenuLinkProps = {
|
|
|
118
107
|
hovered?: boolean,
|
|
119
108
|
selectedValue?: string,
|
|
120
109
|
opened?: boolean,
|
|
121
|
-
onChange?: (newValue: string) => mixed,
|
|
110
|
+
onChange?: (e: SyntheticEvent<HTMLElement>, newValue: string) => mixed,
|
|
122
111
|
};
|
|
123
112
|
|
|
124
113
|
export const SideMenuLink: React$AbstractComponent<
|
|
@@ -137,8 +126,8 @@ export const SideMenuLink: React$AbstractComponent<
|
|
|
137
126
|
ref,
|
|
138
127
|
): React.Node => {
|
|
139
128
|
const selected = selectedValue === pageNameKey;
|
|
140
|
-
const onChangeHandler = () => {
|
|
141
|
-
onChange && onChange(pageNameKey);
|
|
129
|
+
const onChangeHandler = (e: SyntheticEvent<HTMLElement>) => {
|
|
130
|
+
onChange && onChange(e, pageNameKey);
|
|
142
131
|
};
|
|
143
132
|
return (
|
|
144
133
|
<div
|
|
@@ -51,12 +51,14 @@ function useSortableEntries(entries, idName, _ref) {
|
|
|
51
51
|
if (sortDirection === 'original') {
|
|
52
52
|
return entries;
|
|
53
53
|
}
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return
|
|
59
|
-
}
|
|
54
|
+
const caseInsensitiveSortFunction = entry => {
|
|
55
|
+
if (typeof entry[sortKey] === 'string') {
|
|
56
|
+
return entry[sortKey].toLowerCase();
|
|
57
|
+
}
|
|
58
|
+
return entry[sortKey];
|
|
59
|
+
};
|
|
60
|
+
const sortedDesc = (0, _sortBy.default)(entries, caseInsensitiveSortFunction);
|
|
61
|
+
return sortDirection === 'asc' ? sortedDesc : sortedDesc.reverse();
|
|
60
62
|
}, [sortDirection, sortKey, entries]);
|
|
61
63
|
const sortedKeys = React.useMemo(() => sortedEntries.map(ent => (0, _get.default)(ent, idName)), [sortedEntries]);
|
|
62
64
|
return {
|
|
@@ -69,12 +69,14 @@ export function useSortableEntries<T: GenericObject>(
|
|
|
69
69
|
if (sortDirection === 'original') {
|
|
70
70
|
return entries;
|
|
71
71
|
}
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return
|
|
77
|
-
}
|
|
72
|
+
const caseInsensitiveSortFunction = (entry) => {
|
|
73
|
+
if (typeof entry[sortKey] === 'string') {
|
|
74
|
+
return entry[sortKey].toLowerCase();
|
|
75
|
+
}
|
|
76
|
+
return entry[sortKey];
|
|
77
|
+
};
|
|
78
|
+
const sortedDesc = sortBy(entries, caseInsensitiveSortFunction);
|
|
79
|
+
return sortDirection === 'asc' ? sortedDesc : sortedDesc.reverse();
|
|
78
80
|
}, [sortDirection, sortKey, entries]);
|
|
79
81
|
|
|
80
82
|
const sortedKeys = React.useMemo(
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.Tooltip = exports.DELAY_MOTION_DURATION_TYPES = void 0;
|
|
6
|
+
exports.Tooltip = exports.ELEVATION_TYPES = exports.DELAY_MOTION_DURATION_TYPES = void 0;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _react2 = require("@floating-ui/react");
|
|
9
9
|
var ELEVATION = _interopRequireWildcard(require("../../styles/variables/_elevation"));
|
|
@@ -26,6 +26,20 @@ const DELAY_MOTION_DURATION_TYPES = Object.freeze({
|
|
|
26
26
|
slowest: 'slowest'
|
|
27
27
|
});
|
|
28
28
|
exports.DELAY_MOTION_DURATION_TYPES = DELAY_MOTION_DURATION_TYPES;
|
|
29
|
+
const ELEVATION_TYPES = Object.freeze({
|
|
30
|
+
none: 'none',
|
|
31
|
+
card: 'card',
|
|
32
|
+
tooltip: 'tooltip',
|
|
33
|
+
menu: 'menu',
|
|
34
|
+
backdrop: 'backdrop',
|
|
35
|
+
modal: 'modal',
|
|
36
|
+
toast: 'toast'
|
|
37
|
+
});
|
|
38
|
+
exports.ELEVATION_TYPES = ELEVATION_TYPES;
|
|
39
|
+
const getElevationValue = elevation => {
|
|
40
|
+
const elevationKey = 'elevation' + (0, _string.capitalize)(elevation);
|
|
41
|
+
return ELEVATION[elevationKey] || elevation;
|
|
42
|
+
};
|
|
29
43
|
const Tooltip = _ref => {
|
|
30
44
|
let {
|
|
31
45
|
classNames,
|
|
@@ -36,7 +50,7 @@ const Tooltip = _ref => {
|
|
|
36
50
|
bodyMaxLines = 2,
|
|
37
51
|
titleMaxLines = 1,
|
|
38
52
|
delayMotionDuration = 'none',
|
|
39
|
-
elevation =
|
|
53
|
+
elevation = 'tooltip',
|
|
40
54
|
hidden
|
|
41
55
|
} = _ref;
|
|
42
56
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
@@ -80,7 +94,7 @@ const Tooltip = _ref => {
|
|
|
80
94
|
style: {
|
|
81
95
|
position: strategy,
|
|
82
96
|
...floatingStyles,
|
|
83
|
-
'--tooltip-elevation': elevation
|
|
97
|
+
'--tooltip-elevation': getElevationValue(elevation)
|
|
84
98
|
}
|
|
85
99
|
}, getFloatingProps()), !!title && /*#__PURE__*/React.createElement(_Truncate.Truncate, {
|
|
86
100
|
line: titleMaxLines,
|
|
@@ -53,6 +53,18 @@ export type DelayMotionDurationType = $Values<
|
|
|
53
53
|
typeof DELAY_MOTION_DURATION_TYPES,
|
|
54
54
|
>;
|
|
55
55
|
|
|
56
|
+
export const ELEVATION_TYPES = Object.freeze({
|
|
57
|
+
none: 'none',
|
|
58
|
+
card: 'card',
|
|
59
|
+
tooltip: 'tooltip',
|
|
60
|
+
menu: 'menu',
|
|
61
|
+
backdrop: 'backdrop',
|
|
62
|
+
modal: 'modal',
|
|
63
|
+
toast: 'toast',
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
export type ElevationType = $Values<typeof ELEVATION_TYPES>;
|
|
67
|
+
|
|
56
68
|
export type PlacementType =
|
|
57
69
|
| 'top'
|
|
58
70
|
| 'top-start'
|
|
@@ -82,6 +94,11 @@ export type TooltipProps = {
|
|
|
82
94
|
children: any,
|
|
83
95
|
};
|
|
84
96
|
|
|
97
|
+
const getElevationValue = (elevation: string): string => {
|
|
98
|
+
const elevationKey = 'elevation' + capitalize(elevation);
|
|
99
|
+
return ELEVATION[elevationKey] || elevation;
|
|
100
|
+
};
|
|
101
|
+
|
|
85
102
|
export const Tooltip = ({
|
|
86
103
|
classNames,
|
|
87
104
|
children,
|
|
@@ -91,7 +108,7 @@ export const Tooltip = ({
|
|
|
91
108
|
bodyMaxLines = 2,
|
|
92
109
|
titleMaxLines = 1,
|
|
93
110
|
delayMotionDuration = 'none',
|
|
94
|
-
elevation =
|
|
111
|
+
elevation = 'tooltip',
|
|
95
112
|
hidden,
|
|
96
113
|
}: TooltipProps): React.Node => {
|
|
97
114
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
@@ -151,7 +168,7 @@ export const Tooltip = ({
|
|
|
151
168
|
style={{
|
|
152
169
|
position: strategy,
|
|
153
170
|
...floatingStyles,
|
|
154
|
-
'--tooltip-elevation': elevation,
|
|
171
|
+
'--tooltip-elevation': getElevationValue(elevation),
|
|
155
172
|
}}
|
|
156
173
|
{...getFloatingProps()}
|
|
157
174
|
>
|