@cratis/components 0.1.9 → 0.1.10

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.
Files changed (101) hide show
  1. package/dist/cjs/PivotViewer/PivotViewer.css +1258 -0
  2. package/dist/cjs/PivotViewer/components/Spinner.css +77 -0
  3. package/dist/cjs/TimeMachine/EventsView.css +213 -0
  4. package/dist/cjs/TimeMachine/TimeMachine.css +567 -0
  5. package/dist/esm/PivotViewer/PivotViewer.css +1258 -0
  6. package/dist/esm/PivotViewer/components/Spinner.css +77 -0
  7. package/dist/esm/TimeMachine/EventsView.css +213 -0
  8. package/dist/esm/TimeMachine/TimeMachine.css +567 -0
  9. package/package.json +3 -4
  10. package/.storybook/main.ts +0 -24
  11. package/CommandDialog/CommandDialog.stories.tsx +0 -25
  12. package/CommandDialog/CommandDialog.tsx +0 -161
  13. package/CommandDialog/index.ts +0 -4
  14. package/CommandForm/CommandForm.stories.tsx +0 -24
  15. package/CommandForm/CommandForm.tsx +0 -266
  16. package/CommandForm/CommandFormField.tsx +0 -27
  17. package/CommandForm/CommandFormFields.tsx +0 -142
  18. package/CommandForm/DatePickerField.tsx +0 -57
  19. package/CommandForm/DropdownField.tsx +0 -65
  20. package/CommandForm/InputTextField.tsx +0 -62
  21. package/CommandForm/SliderField.tsx +0 -68
  22. package/CommandForm/index.ts +0 -10
  23. package/Common/ErrorBoundary.stories.tsx +0 -10
  24. package/Common/ErrorBoundary.tsx +0 -41
  25. package/Common/FormElement.stories.tsx +0 -10
  26. package/Common/FormElement.tsx +0 -20
  27. package/Common/Page.stories.tsx +0 -10
  28. package/Common/Page.tsx +0 -21
  29. package/Common/index.ts +0 -6
  30. package/DataPage/DataPage.stories.tsx +0 -10
  31. package/DataPage/DataPage.tsx +0 -191
  32. package/DataPage/index.ts +0 -4
  33. package/DataTables/DataTableForObservableQuery.stories.tsx +0 -10
  34. package/DataTables/DataTableForObservableQuery.tsx +0 -97
  35. package/DataTables/DataTableForQuery.stories.tsx +0 -10
  36. package/DataTables/DataTableForQuery.tsx +0 -97
  37. package/DataTables/index.ts +0 -5
  38. package/Dialogs/BusyIndicatorDialog.stories.tsx +0 -26
  39. package/Dialogs/BusyIndicatorDialog.tsx +0 -26
  40. package/Dialogs/ConfirmationDialog.stories.tsx +0 -36
  41. package/Dialogs/ConfirmationDialog.tsx +0 -75
  42. package/Dialogs/index.ts +0 -5
  43. package/Dropdown/Dropdown.tsx +0 -23
  44. package/Dropdown/index.ts +0 -4
  45. package/PivotViewer/PivotViewer.stories.tsx +0 -24
  46. package/PivotViewer/PivotViewer.tsx +0 -791
  47. package/PivotViewer/components/AxisLabels.tsx +0 -69
  48. package/PivotViewer/components/DetailPanel.tsx +0 -108
  49. package/PivotViewer/components/FilterPanel.tsx +0 -189
  50. package/PivotViewer/components/FilterPanelContainer.tsx +0 -10
  51. package/PivotViewer/components/PivotCanvas.tsx +0 -660
  52. package/PivotViewer/components/PivotViewerMain.tsx +0 -229
  53. package/PivotViewer/components/RangeHistogramFilter.tsx +0 -220
  54. package/PivotViewer/components/Spinner.tsx +0 -21
  55. package/PivotViewer/components/Toolbar.tsx +0 -130
  56. package/PivotViewer/components/ToolbarContainer.tsx +0 -10
  57. package/PivotViewer/components/index.ts +0 -12
  58. package/PivotViewer/components/pivot/animation.ts +0 -108
  59. package/PivotViewer/components/pivot/buckets.ts +0 -152
  60. package/PivotViewer/components/pivot/colorResolver.ts +0 -67
  61. package/PivotViewer/components/pivot/constants.ts +0 -46
  62. package/PivotViewer/components/pivot/sprites.ts +0 -265
  63. package/PivotViewer/components/pivot/visibility.ts +0 -319
  64. package/PivotViewer/constants.ts +0 -9
  65. package/PivotViewer/engine/layout.ts +0 -149
  66. package/PivotViewer/engine/pivot.worker.ts +0 -86
  67. package/PivotViewer/engine/store.ts +0 -437
  68. package/PivotViewer/engine/types.ts +0 -255
  69. package/PivotViewer/hooks/index.ts +0 -13
  70. package/PivotViewer/hooks/useContainerDimensions.ts +0 -45
  71. package/PivotViewer/hooks/useDimensionState.ts +0 -53
  72. package/PivotViewer/hooks/useFilterOptions.ts +0 -36
  73. package/PivotViewer/hooks/useFilterPanelDrag.ts +0 -49
  74. package/PivotViewer/hooks/useFilterState.ts +0 -106
  75. package/PivotViewer/hooks/useFilteredData.ts +0 -119
  76. package/PivotViewer/hooks/usePanning.ts +0 -163
  77. package/PivotViewer/hooks/usePivotEngine.ts +0 -252
  78. package/PivotViewer/hooks/useSelectedItem.ts +0 -402
  79. package/PivotViewer/hooks/useWheelZoom.ts +0 -114
  80. package/PivotViewer/hooks/useZoomState.ts +0 -34
  81. package/PivotViewer/index.ts +0 -7
  82. package/PivotViewer/types.ts +0 -59
  83. package/PivotViewer/utils/animations.ts +0 -249
  84. package/PivotViewer/utils/constants.ts +0 -20
  85. package/PivotViewer/utils/index.ts +0 -6
  86. package/PivotViewer/utils/selection.ts +0 -292
  87. package/PivotViewer/utils/utils.ts +0 -259
  88. package/TimeMachine/EventsView.stories.tsx +0 -10
  89. package/TimeMachine/EventsView.tsx +0 -119
  90. package/TimeMachine/Properties.stories.tsx +0 -10
  91. package/TimeMachine/Properties.tsx +0 -98
  92. package/TimeMachine/ReadModelView.stories.tsx +0 -10
  93. package/TimeMachine/ReadModelView.tsx +0 -143
  94. package/TimeMachine/TimeMachine.stories.tsx +0 -10
  95. package/TimeMachine/TimeMachine.tsx +0 -244
  96. package/TimeMachine/index.ts +0 -8
  97. package/TimeMachine/types.ts +0 -23
  98. package/global.d.ts +0 -11
  99. package/index.ts +0 -22
  100. package/useOverlayZIndex.ts +0 -32
  101. package/vite.config.ts +0 -80
