@pega/cosmos-react-core 3.0.0-dev.24.0 → 3.0.0-dev.25.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/lib/components/ListToolbar/ListToolbar.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.js +42 -52
- package/lib/components/ListToolbar/ListToolbar.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.types.d.ts +13 -10
- package/lib/components/ListToolbar/ListToolbar.types.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.types.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListToolbar.d.ts","sourceRoot":"","sources":["../../../src/components/ListToolbar/ListToolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ListToolbar.d.ts","sourceRoot":"","sources":["../../../src/components/ListToolbar/ListToolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAOlB,MAAM,OAAO,CAAC;AAKf,OAAO,EAAU,YAAY,EAAE,MAAM,aAAa,CAAC;AAgBnD,OAAO,EACL,gBAAgB,EAIjB,MAAM,qBAAqB,CAAC;AA2F7B,QAAA,MAAM,WAAW,EAAE,iBAAiB,CAAC,gBAAgB,GAAG,YAAY,CA4QnE,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, useCallback,
|
|
2
|
+
import { forwardRef, useCallback, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import Actions from '../Actions';
|
|
4
4
|
import Text from '../Text';
|
|
5
5
|
import Button from '../Button';
|
|
@@ -27,7 +27,7 @@ const CountMeta = ({ count }) => {
|
|
|
27
27
|
}), count.total !== undefined && count.selected !== undefined && ' ', count.selected !== undefined &&
|
|
28
28
|
`(${t('selected_count', [count.selected], { count: count.selected })})`] }));
|
|
29
29
|
};
|
|
30
|
-
const QueryOptionButton = ({ id, queryOptionProps, iconOnly,
|
|
30
|
+
const QueryOptionButton = ({ id, queryOptionProps, iconOnly, onClick }) => {
|
|
31
31
|
const t = useI18n();
|
|
32
32
|
let i18nKey;
|
|
33
33
|
let icon;
|
|
@@ -39,39 +39,17 @@ const QueryOptionButton = ({ id, queryOptionProps, iconOnly, setCurrentQueryOpti
|
|
|
39
39
|
i18nKey = 'sort';
|
|
40
40
|
icon = 'arrow-up-down';
|
|
41
41
|
}
|
|
42
|
-
else
|
|
42
|
+
else {
|
|
43
43
|
i18nKey = 'group';
|
|
44
44
|
icon = 'row';
|
|
45
45
|
}
|
|
46
46
|
const text = t(i18nKey);
|
|
47
47
|
const variant = iconOnly ? 'simple' : 'text';
|
|
48
|
-
useEffect(() => {
|
|
49
|
-
if (!queryOptionProps || !hasProp(queryOptionProps, 'renderer')) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
setCurrentQueryOption(cur => {
|
|
53
|
-
if (!cur)
|
|
54
|
-
return null;
|
|
55
|
-
if (cur.id === id) {
|
|
56
|
-
return {
|
|
57
|
-
...cur,
|
|
58
|
-
props: queryOptionProps
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
return cur;
|
|
62
|
-
});
|
|
63
|
-
}, [queryOptionProps, setCurrentQueryOption, id]);
|
|
64
48
|
if (hasProp(queryOptionProps, 'renderer')) {
|
|
65
|
-
return (_jsx("div", { children: _jsx(Button, { variant: variant, icon: iconOnly, label: iconOnly ? text : undefined, onClick: (
|
|
66
|
-
setCurrentQueryOption({
|
|
67
|
-
id,
|
|
68
|
-
props: queryOptionProps,
|
|
69
|
-
popoverTarget: e.currentTarget
|
|
70
|
-
});
|
|
71
|
-
}, children: _jsxs(Flex, { container: { inline: true, alignItems: 'center', gap: 1 }, as: 'span', children: [_jsx(Icon, { name: icon }), !iconOnly && text, !iconOnly && queryOptionProps.count && _jsx(Count, { children: queryOptionProps.count })] }) }) }));
|
|
49
|
+
return (_jsx("div", { children: _jsx(Button, { variant: variant, icon: iconOnly, label: iconOnly ? text : undefined, onClick: onClick, children: _jsxs(Flex, { container: { inline: true, alignItems: 'center', gap: 1 }, as: 'span', children: [_jsx(Icon, { name: icon }), !iconOnly && text, !iconOnly && queryOptionProps.count && _jsx(Count, { children: queryOptionProps.count })] }) }) }));
|
|
72
50
|
}
|
|
73
51
|
if (hasProp(queryOptionProps, 'items')) {
|
|
74
|
-
return (_jsx("div", { children: _jsx(MenuButton, { variant: variant, text: text, icon: icon, iconOnly: iconOnly, count: queryOptionProps.count, menu: {
|
|
52
|
+
return (_jsx("div", { children: _jsx(MenuButton, { variant: variant, text: text, icon: icon, iconOnly: iconOnly, count: queryOptionProps.count, onClick: onClick, menu: {
|
|
75
53
|
mode: queryOptionProps.mode,
|
|
76
54
|
items: queryOptionProps.items.map(item => ({ ...item, primary: item.text })),
|
|
77
55
|
onItemClick: queryOptionProps.onItemClick
|
|
@@ -79,33 +57,48 @@ const QueryOptionButton = ({ id, queryOptionProps, iconOnly, setCurrentQueryOpti
|
|
|
79
57
|
}
|
|
80
58
|
return null;
|
|
81
59
|
};
|
|
82
|
-
const ListToolbar = forwardRef(({ heading,
|
|
60
|
+
const ListToolbar = forwardRef(({ heading, createNew, search, count, additionalActions, filter, sort, group, actions, actionsButtonRef, condensed }, ref) => {
|
|
83
61
|
const t = useI18n();
|
|
84
62
|
const isSmallOrAbove = useBreakpoint('sm');
|
|
85
63
|
const isMediumOrAbove = useBreakpoint('md');
|
|
86
64
|
const consolidatedActionsButtonRef = useConsolidatedRef(actionsButtonRef);
|
|
87
|
-
const [
|
|
65
|
+
const [currentQueryOptionId, setCurrentQueryOptionId] = useState(null);
|
|
66
|
+
const queryOptionPopoverTarget = useRef();
|
|
88
67
|
const [actionsQueryOptionPreset, setActionsQueryOptionPreset] = useState();
|
|
89
68
|
const [optionPresetMenuOpen, setOptionPresetMenuOpen] = useState(false);
|
|
90
69
|
const createNewButton = useMemo(() => {
|
|
91
|
-
if (!
|
|
70
|
+
if (!createNew?.onClick)
|
|
92
71
|
return null;
|
|
93
|
-
const text = t('create_new');
|
|
94
|
-
return (_jsx(Button, { variant: isSmallOrAbove ? 'secondary' : 'simple', icon: !isSmallOrAbove, label: isSmallOrAbove ? undefined : text, onClick:
|
|
95
|
-
}, [t,
|
|
96
|
-
const filterButton = filter && (_jsx(QueryOptionButton, { id: 'filter', queryOptionProps: filter, iconOnly: !isMediumOrAbove,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
72
|
+
const text = createNew.label ?? t('create_new');
|
|
73
|
+
return (_jsx(Button, { variant: isSmallOrAbove ? 'secondary' : 'simple', icon: !isSmallOrAbove, label: isSmallOrAbove ? undefined : text, "aria-label": text, onClick: createNew.onClick, children: isSmallOrAbove ? text : _jsx(Icon, { name: 'plus' }) }));
|
|
74
|
+
}, [t, createNew, isSmallOrAbove]);
|
|
75
|
+
const filterButton = filter && (_jsx(QueryOptionButton, { id: 'filter', queryOptionProps: filter, iconOnly: !isMediumOrAbove, onClick: e => {
|
|
76
|
+
setCurrentQueryOptionId('filter');
|
|
77
|
+
queryOptionPopoverTarget.current = e.currentTarget;
|
|
78
|
+
} }));
|
|
79
|
+
const sortButton = sort && (_jsx(QueryOptionButton, { id: 'sort', queryOptionProps: sort, iconOnly: !isMediumOrAbove, onClick: e => {
|
|
80
|
+
setCurrentQueryOptionId('sort');
|
|
81
|
+
queryOptionPopoverTarget.current = e.currentTarget;
|
|
82
|
+
} }));
|
|
83
|
+
const groupButton = group && (_jsx(QueryOptionButton, { id: 'group', queryOptionProps: group, iconOnly: !isMediumOrAbove, onClick: e => {
|
|
84
|
+
setCurrentQueryOptionId('group');
|
|
85
|
+
queryOptionPopoverTarget.current = e.currentTarget;
|
|
86
|
+
} }));
|
|
87
|
+
let queryOptionPopover = null;
|
|
88
|
+
if (currentQueryOptionId) {
|
|
89
|
+
const queryOptionProps = { filter, sort, group }[currentQueryOptionId];
|
|
90
|
+
if (queryOptionProps && hasProp(queryOptionProps, 'renderer')) {
|
|
91
|
+
queryOptionPopover = (_jsx(QueryOptionPopover, { target: queryOptionPopoverTarget.current, heading: t(`${currentQueryOptionId}_by`), onCancel: () => {
|
|
92
|
+
if (queryOptionProps.onCancel() === false)
|
|
93
|
+
return;
|
|
94
|
+
setCurrentQueryOptionId(null);
|
|
95
|
+
}, onSubmit: () => {
|
|
96
|
+
if (queryOptionProps.onSubmit() === false)
|
|
97
|
+
return;
|
|
98
|
+
setCurrentQueryOptionId(null);
|
|
99
|
+
}, children: _jsx(queryOptionProps.renderer, {}) }));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
109
102
|
const getQueryOptionAction = useCallback((id, icon, queryOptionProps) => {
|
|
110
103
|
return {
|
|
111
104
|
text: t(id),
|
|
@@ -114,11 +107,8 @@ const ListToolbar = forwardRef(({ heading, onCreateNew, search, count, additiona
|
|
|
114
107
|
count: queryOptionProps.count,
|
|
115
108
|
onClick: () => {
|
|
116
109
|
if (hasProp(queryOptionProps, 'renderer')) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
popoverTarget: consolidatedActionsButtonRef.current,
|
|
120
|
-
props: queryOptionProps
|
|
121
|
-
});
|
|
110
|
+
setCurrentQueryOptionId(id);
|
|
111
|
+
queryOptionPopoverTarget.current = consolidatedActionsButtonRef.current ?? undefined;
|
|
122
112
|
}
|
|
123
113
|
if (hasProp(queryOptionProps, 'items')) {
|
|
124
114
|
setActionsQueryOptionPreset({
|
|
@@ -166,7 +156,7 @@ const ListToolbar = forwardRef(({ heading, onCreateNew, search, count, additiona
|
|
|
166
156
|
})), menuAt: 1, ref: consolidatedActionsButtonRef }) }))] })] })), (!condensed || !isSmallOrAbove) && (_jsxs(Flex, { container: { alignItems: 'start', justify: 'between', gap: 2 }, children: [_jsxs(Flex, { as: StyledSearchForm, container: { alignItems: 'center', wrap: 'wrap', gap: 2 }, item: { grow: 1 }, children: [search && _jsx(SearchInput, { ...search }), isSmallOrAbove && !condensed && (_jsxs(_Fragment, { children: [count && _jsx(CountMeta, { count: count }), additionalActions] }))] }), !condensed && (filterButton || sortButton || groupButton || actions) && (_jsxs(Flex, { container: { alignItems: 'center', gap: 1 }, md: { container: { gap: 2 } }, children: [_jsxs(_Fragment, { children: [filterButton, sortButton, groupButton] }), actions && (_jsx(Actions, { items: actions.map(({ icon, ...restProps }) => ({
|
|
167
157
|
visual: icon ? _jsx(Icon, { name: icon }) : undefined,
|
|
168
158
|
...restProps
|
|
169
|
-
})), menuAt: 1, ref: consolidatedActionsButtonRef }))] }))] })), !isSmallOrAbove && (count || additionalActions) && (_jsxs(Flex, { container: { alignItems: 'center', wrap: 'wrap', gap: 2 }, children: [count && _jsx(CountMeta, { count: count }), additionalActions] })),
|
|
159
|
+
})), menuAt: 1, ref: consolidatedActionsButtonRef }))] }))] })), !isSmallOrAbove && (count || additionalActions) && (_jsxs(Flex, { container: { alignItems: 'center', wrap: 'wrap', gap: 2 }, children: [count && _jsx(CountMeta, { count: count }), additionalActions] })), queryOptionPopover, condensed && (_jsx(PresetMenuPopover, { buttonRef: consolidatedActionsButtonRef, heading: actionsQueryOptionPreset?.heading, menu: actionsQueryOptionPreset?.menu, isOpen: optionPresetMenuOpen, onClose: () => setOptionPresetMenuOpen(false) }))] }));
|
|
170
160
|
});
|
|
171
161
|
export default ListToolbar;
|
|
172
162
|
//# sourceMappingURL=ListToolbar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListToolbar.js","sourceRoot":"","sources":["../../../src/components/ListToolbar/ListToolbar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,UAAU,EAKV,WAAW,EACX,SAAS,EACT,OAAO,EACP,QAAQ,EACT,MAAM,OAAO,C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EAAE,CAAC,EACT,GAAG,EAAE,4BAA4B,GACjC,CACH,IACI,CACR,IACI,CACR,EACA,CAAC,cAAc,IAAI,CAAC,KAAK,IAAI,iBAAiB,CAAC,IAAI,CAClD,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,aAC5D,KAAK,IAAI,KAAC,SAAS,IAAC,KAAK,EAAE,KAAK,GAAI,EACpC,iBAAiB,IACb,CACR,EAEA,sBAAsB,IAAI,CACzB,KAAC,kBAAkB,IACjB,MAAM,EAAE,sBAAsB,CAAC,aAAa,EAC5C,OAAO,EAAE,CAAC,CAAC,GAAG,sBAAsB,CAAC,EAAE,KAAK,CAAC,EAC7C,QAAQ,EAAE,mBAAmB,EAC7B,QAAQ,EAAE,mBAAmB,YAE7B,KAAC,sBAAsB,CAAC,KAAK,CAAC,QAAQ,KAAG,GACtB,CACtB,EACA,SAAS,IAAI,CACZ,KAAC,iBAAiB,IAChB,SAAS,EAAE,4BAA4B,EACvC,OAAO,EAAE,wBAAwB,EAAE,OAAO,EAC1C,IAAI,EAAE,wBAAwB,EAAE,IAAI,EACpC,MAAM,EAAE,oBAAoB,EAC5B,OAAO,EAAE,GAAG,EAAE,CAAC,uBAAuB,CAAC,KAAK,CAAC,GAC7C,CACH,IACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import {\n Dispatch,\n forwardRef,\n FunctionComponent,\n MouseEvent,\n PropsWithoutRef,\n SetStateAction,\n useCallback,\n useEffect,\n useMemo,\n useState\n} from 'react';\n\nimport Actions from '../Actions';\nimport Text from '../Text';\nimport Button from '../Button';\nimport { Action, ForwardProps } from '../../types';\nimport { useBreakpoint, useConsolidatedRef, useI18n } from '../../hooks';\nimport Flex from '../Flex';\nimport SearchInput from '../SearchInput';\nimport Icon, { registerIcon } from '../Icon';\nimport * as filterIcon from '../Icon/icons/filter.icon';\nimport * as arrowUpDownIcon from '../Icon/icons/arrow-up-down.icon';\nimport * as rowIcon from '../Icon/icons/row.icon';\nimport * as plusIcon from '../Icon/icons/plus.icon';\nimport * as moreIcon from '../Icon/icons/more.icon';\nimport { hasProp } from '../../utils';\nimport MenuButton from '../MenuButton';\nimport { Count } from '../Badges';\n\nimport PresetMenuPopover, { PresetMenuPopoverProps } from './PresetMenuPopover';\nimport { StyledViewSelector, StyledSearchForm, StyledListToolbar } from './ListToolbar.styles';\nimport {\n ListToolbarProps,\n PresetMenuProps,\n QueryOptionDialogProps,\n QueryOptionDialogState,\n QueryOptionId\n} from './ListToolbar.types';\nimport QueryOptionPopover from './QueryOptionPopover';\n\nregisterIcon(filterIcon, arrowUpDownIcon, rowIcon, plusIcon, moreIcon);\n\nconst CountMeta = ({ count }: { count: NonNullable<ListToolbarProps['count']> }) => {\n const t = useI18n();\n return (\n <Text variant='secondary'>\n {count.total !== undefined &&\n t('results_count', [count.totalHasMore ? `${count.total}+` : count.total], {\n count: count.total\n })}\n {count.total !== undefined && count.selected !== undefined && ' '}\n {count.selected !== undefined &&\n `(${t('selected_count', [count.selected], { count: count.selected })})`}\n </Text>\n );\n};\n\nconst QueryOptionButton = ({\n id,\n queryOptionProps,\n iconOnly,\n setCurrentQueryOption\n}: {\n id: QueryOptionId;\n queryOptionProps: QueryOptionDialogProps | PresetMenuProps;\n iconOnly: boolean;\n setCurrentQueryOption: Dispatch<SetStateAction<QueryOptionDialogState>>;\n}) => {\n const t = useI18n();\n let i18nKey!: 'filter' | 'sort' | 'group';\n let icon!: 'filter' | 'arrow-up-down' | 'row';\n\n if (id === 'filter') {\n i18nKey = 'filter';\n icon = 'filter';\n } else if (id === 'sort') {\n i18nKey = 'sort';\n icon = 'arrow-up-down';\n } else if (id === 'group') {\n i18nKey = 'group';\n icon = 'row';\n }\n\n const text = t(i18nKey);\n const variant = iconOnly ? 'simple' : 'text';\n\n useEffect(() => {\n if (!queryOptionProps || !hasProp(queryOptionProps, 'renderer')) {\n return;\n }\n\n setCurrentQueryOption(cur => {\n if (!cur) return null;\n if (cur.id === id) {\n return {\n ...cur,\n props: queryOptionProps\n };\n }\n return cur;\n });\n }, [queryOptionProps, setCurrentQueryOption, id]);\n\n if (hasProp(queryOptionProps, 'renderer')) {\n return (\n <div>\n <Button\n variant={variant}\n icon={iconOnly}\n label={iconOnly ? text : undefined}\n onClick={(e: MouseEvent<HTMLButtonElement>) => {\n setCurrentQueryOption({\n id,\n props: queryOptionProps,\n popoverTarget: e.currentTarget\n });\n }}\n >\n <Flex container={{ inline: true, alignItems: 'center', gap: 1 }} as='span'>\n <Icon name={icon} />\n {!iconOnly && text}\n {!iconOnly && queryOptionProps.count && <Count>{queryOptionProps.count}</Count>}\n </Flex>\n </Button>\n </div>\n );\n }\n\n if (hasProp(queryOptionProps, 'items')) {\n return (\n <div>\n <MenuButton\n variant={variant}\n text={text}\n icon={icon}\n iconOnly={iconOnly}\n count={queryOptionProps.count}\n menu={{\n mode: queryOptionProps.mode,\n items: queryOptionProps.items.map(item => ({ ...item, primary: item.text })),\n onItemClick: queryOptionProps.onItemClick\n }}\n />\n </div>\n );\n }\n\n return null;\n};\n\nconst ListToolbar: FunctionComponent<ListToolbarProps & ForwardProps> = forwardRef(\n (\n {\n heading,\n onCreateNew,\n search,\n count,\n additionalActions,\n filter,\n sort,\n group,\n actions,\n actionsButtonRef,\n condensed\n }: PropsWithoutRef<ListToolbarProps>,\n ref: ListToolbarProps['ref']\n ) => {\n const t = useI18n();\n const isSmallOrAbove = useBreakpoint('sm');\n const isMediumOrAbove = useBreakpoint('md');\n const consolidatedActionsButtonRef = useConsolidatedRef(actionsButtonRef);\n\n const [queryOptionDialogState, setQueryOptionDialogState] =\n useState<QueryOptionDialogState>(null);\n\n const [actionsQueryOptionPreset, setActionsQueryOptionPreset] =\n useState<Pick<PresetMenuPopoverProps, 'heading' | 'menu'>>();\n const [optionPresetMenuOpen, setOptionPresetMenuOpen] = useState(false);\n\n const createNewButton = useMemo(() => {\n if (!onCreateNew) return null;\n const text = t('create_new');\n\n return (\n <Button\n variant={isSmallOrAbove ? 'secondary' : 'simple'}\n icon={!isSmallOrAbove}\n label={isSmallOrAbove ? undefined : text}\n onClick={onCreateNew}\n >\n {isSmallOrAbove ? <span>{text}</span> : <Icon name='plus' />}\n </Button>\n );\n }, [t, onCreateNew, isSmallOrAbove]);\n\n const filterButton = filter && (\n <QueryOptionButton\n id='filter'\n queryOptionProps={filter}\n iconOnly={!isMediumOrAbove}\n setCurrentQueryOption={setQueryOptionDialogState}\n />\n );\n\n const sortButton = sort && (\n <QueryOptionButton\n id='sort'\n queryOptionProps={sort}\n iconOnly={!isMediumOrAbove}\n setCurrentQueryOption={setQueryOptionDialogState}\n />\n );\n\n const groupButton = group && (\n <QueryOptionButton\n id='group'\n queryOptionProps={group}\n iconOnly={!isMediumOrAbove}\n setCurrentQueryOption={setQueryOptionDialogState}\n />\n );\n\n const onQueryOptionCancel = useCallback(() => {\n if (queryOptionDialogState?.props.onCancel() === false) return;\n setQueryOptionDialogState(null);\n }, [queryOptionDialogState]);\n\n const onQueryOptionSubmit = useCallback(() => {\n if (queryOptionDialogState?.props.onSubmit() === false) return;\n setQueryOptionDialogState(null);\n }, [queryOptionDialogState]);\n\n const getQueryOptionAction = useCallback(\n (\n id: 'sort' | 'group' | 'filter',\n icon: string,\n queryOptionProps: QueryOptionDialogProps | PresetMenuProps\n ) => {\n return {\n text: t(id),\n id,\n icon,\n count: queryOptionProps.count,\n onClick: () => {\n if (hasProp(queryOptionProps, 'renderer')) {\n setQueryOptionDialogState({\n id,\n popoverTarget: consolidatedActionsButtonRef.current,\n props: queryOptionProps\n });\n }\n if (hasProp(queryOptionProps, 'items')) {\n setActionsQueryOptionPreset({\n heading: t(`${id}_by`),\n menu: {\n mode: queryOptionProps.mode,\n items: queryOptionProps.items.map(item => ({ ...item, primary: item.text })),\n onItemClick: queryOptionProps.onItemClick\n }\n });\n setOptionPresetMenuOpen(true);\n }\n }\n };\n },\n []\n );\n\n const basicModeActions = useMemo(() => {\n let basicActions: Action[] = [];\n if (filter) {\n const filterAction: Action = getQueryOptionAction('filter', 'filter', filter);\n basicActions.push(filterAction);\n }\n if (sort) {\n const sortAction: Action = getQueryOptionAction('sort', 'arrow-up-down', sort);\n basicActions.push(sortAction);\n }\n if (group) {\n const groupAction: Action = getQueryOptionAction('group', 'row', group);\n basicActions.push(groupAction);\n }\n if (actions) {\n basicActions = basicActions.concat(actions);\n }\n\n return basicActions.length ? basicActions : undefined;\n }, [actions, filter, sort, group, getQueryOptionAction]);\n\n return (\n <Flex\n as={StyledListToolbar}\n container={{ direction: 'column', gap: 2 }}\n item={{ grow: 1 }}\n ref={ref}\n role='toolbar'\n >\n {(heading ||\n createNewButton ||\n (condensed && (count || additionalActions || search || basicModeActions))) && (\n <Flex container={{ alignItems: 'start', justify: 'between', gap: 2 }}>\n <Flex container={{ alignItems: 'center', gap: 2, wrap: 'wrap' }}>\n {heading &&\n (typeof heading === 'string' ? (\n <Text variant='h3'>{heading}</Text>\n ) : (\n <StyledViewSelector\n variant='text'\n text={heading.views.find(view => view.selected)?.text ?? heading.views[0].text}\n menu={{\n mode: 'single-select',\n items: heading.views.map(view => ({ ...view, primary: view.text })),\n onItemClick: heading.onViewSelect\n }}\n />\n ))}\n {isSmallOrAbove && condensed && (\n <>\n {count && <CountMeta count={count} />}\n {additionalActions}\n </>\n )}\n </Flex>\n <Flex container={{ alignItems: 'center', gap: 2 }}>\n {search && condensed && isSmallOrAbove && <SearchInput {...search} />}\n {createNewButton}\n {condensed && basicModeActions && (\n <span>\n <Actions\n items={basicModeActions.map(({ icon, ...restProps }) => ({\n visual: icon ? <Icon name={icon} /> : undefined,\n ...restProps\n }))}\n menuAt={1}\n ref={consolidatedActionsButtonRef}\n />\n </span>\n )}\n </Flex>\n </Flex>\n )}\n {(!condensed || !isSmallOrAbove) && (\n <Flex container={{ alignItems: 'start', justify: 'between', gap: 2 }}>\n <Flex\n as={StyledSearchForm}\n container={{ alignItems: 'center', wrap: 'wrap', gap: 2 }}\n item={{ grow: 1 }}\n >\n {search && <SearchInput {...search} />}\n {isSmallOrAbove && !condensed && (\n <>\n {count && <CountMeta count={count} />}\n {additionalActions}\n </>\n )}\n </Flex>\n {!condensed && (filterButton || sortButton || groupButton || actions) && (\n <Flex container={{ alignItems: 'center', gap: 1 }} md={{ container: { gap: 2 } }}>\n <>\n {filterButton}\n {sortButton}\n {groupButton}\n </>\n {actions && (\n <Actions\n items={actions.map(({ icon, ...restProps }) => ({\n visual: icon ? <Icon name={icon} /> : undefined,\n ...restProps\n }))}\n menuAt={1}\n ref={consolidatedActionsButtonRef}\n />\n )}\n </Flex>\n )}\n </Flex>\n )}\n {!isSmallOrAbove && (count || additionalActions) && (\n <Flex container={{ alignItems: 'center', wrap: 'wrap', gap: 2 }}>\n {count && <CountMeta count={count} />}\n {additionalActions}\n </Flex>\n )}\n\n {queryOptionDialogState && (\n <QueryOptionPopover\n target={queryOptionDialogState.popoverTarget}\n heading={t(`${queryOptionDialogState.id}_by`)}\n onCancel={onQueryOptionCancel}\n onSubmit={onQueryOptionSubmit}\n >\n <queryOptionDialogState.props.renderer />\n </QueryOptionPopover>\n )}\n {condensed && (\n <PresetMenuPopover\n buttonRef={consolidatedActionsButtonRef}\n heading={actionsQueryOptionPreset?.heading}\n menu={actionsQueryOptionPreset?.menu}\n isOpen={optionPresetMenuOpen}\n onClose={() => setOptionPresetMenuOpen(false)}\n />\n )}\n </Flex>\n );\n }\n);\n\nexport default ListToolbar;\n"]}
|
|
1
|
+
{"version":3,"file":"ListToolbar.js","sourceRoot":"","sources":["../../../src/components/ListToolbar/ListToolbar.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAIV,WAAW,EACX,OAAO,EACP,MAAM,EACN,QAAQ,EACT,MAAM,OAAO,CAAC;AAEf,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,MAAM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E,CAAC,EACT,GAAG,EAAE,4BAA4B,GACjC,CACH,IACI,CACR,IACI,CACR,EACA,CAAC,cAAc,IAAI,CAAC,KAAK,IAAI,iBAAiB,CAAC,IAAI,CAClD,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,aAC5D,KAAK,IAAI,KAAC,SAAS,IAAC,KAAK,EAAE,KAAK,GAAI,EACpC,iBAAiB,IACb,CACR,EAEA,kBAAkB,EAElB,SAAS,IAAI,CACZ,KAAC,iBAAiB,IAChB,SAAS,EAAE,4BAA4B,EACvC,OAAO,EAAE,wBAAwB,EAAE,OAAO,EAC1C,IAAI,EAAE,wBAAwB,EAAE,IAAI,EACpC,MAAM,EAAE,oBAAoB,EAC5B,OAAO,EAAE,GAAG,EAAE,CAAC,uBAAuB,CAAC,KAAK,CAAC,GAC7C,CACH,IACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n MouseEvent,\n PropsWithoutRef,\n useCallback,\n useMemo,\n useRef,\n useState\n} from 'react';\n\nimport Actions from '../Actions';\nimport Text from '../Text';\nimport Button from '../Button';\nimport { Action, ForwardProps } from '../../types';\nimport { useBreakpoint, useConsolidatedRef, useI18n } from '../../hooks';\nimport Flex from '../Flex';\nimport SearchInput from '../SearchInput';\nimport Icon, { registerIcon } from '../Icon';\nimport * as filterIcon from '../Icon/icons/filter.icon';\nimport * as arrowUpDownIcon from '../Icon/icons/arrow-up-down.icon';\nimport * as rowIcon from '../Icon/icons/row.icon';\nimport * as plusIcon from '../Icon/icons/plus.icon';\nimport * as moreIcon from '../Icon/icons/more.icon';\nimport { hasProp } from '../../utils';\nimport MenuButton from '../MenuButton';\nimport { Count } from '../Badges';\n\nimport PresetMenuPopover, { PresetMenuPopoverProps } from './PresetMenuPopover';\nimport { StyledViewSelector, StyledSearchForm, StyledListToolbar } from './ListToolbar.styles';\nimport {\n ListToolbarProps,\n PresetMenuProps,\n QueryOptionDialogProps,\n QueryOptionId\n} from './ListToolbar.types';\nimport QueryOptionPopover from './QueryOptionPopover';\n\nregisterIcon(filterIcon, arrowUpDownIcon, rowIcon, plusIcon, moreIcon);\n\nconst CountMeta = ({ count }: { count: NonNullable<ListToolbarProps['count']> }) => {\n const t = useI18n();\n return (\n <Text variant='secondary'>\n {count.total !== undefined &&\n t('results_count', [count.totalHasMore ? `${count.total}+` : count.total], {\n count: count.total\n })}\n {count.total !== undefined && count.selected !== undefined && ' '}\n {count.selected !== undefined &&\n `(${t('selected_count', [count.selected], { count: count.selected })})`}\n </Text>\n );\n};\n\nconst QueryOptionButton = ({\n id,\n queryOptionProps,\n iconOnly,\n onClick\n}: {\n id: QueryOptionId;\n queryOptionProps: QueryOptionDialogProps | PresetMenuProps;\n iconOnly: boolean;\n onClick: (e: MouseEvent<HTMLButtonElement>) => void;\n}) => {\n const t = useI18n();\n let i18nKey: 'filter' | 'sort' | 'group';\n let icon: 'filter' | 'arrow-up-down' | 'row';\n\n if (id === 'filter') {\n i18nKey = 'filter';\n icon = 'filter';\n } else if (id === 'sort') {\n i18nKey = 'sort';\n icon = 'arrow-up-down';\n } else {\n i18nKey = 'group';\n icon = 'row';\n }\n\n const text = t(i18nKey);\n const variant = iconOnly ? 'simple' : 'text';\n\n if (hasProp(queryOptionProps, 'renderer')) {\n return (\n <div>\n <Button\n variant={variant}\n icon={iconOnly}\n label={iconOnly ? text : undefined}\n onClick={onClick}\n >\n <Flex container={{ inline: true, alignItems: 'center', gap: 1 }} as='span'>\n <Icon name={icon} />\n {!iconOnly && text}\n {!iconOnly && queryOptionProps.count && <Count>{queryOptionProps.count}</Count>}\n </Flex>\n </Button>\n </div>\n );\n }\n\n if (hasProp(queryOptionProps, 'items')) {\n return (\n <div>\n <MenuButton\n variant={variant}\n text={text}\n icon={icon}\n iconOnly={iconOnly}\n count={queryOptionProps.count}\n onClick={onClick}\n menu={{\n mode: queryOptionProps.mode,\n items: queryOptionProps.items.map(item => ({ ...item, primary: item.text })),\n onItemClick: queryOptionProps.onItemClick\n }}\n />\n </div>\n );\n }\n\n return null;\n};\n\nconst ListToolbar: FunctionComponent<ListToolbarProps & ForwardProps> = forwardRef(\n (\n {\n heading,\n createNew,\n search,\n count,\n additionalActions,\n filter,\n sort,\n group,\n actions,\n actionsButtonRef,\n condensed\n }: PropsWithoutRef<ListToolbarProps>,\n ref: ListToolbarProps['ref']\n ) => {\n const t = useI18n();\n const isSmallOrAbove = useBreakpoint('sm');\n const isMediumOrAbove = useBreakpoint('md');\n const consolidatedActionsButtonRef = useConsolidatedRef(actionsButtonRef);\n\n const [currentQueryOptionId, setCurrentQueryOptionId] = useState<QueryOptionId | null>(null);\n const queryOptionPopoverTarget = useRef<HTMLButtonElement>();\n\n const [actionsQueryOptionPreset, setActionsQueryOptionPreset] =\n useState<Pick<PresetMenuPopoverProps, 'heading' | 'menu'>>();\n const [optionPresetMenuOpen, setOptionPresetMenuOpen] = useState(false);\n\n const createNewButton = useMemo(() => {\n if (!createNew?.onClick) return null;\n const text = createNew.label ?? t('create_new');\n\n return (\n <Button\n variant={isSmallOrAbove ? 'secondary' : 'simple'}\n icon={!isSmallOrAbove}\n label={isSmallOrAbove ? undefined : text}\n aria-label={text}\n onClick={createNew.onClick}\n >\n {isSmallOrAbove ? text : <Icon name='plus' />}\n </Button>\n );\n }, [t, createNew, isSmallOrAbove]);\n\n const filterButton = filter && (\n <QueryOptionButton\n id='filter'\n queryOptionProps={filter}\n iconOnly={!isMediumOrAbove}\n onClick={e => {\n setCurrentQueryOptionId('filter');\n queryOptionPopoverTarget.current = e.currentTarget;\n }}\n />\n );\n\n const sortButton = sort && (\n <QueryOptionButton\n id='sort'\n queryOptionProps={sort}\n iconOnly={!isMediumOrAbove}\n onClick={e => {\n setCurrentQueryOptionId('sort');\n queryOptionPopoverTarget.current = e.currentTarget;\n }}\n />\n );\n\n const groupButton = group && (\n <QueryOptionButton\n id='group'\n queryOptionProps={group}\n iconOnly={!isMediumOrAbove}\n onClick={e => {\n setCurrentQueryOptionId('group');\n queryOptionPopoverTarget.current = e.currentTarget;\n }}\n />\n );\n\n let queryOptionPopover = null;\n if (currentQueryOptionId) {\n const queryOptionProps = { filter, sort, group }[currentQueryOptionId];\n if (queryOptionProps && hasProp(queryOptionProps, 'renderer')) {\n queryOptionPopover = (\n <QueryOptionPopover\n target={queryOptionPopoverTarget.current}\n heading={t(`${currentQueryOptionId}_by`)}\n onCancel={() => {\n if (queryOptionProps.onCancel() === false) return;\n setCurrentQueryOptionId(null);\n }}\n onSubmit={() => {\n if (queryOptionProps.onSubmit() === false) return;\n setCurrentQueryOptionId(null);\n }}\n >\n <queryOptionProps.renderer />\n </QueryOptionPopover>\n );\n }\n }\n\n const getQueryOptionAction = useCallback(\n (\n id: 'sort' | 'group' | 'filter',\n icon: string,\n queryOptionProps: QueryOptionDialogProps | PresetMenuProps\n ) => {\n return {\n text: t(id),\n id,\n icon,\n count: queryOptionProps.count,\n onClick: () => {\n if (hasProp(queryOptionProps, 'renderer')) {\n setCurrentQueryOptionId(id);\n queryOptionPopoverTarget.current = consolidatedActionsButtonRef.current ?? undefined;\n }\n if (hasProp(queryOptionProps, 'items')) {\n setActionsQueryOptionPreset({\n heading: t(`${id}_by`),\n menu: {\n mode: queryOptionProps.mode,\n items: queryOptionProps.items.map(item => ({ ...item, primary: item.text })),\n onItemClick: queryOptionProps.onItemClick\n }\n });\n setOptionPresetMenuOpen(true);\n }\n }\n };\n },\n []\n );\n\n const basicModeActions = useMemo(() => {\n let basicActions: Action[] = [];\n if (filter) {\n const filterAction: Action = getQueryOptionAction('filter', 'filter', filter);\n basicActions.push(filterAction);\n }\n if (sort) {\n const sortAction: Action = getQueryOptionAction('sort', 'arrow-up-down', sort);\n basicActions.push(sortAction);\n }\n if (group) {\n const groupAction: Action = getQueryOptionAction('group', 'row', group);\n basicActions.push(groupAction);\n }\n if (actions) {\n basicActions = basicActions.concat(actions);\n }\n\n return basicActions.length ? basicActions : undefined;\n }, [actions, filter, sort, group, getQueryOptionAction]);\n\n return (\n <Flex\n as={StyledListToolbar}\n container={{ direction: 'column', gap: 2 }}\n item={{ grow: 1 }}\n ref={ref}\n role='toolbar'\n >\n {(heading ||\n createNewButton ||\n (condensed && (count || additionalActions || search || basicModeActions))) && (\n <Flex container={{ alignItems: 'start', justify: 'between', gap: 2 }}>\n <Flex container={{ alignItems: 'center', gap: 2, wrap: 'wrap' }}>\n {heading &&\n (typeof heading === 'string' ? (\n <Text variant='h3'>{heading}</Text>\n ) : (\n <StyledViewSelector\n variant='text'\n text={heading.views.find(view => view.selected)?.text ?? heading.views[0].text}\n menu={{\n mode: 'single-select',\n items: heading.views.map(view => ({ ...view, primary: view.text })),\n onItemClick: heading.onViewSelect\n }}\n />\n ))}\n {isSmallOrAbove && condensed && (\n <>\n {count && <CountMeta count={count} />}\n {additionalActions}\n </>\n )}\n </Flex>\n <Flex container={{ alignItems: 'center', gap: 2 }}>\n {search && condensed && isSmallOrAbove && <SearchInput {...search} />}\n {createNewButton}\n {condensed && basicModeActions && (\n <span>\n <Actions\n items={basicModeActions.map(({ icon, ...restProps }) => ({\n visual: icon ? <Icon name={icon} /> : undefined,\n ...restProps\n }))}\n menuAt={1}\n ref={consolidatedActionsButtonRef}\n />\n </span>\n )}\n </Flex>\n </Flex>\n )}\n {(!condensed || !isSmallOrAbove) && (\n <Flex container={{ alignItems: 'start', justify: 'between', gap: 2 }}>\n <Flex\n as={StyledSearchForm}\n container={{ alignItems: 'center', wrap: 'wrap', gap: 2 }}\n item={{ grow: 1 }}\n >\n {search && <SearchInput {...search} />}\n {isSmallOrAbove && !condensed && (\n <>\n {count && <CountMeta count={count} />}\n {additionalActions}\n </>\n )}\n </Flex>\n {!condensed && (filterButton || sortButton || groupButton || actions) && (\n <Flex container={{ alignItems: 'center', gap: 1 }} md={{ container: { gap: 2 } }}>\n <>\n {filterButton}\n {sortButton}\n {groupButton}\n </>\n {actions && (\n <Actions\n items={actions.map(({ icon, ...restProps }) => ({\n visual: icon ? <Icon name={icon} /> : undefined,\n ...restProps\n }))}\n menuAt={1}\n ref={consolidatedActionsButtonRef}\n />\n )}\n </Flex>\n )}\n </Flex>\n )}\n {!isSmallOrAbove && (count || additionalActions) && (\n <Flex container={{ alignItems: 'center', wrap: 'wrap', gap: 2 }}>\n {count && <CountMeta count={count} />}\n {additionalActions}\n </Flex>\n )}\n\n {queryOptionPopover}\n\n {condensed && (\n <PresetMenuPopover\n buttonRef={consolidatedActionsButtonRef}\n heading={actionsQueryOptionPreset?.heading}\n menu={actionsQueryOptionPreset?.menu}\n isOpen={optionPresetMenuOpen}\n onClose={() => setOptionPresetMenuOpen(false)}\n />\n )}\n </Flex>\n );\n }\n);\n\nexport default ListToolbar;\n"]}
|
|
@@ -32,26 +32,29 @@ export interface QueryOptionDialogProps extends QueryOption {
|
|
|
32
32
|
}
|
|
33
33
|
/** Optionally provide query option presets. */
|
|
34
34
|
export interface PresetMenuProps extends QueryOption {
|
|
35
|
+
/** Mode defining whether menu selection is single or multi mode. */
|
|
35
36
|
mode?: Exclude<MenuProps['mode'], 'action'>;
|
|
37
|
+
/** Items of the menu. */
|
|
36
38
|
items: {
|
|
37
39
|
id: string;
|
|
38
40
|
text: string;
|
|
39
41
|
selected: boolean;
|
|
40
42
|
icon?: string;
|
|
41
43
|
}[];
|
|
44
|
+
/** Callback invoked on item selection. Passes the item id as an argument. */
|
|
42
45
|
onItemClick: MenuProps['onItemClick'];
|
|
43
46
|
}
|
|
44
47
|
export declare type QueryOptionId = 'filter' | 'sort' | 'group';
|
|
45
|
-
export declare type QueryOptionDialogState = {
|
|
46
|
-
id: 'filter' | 'sort' | 'group';
|
|
47
|
-
props: QueryOptionDialogProps;
|
|
48
|
-
popoverTarget: HTMLButtonElement | null;
|
|
49
|
-
} | null;
|
|
50
48
|
export interface ListToolbarProps extends BaseProps {
|
|
51
|
-
/**
|
|
49
|
+
/** Renders a simple heading or view selection menu. */
|
|
52
50
|
heading?: string | ViewSelectorProps;
|
|
53
|
-
/**
|
|
54
|
-
|
|
51
|
+
/** Props related to new item creation button. */
|
|
52
|
+
createNew?: {
|
|
53
|
+
/** Label of the new item creation button. */
|
|
54
|
+
label?: string;
|
|
55
|
+
/** Callback that will render a Create new button and is fired when that button is clicked. */
|
|
56
|
+
onClick: (e: MouseEvent) => void;
|
|
57
|
+
};
|
|
55
58
|
/** Props related to the Search Input. */
|
|
56
59
|
search?: SearchInputProps;
|
|
57
60
|
/** Total returned results related for a given search. Optional indication of a selected item count. */
|
|
@@ -74,11 +77,11 @@ export interface ListToolbarProps extends BaseProps {
|
|
|
74
77
|
group?: QueryOptionDialogProps | PresetMenuProps;
|
|
75
78
|
/** Top level dataset actions. */
|
|
76
79
|
actions?: Action[];
|
|
77
|
-
/** Ref for the wrapping element. */
|
|
78
|
-
ref?: Ref<HTMLDivElement>;
|
|
79
80
|
/** Ref for the actions button element. */
|
|
80
81
|
actionsButtonRef?: Ref<HTMLButtonElement>;
|
|
81
82
|
/** Renders toolbar in condensed mode. */
|
|
82
83
|
condensed?: boolean;
|
|
84
|
+
/** Ref for the wrapping element. */
|
|
85
|
+
ref?: Ref<HTMLDivElement>;
|
|
83
86
|
}
|
|
84
87
|
//# sourceMappingURL=ListToolbar.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListToolbar.types.d.ts","sourceRoot":"","sources":["../../../src/components/ListToolbar/ListToolbar.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,WAAW,iBAAiB;I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AAM,CAAC;QACf,8FAA8F;QAC9F,OAAO,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;KAClC,CAAC;IACF,yCAAyC;IACzC,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,uGAAuG;IACvG,KAAK,CAAC,EAAE;QACN,KAAK,CAAC,EAAE,MAAM,CAAC;QACf;;;WAGG;QACH,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,gCAAgC;IAChC,iBAAiB,CAAC,EAAE,SAAS,CAAC;IAC9B,2DAA2D;IAC3D,MAAM,CAAC,EAAE,sBAAsB,GAAG,eAAe,CAAC;IAClD,yDAAyD;IACzD,IAAI,CAAC,EAAE,sBAAsB,GAAG,eAAe,CAAC;IAChD,0DAA0D;IAC1D,KAAK,CAAC,EAAE,sBAAsB,GAAG,eAAe,CAAC;IACjD,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,0CAA0C;IAC1C,gBAAgB,CAAC,EAAE,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAC1C,yCAAyC;IACzC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListToolbar.types.js","sourceRoot":"","sources":["../../../src/components/ListToolbar/ListToolbar.types.ts"],"names":[],"mappings":"","sourcesContent":["import { MouseEvent, Ref, ComponentType, ReactNode } from 'react';\n\nimport { SearchInputProps } from '../SearchInput';\nimport { MenuProps } from '../Menu';\nimport { Action, BaseProps } from '../../types';\n\nexport interface ViewSelectorProps {\n /** A list of pre-defined data views. */\n views: { id: string; text: string; selected: boolean }[];\n /** Called when a view is selected. */\n onViewSelect: MenuProps['onItemClick'];\n}\nexport interface QueryOption {\n /** A count representing the number of applied conditions within the query option. */\n count?: number;\n}\n\nexport interface QueryOptionDialogProps extends QueryOption {\n /** A component to render the content portion of the query option dialog. */\n renderer: ComponentType;\n /**\n * Called when the user explicitly or implicitly cancels(closes) the query dialog.\n * Returning false will block the dialog from closing.\n */\n onCancel: () => boolean | void;\n /**\n * Called when the user explicitly applies the query option conditions.\n * Returning false will block the dialog from closing.\n */\n onSubmit: () => boolean | void;\n}\n\n/** Optionally provide query option presets. */\nexport interface PresetMenuProps extends QueryOption {\n mode?: Exclude<MenuProps['mode'], 'action'>;\n items: { id: string; text: string; selected: boolean; icon?: string }[];\n onItemClick: MenuProps['onItemClick'];\n}\nexport type QueryOptionId = 'filter' | 'sort' | 'group';\n\nexport
|
|
1
|
+
{"version":3,"file":"ListToolbar.types.js","sourceRoot":"","sources":["../../../src/components/ListToolbar/ListToolbar.types.ts"],"names":[],"mappings":"","sourcesContent":["import { MouseEvent, Ref, ComponentType, ReactNode } from 'react';\n\nimport { SearchInputProps } from '../SearchInput';\nimport { MenuProps } from '../Menu';\nimport { Action, BaseProps } from '../../types';\n\nexport interface ViewSelectorProps {\n /** A list of pre-defined data views. */\n views: { id: string; text: string; selected: boolean }[];\n /** Called when a view is selected. */\n onViewSelect: MenuProps['onItemClick'];\n}\nexport interface QueryOption {\n /** A count representing the number of applied conditions within the query option. */\n count?: number;\n}\n\nexport interface QueryOptionDialogProps extends QueryOption {\n /** A component to render the content portion of the query option dialog. */\n renderer: ComponentType;\n /**\n * Called when the user explicitly or implicitly cancels(closes) the query dialog.\n * Returning false will block the dialog from closing.\n */\n onCancel: () => boolean | void;\n /**\n * Called when the user explicitly applies the query option conditions.\n * Returning false will block the dialog from closing.\n */\n onSubmit: () => boolean | void;\n}\n\n/** Optionally provide query option presets. */\nexport interface PresetMenuProps extends QueryOption {\n /** Mode defining whether menu selection is single or multi mode. */\n mode?: Exclude<MenuProps['mode'], 'action'>;\n /** Items of the menu. */\n items: { id: string; text: string; selected: boolean; icon?: string }[];\n /** Callback invoked on item selection. Passes the item id as an argument. */\n onItemClick: MenuProps['onItemClick'];\n}\nexport type QueryOptionId = 'filter' | 'sort' | 'group';\n\nexport interface ListToolbarProps extends BaseProps {\n /** Renders a simple heading or view selection menu. */\n heading?: string | ViewSelectorProps;\n /** Props related to new item creation button. */\n createNew?: {\n /** Label of the new item creation button. */\n label?: string;\n /** Callback that will render a Create new button and is fired when that button is clicked. */\n onClick: (e: MouseEvent) => void;\n };\n /** Props related to the Search Input. */\n search?: SearchInputProps;\n /** Total returned results related for a given search. Optional indication of a selected item count. */\n count?: {\n total?: number;\n /**\n * If true renders + next to total number.\n * @default false\n */\n totalHasMore?: boolean;\n selected?: number;\n };\n /** Additional actions region */\n additionalActions?: ReactNode;\n /** Custom Rendering or available presets for filtering. */\n filter?: QueryOptionDialogProps | PresetMenuProps;\n /** Custom Rendering or available presets for sorting. */\n sort?: QueryOptionDialogProps | PresetMenuProps;\n /** Custom Rendering or available presets for grouping. */\n group?: QueryOptionDialogProps | PresetMenuProps;\n /** Top level dataset actions. */\n actions?: Action[];\n /** Ref for the actions button element. */\n actionsButtonRef?: Ref<HTMLButtonElement>;\n /** Renders toolbar in condensed mode. */\n condensed?: boolean;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/cosmos-react-core",
|
|
3
|
-
"version": "3.0.0-dev.
|
|
3
|
+
"version": "3.0.0-dev.25.0",
|
|
4
4
|
"description": "Cosmos is a visual design system and UI component collection. Its goal is to empower application developers in their pursuit to create engaging and rewarding user experiences.",
|
|
5
5
|
"author": "Pegasystems",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|