@xqmsg/ui-core 0.18.8 → 0.19.1
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/icons/neutral/index.d.ts +1 -0
- package/dist/components/toast/Toast.stories.d.ts +5 -0
- package/dist/components/toast/index.d.ts +12 -0
- package/dist/hooks/useToast.d.ts +6 -0
- package/dist/index.d.ts +1 -0
- package/dist/theme/provider/index.d.ts +1 -1
- package/dist/ui-core.cjs.development.js +122 -19
- package/dist/ui-core.cjs.development.js.map +1 -1
- package/dist/ui-core.cjs.production.min.js +1 -1
- package/dist/ui-core.cjs.production.min.js.map +1 -1
- package/dist/ui-core.esm.js +122 -20
- package/dist/ui-core.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/breadcrumbs/index.tsx +1 -0
- package/src/components/form/section/index.tsx +1 -0
- package/src/components/icons/neutral/index.tsx +3 -2
- package/src/components/icons/neutral/neutral.svg +1 -1
- package/src/components/input/StackedMultiSelect/index.tsx +8 -2
- package/src/components/input/StackedPilledInput/index.tsx +1 -0
- package/src/components/input/components/dropdown/index.tsx +3 -3
- package/src/components/navigation/index.tsx +4 -3
- package/src/components/table/empty/index.tsx +1 -1
- package/src/components/table/index.tsx +6 -6
- package/src/components/tabs/index.tsx +2 -2
- package/src/components/toast/Toast.stories.tsx +52 -0
- package/src/components/toast/index.tsx +78 -0
- package/src/components/toolbar/components/breadcrumbs/index.tsx +1 -1
- package/src/components/toolbar/components/dropdown/index.tsx +2 -2
- package/src/hooks/useToast.tsx +13 -0
- package/src/index.tsx +1 -0
- package/src/theme/provider/index.tsx +1 -1
package/dist/ui-core.esm.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React__default, { memo, forwardRef, createElement, useMemo, useCallback, useRef, useEffect, useState } from 'react';
|
|
2
|
-
import { Button as Button$2, Alert as Alert$1, AlertDescription, Flex, Box, Text as Text$2, Spinner, Checkbox, InputGroup, Input as Input$2, RadioGroup, Radio, InputRightElement, Textarea as Textarea$1, useOutsideClick, Switch as Switch$1, FormLabel as FormLabel$1, Tooltip, FormControl, FormErrorMessage, FormHelperText, SimpleGrid, useMediaQuery, Grid, GridItem, IconButton, Collapse, Link as Link$2, Table as Table$2, Tbody, Tr, Td, TableContainer, Thead, Th, Tabs as Tabs$1, TabList, Tab, extendTheme } from '@chakra-ui/react';
|
|
2
|
+
import { Button as Button$2, Alert as Alert$1, AlertDescription, Flex, Box, Text as Text$2, Spinner, Checkbox, InputGroup, Input as Input$2, RadioGroup, Radio, InputRightElement, Textarea as Textarea$1, useOutsideClick, Switch as Switch$1, FormLabel as FormLabel$1, Tooltip, FormControl, FormErrorMessage, FormHelperText, SimpleGrid, useMediaQuery, Grid, GridItem, IconButton, Collapse, Link as Link$2, Table as Table$2, Tbody, Tr, Td, TableContainer, Thead, Th, Tabs as Tabs$1, TabList, Tab, extendTheme, ChakraProvider, useToast as useToast$1 } from '@chakra-ui/react';
|
|
3
3
|
import { FormProvider, useWatch, Controller } from 'react-hook-form';
|
|
4
4
|
import { debounce, truncate } from 'lodash-es';
|
|
5
5
|
import { QuestionOutlineIcon, CloseIcon, HamburgerIcon } from '@chakra-ui/icons';
|
|
6
6
|
import { Link as Link$3 } from 'react-router-dom';
|
|
7
7
|
import { HiOutlineRefresh } from 'react-icons/hi';
|
|
8
|
-
import { ChakraProvider } from '@chakra-ui/provider';
|
|
9
8
|
import { createBreakpoints, transparentize, mode, getColor } from '@chakra-ui/theme-tools';
|
|
10
9
|
import { defineStyle } from '@chakra-ui/system';
|
|
11
10
|
|
|
@@ -84,7 +83,7 @@ var SvgNeutral = function SvgNeutral(props, ref) {
|
|
|
84
83
|
ref: ref
|
|
85
84
|
}, props), _path$1 || (_path$1 = /*#__PURE__*/createElement("path", {
|
|
86
85
|
d: "M7 4.5V4a.5.5 0 0 0-.5.5H7Zm.005 0h.5a.5.5 0 0 0-.5-.5v.5Zm0 .005v.5a.5.5 0 0 0 .5-.5h-.5Zm-.005 0h-.5a.5.5 0 0 0 .5.5v-.5Zm-.724 1.548a.5.5 0 1 0 .448.894l-.448-.894Zm.252.433-.224-.447.224.447Zm.708.569.485.12-.485-.12Zm-.472 1.89-.485-.12.485.12Zm.708.569.224.447-.224-.447Zm.252.433a.5.5 0 1 0-.448-.894l.448.894ZM12.5 7A5.5 5.5 0 0 1 7 12.5v1A6.5 6.5 0 0 0 13.5 7h-1ZM7 12.5A5.5 5.5 0 0 1 1.5 7h-1A6.5 6.5 0 0 0 7 13.5v-1ZM1.5 7A5.5 5.5 0 0 1 7 1.5v-1A6.5 6.5 0 0 0 .5 7h1ZM7 1.5A5.5 5.5 0 0 1 12.5 7h1A6.5 6.5 0 0 0 7 .5v1ZM7 5h.005V4H7v1Zm-.495-.5v.005h1V4.5h-1Zm.5-.495H7v1h.005v-1Zm.495.5V4.5h-1v.005h1Zm-.776 2.442.027-.014-.447-.894-.028.014.448.894Zm.027-.014L6.28 8.824l.97.243.472-1.891-.97-.243Zm.945 3.028.028-.014-.448-.894-.027.014.447.894ZM6.279 8.824a1 1 0 0 0 1.417 1.137l-.447-.894-.97-.243Zm.472-1.89.97.242a1 1 0 0 0-1.417-1.137l.447.894Z",
|
|
87
|
-
fill: "
|
|
86
|
+
fill: "current",
|
|
88
87
|
fillOpacity: 0.6
|
|
89
88
|
})));
|
|
90
89
|
};
|
|
@@ -96,9 +95,11 @@ var Memo$1 = /*#__PURE__*/memo(ForwardRef$1);
|
|
|
96
95
|
*/
|
|
97
96
|
|
|
98
97
|
var Neutral = function Neutral(_ref) {
|
|
99
|
-
var
|
|
98
|
+
var color = _ref.color,
|
|
99
|
+
boxSize = _ref.boxSize;
|
|
100
100
|
return /*#__PURE__*/React__default.createElement(Memo$1, {
|
|
101
|
-
boxSize: boxSize
|
|
101
|
+
boxSize: boxSize,
|
|
102
|
+
fill: color || '#3C3C43'
|
|
102
103
|
});
|
|
103
104
|
};
|
|
104
105
|
|
|
@@ -433,6 +434,7 @@ var Breadcrumbs = function Breadcrumbs(_ref) {
|
|
|
433
434
|
flexDir: orientation === 'horizontal' ? 'row' : 'column'
|
|
434
435
|
}, steps.map(function (step, idx) {
|
|
435
436
|
return /*#__PURE__*/React__default.createElement(Flex, {
|
|
437
|
+
key: idx,
|
|
436
438
|
alignItems: "center",
|
|
437
439
|
pr: orientation === 'horizontal' ? '16px' : 0,
|
|
438
440
|
py: "4px"
|
|
@@ -734,10 +736,13 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
734
736
|
optionIndex = _ref.optionIndex;
|
|
735
737
|
var DropdownContent = useMemo(function () {
|
|
736
738
|
return options.map(function (option, idx) {
|
|
737
|
-
return /*#__PURE__*/React__default.createElement(
|
|
739
|
+
return /*#__PURE__*/React__default.createElement(Box, {
|
|
740
|
+
key: idx,
|
|
741
|
+
width: "100%"
|
|
742
|
+
}, option.value === 'section_header' && options[idx + 1] && options[idx + 1].value !== 'section_header' && /*#__PURE__*/React__default.createElement(Box, {
|
|
738
743
|
color: colors.label.secondary.light,
|
|
739
744
|
fontSize: "13px",
|
|
740
|
-
width: "
|
|
745
|
+
width: "100%",
|
|
741
746
|
fontWeight: "bold",
|
|
742
747
|
px: "8px",
|
|
743
748
|
bg: "inherit",
|
|
@@ -1421,8 +1426,9 @@ var StackedMultiSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2,
|
|
|
1421
1426
|
}
|
|
1422
1427
|
},
|
|
1423
1428
|
ref: scrollRef
|
|
1424
|
-
}, localValues.length ? localValues.map(function (option) {
|
|
1429
|
+
}, localValues.length ? localValues.map(function (option, idx) {
|
|
1425
1430
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
1431
|
+
key: idx,
|
|
1426
1432
|
mr: "4px",
|
|
1427
1433
|
width: "fit-content",
|
|
1428
1434
|
h: "16px",
|
|
@@ -1680,6 +1686,7 @@ var StackedPilledInput = /*#__PURE__*/React__default.forwardRef(function (_ref2,
|
|
|
1680
1686
|
ref: scrollRef
|
|
1681
1687
|
}, lastestFormValueToArray.length ? lastestFormValueToArray.map(function (label, index) {
|
|
1682
1688
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
1689
|
+
key: index,
|
|
1683
1690
|
mr: "4px",
|
|
1684
1691
|
border: tokenIndex === index ? "1px solid " + colors.border.focus : 'none',
|
|
1685
1692
|
borderRadius: "full",
|
|
@@ -2010,6 +2017,7 @@ function FormSection(_ref) {
|
|
|
2010
2017
|
disabled = _ref2.disabled,
|
|
2011
2018
|
defaultValue = _ref2.defaultValue;
|
|
2012
2019
|
return /*#__PURE__*/React__default.createElement(Input, {
|
|
2020
|
+
key: name,
|
|
2013
2021
|
control: form.control,
|
|
2014
2022
|
label: label,
|
|
2015
2023
|
inputType: inputType,
|
|
@@ -2930,15 +2938,17 @@ var NavigationMenu = function NavigationMenu(_ref) {
|
|
|
2930
2938
|
height: "100%",
|
|
2931
2939
|
overflowY: "auto",
|
|
2932
2940
|
width: "220px"
|
|
2933
|
-
}, sortedGroupedMenuItems == null ? void 0 : sortedGroupedMenuItems.map(function (menuItemGroup) {
|
|
2941
|
+
}, sortedGroupedMenuItems == null ? void 0 : sortedGroupedMenuItems.map(function (menuItemGroup, idx) {
|
|
2934
2942
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
2943
|
+
key: idx,
|
|
2935
2944
|
_notLast: {
|
|
2936
2945
|
paddingBottom: '8px'
|
|
2937
2946
|
}
|
|
2938
2947
|
}, menuItemGroup.groupHeader && /*#__PURE__*/React__default.createElement(NavigationMenuHeader, {
|
|
2939
2948
|
label: menuItemGroup.groupHeader
|
|
2940
|
-
}), menuItemGroup.groupMenuItems.map(function (item) {
|
|
2949
|
+
}), menuItemGroup.groupMenuItems.map(function (item, idx) {
|
|
2941
2950
|
return /*#__PURE__*/React__default.createElement(NavigationMenuItem, Object.assign({}, item, {
|
|
2951
|
+
key: idx,
|
|
2942
2952
|
isSelected: selectedMenuItem === item.label,
|
|
2943
2953
|
onClick: function onClick() {
|
|
2944
2954
|
return setSelectedMenuItem(item.label);
|
|
@@ -3086,7 +3096,9 @@ var EmptyTable = function EmptyTable() {
|
|
|
3086
3096
|
}, function (_, i) {
|
|
3087
3097
|
return i + 1;
|
|
3088
3098
|
}).map(function (i) {
|
|
3089
|
-
return /*#__PURE__*/React__default.createElement(Tr,
|
|
3099
|
+
return /*#__PURE__*/React__default.createElement(Tr, {
|
|
3100
|
+
key: i
|
|
3101
|
+
}, /*#__PURE__*/React__default.createElement(Td, {
|
|
3090
3102
|
height: "26px",
|
|
3091
3103
|
opacity: getOpacity(i)
|
|
3092
3104
|
}));
|
|
@@ -3120,18 +3132,24 @@ function Table(_ref) {
|
|
|
3120
3132
|
_odd: {
|
|
3121
3133
|
bg: colors.label.primary.dark
|
|
3122
3134
|
}
|
|
3123
|
-
}, columnsAsConst.map(function (column) {
|
|
3135
|
+
}, columnsAsConst.map(function (column, idx) {
|
|
3124
3136
|
return (
|
|
3125
3137
|
/*#__PURE__*/
|
|
3126
3138
|
// @ts-ignore
|
|
3127
|
-
React__default.createElement(Th,
|
|
3139
|
+
React__default.createElement(Th, {
|
|
3140
|
+
key: idx
|
|
3141
|
+
}, headers[column])
|
|
3128
3142
|
);
|
|
3129
|
-
}))), /*#__PURE__*/React__default.createElement(Tbody, null, body.map(function (row) {
|
|
3130
|
-
return /*#__PURE__*/React__default.createElement(Tr,
|
|
3143
|
+
}))), /*#__PURE__*/React__default.createElement(Tbody, null, body.map(function (row, idx) {
|
|
3144
|
+
return /*#__PURE__*/React__default.createElement(Tr, {
|
|
3145
|
+
key: idx
|
|
3146
|
+
}, columnsAsConst.map(function (column, idx) {
|
|
3131
3147
|
return (
|
|
3132
3148
|
/*#__PURE__*/
|
|
3133
3149
|
// @ts-ignore
|
|
3134
|
-
React__default.createElement(Td,
|
|
3150
|
+
React__default.createElement(Td, {
|
|
3151
|
+
key: idx
|
|
3152
|
+
}, row[column])
|
|
3135
3153
|
);
|
|
3136
3154
|
}));
|
|
3137
3155
|
}))) : /*#__PURE__*/React__default.createElement(EmptyTable, null), loadMore && loading !== undefined && body.length ? /*#__PURE__*/React__default.createElement(TableLoadingRows, {
|
|
@@ -3166,8 +3184,10 @@ var TabsWrapper = function TabsWrapper(_ref) {
|
|
|
3166
3184
|
borderBottom: 0,
|
|
3167
3185
|
borderBottomLeftRadius: 0,
|
|
3168
3186
|
borderBottomRightRadius: 0
|
|
3169
|
-
}, navItems.map(function (navItem) {
|
|
3170
|
-
return /*#__PURE__*/React__default.createElement(Tab,
|
|
3187
|
+
}, navItems.map(function (navItem, idx) {
|
|
3188
|
+
return /*#__PURE__*/React__default.createElement(Tab, {
|
|
3189
|
+
key: idx
|
|
3190
|
+
}, navItem);
|
|
3171
3191
|
})), children);
|
|
3172
3192
|
};
|
|
3173
3193
|
|
|
@@ -4272,7 +4292,8 @@ var ToolbarBreadcrumbs = function ToolbarBreadcrumbs(_ref) {
|
|
|
4272
4292
|
height: "26px"
|
|
4273
4293
|
}, filteredPageList.map(function (page, i) {
|
|
4274
4294
|
return /*#__PURE__*/React__default.createElement(Flex, {
|
|
4275
|
-
alignItems: "center"
|
|
4295
|
+
alignItems: "center",
|
|
4296
|
+
key: i
|
|
4276
4297
|
}, /*#__PURE__*/React__default.createElement(ToolbarBreadcrumbItem, {
|
|
4277
4298
|
page: getPageType(i),
|
|
4278
4299
|
pageLabel: page.label,
|
|
@@ -4310,6 +4331,87 @@ var Toolbar = function Toolbar(_ref) {
|
|
|
4310
4331
|
}, children, " ")));
|
|
4311
4332
|
};
|
|
4312
4333
|
|
|
4334
|
+
/**
|
|
4335
|
+
* A functional React component utilized to render the `Toast` component
|
|
4336
|
+
*/
|
|
4337
|
+
|
|
4338
|
+
var Toast = function Toast(_ref) {
|
|
4339
|
+
var variant = _ref.variant,
|
|
4340
|
+
message = _ref.message,
|
|
4341
|
+
buttonText = _ref.buttonText,
|
|
4342
|
+
onClick = _ref.onClick;
|
|
4343
|
+
var Icon = useMemo(function () {
|
|
4344
|
+
switch (variant) {
|
|
4345
|
+
case 'error':
|
|
4346
|
+
return /*#__PURE__*/React__default.createElement(Error$1, {
|
|
4347
|
+
boxSize: "16px"
|
|
4348
|
+
});
|
|
4349
|
+
|
|
4350
|
+
case 'neutral':
|
|
4351
|
+
return /*#__PURE__*/React__default.createElement(Neutral, {
|
|
4352
|
+
boxSize: "16px",
|
|
4353
|
+
color: "white"
|
|
4354
|
+
});
|
|
4355
|
+
|
|
4356
|
+
case 'positive':
|
|
4357
|
+
return /*#__PURE__*/React__default.createElement(Positive, {
|
|
4358
|
+
boxSize: "16px"
|
|
4359
|
+
});
|
|
4360
|
+
|
|
4361
|
+
case 'warning':
|
|
4362
|
+
return /*#__PURE__*/React__default.createElement(Warning, {
|
|
4363
|
+
boxSize: "16px"
|
|
4364
|
+
});
|
|
4365
|
+
|
|
4366
|
+
default:
|
|
4367
|
+
return null;
|
|
4368
|
+
}
|
|
4369
|
+
}, [variant]);
|
|
4370
|
+
return /*#__PURE__*/React__default.createElement(Flex, {
|
|
4371
|
+
alignItems: "center",
|
|
4372
|
+
width: "fit-content",
|
|
4373
|
+
height: "32px",
|
|
4374
|
+
p: "8px",
|
|
4375
|
+
bg: "#151515D9",
|
|
4376
|
+
borderColor: "#9999991A",
|
|
4377
|
+
borderRadius: "8px"
|
|
4378
|
+
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
4379
|
+
pr: "8px"
|
|
4380
|
+
}, Icon), /*#__PURE__*/React__default.createElement(Text$2, {
|
|
4381
|
+
pr: "16px",
|
|
4382
|
+
fontSize: "13px",
|
|
4383
|
+
color: colors.label.primary.dark
|
|
4384
|
+
}, message), onClick && buttonText && /*#__PURE__*/React__default.createElement(Flex, {
|
|
4385
|
+
ml: "auto",
|
|
4386
|
+
justifyContent: "flex-end"
|
|
4387
|
+
}, /*#__PURE__*/React__default.createElement(Button$2, {
|
|
4388
|
+
color: colors.fill.action,
|
|
4389
|
+
style: {
|
|
4390
|
+
background: 'transparent',
|
|
4391
|
+
border: 'transparent',
|
|
4392
|
+
boxShadow: 'none'
|
|
4393
|
+
},
|
|
4394
|
+
_hover: {
|
|
4395
|
+
bg: 'transparent',
|
|
4396
|
+
border: 'transparent',
|
|
4397
|
+
boxShadow: 'none'
|
|
4398
|
+
},
|
|
4399
|
+
onClick: onClick
|
|
4400
|
+
}, buttonText)));
|
|
4401
|
+
};
|
|
4402
|
+
|
|
4403
|
+
var useToast = function useToast(props) {
|
|
4404
|
+
var toast = useToast$1();
|
|
4405
|
+
return function () {
|
|
4406
|
+
return toast({
|
|
4407
|
+
position: props.position,
|
|
4408
|
+
render: function render() {
|
|
4409
|
+
return /*#__PURE__*/React__default.createElement(Toast, Object.assign({}, props));
|
|
4410
|
+
}
|
|
4411
|
+
});
|
|
4412
|
+
};
|
|
4413
|
+
};
|
|
4414
|
+
|
|
4313
4415
|
function formatErrorResponse(error) {
|
|
4314
4416
|
var _error$response, _error$response$data;
|
|
4315
4417
|
|
|
@@ -4336,5 +4438,5 @@ function formatErrorResponse(error) {
|
|
|
4336
4438
|
};
|
|
4337
4439
|
}
|
|
4338
4440
|
|
|
4339
|
-
export { Banner, Breadcrumbs, Button, Checkmark, ChevronDown, ChevronRight, Clock, Close, Dropdown$1 as Dropdown, Error$1 as Error, FileFill, FileOutline, FolderAddFill, FolderAddOutline, FolderFill, FolderOutline, Form, FormSection, Google, GoogleButton, GoogleDrive, Group, Home, Image, Input, Layout, Link, LoadingIndicator, Menu, Microsoft, MicrosoftButton, MicrosoftOneDrive, NavigationMenu, Neutral, Positive, Search, Settings, SpinnerButton, Table, TableFill, TableOutline, TabsWrapper, Text, Toolbar, Trash, Warning, XQThemeProvider, colors, formatErrorResponse };
|
|
4441
|
+
export { Banner, Breadcrumbs, Button, Checkmark, ChevronDown, ChevronRight, Clock, Close, Dropdown$1 as Dropdown, Error$1 as Error, FileFill, FileOutline, FolderAddFill, FolderAddOutline, FolderFill, FolderOutline, Form, FormSection, Google, GoogleButton, GoogleDrive, Group, Home, Image, Input, Layout, Link, LoadingIndicator, Menu, Microsoft, MicrosoftButton, MicrosoftOneDrive, NavigationMenu, Neutral, Positive, Search, Settings, SpinnerButton, Table, TableFill, TableOutline, TabsWrapper, Text, Toolbar, Trash, Warning, XQThemeProvider, colors, formatErrorResponse, useToast };
|
|
4340
4442
|
//# sourceMappingURL=ui-core.esm.js.map
|