@dxos/react-ui-table 0.7.0 → 0.7.1-staging.7f6f91c
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/lib/browser/index.mjs +19 -20
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +46 -47
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +19 -20
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/Table/Table.d.ts +2 -1
- package/dist/types/src/components/Table/Table.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/common.d.ts +5 -11
- package/dist/types/src/components/Toolbar/common.d.ts.map +1 -1
- package/package.json +27 -27
- package/src/components/Table/ColumnSettings.tsx +1 -1
- package/src/components/Table/Table.stories.tsx +3 -3
- package/src/components/Table/Table.tsx +15 -10
- package/src/components/Toolbar/Toolbar.tsx +5 -4
- package/src/components/Toolbar/common.tsx +9 -10
- package/src/model/selection-model.ts +1 -1
- package/src/model/table-model.ts +1 -1
- package/src/util/table-controls.ts +1 -1
|
@@ -2,20 +2,19 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type Icon } from '@phosphor-icons/react';
|
|
6
5
|
import React from 'react';
|
|
7
6
|
|
|
8
7
|
import {
|
|
8
|
+
Icon,
|
|
9
|
+
type IconProps,
|
|
9
10
|
Toolbar as NaturalToolbar,
|
|
10
11
|
Tooltip,
|
|
11
12
|
type ToolbarButtonProps as NaturalToolbarButtonProps,
|
|
12
13
|
type ToolbarToggleGroupItemProps as NaturalToolbarToggleGroupItemProps,
|
|
13
14
|
} from '@dxos/react-ui';
|
|
14
|
-
import { getSize } from '@dxos/react-ui-theme';
|
|
15
15
|
|
|
16
|
-
// TODO(burdon): Factor out in common with react-ui-editor.
|
|
16
|
+
// TODO(burdon): Factor out into new package (react-ui-toolbar) in common with react-ui-editor, etc.
|
|
17
17
|
|
|
18
|
-
export const iconStyles = getSize(5);
|
|
19
18
|
export const buttonStyles = 'min-bs-0 p-2';
|
|
20
19
|
export const tooltipProps = { side: 'top' as const, classNames: 'z-10' };
|
|
21
20
|
|
|
@@ -25,14 +24,14 @@ export const ToolbarSeparator = () => <div role='separator' className='grow' />;
|
|
|
25
24
|
// ToolbarButton
|
|
26
25
|
//
|
|
27
26
|
|
|
28
|
-
type ToolbarButtonProps = NaturalToolbarButtonProps &
|
|
27
|
+
type ToolbarButtonProps = NaturalToolbarButtonProps & Pick<IconProps, 'icon'>;
|
|
29
28
|
|
|
30
|
-
export const ToolbarButton = ({
|
|
29
|
+
export const ToolbarButton = ({ icon, children, ...props }: ToolbarButtonProps) => {
|
|
31
30
|
return (
|
|
32
31
|
<Tooltip.Root>
|
|
33
32
|
<Tooltip.Trigger asChild>
|
|
34
33
|
<NaturalToolbar.Button variant='ghost' {...props} classNames={buttonStyles}>
|
|
35
|
-
<Icon
|
|
34
|
+
<Icon icon={icon} size={5} />
|
|
36
35
|
<span className='sr-only'>{children}</span>
|
|
37
36
|
</NaturalToolbar.Button>
|
|
38
37
|
</Tooltip.Trigger>
|
|
@@ -50,14 +49,14 @@ export const ToolbarButton = ({ Icon, children, ...props }: ToolbarButtonProps)
|
|
|
50
49
|
// ToolbarToggleButton
|
|
51
50
|
//
|
|
52
51
|
|
|
53
|
-
export type ToolbarToggleButtonProps = NaturalToolbarToggleGroupItemProps &
|
|
52
|
+
export type ToolbarToggleButtonProps = NaturalToolbarToggleGroupItemProps & Pick<IconProps, 'icon'>;
|
|
54
53
|
|
|
55
|
-
export const ToolbarToggleButton = ({
|
|
54
|
+
export const ToolbarToggleButton = ({ icon, children, ...props }: ToolbarToggleButtonProps) => {
|
|
56
55
|
return (
|
|
57
56
|
<Tooltip.Root>
|
|
58
57
|
<Tooltip.Trigger asChild>
|
|
59
58
|
<NaturalToolbar.ToggleGroupItem variant='ghost' {...props} classNames={buttonStyles}>
|
|
60
|
-
<Icon
|
|
59
|
+
<Icon icon={icon} size={5} />
|
|
61
60
|
<span className='sr-only'>{children}</span>
|
|
62
61
|
</NaturalToolbar.ToggleGroupItem>
|
|
63
62
|
</Tooltip.Trigger>
|
|
@@ -28,7 +28,7 @@ export class SelectionModel<T extends BaseTableRow> extends Resource {
|
|
|
28
28
|
if (rows.length === 0) {
|
|
29
29
|
return false;
|
|
30
30
|
}
|
|
31
|
-
return rows.
|
|
31
|
+
return rows.every((row) => this._selection.value.has(row.id));
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
constructor(
|
package/src/model/table-model.ts
CHANGED
|
@@ -14,7 +14,7 @@ export const renderCheckbox = ({
|
|
|
14
14
|
checked = false,
|
|
15
15
|
disabled = false,
|
|
16
16
|
}: RenderCheckboxProps): string => {
|
|
17
|
-
const baseClasses = 'absolute inset-block-[6px] inline-end-[6px]' as const;
|
|
17
|
+
const baseClasses = 'absolute inset-block-[6px] inline-end-[6px] ch-checkbox' as const;
|
|
18
18
|
const { attributes } = tableControls.checkbox;
|
|
19
19
|
return `<input type="checkbox" class="${baseClasses}" ${attributes.checkbox}="${rowIndex}" ${header ? attributes.header : ''} ${checked ? 'checked' : ''} ${disabled ? 'disabled' : ''}/>`;
|
|
20
20
|
};
|