@scality/core-ui 0.194.0 → 0.195.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/dist/components/UnsuccessfulResult.component.d.ts.map +1 -1
- package/dist/components/accordion/Accordion.component.d.ts.map +1 -1
- package/dist/components/banner/Banner.component.d.ts +6 -1
- package/dist/components/banner/Banner.component.d.ts.map +1 -1
- package/dist/components/banner/Banner.component.js +30 -9
- package/dist/components/breadcrumb/Breadcrumb.component.d.ts.map +1 -1
- package/dist/components/buttonv2/CopyButton.component.d.ts.map +1 -1
- package/dist/components/charts/MetricsTimeSpanProvider.d.ts.map +1 -1
- package/dist/components/charts/barchart/Barchart.d.ts.map +1 -1
- package/dist/components/charts/barchart/Barchart.utils.d.ts.map +1 -1
- package/dist/components/charts/barchart/BarchartTooltip.d.ts.map +1 -1
- package/dist/components/charts/common/ChartTooltip.d.ts.map +1 -1
- package/dist/components/charts/common/SharedComponents.d.ts +6 -6
- package/dist/components/charts/common/SharedComponents.d.ts.map +1 -1
- package/dist/components/charts/common/SharedComponents.js +7 -3
- package/dist/components/charts/common/chartUtils.d.ts.map +1 -1
- package/dist/components/charts/globalhealthbar/GlobalHealthBar.hooks.d.ts.map +1 -1
- package/dist/components/charts/globalhealthbar/GlobalHealthBar.utils.d.ts +3 -1
- package/dist/components/charts/globalhealthbar/GlobalHealthBar.utils.d.ts.map +1 -1
- package/dist/components/charts/globalhealthbar/GlobalHealthBarTooltip.d.ts.map +1 -1
- package/dist/components/charts/globalhealthbar/HealthBarXAxis.d.ts.map +1 -1
- package/dist/components/charts/legend/ChartLegend.d.ts.map +1 -1
- package/dist/components/charts/legend/ChartLegendWrapper.d.ts.map +1 -1
- package/dist/components/charts/linetimeseries/LineTimeSerieChart.types.d.ts.map +1 -1
- package/dist/components/charts/linetimeseries/LineTimeSerieChart.utils.d.ts.map +1 -1
- package/dist/components/charts/linetimeseries/LineTimeSerieChartTooltip.d.ts.map +1 -1
- package/dist/components/constrainedtext/Constrainedtext.component.d.ts.map +1 -1
- package/dist/components/constrainedtext/Constrainedtext.component.js +1 -0
- package/dist/components/coreuithemeprovider/CoreUiThemeProvider.d.ts.map +1 -1
- package/dist/components/date/FormattedDateTime.d.ts.map +1 -1
- package/dist/components/form/Form.component.d.ts.map +1 -1
- package/dist/components/form/Form.component.js +3 -3
- package/dist/components/icon/CustomsIcons.d.ts.map +1 -1
- package/dist/components/icon/Icon.component.d.ts +2 -130
- package/dist/components/icon/Icon.component.d.ts.map +1 -1
- package/dist/components/icon/Icon.component.js +5 -131
- package/dist/components/icon/iconTable.d.ts +138 -0
- package/dist/components/icon/iconTable.d.ts.map +1 -0
- package/dist/components/icon/iconTable.js +137 -0
- package/dist/components/iconhelper/IconHelper.d.ts.map +1 -1
- package/dist/components/infomessage/InfoMessage.component.d.ts.map +1 -1
- package/dist/components/infomessage/InfoMessageUtils.d.ts.map +1 -1
- package/dist/components/inlineinput/InlineInput.d.ts.map +1 -1
- package/dist/components/inputlist/InputButtons.d.ts.map +1 -1
- package/dist/components/inputlist/InputList.component.d.ts +2 -0
- package/dist/components/inputlist/InputList.component.d.ts.map +1 -1
- package/dist/components/inputlist/InputList.component.js +2 -2
- package/dist/components/inputv2/inputv2.d.ts +2 -0
- package/dist/components/inputv2/inputv2.d.ts.map +1 -1
- package/dist/components/inputv2/inputv2.js +6 -2
- package/dist/components/layout/v2/panels.d.ts.map +1 -1
- package/dist/components/modal/Modal.component.d.ts.map +1 -1
- package/dist/components/searchinput/SearchInput.component.d.ts.map +1 -1
- package/dist/components/searchinput/SearchInput.component.js +1 -1
- package/dist/components/statusicon/StatusIcon.component.d.ts.map +1 -1
- package/dist/components/tablev2/MultiSelectableContent.d.ts.map +1 -1
- package/dist/components/tablev2/Search.d.ts.map +1 -1
- package/dist/components/tablev2/TableCommon.d.ts.map +1 -1
- package/dist/components/tablev2/TableUtils.d.ts.map +1 -1
- package/dist/components/tablev2/Tablestyle.d.ts.map +1 -1
- package/dist/components/tablev2/Tablev2.component.d.ts.map +1 -1
- package/dist/components/tabsv2/useScrollingTabs.d.ts.map +1 -1
- package/dist/components/text/Text.component.d.ts +9 -6
- package/dist/components/text/Text.component.d.ts.map +1 -1
- package/dist/components/text/Text.component.js +5 -0
- package/dist/components/toast/Toast.component.d.ts.map +1 -1
- package/dist/components/toast/useMutationsHandler.d.ts.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/next.d.ts +3 -3
- package/dist/next.d.ts.map +1 -1
- package/dist/organisms/attachments/AttachmentTable.d.ts.map +1 -1
- package/dist/spacing.d.ts.map +1 -1
- package/dist/utils.d.ts +2 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +2 -0
- package/jest.config.js +6 -1
- package/package.json +7 -7
- package/src/lib/components/banner/Banner.component.test.tsx +58 -0
- package/src/lib/components/banner/Banner.component.tsx +57 -10
- package/src/lib/components/charts/barchart/Barchart.test.tsx +3 -1
- package/src/lib/components/charts/common/SharedComponents.tsx +15 -11
- package/src/lib/components/constrainedtext/Constrainedtext.component.tsx +1 -0
- package/src/lib/components/form/Form.component.tsx +5 -19
- package/src/lib/components/icon/Icon.component.tsx +8 -135
- package/src/lib/components/icon/iconTable.ts +137 -0
- package/src/lib/components/iconhelper/IconHelper.test.tsx +2 -2
- package/src/lib/components/inputlist/InputList.component.tsx +4 -2
- package/src/lib/components/inputv2/inputv2.tsx +11 -5
- package/src/lib/components/searchinput/SearchInput.component.tsx +1 -0
- package/src/lib/components/searchinput/SearchInput.test.tsx +6 -6
- package/src/lib/components/text/Text.component.tsx +18 -10
- package/src/lib/index.ts +2 -2
- package/src/lib/next.ts +3 -3
- package/src/lib/utils.ts +4 -0
- package/stories/banner.stories.tsx +37 -5
- package/stories/inputlist.stories.tsx +18 -6
- package/tsconfig.json +1 -1
- package/dist/components/date/FormattedDateTime.spec.d.ts +0 -2
- package/dist/components/date/FormattedDateTime.spec.d.ts.map +0 -1
- package/dist/components/date/FormattedDateTime.spec.js +0 -161
- package/dist/components/date/dateDiffer.spec.d.ts +0 -2
- package/dist/components/date/dateDiffer.spec.d.ts.map +0 -1
- package/dist/components/date/dateDiffer.spec.js +0 -6
|
@@ -11,140 +11,11 @@ import styled, { css } from 'styled-components';
|
|
|
11
11
|
import { CoreUITheme } from '../../style/theme';
|
|
12
12
|
import { Loader } from '../loader/Loader.component';
|
|
13
13
|
import { Bucket, Buckets, RemoteGroup, RemoteUser } from './CustomsIcons';
|
|
14
|
+
import { iconTable } from './iconTable';
|
|
14
15
|
|
|
15
16
|
// Module-level cache for imported icons
|
|
16
17
|
const iconCache: Record<string, any> = {};
|
|
17
18
|
|
|
18
|
-
export const iconTable = {
|
|
19
|
-
Account: 'fas faWallet',
|
|
20
|
-
Backend: 'fas faNetworkWired',
|
|
21
|
-
Tape: 'fas faTape',
|
|
22
|
-
'Node-backend': 'fas faServer',
|
|
23
|
-
'Volume-backend': 'fas faHdd',
|
|
24
|
-
'Node-pdf': 'fas faDatabase',
|
|
25
|
-
'Volume-pdf': 'fas faCompactDisc',
|
|
26
|
-
Network: 'fas faProjectDiagram',
|
|
27
|
-
'Cloud-backend': 'fas faCloud',
|
|
28
|
-
Datacenter: 'fas faWarehouse',
|
|
29
|
-
'Simple-user': 'fas faUser',
|
|
30
|
-
User: 'fas faUserCog',
|
|
31
|
-
Group: 'fas faUsers',
|
|
32
|
-
Alert: 'fas faBell',
|
|
33
|
-
Bell: 'far faBell',
|
|
34
|
-
'Lat-menu': 'fas faBars',
|
|
35
|
-
Dashboard: 'fas faDesktop',
|
|
36
|
-
Workflow: 'fas faRoute',
|
|
37
|
-
Expiration: 'fas faStopwatch',
|
|
38
|
-
Replication: 'fas faCoins',
|
|
39
|
-
Transition: 'fas faRocket',
|
|
40
|
-
Discovery: 'fas faReply',
|
|
41
|
-
Metrics: 'fas faChartLine',
|
|
42
|
-
Edit: 'fas faEdit',
|
|
43
|
-
Logs: 'far faFileAlt',
|
|
44
|
-
Lock: 'fa faLock',
|
|
45
|
-
'Lock-open': 'fa faLockOpen',
|
|
46
|
-
'Create-add': 'fas faPlus',
|
|
47
|
-
Delete: 'fas faTrash',
|
|
48
|
-
Save: 'fas faSave',
|
|
49
|
-
'External-link': 'fas faExternalLinkAlt',
|
|
50
|
-
Link: 'fas faLink',
|
|
51
|
-
Unlink: 'fas faUnlink',
|
|
52
|
-
Close: 'fas faTimes',
|
|
53
|
-
'Dropdown-down': 'fas faCaretDown',
|
|
54
|
-
'Dropdown-up': 'fas faCaretUp',
|
|
55
|
-
Search: 'fas faSearch',
|
|
56
|
-
More: 'fas faEllipsisV',
|
|
57
|
-
Info: 'fas faQuestionCircle',
|
|
58
|
-
Sync: 'fas faSync',
|
|
59
|
-
Export: 'fas faFileExport',
|
|
60
|
-
Copy: 'far faClone',
|
|
61
|
-
'Simple-upload': 'fas faUpload',
|
|
62
|
-
Upload: 'fas faFileUpload',
|
|
63
|
-
'Add-plus': 'fas faPlusSquare',
|
|
64
|
-
Minus: 'fas faMinus',
|
|
65
|
-
'Remove-minus': 'fas faMinusSquare',
|
|
66
|
-
Sort: 'fas faSort',
|
|
67
|
-
'Sort-up': 'fas faSortUp',
|
|
68
|
-
'Sort-down': 'fas faSortDown',
|
|
69
|
-
Calendar: 'fas faCalendarWeek',
|
|
70
|
-
'Calendar-minus': 'fas faCalendarMinus',
|
|
71
|
-
'Arrow-up': 'fas faArrowUp',
|
|
72
|
-
'Arrow-down': 'fas faArrowDown',
|
|
73
|
-
'Arrow-right': 'fas faArrowRight',
|
|
74
|
-
'Arrow-left': 'fas faArrowLeft',
|
|
75
|
-
'Arrow-alt-circle-up': 'fas faArrowAltCircleUp',
|
|
76
|
-
Folder: 'far faFolder',
|
|
77
|
-
File: 'far faFile',
|
|
78
|
-
'File-invoice': 'fas faFileInvoice',
|
|
79
|
-
License: 'fas faFileInvoice',
|
|
80
|
-
'Deletion-marker': 'fas faBan',
|
|
81
|
-
'Map-marker': 'fas faMapMarkerAlt',
|
|
82
|
-
Location: 'fas faMapMarkerAlt',
|
|
83
|
-
'Info-circle': 'fas faInfoCircle',
|
|
84
|
-
'Exclamation-triangle': 'fas faExclamationTriangle',
|
|
85
|
-
'Exclamation-circle': 'fas faExclamationCircle',
|
|
86
|
-
Exclamation: 'fas faExclamation',
|
|
87
|
-
Check: 'fas faCheck',
|
|
88
|
-
Protected: 'fas faShieldAlt',
|
|
89
|
-
'Chevron-left': 'fas faChevronLeft',
|
|
90
|
-
'Chevron-right': 'fas faChevronRight',
|
|
91
|
-
'Chevron-down': 'fas faChevronDown',
|
|
92
|
-
'Chevron-up': 'fas faChevronUp',
|
|
93
|
-
'Angle-right': 'fas faAngleRight',
|
|
94
|
-
'Angle-double-right': 'fas faAngleDoubleRight',
|
|
95
|
-
Language: 'fas faLanguage',
|
|
96
|
-
Theme: 'fas faPalette',
|
|
97
|
-
Documentation: 'fas faClipboardList',
|
|
98
|
-
Support: 'fas faComments',
|
|
99
|
-
EULA: 'fas faFileContract',
|
|
100
|
-
'Log-out': 'fas faSignOutAlt',
|
|
101
|
-
Hourglass: 'far faHourglass',
|
|
102
|
-
Pause: 'fas faPause',
|
|
103
|
-
'Pause-circle': 'far faPauseCircle',
|
|
104
|
-
'Play-circle': 'far faPlayCircle',
|
|
105
|
-
Upgrade: 'fas faLevelUpAlt',
|
|
106
|
-
Expansion: 'fas faExpandAlt',
|
|
107
|
-
Rebalance: 'fas faBalanceScale',
|
|
108
|
-
Maintenance: 'fas faHardHat',
|
|
109
|
-
Role: 'fas faHatCowboy',
|
|
110
|
-
'Change-erasure': 'fas faExchangeAlt',
|
|
111
|
-
'Circle-health': 'fas faCircle',
|
|
112
|
-
'Circle-empty': 'far faCircle',
|
|
113
|
-
'Dot-circle': 'fas faDotCircle',
|
|
114
|
-
'Check-circle': 'fas faCheckCircle',
|
|
115
|
-
'Times-circle': 'fas faTimesCircle',
|
|
116
|
-
Toolbox: 'fas faToolbox',
|
|
117
|
-
Cubes: 'fas faCubes',
|
|
118
|
-
Policy: 'fas faFileSignature',
|
|
119
|
-
Pen: 'fa faPen',
|
|
120
|
-
Pencil: 'fas faPencilAlt',
|
|
121
|
-
Eye: 'fas faEye',
|
|
122
|
-
EyeSlash: 'fas faEyeSlash',
|
|
123
|
-
Snowflake: 'fas faSnowflake',
|
|
124
|
-
Key: 'fas faKey',
|
|
125
|
-
Filter: 'fas faFilter',
|
|
126
|
-
Download: 'fas faDownload',
|
|
127
|
-
Certificate: 'fas faCertificate',
|
|
128
|
-
Redo: 'fas faRedoAlt',
|
|
129
|
-
Eraser: 'fas faEraser',
|
|
130
|
-
'ID-card': 'fas faIdCard',
|
|
131
|
-
Setting: 'fas faCog', //TODO: Rename to Gear in FA v6 <i class="fa-sharp fa-solid fa-gear"></i>
|
|
132
|
-
Desktop: 'fas faDesktop',
|
|
133
|
-
Globe: 'fas faGlobe',
|
|
134
|
-
Satellite: 'fas faSatelliteDish',
|
|
135
|
-
LightMode: 'fas faSun',
|
|
136
|
-
DarkMode: 'fas faMoon',
|
|
137
|
-
News: 'fas faBullhorn',
|
|
138
|
-
Ring: 'fas faRing',
|
|
139
|
-
Stop: 'fas faStop',
|
|
140
|
-
Play: 'fas faPlay',
|
|
141
|
-
Mail: 'fas faEnvelope',
|
|
142
|
-
ThumbsUp: 'far faThumbsUp',
|
|
143
|
-
ThumbsDown: 'far faThumbsDown',
|
|
144
|
-
Sidebar: 'fas faColumns',
|
|
145
|
-
Bookopen: 'fas faBookOpen',
|
|
146
|
-
};
|
|
147
|
-
|
|
148
19
|
type IconProps = {
|
|
149
20
|
'aria-label'?: string;
|
|
150
21
|
color?: string;
|
|
@@ -279,10 +150,12 @@ function NonWrappedIcon({
|
|
|
279
150
|
}
|
|
280
151
|
|
|
281
152
|
// Handle FontAwesome icons with dynamic import
|
|
282
|
-
import(
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
153
|
+
import(
|
|
154
|
+
/* webpackExclude: /import\.macro\.js$/ */
|
|
155
|
+
`@fortawesome/${fontAwesomeType}/${iconClass}.js`).then((module) => {
|
|
156
|
+
setIcon(module[iconClass]);
|
|
157
|
+
iconCache[cacheKey] = module[iconClass];
|
|
158
|
+
});
|
|
286
159
|
return () => setIcon(undefined);
|
|
287
160
|
}, [name, iconInfo]);
|
|
288
161
|
|
|
@@ -319,4 +192,4 @@ function Icon({ withWrapper, ...props }: Props) {
|
|
|
319
192
|
return <NonWrappedIcon {...props} />;
|
|
320
193
|
}
|
|
321
194
|
|
|
322
|
-
export { Icon };
|
|
195
|
+
export { Icon, iconTable };
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps human-readable icon names to FontAwesome icon info.
|
|
3
|
+
* Format: 'iconType iconClass' where:
|
|
4
|
+
* - iconType: 'fas' (solid), 'far' (regular)
|
|
5
|
+
* - iconClass: the FA v7 icon class name (e.g., 'faWallet')
|
|
6
|
+
*
|
|
7
|
+
* Updated to FA v7 naming conventions.
|
|
8
|
+
*/
|
|
9
|
+
export const iconTable = {
|
|
10
|
+
Account: 'fas faWallet',
|
|
11
|
+
Backend: 'fas faNetworkWired',
|
|
12
|
+
Tape: 'fas faTape',
|
|
13
|
+
'Node-backend': 'fas faServer',
|
|
14
|
+
'Volume-backend': 'fas faHardDrive',
|
|
15
|
+
'Node-pdf': 'fas faDatabase',
|
|
16
|
+
'Volume-pdf': 'fas faCompactDisc',
|
|
17
|
+
Network: 'fas faDiagramProject',
|
|
18
|
+
'Cloud-backend': 'fas faCloud',
|
|
19
|
+
Datacenter: 'fas faWarehouse',
|
|
20
|
+
'Simple-user': 'fas faUser',
|
|
21
|
+
User: 'fas faUserGear',
|
|
22
|
+
Group: 'fas faUsers',
|
|
23
|
+
Alert: 'fas faBell',
|
|
24
|
+
Bell: 'far faBell',
|
|
25
|
+
'Lat-menu': 'fas faBars',
|
|
26
|
+
Dashboard: 'fas faDesktop',
|
|
27
|
+
Workflow: 'fas faRoute',
|
|
28
|
+
Expiration: 'fas faStopwatch',
|
|
29
|
+
Replication: 'fas faCoins',
|
|
30
|
+
Transition: 'fas faRocket',
|
|
31
|
+
Discovery: 'fas faReply',
|
|
32
|
+
Metrics: 'fas faChartLine',
|
|
33
|
+
Edit: 'fas faPenToSquare',
|
|
34
|
+
Logs: 'far faFileLines',
|
|
35
|
+
Lock: 'fas faLock',
|
|
36
|
+
'Lock-open': 'fas faLockOpen',
|
|
37
|
+
'Create-add': 'fas faPlus',
|
|
38
|
+
Delete: 'fas faTrash',
|
|
39
|
+
Save: 'fas faFloppyDisk',
|
|
40
|
+
'External-link': 'fas faArrowUpRightFromSquare',
|
|
41
|
+
Link: 'fas faLink',
|
|
42
|
+
Unlink: 'fas faLinkSlash',
|
|
43
|
+
Close: 'fas faXmark',
|
|
44
|
+
'Dropdown-down': 'fas faCaretDown',
|
|
45
|
+
'Dropdown-up': 'fas faCaretUp',
|
|
46
|
+
Search: 'fas faMagnifyingGlass',
|
|
47
|
+
More: 'fas faEllipsisVertical',
|
|
48
|
+
Info: 'fas faCircleQuestion',
|
|
49
|
+
Sync: 'fas faRotate',
|
|
50
|
+
Export: 'fas faFileExport',
|
|
51
|
+
Copy: 'far faClone',
|
|
52
|
+
'Simple-upload': 'fas faUpload',
|
|
53
|
+
Upload: 'fas faFileArrowUp',
|
|
54
|
+
'Add-plus': 'fas faSquarePlus',
|
|
55
|
+
Minus: 'fas faMinus',
|
|
56
|
+
'Remove-minus': 'fas faSquareMinus',
|
|
57
|
+
Sort: 'fas faSort',
|
|
58
|
+
'Sort-up': 'fas faSortUp',
|
|
59
|
+
'Sort-down': 'fas faSortDown',
|
|
60
|
+
Calendar: 'fas faCalendarWeek',
|
|
61
|
+
'Calendar-minus': 'fas faCalendarMinus',
|
|
62
|
+
'Arrow-up': 'fas faArrowUp',
|
|
63
|
+
'Arrow-down': 'fas faArrowDown',
|
|
64
|
+
'Arrow-right': 'fas faArrowRight',
|
|
65
|
+
'Arrow-left': 'fas faArrowLeft',
|
|
66
|
+
'Arrow-alt-circle-up': 'fas faCircleArrowUp',
|
|
67
|
+
Folder: 'far faFolder',
|
|
68
|
+
File: 'far faFile',
|
|
69
|
+
'File-invoice': 'fas faFileInvoice',
|
|
70
|
+
License: 'fas faFileInvoice',
|
|
71
|
+
'Deletion-marker': 'fas faBan',
|
|
72
|
+
'Map-marker': 'fas faLocationDot',
|
|
73
|
+
Location: 'fas faLocationDot',
|
|
74
|
+
'Info-circle': 'fas faCircleInfo',
|
|
75
|
+
'Exclamation-triangle': 'fas faTriangleExclamation',
|
|
76
|
+
'Exclamation-circle': 'fas faCircleExclamation',
|
|
77
|
+
Exclamation: 'fas faExclamation',
|
|
78
|
+
Check: 'fas faCheck',
|
|
79
|
+
Protected: 'fas faShieldHalved',
|
|
80
|
+
'Chevron-left': 'fas faChevronLeft',
|
|
81
|
+
'Chevron-right': 'fas faChevronRight',
|
|
82
|
+
'Chevron-down': 'fas faChevronDown',
|
|
83
|
+
'Chevron-up': 'fas faChevronUp',
|
|
84
|
+
'Angle-right': 'fas faAngleRight',
|
|
85
|
+
'Angle-double-right': 'fas faAnglesRight',
|
|
86
|
+
Language: 'fas faLanguage',
|
|
87
|
+
Theme: 'fas faPalette',
|
|
88
|
+
Documentation: 'fas faClipboardList',
|
|
89
|
+
Support: 'fas faComments',
|
|
90
|
+
EULA: 'fas faFileContract',
|
|
91
|
+
'Log-out': 'fas faRightFromBracket',
|
|
92
|
+
Hourglass: 'far faHourglass',
|
|
93
|
+
Pause: 'fas faPause',
|
|
94
|
+
'Pause-circle': 'far faCirclePause',
|
|
95
|
+
'Play-circle': 'far faCirclePlay',
|
|
96
|
+
Upgrade: 'fas faArrowTurnUp',
|
|
97
|
+
Expansion: 'fas faUpRightAndDownLeftFromCenter',
|
|
98
|
+
Rebalance: 'fas faScaleBalanced',
|
|
99
|
+
Maintenance: 'fas faHelmetSafety',
|
|
100
|
+
Role: 'fas faHatCowboy',
|
|
101
|
+
'Change-erasure': 'fas faArrowRightArrowLeft',
|
|
102
|
+
'Circle-health': 'fas faCircle',
|
|
103
|
+
'Circle-empty': 'far faCircle',
|
|
104
|
+
'Dot-circle': 'fas faCircleDot',
|
|
105
|
+
'Check-circle': 'fas faCircleCheck',
|
|
106
|
+
'Times-circle': 'fas faCircleXmark',
|
|
107
|
+
Toolbox: 'fas faToolbox',
|
|
108
|
+
Cubes: 'fas faCubes',
|
|
109
|
+
Policy: 'fas faFileSignature',
|
|
110
|
+
Pen: 'fas faPen',
|
|
111
|
+
Pencil: 'fas faPencil',
|
|
112
|
+
Eye: 'fas faEye',
|
|
113
|
+
EyeSlash: 'fas faEyeSlash',
|
|
114
|
+
Snowflake: 'fas faSnowflake',
|
|
115
|
+
Key: 'fas faKey',
|
|
116
|
+
Filter: 'fas faFilter',
|
|
117
|
+
Download: 'fas faDownload',
|
|
118
|
+
Certificate: 'fas faCertificate',
|
|
119
|
+
Redo: 'fas faRotateRight',
|
|
120
|
+
Eraser: 'fas faEraser',
|
|
121
|
+
'ID-card': 'fas faIdCard',
|
|
122
|
+
Setting: 'fas faGear',
|
|
123
|
+
Desktop: 'fas faDesktop',
|
|
124
|
+
Globe: 'fas faGlobe',
|
|
125
|
+
Satellite: 'fas faSatelliteDish',
|
|
126
|
+
LightMode: 'fas faSun',
|
|
127
|
+
DarkMode: 'fas faMoon',
|
|
128
|
+
News: 'fas faBullhorn',
|
|
129
|
+
Ring: 'fas faRing',
|
|
130
|
+
Stop: 'fas faStop',
|
|
131
|
+
Play: 'fas faPlay',
|
|
132
|
+
Mail: 'fas faEnvelope',
|
|
133
|
+
ThumbsUp: 'far faThumbsUp',
|
|
134
|
+
ThumbsDown: 'far faThumbsDown',
|
|
135
|
+
Sidebar: 'fas faTableColumns',
|
|
136
|
+
Bookopen: 'fas faBookOpen',
|
|
137
|
+
};
|
|
@@ -35,7 +35,7 @@ describe('IconHelper', () => {
|
|
|
35
35
|
expect(screen.getByText(tooltipMessage)).toBeVisible();
|
|
36
36
|
});
|
|
37
37
|
});
|
|
38
|
-
it('should
|
|
38
|
+
it('should render with title prop (passed to FontAwesome as native tooltip)', async () => {
|
|
39
39
|
const { Wrapper } = getWrapper();
|
|
40
40
|
render(
|
|
41
41
|
<Wrapper>
|
|
@@ -46,7 +46,7 @@ describe('IconHelper', () => {
|
|
|
46
46
|
</Wrapper>,
|
|
47
47
|
);
|
|
48
48
|
await waitFor(() => {
|
|
49
|
-
expect(screen.
|
|
49
|
+
expect(screen.getByRole('img', { name: /Info/i })).toBeInTheDocument();
|
|
50
50
|
});
|
|
51
51
|
});
|
|
52
52
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HTMLProps, forwardRef } from 'react';
|
|
2
2
|
import { RefCallBack } from 'react-hook-form';
|
|
3
3
|
import { Box } from '../box/Box';
|
|
4
|
-
import { Input } from '../inputv2/inputv2';
|
|
4
|
+
import { Input, InputSize } from '../inputv2/inputv2';
|
|
5
5
|
import { AddButton, SubButton } from './InputButtons';
|
|
6
6
|
|
|
7
7
|
export type InputListProps<T> = Omit<HTMLProps<HTMLInputElement>, 'size'> & {
|
|
@@ -15,6 +15,7 @@ export type InputListProps<T> = Omit<HTMLProps<HTMLInputElement>, 'size'> & {
|
|
|
15
15
|
disabled?: boolean;
|
|
16
16
|
maxItems?: number;
|
|
17
17
|
value: T[];
|
|
18
|
+
size?: InputSize;
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
function InternalInputList<
|
|
@@ -33,6 +34,7 @@ function InternalInputList<
|
|
|
33
34
|
maxItems,
|
|
34
35
|
value,
|
|
35
36
|
name,
|
|
37
|
+
size = '1/2',
|
|
36
38
|
...rest
|
|
37
39
|
}: InputListProps<T>,
|
|
38
40
|
_,
|
|
@@ -64,7 +66,7 @@ function InternalInputList<
|
|
|
64
66
|
<Input
|
|
65
67
|
id={`${name}[${index}]`}
|
|
66
68
|
aria-label={`${name}${index}`}
|
|
67
|
-
size=
|
|
69
|
+
size={size}
|
|
68
70
|
value={val}
|
|
69
71
|
onChange={(evt) => {
|
|
70
72
|
const tempValues = [...value];
|
|
@@ -81,19 +81,19 @@ const InputBorder = styled.div<{
|
|
|
81
81
|
height: ${spacing.r32};
|
|
82
82
|
border: ${spacing.r1} solid
|
|
83
83
|
${(props) =>
|
|
84
|
-
|
|
84
|
+
props.hasError ? props.theme.statusCritical : props.theme.border};
|
|
85
85
|
border-radius: ${spacing.r4};
|
|
86
86
|
&:hover {
|
|
87
87
|
${(props) =>
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
!props.disabled &&
|
|
89
|
+
`border: ${spacing.r1} solid ${props.theme.infoPrimary};`}
|
|
90
90
|
}
|
|
91
91
|
&:focus-within {
|
|
92
92
|
border: ${spacing.r1} solid ${(props) => props.theme.infoPrimary};
|
|
93
93
|
}
|
|
94
94
|
`;
|
|
95
95
|
|
|
96
|
-
const SelfCenterredIcon = styled(Icon)<{ color: keyof CoreUITheme }>`
|
|
96
|
+
const SelfCenterredIcon = styled(Icon) <{ color: keyof CoreUITheme }>`
|
|
97
97
|
align-self: center;
|
|
98
98
|
color: ${(props) => props.theme[props.color]};
|
|
99
99
|
`;
|
|
@@ -108,6 +108,7 @@ export type InputProps = {
|
|
|
108
108
|
rightIcon?: IconName;
|
|
109
109
|
rightIconColor?: keyof CoreUITheme;
|
|
110
110
|
size?: InputSize;
|
|
111
|
+
noPlaceholderPrefix?: boolean;
|
|
111
112
|
} & Omit<InputHTMLAttributes<HTMLInputElement>, 'size'>;
|
|
112
113
|
|
|
113
114
|
export const Input = forwardRef<HTMLInputElement, InputProps>(
|
|
@@ -122,6 +123,7 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
|
|
|
122
123
|
rightIconColor = 'textSecondary',
|
|
123
124
|
placeholder,
|
|
124
125
|
size,
|
|
126
|
+
noPlaceholderPrefix,
|
|
125
127
|
...inputProps
|
|
126
128
|
},
|
|
127
129
|
ref,
|
|
@@ -131,7 +133,11 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
|
|
|
131
133
|
disabled: disabledFromFieldContext,
|
|
132
134
|
error: errorFromFieldContext,
|
|
133
135
|
} = useFieldContext();
|
|
134
|
-
placeholder = placeholder
|
|
136
|
+
placeholder = placeholder
|
|
137
|
+
? noPlaceholderPrefix
|
|
138
|
+
? placeholder
|
|
139
|
+
: `Example: ${placeholder}`
|
|
140
|
+
: undefined;
|
|
135
141
|
|
|
136
142
|
return (
|
|
137
143
|
<InputBorder
|
|
@@ -15,7 +15,7 @@ describe('SearchInput', () => {
|
|
|
15
15
|
clearButton: () => screen.queryByRole('button'),
|
|
16
16
|
};
|
|
17
17
|
it('should render the SearchInput component', async () => {
|
|
18
|
-
render(<SearchInputRender value="" onChange={() => {}} />);
|
|
18
|
+
render(<SearchInputRender value="" onChange={() => { }} />);
|
|
19
19
|
await waitFor(() => screen.queryAllByRole('img', { hidden: true }));
|
|
20
20
|
|
|
21
21
|
const searchInput = selectors.searchInput();
|
|
@@ -24,15 +24,15 @@ describe('SearchInput', () => {
|
|
|
24
24
|
|
|
25
25
|
it('should render the SearchInput component with placeholder', () => {
|
|
26
26
|
render(
|
|
27
|
-
<SearchInputRender value="" onChange={() => {}} placeholder="Search" />,
|
|
27
|
+
<SearchInputRender value="" onChange={() => { }} placeholder="Search" />,
|
|
28
28
|
);
|
|
29
29
|
|
|
30
|
-
const searchInput = screen.queryByPlaceholderText('
|
|
30
|
+
const searchInput = screen.queryByPlaceholderText('Search');
|
|
31
31
|
expect(searchInput).toBeInTheDocument();
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
it('should render the SearchInput component with disabled prop', () => {
|
|
35
|
-
render(<SearchInputRender value="" onChange={() => {}} disabled />);
|
|
35
|
+
render(<SearchInputRender value="" onChange={() => { }} disabled />);
|
|
36
36
|
|
|
37
37
|
const searchInput = selectors.searchInput();
|
|
38
38
|
expect(searchInput).toBeInTheDocument();
|
|
@@ -55,7 +55,7 @@ describe('SearchInput', () => {
|
|
|
55
55
|
});
|
|
56
56
|
|
|
57
57
|
it('should have a clear button when the input is not empty', () => {
|
|
58
|
-
render(<SearchInputRender value="" onChange={() => {}} />);
|
|
58
|
+
render(<SearchInputRender value="" onChange={() => { }} />);
|
|
59
59
|
|
|
60
60
|
// clear button should not be rendered as value is empty
|
|
61
61
|
let clearButton = selectors.clearButton();
|
|
@@ -72,7 +72,7 @@ describe('SearchInput', () => {
|
|
|
72
72
|
it('should call the onReset function when the clear button is clicked and clear the input value', async () => {
|
|
73
73
|
const onReset = jest.fn();
|
|
74
74
|
render(
|
|
75
|
-
<SearchInputRender value="test" onChange={() => {}} onReset={onReset} />,
|
|
75
|
+
<SearchInputRender value="test" onChange={() => { }} onReset={onReset} />,
|
|
76
76
|
);
|
|
77
77
|
const searchInput = selectors.searchInput();
|
|
78
78
|
const clearButton = selectors.clearButton();
|
|
@@ -16,6 +16,13 @@ type Props = {
|
|
|
16
16
|
children: React.ReactNode | string;
|
|
17
17
|
status?: Status;
|
|
18
18
|
id?: string;
|
|
19
|
+
} & TextProps;
|
|
20
|
+
type TextProps = {
|
|
21
|
+
color?: keyof CoreUITheme;
|
|
22
|
+
variant?: TextVariant;
|
|
23
|
+
isEmphazed?: boolean;
|
|
24
|
+
isGentleEmphazed?: boolean;
|
|
25
|
+
compact?: boolean;
|
|
19
26
|
};
|
|
20
27
|
const BasicTextStyle = styled.span`
|
|
21
28
|
color: ${(props) => props.theme.textPrimary};
|
|
@@ -33,7 +40,7 @@ const LargerTextStyle = styled(BasicTextStyle)`
|
|
|
33
40
|
const EmphaseTextStyle = styled(BasicTextStyle)`
|
|
34
41
|
font-weight: 700;
|
|
35
42
|
`;
|
|
36
|
-
const StatusTextStyle = styled(BasicTextStyle)<{ statusColor: string }>`
|
|
43
|
+
const StatusTextStyle = styled(BasicTextStyle) <{ statusColor: string }>`
|
|
37
44
|
color: ${(props) => props.theme[`${props.statusColor}`]};
|
|
38
45
|
`;
|
|
39
46
|
const LargetStyle = styled(BasicTextStyle)`
|
|
@@ -70,7 +77,7 @@ const getStatusColor = (status?: Status) => {
|
|
|
70
77
|
return statusColor;
|
|
71
78
|
};
|
|
72
79
|
|
|
73
|
-
export const SmallerEmphaseTextStyle = styled(SmallerTextStyle)<{
|
|
80
|
+
export const SmallerEmphaseTextStyle = styled(SmallerTextStyle) <{
|
|
74
81
|
statusColor: string;
|
|
75
82
|
}>`
|
|
76
83
|
font-weight: 700;
|
|
@@ -122,7 +129,7 @@ export function SmallerEmphaseText({ children, status, ...rest }: Props) {
|
|
|
122
129
|
export function ChartTitleText({ children, ...rest }: Props) {
|
|
123
130
|
return <ChartTitleTextStyle {...rest}>{children}</ChartTitleTextStyle>;
|
|
124
131
|
}
|
|
125
|
-
export const GentleEmphaseSecondaryText = styled(SecondaryText)<{
|
|
132
|
+
export const GentleEmphaseSecondaryText = styled(SecondaryText) <{
|
|
126
133
|
alignRight?: boolean;
|
|
127
134
|
}>`
|
|
128
135
|
font-style: italic;
|
|
@@ -135,12 +142,7 @@ export const GentleEmphaseSecondaryText = styled(SecondaryText)<{
|
|
|
135
142
|
: ''}
|
|
136
143
|
`;
|
|
137
144
|
|
|
138
|
-
export const Text = styled.span<
|
|
139
|
-
variant?: TextVariant;
|
|
140
|
-
color?: keyof CoreUITheme;
|
|
141
|
-
isEmphazed?: boolean;
|
|
142
|
-
isGentleEmphazed?: boolean;
|
|
143
|
-
}>`
|
|
145
|
+
export const Text = styled.span<TextProps>`
|
|
144
146
|
${(props) => props.color && `color: ${props.theme[props.color]};`}
|
|
145
147
|
${(props) =>
|
|
146
148
|
props.variant === 'Larger'
|
|
@@ -187,8 +189,14 @@ export const Text = styled.span<{
|
|
|
187
189
|
|
|
188
190
|
${(props) =>
|
|
189
191
|
props.variant === 'ChartTitle' && `letter-spacing: ${spacing.r2};`}
|
|
190
|
-
`;
|
|
191
192
|
|
|
193
|
+
${(props) => props.compact && `line-height: 1.2;`}
|
|
194
|
+
`;
|
|
195
|
+
export const HelperText = ({ children, color, ...rest }: Props) => {
|
|
196
|
+
return (
|
|
197
|
+
<Text variant="Smaller" isEmphazed compact color={color} {...rest}>{children}</Text>
|
|
198
|
+
);
|
|
199
|
+
}
|
|
192
200
|
export const Link = styled.a`
|
|
193
201
|
font-size: 1rem;
|
|
194
202
|
line-height: ${spacing.r24};
|
package/src/lib/index.ts
CHANGED
|
@@ -11,8 +11,8 @@ export {
|
|
|
11
11
|
STATUS_INFO,
|
|
12
12
|
STATUS_UNKNOWN,
|
|
13
13
|
STATUS_NONE,
|
|
14
|
-
Status,
|
|
15
14
|
} from './components/constants';
|
|
15
|
+
export type { Status } from './components/constants';
|
|
16
16
|
export { Layout } from './components/layout/Layout.component';
|
|
17
17
|
export { Loader } from './components/loader/Loader.component';
|
|
18
18
|
export { Modal } from './components/modal/Modal.component';
|
|
@@ -78,5 +78,5 @@ export { InfoMessage } from './components/infomessage/InfoMessage.component';
|
|
|
78
78
|
export { InputList } from './components/inputlist/InputList.component';
|
|
79
79
|
export { InlineInput } from './components/inlineinput/InlineInput';
|
|
80
80
|
export { UnsuccessfulResult } from './components/UnsuccessfulResult.component';
|
|
81
|
-
export { CoreUITheme } from './style/theme';
|
|
81
|
+
export type { CoreUITheme } from './style/theme';
|
|
82
82
|
export { formatISONumber } from './utils';
|
package/src/lib/next.ts
CHANGED
|
@@ -21,8 +21,6 @@ export { Accordion } from './components/accordion/Accordion.component';
|
|
|
21
21
|
// Export all chart components from the consolidated charts folder
|
|
22
22
|
export {
|
|
23
23
|
Barchart,
|
|
24
|
-
BarchartSortFn,
|
|
25
|
-
BarchartTooltipFn,
|
|
26
24
|
BarchartTooltip,
|
|
27
25
|
LineTimeSerieChart,
|
|
28
26
|
GlobalHealthBar,
|
|
@@ -40,6 +38,8 @@ export {
|
|
|
40
38
|
export type {
|
|
41
39
|
BarchartProps,
|
|
42
40
|
BarchartBars,
|
|
41
|
+
BarchartSortFn,
|
|
42
|
+
BarchartTooltipFn,
|
|
43
43
|
LineChartProps,
|
|
44
44
|
Serie,
|
|
45
45
|
GlobalHealthProps,
|
|
@@ -49,4 +49,4 @@ export type {
|
|
|
49
49
|
CategoryType,
|
|
50
50
|
} from './components/charts';
|
|
51
51
|
|
|
52
|
-
export { CoreUITheme } from './style/theme';
|
|
52
|
+
export type { CoreUITheme } from './style/theme';
|
package/src/lib/utils.ts
CHANGED
|
@@ -25,6 +25,10 @@ export const getThemeVariantSelector = () => (props) => {
|
|
|
25
25
|
return theme[key];
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
+
/** Returns the theme color key for a given variant (e.g. for use with Icon color prop). */
|
|
29
|
+
export const getVariantThemeKey = (variant: string): string =>
|
|
30
|
+
variantMapping[variant] ?? variant;
|
|
31
|
+
|
|
28
32
|
export const hex2RGB = (str: string): [number, number, number] => {
|
|
29
33
|
const [, short, long] = String(str).match(RGB_HEX) || [];
|
|
30
34
|
|
|
@@ -9,22 +9,24 @@ export default {
|
|
|
9
9
|
component: Banner,
|
|
10
10
|
decorators: [(story) => <Wrapper>{story()}</Wrapper>],
|
|
11
11
|
args: {
|
|
12
|
-
|
|
12
|
+
withDefaultIcon: true,
|
|
13
13
|
},
|
|
14
14
|
argTypes: {
|
|
15
|
+
withDefaultIcon: { control: 'boolean' },
|
|
15
16
|
icon: iconArgType,
|
|
16
17
|
},
|
|
17
18
|
};
|
|
18
19
|
|
|
19
20
|
export const Playground = {
|
|
20
|
-
render: ({ icon, variant, children, ...args }) => {
|
|
21
|
+
render: ({ withDefaultIcon, icon, variant, children, ...args }) => {
|
|
21
22
|
return (
|
|
22
23
|
<Banner
|
|
23
|
-
|
|
24
|
+
withDefaultIcon={withDefaultIcon}
|
|
25
|
+
icon={icon ? <Icon name={icon} /> : undefined}
|
|
24
26
|
variant={variant}
|
|
25
27
|
children={children}
|
|
26
28
|
{...args}
|
|
27
|
-
|
|
29
|
+
/>
|
|
28
30
|
);
|
|
29
31
|
},
|
|
30
32
|
args: {
|
|
@@ -35,23 +37,38 @@ export const Playground = {
|
|
|
35
37
|
variant: { control: { disable: false } },
|
|
36
38
|
title: { control: { disable: false } },
|
|
37
39
|
children: { control: { disable: false } },
|
|
40
|
+
withDefaultIcon: { control: { disable: false } },
|
|
38
41
|
icon: { control: { disable: false } },
|
|
39
42
|
},
|
|
40
43
|
};
|
|
41
44
|
|
|
45
|
+
/** No icon. */
|
|
42
46
|
export const Default = {
|
|
43
47
|
...Playground,
|
|
44
48
|
args: {
|
|
45
49
|
children: 'There is an alert',
|
|
46
50
|
variant: 'base',
|
|
51
|
+
withDefaultIcon: false,
|
|
47
52
|
icon: undefined,
|
|
48
53
|
},
|
|
49
54
|
};
|
|
50
55
|
|
|
56
|
+
/** Simple default: withDefaultIcon + variant. Info-circle for base, Exclamation-circle otherwise. */
|
|
57
|
+
export const WithIcon = {
|
|
58
|
+
args: {
|
|
59
|
+
withDefaultIcon: true,
|
|
60
|
+
variant: 'base',
|
|
61
|
+
title: 'Info',
|
|
62
|
+
children: 'Use withDefaultIcon for the default icon (Info-circle on base, Exclamation-circle on warning/danger/etc.).',
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
51
66
|
export const SuccessBanner = {
|
|
52
67
|
...Playground,
|
|
53
68
|
args: {
|
|
54
|
-
variant: '
|
|
69
|
+
variant: 'healthy',
|
|
70
|
+
withDefaultIcon: false,
|
|
71
|
+
icon: 'Check-circle',
|
|
55
72
|
title: 'Success',
|
|
56
73
|
children: 'There is a success',
|
|
57
74
|
},
|
|
@@ -60,16 +77,31 @@ export const SuccessBanner = {
|
|
|
60
77
|
export const WarningBanner = {
|
|
61
78
|
...Playground,
|
|
62
79
|
args: {
|
|
80
|
+
withDefaultIcon: true,
|
|
63
81
|
variant: 'warning',
|
|
64
82
|
title: 'Warning',
|
|
65
83
|
children: 'There is a warning',
|
|
66
84
|
},
|
|
67
85
|
};
|
|
86
|
+
|
|
68
87
|
export const ErrorBanner = {
|
|
69
88
|
...Playground,
|
|
70
89
|
args: {
|
|
90
|
+
withDefaultIcon: true,
|
|
71
91
|
variant: 'danger',
|
|
72
92
|
title: 'Error',
|
|
73
93
|
children: 'There is an error',
|
|
74
94
|
},
|
|
75
95
|
};
|
|
96
|
+
|
|
97
|
+
/** Custom icon when default (Exclamation-circle / Info-circle) is not desired. */
|
|
98
|
+
export const WithCustomIcon = {
|
|
99
|
+
...Playground,
|
|
100
|
+
args: {
|
|
101
|
+
variant: 'base',
|
|
102
|
+
withDefaultIcon: false,
|
|
103
|
+
icon: 'Exclamation-circle',
|
|
104
|
+
title: 'Custom',
|
|
105
|
+
children: 'Use the icon prop when you need a specific icon other than the withDefaultIcon default.',
|
|
106
|
+
},
|
|
107
|
+
};
|