@xqmsg/ui-core 0.18.0 → 0.18.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/toolbar/index.d.ts +2 -6
- package/dist/ui-core.cjs.development.js +6 -236
- 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 +6 -236
- package/dist/ui-core.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/toolbar/Toolbar.stories.tsx +9 -2
- package/src/components/toolbar/index.tsx +5 -49
- package/dist/components/toolbar/components/actions/index.d.ts +0 -14
- package/src/components/toolbar/components/actions/index.tsx +0 -39
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { FieldOption, FieldOptions } from '../input/InputTypes';
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
3
2
|
export declare type ToolbarLabelAndHandler = {
|
|
4
3
|
label: string;
|
|
5
4
|
handler: () => void;
|
|
6
5
|
};
|
|
7
|
-
export interface ToolbarProps {
|
|
6
|
+
export interface ToolbarProps extends PropsWithChildren {
|
|
8
7
|
pageList: ToolbarLabelAndHandler[];
|
|
9
8
|
currentPage: string;
|
|
10
9
|
searchValue: string;
|
|
11
|
-
sortOptions: FieldOptions;
|
|
12
|
-
onSelectSortItem: (option: FieldOption) => void;
|
|
13
|
-
onClickAdd: () => void;
|
|
14
10
|
onChangeSearch: (value: string) => void;
|
|
15
11
|
}
|
|
16
12
|
/**
|
|
@@ -14,8 +14,6 @@ var hi = require('react-icons/hi');
|
|
|
14
14
|
var provider = require('@chakra-ui/provider');
|
|
15
15
|
var themeTools = require('@chakra-ui/theme-tools');
|
|
16
16
|
var system = require('@chakra-ui/system');
|
|
17
|
-
var icons$1 = require('src/components/icons');
|
|
18
|
-
var mediaQuery = require('@chakra-ui/media-query');
|
|
19
17
|
|
|
20
18
|
/**
|
|
21
19
|
* A functional React component utilized to render the `Button` component
|
|
@@ -4212,221 +4210,14 @@ var ToolbarBreadcrumbs = function ToolbarBreadcrumbs(_ref) {
|
|
|
4212
4210
|
}));
|
|
4213
4211
|
};
|
|
4214
4212
|
|
|
4215
|
-
/**
|
|
4216
|
-
* A functional React component utilized to render the `Add` component
|
|
4217
|
-
*/
|
|
4218
|
-
|
|
4219
|
-
var Add = function Add(_ref) {
|
|
4220
|
-
var onClick = _ref.onClick;
|
|
4221
|
-
return /*#__PURE__*/React__default.createElement(react.Box, {
|
|
4222
|
-
mx: "8px",
|
|
4223
|
-
cursor: "pointer",
|
|
4224
|
-
onClick: onClick
|
|
4225
|
-
}, /*#__PURE__*/React__default.createElement(icons$1.FolderAddOutline, {
|
|
4226
|
-
boxSize: "16px"
|
|
4227
|
-
}));
|
|
4228
|
-
};
|
|
4229
|
-
|
|
4230
|
-
/**
|
|
4231
|
-
* A functional React component utilized to render the `Dropdown` component
|
|
4232
|
-
*/
|
|
4233
|
-
|
|
4234
|
-
var Dropdown$2 = function Dropdown(_ref) {
|
|
4235
|
-
var onSelectItem = _ref.onSelectItem,
|
|
4236
|
-
options = _ref.options,
|
|
4237
|
-
dropdownRef = _ref.dropdownRef,
|
|
4238
|
-
position = _ref.position,
|
|
4239
|
-
optionIndex = _ref.optionIndex,
|
|
4240
|
-
setOptionIndex = _ref.setOptionIndex;
|
|
4241
|
-
var DropdownContent = React.useMemo(function () {
|
|
4242
|
-
return options.map(function (option, idx) {
|
|
4243
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, option.value === 'section_header' && options[idx + 1] && options[idx + 1].value !== 'section_header' && /*#__PURE__*/React__default.createElement(react.Box, {
|
|
4244
|
-
color: colors.label.secondary.light,
|
|
4245
|
-
fontSize: "13px",
|
|
4246
|
-
width: "fit-content",
|
|
4247
|
-
fontWeight: "bold",
|
|
4248
|
-
px: "8px",
|
|
4249
|
-
pl: "26px",
|
|
4250
|
-
whiteSpace: "nowrap"
|
|
4251
|
-
}, idx > 0 && /*#__PURE__*/React__default.createElement(react.Box, {
|
|
4252
|
-
width: "100%",
|
|
4253
|
-
my: "3px",
|
|
4254
|
-
borderTop: "2px solid",
|
|
4255
|
-
borderColor: colors.border["default"]
|
|
4256
|
-
}), option.label), option.value !== 'section_header' && /*#__PURE__*/React__default.createElement(react.Flex, {
|
|
4257
|
-
alignItems: "center",
|
|
4258
|
-
cursor: "pointer",
|
|
4259
|
-
onClick: function onClick() {
|
|
4260
|
-
setOptionIndex(idx);
|
|
4261
|
-
onSelectItem(option);
|
|
4262
|
-
},
|
|
4263
|
-
key: option.value,
|
|
4264
|
-
fontSize: "13px",
|
|
4265
|
-
px: "8px",
|
|
4266
|
-
py: "4px",
|
|
4267
|
-
width: "100%",
|
|
4268
|
-
color: colors.label.primary.light,
|
|
4269
|
-
whiteSpace: "nowrap",
|
|
4270
|
-
id: option.value
|
|
4271
|
-
}, /*#__PURE__*/React__default.createElement(react.Box, {
|
|
4272
|
-
mr: "8px",
|
|
4273
|
-
width: "12px"
|
|
4274
|
-
}, optionIndex === idx && /*#__PURE__*/React__default.createElement(Checkmark, {
|
|
4275
|
-
boxSize: "12px"
|
|
4276
|
-
})), option.label));
|
|
4277
|
-
});
|
|
4278
|
-
}, [onSelectItem, optionIndex, options, setOptionIndex]);
|
|
4279
|
-
return /*#__PURE__*/React__default.createElement(react.Flex, {
|
|
4280
|
-
flexDirection: "column",
|
|
4281
|
-
ref: dropdownRef,
|
|
4282
|
-
scrollMargin: "15px",
|
|
4283
|
-
backdropFilter: "auto",
|
|
4284
|
-
backdropBlur: "64px",
|
|
4285
|
-
borderRadius: "4px",
|
|
4286
|
-
bg: colors.fill.light.tertiary,
|
|
4287
|
-
mt: "3px",
|
|
4288
|
-
maxH: "240px",
|
|
4289
|
-
overflowY: "auto",
|
|
4290
|
-
px: "8px",
|
|
4291
|
-
py: "4px",
|
|
4292
|
-
position: "absolute",
|
|
4293
|
-
top: position === 'top' ? 26 : undefined,
|
|
4294
|
-
bottom: position === 'bottom' ? 30 : undefined,
|
|
4295
|
-
right: 0,
|
|
4296
|
-
width: "fit-content",
|
|
4297
|
-
minWidth: "100%",
|
|
4298
|
-
zIndex: 100,
|
|
4299
|
-
tabIndex: -2000
|
|
4300
|
-
}, DropdownContent);
|
|
4301
|
-
};
|
|
4302
|
-
|
|
4303
|
-
/**
|
|
4304
|
-
* A functional React component utilized to render the `Sort` component
|
|
4305
|
-
*/
|
|
4306
|
-
|
|
4307
|
-
var Sort = function Sort(_ref) {
|
|
4308
|
-
var onSelectItem = _ref.onSelectItem,
|
|
4309
|
-
sortOptions = _ref.sortOptions;
|
|
4310
|
-
var dropdownMenuRef = React.useRef(null);
|
|
4311
|
-
|
|
4312
|
-
var _useState = React.useState(false),
|
|
4313
|
-
showDropdown = _useState[0],
|
|
4314
|
-
setShowDropdown = _useState[1];
|
|
4315
|
-
|
|
4316
|
-
var _useState2 = React.useState(null),
|
|
4317
|
-
optionIndex = _useState2[0],
|
|
4318
|
-
setOptionIndex = _useState2[1];
|
|
4319
|
-
|
|
4320
|
-
react.useOutsideClick({
|
|
4321
|
-
ref: dropdownMenuRef,
|
|
4322
|
-
handler: function handler() {
|
|
4323
|
-
return setShowDropdown(false);
|
|
4324
|
-
}
|
|
4325
|
-
});
|
|
4326
|
-
return /*#__PURE__*/React__default.createElement(react.Box, {
|
|
4327
|
-
onClick: function onClick() {
|
|
4328
|
-
return setShowDropdown(!showDropdown);
|
|
4329
|
-
},
|
|
4330
|
-
position: "relative"
|
|
4331
|
-
}, /*#__PURE__*/React__default.createElement(react.Flex, {
|
|
4332
|
-
alignItems: "center",
|
|
4333
|
-
cursor: "pointer",
|
|
4334
|
-
onClick: function onClick() {
|
|
4335
|
-
return setShowDropdown(!showDropdown);
|
|
4336
|
-
}
|
|
4337
|
-
}, /*#__PURE__*/React__default.createElement(TableOutline, {
|
|
4338
|
-
boxSize: "16px"
|
|
4339
|
-
}), /*#__PURE__*/React__default.createElement(react.Box, {
|
|
4340
|
-
ml: "2px"
|
|
4341
|
-
}, /*#__PURE__*/React__default.createElement(ChevronDown, {
|
|
4342
|
-
boxSize: "12px"
|
|
4343
|
-
})), showDropdown && /*#__PURE__*/React__default.createElement(Dropdown$2, {
|
|
4344
|
-
onSelectItem: onSelectItem,
|
|
4345
|
-
options: sortOptions,
|
|
4346
|
-
position: "top",
|
|
4347
|
-
dropdownRef: dropdownMenuRef,
|
|
4348
|
-
optionIndex: optionIndex,
|
|
4349
|
-
setOptionIndex: setOptionIndex
|
|
4350
|
-
})));
|
|
4351
|
-
};
|
|
4352
|
-
|
|
4353
|
-
/**
|
|
4354
|
-
* A functional React component utilized to render the `Search` component
|
|
4355
|
-
*/
|
|
4356
|
-
|
|
4357
|
-
var Search$1 = function Search$1(_ref) {
|
|
4358
|
-
var searchValue = _ref.searchValue,
|
|
4359
|
-
onClick = _ref.onClick,
|
|
4360
|
-
_onChange = _ref.onChange;
|
|
4361
|
-
|
|
4362
|
-
var _useMediaQuery = react.useMediaQuery('(max-width: 600px)'),
|
|
4363
|
-
breakpoint600 = _useMediaQuery[0];
|
|
4364
|
-
|
|
4365
|
-
return /*#__PURE__*/React__default.createElement(react.Box, null, breakpoint600 ? /*#__PURE__*/React__default.createElement(react.Box, {
|
|
4366
|
-
cursor: "pointer",
|
|
4367
|
-
onClick: onClick
|
|
4368
|
-
}, /*#__PURE__*/React__default.createElement(Search, {
|
|
4369
|
-
boxSize: "16px"
|
|
4370
|
-
})) : /*#__PURE__*/React__default.createElement(StackedInput, {
|
|
4371
|
-
placeholder: "Search...",
|
|
4372
|
-
name: "search",
|
|
4373
|
-
value: searchValue,
|
|
4374
|
-
onChange: function onChange(e) {
|
|
4375
|
-
return _onChange(e.target.value);
|
|
4376
|
-
}
|
|
4377
|
-
}));
|
|
4378
|
-
};
|
|
4379
|
-
|
|
4380
|
-
/**
|
|
4381
|
-
* A functional React component utilized to render the `Actions` component
|
|
4382
|
-
*/
|
|
4383
|
-
|
|
4384
|
-
var Actions = function Actions(_ref) {
|
|
4385
|
-
var onSelectSortItem = _ref.onSelectSortItem,
|
|
4386
|
-
onClickAdd = _ref.onClickAdd,
|
|
4387
|
-
onChangeSearch = _ref.onChangeSearch,
|
|
4388
|
-
onClickSearch = _ref.onClickSearch,
|
|
4389
|
-
searchValue = _ref.searchValue,
|
|
4390
|
-
sortOptions = _ref.sortOptions;
|
|
4391
|
-
return /*#__PURE__*/React__default.createElement(react.Flex, {
|
|
4392
|
-
alignItems: "center"
|
|
4393
|
-
}, /*#__PURE__*/React__default.createElement(Sort, {
|
|
4394
|
-
onSelectItem: onSelectSortItem,
|
|
4395
|
-
sortOptions: sortOptions
|
|
4396
|
-
}), /*#__PURE__*/React__default.createElement(Add, {
|
|
4397
|
-
onClick: onClickAdd
|
|
4398
|
-
}), /*#__PURE__*/React__default.createElement(Search$1, {
|
|
4399
|
-
onChange: onChangeSearch,
|
|
4400
|
-
onClick: onClickSearch,
|
|
4401
|
-
searchValue: searchValue
|
|
4402
|
-
}));
|
|
4403
|
-
};
|
|
4404
|
-
|
|
4405
4213
|
/**
|
|
4406
4214
|
* A functional React component utilized to render the `Toolbar` component
|
|
4407
4215
|
*/
|
|
4408
4216
|
|
|
4409
4217
|
var Toolbar = function Toolbar(_ref) {
|
|
4410
|
-
var
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
sortOptions = _ref.sortOptions,
|
|
4414
|
-
onChangeSearch = _ref.onChangeSearch,
|
|
4415
|
-
onClickAdd = _ref.onClickAdd,
|
|
4416
|
-
onSelectSortItem = _ref.onSelectSortItem;
|
|
4417
|
-
|
|
4418
|
-
var _useMediaQuery = mediaQuery.useMediaQuery('(min-width: 600px)'),
|
|
4419
|
-
breakpoint800 = _useMediaQuery[0];
|
|
4420
|
-
|
|
4421
|
-
var _useState = React.useState(false),
|
|
4422
|
-
showSearch = _useState[0],
|
|
4423
|
-
setShowSearch = _useState[1];
|
|
4424
|
-
|
|
4425
|
-
React.useEffect(function () {
|
|
4426
|
-
if (breakpoint800) {
|
|
4427
|
-
setShowSearch(false);
|
|
4428
|
-
}
|
|
4429
|
-
}, [breakpoint800, showSearch]);
|
|
4218
|
+
var children = _ref.children,
|
|
4219
|
+
pageList = _ref.pageList,
|
|
4220
|
+
currentPage = _ref.currentPage;
|
|
4430
4221
|
return /*#__PURE__*/React__default.createElement(react.Flex, {
|
|
4431
4222
|
flexDirection: "column"
|
|
4432
4223
|
}, /*#__PURE__*/React__default.createElement(react.Flex, {
|
|
@@ -4438,30 +4229,9 @@ var Toolbar = function Toolbar(_ref) {
|
|
|
4438
4229
|
}, /*#__PURE__*/React__default.createElement(ToolbarBreadcrumbs, {
|
|
4439
4230
|
pageList: pageList,
|
|
4440
4231
|
currentPage: currentPage
|
|
4441
|
-
}), /*#__PURE__*/React__default.createElement(
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
onClickSearch: function onClickSearch() {
|
|
4445
|
-
return setShowSearch(!showSearch);
|
|
4446
|
-
},
|
|
4447
|
-
onSelectSortItem: onSelectSortItem,
|
|
4448
|
-
searchValue: searchValue,
|
|
4449
|
-
sortOptions: sortOptions
|
|
4450
|
-
})), showSearch && /*#__PURE__*/React__default.createElement(react.Flex, {
|
|
4451
|
-
px: "13px",
|
|
4452
|
-
height: "52px",
|
|
4453
|
-
alignItems: "center",
|
|
4454
|
-
background: "white",
|
|
4455
|
-
borderTop: "1px solid",
|
|
4456
|
-
borderColor: colors.fill.light.tertiary
|
|
4457
|
-
}, /*#__PURE__*/React__default.createElement(StackedInput, {
|
|
4458
|
-
placeholder: "Search...",
|
|
4459
|
-
name: "search",
|
|
4460
|
-
value: searchValue,
|
|
4461
|
-
onChange: function onChange(e) {
|
|
4462
|
-
return onChangeSearch(e.target.value);
|
|
4463
|
-
}
|
|
4464
|
-
})));
|
|
4232
|
+
}), /*#__PURE__*/React__default.createElement(react.Flex, {
|
|
4233
|
+
alignItems: "center"
|
|
4234
|
+
}, children, " ")));
|
|
4465
4235
|
};
|
|
4466
4236
|
|
|
4467
4237
|
function formatErrorResponse(error) {
|