@canlooks/can-ui 0.0.208 → 0.0.209
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/cjs/components/selectedList/selectedItem.d.ts +1 -2
- package/dist/cjs/components/selectedList/selectedItem.js +1 -2
- package/dist/cjs/components/selectedList/selectedList.d.ts +3 -4
- package/dist/cjs/components/selectedList/selectedList.js +1 -2
- package/dist/cjs/components/selectedList/selectedList.style.d.ts +0 -1
- package/dist/cjs/components/selectedList/selectedList.style.js +0 -1
- package/dist/esm/components/selectedList/selectedItem.d.ts +1 -2
- package/dist/esm/components/selectedList/selectedItem.js +1 -2
- package/dist/esm/components/selectedList/selectedList.d.ts +3 -4
- package/dist/esm/components/selectedList/selectedList.js +1 -2
- package/dist/esm/components/selectedList/selectedList.style.d.ts +0 -1
- package/dist/esm/components/selectedList/selectedList.style.js +0 -1
- package/package.json +1 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { AlertProps } from '../alert';
|
|
2
2
|
import { Id } from '../../types';
|
|
3
|
-
|
|
4
|
-
interface SelectedItemProps extends Omit<AlertProps, 'onClose'>, Pick<SelectedListProps, 'itemProps'> {
|
|
3
|
+
interface SelectedItemProps extends Omit<AlertProps, 'onClose'> {
|
|
5
4
|
value: Id;
|
|
6
5
|
index: number;
|
|
7
6
|
itemProps?(value: Id, index: number): AlertProps | Promise<AlertProps>;
|
|
@@ -5,7 +5,6 @@ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
|
5
5
|
const alert_1 = require("../alert");
|
|
6
6
|
const utils_1 = require("../../utils");
|
|
7
7
|
const react_1 = require("react");
|
|
8
|
-
const transitionBase_1 = require("../transitionBase");
|
|
9
8
|
const selectedList_style_1 = require("./selectedList.style");
|
|
10
9
|
const sortableItem_1 = require("../sortableItem");
|
|
11
10
|
function SelectedItem({ value, index, itemProps, onClose, sortable, ...props }) {
|
|
@@ -18,5 +17,5 @@ function SelectedItem({ value, index, itemProps, onClose, sortable, ...props })
|
|
|
18
17
|
alertProps.current?.onClose?.(e);
|
|
19
18
|
onClose?.(value, index);
|
|
20
19
|
};
|
|
21
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)(sortableItem_1.SortableItem, { component: alert_1.Alert, id: value, index: index, closable: true, color: "info", showIcon: false, ...props, ...alertProps.current, className: (0, utils_1.clsx)(selectedList_style_1.classes.optionWrap, alertProps.current?.className), onClose: closeHandler, loading: loading.current }));
|
|
22
21
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { ReactElement, Ref } from 'react';
|
|
2
|
-
import { Id } from '../../types';
|
|
2
|
+
import { DivProps, Id } from '../../types';
|
|
3
3
|
import { AlertProps } from '../alert';
|
|
4
|
-
|
|
5
|
-
export type SelectedListProps<V extends Id = Id> = Omit<TransitionGroupProps, 'ref'> & {
|
|
4
|
+
export interface SelectedListProps<V extends Id = Id> extends DivProps {
|
|
6
5
|
ref?: Ref<any>;
|
|
7
6
|
value?: V[];
|
|
8
7
|
itemProps?(value: V, index: number): AlertProps | Promise<AlertProps>;
|
|
9
8
|
onClose?(value: V, index: number): void;
|
|
10
9
|
sortable?: boolean;
|
|
11
10
|
onSort?(value: V[]): void;
|
|
12
|
-
}
|
|
11
|
+
}
|
|
13
12
|
export declare const SelectedList: <V extends Id = Id>(props: SelectedListProps<V>) => ReactElement;
|
|
@@ -5,7 +5,6 @@ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const utils_1 = require("../../utils");
|
|
7
7
|
const selectedList_style_1 = require("./selectedList.style");
|
|
8
|
-
const react_transition_group_1 = require("react-transition-group");
|
|
9
8
|
const selectionContext_1 = require("../selectionContext");
|
|
10
9
|
const selectedItem_1 = require("./selectedItem");
|
|
11
10
|
const react_2 = require("@dnd-kit/react");
|
|
@@ -23,5 +22,5 @@ exports.SelectedList = (0, react_1.memo)(({ value, itemProps, onClose, sortable,
|
|
|
23
22
|
setInnerValue?.(newValue);
|
|
24
23
|
}
|
|
25
24
|
};
|
|
26
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
25
|
+
return ((0, jsx_runtime_1.jsx)("div", { ...props, css: selectedList_style_1.style, className: (0, utils_1.clsx)(selectedList_style_1.classes.root, props.className), children: (0, jsx_runtime_1.jsx)(react_2.DragDropProvider, { sensors: utils_1.defaultSensors, onDragEnd: dragEndHandler, children: arr?.map((v, i) => (0, jsx_runtime_1.jsx)(selectedItem_1.SelectedItem, { value: v, index: i, itemProps: itemProps, onClose: closeHandler, sortable: sortable }, v)) }) }));
|
|
27
26
|
});
|
|
@@ -5,7 +5,6 @@ const react_1 = require("@emotion/react");
|
|
|
5
5
|
const utils_1 = require("../../utils");
|
|
6
6
|
const alert_style_1 = require("../alert/alert.style");
|
|
7
7
|
exports.classes = (0, utils_1.defineInnerClasses)('selected-list', [
|
|
8
|
-
'option',
|
|
9
8
|
'optionWrap'
|
|
10
9
|
]);
|
|
11
10
|
exports.style = (0, utils_1.defineCss)(({ spacing }) => (0, react_1.css) `
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { AlertProps } from '../alert/index.js';
|
|
2
2
|
import { Id } from '../../types.js';
|
|
3
|
-
|
|
4
|
-
interface SelectedItemProps extends Omit<AlertProps, 'onClose'>, Pick<SelectedListProps, 'itemProps'> {
|
|
3
|
+
interface SelectedItemProps extends Omit<AlertProps, 'onClose'> {
|
|
5
4
|
value: Id;
|
|
6
5
|
index: number;
|
|
7
6
|
itemProps?(value: Id, index: number): AlertProps | Promise<AlertProps>;
|
|
@@ -2,7 +2,6 @@ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
|
2
2
|
import { Alert } from '../alert/index.js';
|
|
3
3
|
import { clsx, useLoading, useSyncState } from '../../utils/index.js';
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
|
-
import { Collapse } from '../transitionBase/index.js';
|
|
6
5
|
import { classes } from './selectedList.style.js';
|
|
7
6
|
import { SortableItem } from '../sortableItem/index.js';
|
|
8
7
|
export function SelectedItem({ value, index, itemProps, onClose, sortable, ...props }) {
|
|
@@ -15,5 +14,5 @@ export function SelectedItem({ value, index, itemProps, onClose, sortable, ...pr
|
|
|
15
14
|
alertProps.current?.onClose?.(e);
|
|
16
15
|
onClose?.(value, index);
|
|
17
16
|
};
|
|
18
|
-
return (_jsx(
|
|
17
|
+
return (_jsx(SortableItem, { component: Alert, id: value, index: index, closable: true, color: "info", showIcon: false, ...props, ...alertProps.current, className: clsx(classes.optionWrap, alertProps.current?.className), onClose: closeHandler, loading: loading.current }));
|
|
19
18
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { ReactElement, Ref } from 'react';
|
|
2
|
-
import { Id } from '../../types.js';
|
|
2
|
+
import { DivProps, Id } from '../../types.js';
|
|
3
3
|
import { AlertProps } from '../alert/index.js';
|
|
4
|
-
|
|
5
|
-
export type SelectedListProps<V extends Id = Id> = Omit<TransitionGroupProps, 'ref'> & {
|
|
4
|
+
export interface SelectedListProps<V extends Id = Id> extends DivProps {
|
|
6
5
|
ref?: Ref<any>;
|
|
7
6
|
value?: V[];
|
|
8
7
|
itemProps?(value: V, index: number): AlertProps | Promise<AlertProps>;
|
|
9
8
|
onClose?(value: V, index: number): void;
|
|
10
9
|
sortable?: boolean;
|
|
11
10
|
onSort?(value: V[]): void;
|
|
12
|
-
}
|
|
11
|
+
}
|
|
13
12
|
export declare const SelectedList: <V extends Id = Id>(props: SelectedListProps<V>) => ReactElement;
|
|
@@ -2,7 +2,6 @@ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
|
2
2
|
import { memo } from 'react';
|
|
3
3
|
import { clsx, defaultSensors, onDndDragEnd, toArray } from '../../utils/index.js';
|
|
4
4
|
import { classes, style } from './selectedList.style.js';
|
|
5
|
-
import { TransitionGroup } from 'react-transition-group';
|
|
6
5
|
import { useSelectionContext } from '../selectionContext/index.js';
|
|
7
6
|
import { SelectedItem } from './selectedItem.js';
|
|
8
7
|
import { DragDropProvider } from '@dnd-kit/react';
|
|
@@ -20,5 +19,5 @@ export const SelectedList = memo(({ value, itemProps, onClose, sortable, onSort,
|
|
|
20
19
|
setInnerValue?.(newValue);
|
|
21
20
|
}
|
|
22
21
|
};
|
|
23
|
-
return (_jsx(
|
|
22
|
+
return (_jsx("div", { ...props, css: style, className: clsx(classes.root, props.className), children: _jsx(DragDropProvider, { sensors: defaultSensors, onDragEnd: dragEndHandler, children: arr?.map((v, i) => _jsx(SelectedItem, { value: v, index: i, itemProps: itemProps, onClose: closeHandler, sortable: sortable }, v)) }) }));
|
|
24
23
|
});
|
|
@@ -2,7 +2,6 @@ import { css } from '@emotion/react';
|
|
|
2
2
|
import { defineInnerClasses, defineCss } from '../../utils/index.js';
|
|
3
3
|
import { classes as alertClasses } from '../alert/alert.style.js';
|
|
4
4
|
export const classes = defineInnerClasses('selected-list', [
|
|
5
|
-
'option',
|
|
6
5
|
'optionWrap'
|
|
7
6
|
]);
|
|
8
7
|
export const style = defineCss(({ spacing }) => css `
|