@@ -1,97 +0,0 @@
1
- // Copyright (c) Cratis. All rights reserved.
2
- // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
-
4
- import { DataTable, DataTableFilterMeta, DataTableSelectionSingleChangeEvent } from 'primereact/datatable';
5
- import { Constructor } from '@cratis/fundamentals';
6
- import { IQueryFor, Paging } from '@cratis/arc/queries';
7
- import { useQueryWithPaging } from '@cratis/arc.react/queries';
8
- import { ReactNode, useState } from 'react';
9
-
10
-
11
-
12
- /**
13
- * Props for the DataTableForQuery component
14
- */
15
- export interface DataTableForQueryProps<TQuery extends IQueryFor<TDataType>, TDataType, TArguments> {
16
- /**
17
- * Children to render
18
- */
19
- children?: ReactNode;
20
-
21
- /**
22
- * The type of query to use
23
- */
24
- query: Constructor<TQuery>;
25
-
26
- /**
27
- * Optional Arguments to pass to the query
28
- */
29
- queryArguments?: TArguments;
30
-
31
- /**
32
- * The message to show when there is no data
33
- */
34
- emptyMessage: string;
35
-
36
- /**
37
- * The key to use for the data
38
- */
39
- dataKey?: string | undefined;
40
-
41
- /**
42
- * The current selection.
43
- */
44
- selection?: any | undefined | null;
45
-
46
- /**
47
- * Callback for when the selection changes
48
- */
49
- onSelectionChange?(event: DataTableSelectionSingleChangeEvent<any>): void;
50
-
51
- /**
52
- * Fields to use for global filtering
53
- */
54
- globalFilterFields?: string[] | undefined;
55
-
56
- /**
57
- * Default filters to use
58
- */
59
- defaultFilters?: DataTableFilterMeta;
60
- }
61
-
62
- const paging = new Paging(0, 20);
63
-
64
- /**
65
- * Represents a DataTable for a query.
66
- * @param props Props for the component
67
- * @returns Function to render the DataTableForQuery component
68
- */
69
- export const DataTableForQuery = <TQuery extends IQueryFor<TDataType, TArguments>, TDataType, TArguments extends object>(props: DataTableForQueryProps<TQuery, TDataType, TArguments>) => {
70
- const [filters, setFilters] = useState<DataTableFilterMeta>(props.defaultFilters ?? {});
71
- const [result, , , setPage] = useQueryWithPaging(props.query, paging, props.queryArguments);
72
-
73
- return (
74
- <DataTable
75
- value={result.data as unknown}
76
- lazy
77
- rows={paging.pageSize}
78
- totalRecords={result.paging.totalItems}
79
- paginator
80
- alwaysShowPaginator={false}
81
- first={result.paging.page * paging.pageSize}
82
- onPage={(e) => setPage(e.page ?? 0)}
83
- scrollable
84
- scrollHeight={'flex'}
85
- selectionMode='single'
86
- selection={props.selection}
87
- onSelectionChange={props.onSelectionChange}
88
- dataKey={props.dataKey}
89
- filters={filters}
90
- filterDisplay='menu'
91
- onFilter={(e) => setFilters(e.filters)}
92
- globalFilterFields={props.globalFilterFields}
93
- emptyMessage={props.emptyMessage} >
94
- {props.children}
95
- </DataTable >
96
- );
97
- };
@@ -1,5 +0,0 @@
1
- // Copyright (c) Cratis. All rights reserved.
2
- // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
-
4
- export * from './DataTableForQuery';
5
- export * from './DataTableForObservableQuery';
@@ -1,26 +0,0 @@
1
- // Copyright (c) Cratis. All rights reserved.
2
- // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
-
4
- import React from 'react';
5
- import { Meta, StoryObj } from '@storybook/react';
6
- import { BusyIndicatorDialog } from './BusyIndicatorDialog';
7
-
8
- const meta: Meta<typeof BusyIndicatorDialog> = {
9
- title: 'Dialogs/BusyIndicatorDialog',
10
- component: BusyIndicatorDialog,
11
- };
12
-
13
- export default meta;
14
- type Story = StoryObj<typeof BusyIndicatorDialog>;
15
-
16
- export const Default: Story = {
17
- args: {
18
- title: 'Loading',
19
- message: 'Please wait while we process your request...'
20
- },
21
- render: (args) => (
22
- <div className="storybook-wrapper">
23
- <BusyIndicatorDialog {...args} />
24
- </div>
25
- )
26
- };
@@ -1,26 +0,0 @@
1
- // Copyright (c) Cratis. All rights reserved.
2
- // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
-
4
- import { Dialog } from 'primereact/dialog';
5
- import { BusyIndicatorDialogRequest } from '@cratis/arc.react/dialogs';
6
- import { ProgressSpinner } from 'primereact/progressspinner';
7
-
8
- export const BusyIndicatorDialog = (props: BusyIndicatorDialogRequest) => {
9
-
10
- const headerElement = (
11
- <div className="inline-flex align-items-center justify-content-center gap-2">
12
- <span className="font-bold white-space-nowrap">{props.title}</span>
13
- </div>
14
- );
15
-
16
- return (
17
- <>
18
- <Dialog header={headerElement} modal visible={true} onHide={() => undefined}>
19
- <ProgressSpinner />
20
- <p className="m-0">
21
- {props.message}
22
- </p>
23
- </Dialog>
24
- </>
25
- );
26
- };
@@ -1,36 +0,0 @@
1
- // Copyright (c) Cratis. All rights reserved.
2
- // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
-
4
- import React from 'react';
5
- import { Meta, StoryObj } from '@storybook/react';
6
- import { ConfirmationDialog } from './ConfirmationDialog';
7
- import { DialogButtons, DialogComponents, useConfirmationDialog } from '@cratis/arc.react/dialogs';
8
-
9
- const meta: Meta<typeof ConfirmationDialog> = {
10
- title: 'Dialogs/ConfirmationDialog',
11
- component: ConfirmationDialog,
12
- };
13
-
14
- export default meta;
15
- type Story = StoryObj<typeof ConfirmationDialog>;
16
-
17
- const DialogWrapper = ({ title, message }: { title: string; message: string }) => {
18
- const [showDialog] = useConfirmationDialog(title, message, DialogButtons.YesNoCancel);
19
- return (
20
- <button onClick={() => showDialog()}>Show dialog</button>
21
- );
22
- };
23
-
24
- export const Default: Story = {
25
- args: {
26
- title: 'Are you sure you want to proceed?',
27
- message: 'Do you really really want to proceed with this action?'
28
- },
29
- render: (args: any) => (
30
- <div className="storybook-wrapper" >
31
- <DialogComponents confirmation={ConfirmationDialog}>
32
- <DialogWrapper title={args.title} message={args.message} />
33
- </DialogComponents>
34
- </div>
35
- )
36
- };
@@ -1,75 +0,0 @@
1
- // Copyright (c) Cratis. All rights reserved.
2
- // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
-
4
- import { Dialog } from 'primereact/dialog';
5
- import { DialogButtons, ConfirmationDialogRequest } from '@cratis/arc.react/dialogs';
6
- import { DialogResult, useDialogContext } from '@cratis/arc.react/dialogs';
7
- import { Button } from 'primereact/button';
8
-
9
- export const ConfirmationDialog = () => {
10
- const { request, closeDialog } = useDialogContext<ConfirmationDialogRequest>();
11
-
12
- const headerElement = (
13
- <div className="inline-flex align-items-center justify-content-center gap-2">
14
- <span className="font-bold white-space-nowrap">{request.title}</span>
15
- </div>
16
- );
17
-
18
- const okFooter = (
19
- <>
20
- <Button label="Ok" icon="pi pi-check" onClick={() => closeDialog(DialogResult.Ok)} autoFocus />
21
- </>
22
- );
23
-
24
- const okCancelFooter = (
25
- <>
26
- <Button label="Ok" icon="pi pi-check" onClick={() => closeDialog(DialogResult.Ok)} autoFocus />
27
- <Button label="Cancel" icon="pi pi-times" severity='secondary' onClick={() => closeDialog(DialogResult.Cancelled)} />
28
- </>
29
- );
30
-
31
- const yesNoFooter = (
32
- <>
33
- <Button label="Yes" icon="pi pi-check" onClick={() => closeDialog(DialogResult.Yes)} autoFocus />
34
- <Button label="No" icon="pi pi-times" severity='secondary' onClick={() => closeDialog(DialogResult.No)} />
35
- </>
36
- );
37
-
38
- const yesNoCancelFooter = (
39
- <>
40
- <Button label="Yes" icon="pi pi-check" onClick={() => closeDialog(DialogResult.Yes)} autoFocus />
41
- <Button label="No" icon="pi pi-times" severity='secondary' onClick={() => closeDialog(DialogResult.No)} />
42
- </>
43
- );
44
-
45
- const getFooterInterior = () => {
46
- switch (request.buttons) {
47
- case DialogButtons.Ok:
48
- return okFooter;
49
- case DialogButtons.OkCancel:
50
- return okCancelFooter;
51
- case DialogButtons.YesNo:
52
- return yesNoFooter;
53
- case DialogButtons.YesNoCancel:
54
- return yesNoCancelFooter;
55
- }
56
-
57
- return (<></>);
58
- };
59
-
60
- const footer = (
61
- <div className="card flex flex-wrap justify-content-center gap-3">
62
- {getFooterInterior()}
63
- </div>
64
- );
65
-
66
- return (
67
- <>
68
- <Dialog header={headerElement} modal footer={footer} onHide={() => closeDialog(DialogResult.Cancelled)} visible={true}>
69
- <p className="m-0">
70
- {request.message}
71
- </p>
72
- </Dialog>
73
- </>
74
- );
75
- };
package/Dialogs/index.ts DELETED
@@ -1,5 +0,0 @@
1
- // Copyright (c) Cratis. All rights reserved.
2
- // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
-
4
- export * from './ConfirmationDialog';
5
- export * from './BusyIndicatorDialog';
@@ -1,23 +0,0 @@
1
- // Copyright (c) Cratis. All rights reserved.
2
- // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
-
4
- import React from 'react';
5
- import { Dropdown as PrimeDropdown, DropdownProps as PrimeDropdownProps } from 'primereact/dropdown';
6
- import { useOverlayZIndex } from '../useOverlayZIndex';
7
-
8
- export type DropdownProps = PrimeDropdownProps;
9
-
10
- export const Dropdown = React.forwardRef<PrimeDropdown, DropdownProps>((props, ref) => {
11
- // Force z-index on the dropdown panel to appear above dialogs
12
- useOverlayZIndex('p-dropdown-panel');
13
-
14
- return (
15
- <PrimeDropdown
16
- ref={ref}
17
- {...props}
18
- appendTo={props.appendTo ?? document.body}
19
- />
20
- );
21
- });
22
-
23
- Dropdown.displayName = 'Dropdown';
package/Dropdown/index.ts DELETED
@@ -1,4 +0,0 @@
1
- // Copyright (c) Cratis. All rights reserved.
2
- // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
-
4
- export * from './Dropdown';
@@ -1,24 +0,0 @@
1
- // Copyright (c) Cratis. All rights reserved.
2
- // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
-
4
- import React from 'react';
5
- import { Meta, StoryObj } from '@storybook/react';
6
- import { PivotViewer } from './PivotViewer';
7
-
8
- const meta: Meta<typeof PivotViewer> = {
9
- title: 'PivotViewer/PivotViewer',
10
- component: PivotViewer,
11
- };
12
-
13
- export default meta;
14
- type Story = StoryObj<typeof PivotViewer>;
15
-
16
- export const Default: Story = {
17
- args: {
18
- },
19
- render: (args) => (
20
- <div className="storybook-wrapper" >
21
- <PivotViewer {...args} data={[]} />
22
- </div>
23
- )
24
- };