@kwiz/fluentui 1.0.29 → 1.0.31
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/controls/divider.d.ts +5 -2
- package/dist/controls/divider.js +4 -3
- package/dist/controls/divider.js.map +1 -1
- package/dist/controls/horizontal.d.ts +3 -1
- package/dist/controls/horizontal.js +3 -2
- package/dist/controls/horizontal.js.map +1 -1
- package/dist/controls/vertical.d.ts +3 -1
- package/dist/controls/vertical.js +3 -2
- package/dist/controls/vertical.js.map +1 -1
- package/dist/helpers/drag-drop/drag-drop-context.d.ts +2 -0
- package/dist/helpers/drag-drop/drag-drop-context.js +6 -2
- package/dist/helpers/drag-drop/drag-drop-context.js.map +1 -1
- package/package.json +1 -1
- package/src/controls/divider.tsx +5 -5
- package/src/controls/horizontal.tsx +2 -2
- package/src/controls/vertical.tsx +2 -2
- package/src/helpers/drag-drop/drag-drop-context.tsx +6 -2
@@ -1,5 +1,8 @@
|
|
1
|
+
import { DividerProps } from '@fluentui/react-components';
|
1
2
|
import React from 'react';
|
2
|
-
interface IProps {
|
3
|
+
interface IProps extends DividerProps {
|
3
4
|
}
|
4
|
-
export declare const DividerEX: React.
|
5
|
+
export declare const DividerEX: React.ForwardRefExoticComponent<IProps & {
|
6
|
+
children?: React.ReactNode | undefined;
|
7
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
5
8
|
export {};
|
package/dist/controls/divider.js
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import { Divider, makeStyles } from '@fluentui/react-components';
|
3
|
+
import React from 'react';
|
3
4
|
const useStyles = makeStyles({
|
4
5
|
separator: {
|
5
6
|
flexGrow: 0
|
6
7
|
}
|
7
8
|
});
|
8
|
-
export const DividerEX = (props) => {
|
9
|
+
export const DividerEX = React.forwardRef((props, ref) => {
|
9
10
|
const cssNames = useStyles();
|
10
|
-
return (_jsx(Divider, Object.assign({}, props, { className: cssNames.separator })));
|
11
|
-
};
|
11
|
+
return (_jsx(Divider, Object.assign({ ref: ref }, props, { className: cssNames.separator })));
|
12
|
+
});
|
12
13
|
//# sourceMappingURL=divider.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"divider.js","sourceRoot":"","sources":["../../src/controls/divider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,
|
1
|
+
{"version":3,"file":"divider.js","sourceRoot":"","sources":["../../src/controls/divider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAgB,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,SAAS,GAAG,UAAU,CAAC;IACzB,SAAS,EAAE;QACP,QAAQ,EAAE,CAAC;KACd;CACJ,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAAoD,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACxG,MAAM,QAAQ,GAAG,SAAS,EAAE,CAAC;IAC7B,OAAO,CACH,KAAC,OAAO,kBAAC,GAAG,EAAE,GAAG,IAAM,KAAK,IAAE,SAAS,EAAE,QAAQ,CAAC,SAAS,IAAI,CAClE,CAAC;AACN,CAAC,CAAC,CAAC"}
|
@@ -4,5 +4,7 @@ interface IProps extends ISectionProps {
|
|
4
4
|
wrap?: boolean;
|
5
5
|
nogap?: boolean;
|
6
6
|
}
|
7
|
-
export declare const Horizontal: React.
|
7
|
+
export declare const Horizontal: React.ForwardRefExoticComponent<IProps & {
|
8
|
+
children?: React.ReactNode | undefined;
|
9
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
8
10
|
export {};
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import { makeStyles } from '@fluentui/react-components';
|
3
3
|
import { isNotEmptyArray } from '@kwiz/common';
|
4
|
+
import React from 'react';
|
4
5
|
import { KnownClassNames, mixins } from '../styles/styles';
|
5
6
|
import { Section } from './section';
|
6
7
|
const useStyles = makeStyles({
|
@@ -8,7 +9,7 @@ const useStyles = makeStyles({
|
|
8
9
|
wrap: mixins.wrap,
|
9
10
|
nogap: mixins.nogap
|
10
11
|
});
|
11
|
-
export const Horizontal = (props) => {
|
12
|
+
export const Horizontal = React.forwardRef((props, ref) => {
|
12
13
|
const cssNames = useStyles();
|
13
14
|
let css = [KnownClassNames.horizontal];
|
14
15
|
css.push(cssNames.horizontal);
|
@@ -19,5 +20,5 @@ export const Horizontal = (props) => {
|
|
19
20
|
if (isNotEmptyArray(props.css))
|
20
21
|
css.push(...props.css);
|
21
22
|
return (_jsx(Section, Object.assign({}, props, { css: css })));
|
22
|
-
};
|
23
|
+
});
|
23
24
|
//# sourceMappingURL=horizontal.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"horizontal.js","sourceRoot":"","sources":["../../src/controls/horizontal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;
|
1
|
+
{"version":3,"file":"horizontal.js","sourceRoot":"","sources":["../../src/controls/horizontal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAiB,OAAO,EAAE,MAAM,WAAW,CAAC;AAEnD,MAAM,SAAS,GAAG,UAAU,CAAC;IACzB,UAAU,kCACH,MAAM,CAAC,IAAI,KACd,aAAa,EAAE,KAAK,GACvB;IACD,IAAI,EAAE,MAAM,CAAC,IAAI;IACjB,KAAK,EAAE,MAAM,CAAC,KAAK;CACtB,CAAC,CAAA;AAMF,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAkD,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACvG,MAAM,QAAQ,GAAG,SAAS,EAAE,CAAC;IAC7B,IAAI,GAAG,GAAa,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;IAEjD,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IAC9B,IAAI,KAAK,CAAC,IAAI;QACV,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,KAAK,CAAC,KAAK;QACX,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE7B,IAAI,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC;QAAE,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;IAEvD,OAAO,CACH,KAAC,OAAO,oBAAK,KAAK,IAAE,GAAG,EAAE,GAAG,IAAI,CACnC,CAAC;AACN,CAAC,CAAC,CAAC"}
|
@@ -4,5 +4,7 @@ interface IProps extends ISectionProps {
|
|
4
4
|
wrap?: boolean;
|
5
5
|
nogap?: boolean;
|
6
6
|
}
|
7
|
-
export declare const Vertical: React.
|
7
|
+
export declare const Vertical: React.ForwardRefExoticComponent<IProps & {
|
8
|
+
children?: React.ReactNode | undefined;
|
9
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
8
10
|
export {};
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import { makeStyles } from '@fluentui/react-components';
|
3
3
|
import { isNotEmptyArray } from '@kwiz/common';
|
4
|
+
import React from 'react';
|
4
5
|
import { KnownClassNames, mixins } from '../styles/styles';
|
5
6
|
import { Section } from './section';
|
6
7
|
const useStyles = makeStyles({
|
@@ -8,7 +9,7 @@ const useStyles = makeStyles({
|
|
8
9
|
wrap: mixins.wrap,
|
9
10
|
nogap: mixins.nogap
|
10
11
|
});
|
11
|
-
export const Vertical = (props) => {
|
12
|
+
export const Vertical = React.forwardRef((props, ref) => {
|
12
13
|
const cssNames = useStyles();
|
13
14
|
let css = [KnownClassNames.vertical];
|
14
15
|
css.push(cssNames.vertical);
|
@@ -19,5 +20,5 @@ export const Vertical = (props) => {
|
|
19
20
|
if (isNotEmptyArray(props.css))
|
20
21
|
css.push(...props.css);
|
21
22
|
return (_jsx(Section, Object.assign({}, props, { css: css })));
|
22
|
-
};
|
23
|
+
});
|
23
24
|
//# sourceMappingURL=vertical.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"vertical.js","sourceRoot":"","sources":["../../src/controls/vertical.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;
|
1
|
+
{"version":3,"file":"vertical.js","sourceRoot":"","sources":["../../src/controls/vertical.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAiB,OAAO,EAAE,MAAM,WAAW,CAAC;AAEnD,MAAM,SAAS,GAAG,UAAU,CAAC;IACzB,QAAQ,kCACD,MAAM,CAAC,IAAI,KACd,aAAa,EAAE,QAAQ,GAC1B;IACD,IAAI,EAAE,MAAM,CAAC,IAAI;IACjB,KAAK,EAAE,MAAM,CAAC,KAAK;CACtB,CAAC,CAAA;AAMF,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAkD,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACrG,MAAM,QAAQ,GAAG,SAAS,EAAE,CAAC;IAC7B,IAAI,GAAG,GAAa,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;IAE/C,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC5B,IAAI,KAAK,CAAC,IAAI;QACV,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,KAAK,CAAC,KAAK;QACX,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE7B,IAAI,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC;QAAE,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;IAEvD,OAAO,CACH,KAAC,OAAO,oBAAK,KAAK,IAAE,GAAG,EAAE,GAAG,IAAI,CACnC,CAAC;AACN,CAAC,CAAC,CAAC"}
|
@@ -22,6 +22,8 @@ export declare function useDragDropContext<DragItemType extends iDraggedItemType
|
|
22
22
|
isOver: boolean;
|
23
23
|
dropRef: import("react-dnd").ConnectDropTarget;
|
24
24
|
};
|
25
|
+
/** an item that this control can handler is being dragged */
|
26
|
+
expectingDrop: boolean;
|
25
27
|
dragDropRef: import("react-dnd").ConnectDragSource;
|
26
28
|
};
|
27
29
|
export declare function useDragDropContextProvider(): iDragDropContext;
|
@@ -19,17 +19,21 @@ export function useDragDropContext(info) {
|
|
19
19
|
const isDroppable = !isNullOrUndefined(info.dropInfo);
|
20
20
|
const drag = useDraggable(info === null || info === void 0 ? void 0 : info.dragInfo);
|
21
21
|
const drop = useDroppable(info === null || info === void 0 ? void 0 : info.dropInfo);
|
22
|
-
const
|
22
|
+
const expectingDrop = isDroppable && !drag.isDragging && dragDropContext.isDragging
|
23
|
+
//check if item being dragged is allowed in this context...
|
24
|
+
&& info.dropInfo.acceptTypes.indexOf(dragDropContext.dragItem.type) >= 0;
|
23
25
|
return {
|
24
26
|
dragDropContext,
|
25
27
|
drag,
|
26
28
|
drop,
|
29
|
+
/** an item that this control can handler is being dragged */
|
30
|
+
expectingDrop,
|
27
31
|
dragDropRef: isDraggable && !isDroppable
|
28
32
|
? drag.dragRef
|
29
33
|
: !isDraggable && isDroppable
|
30
34
|
? drop.dropRef
|
31
35
|
//both drag and drop allowed
|
32
|
-
:
|
36
|
+
: expectingDrop ? drop.dropRef : drag.dragRef
|
33
37
|
};
|
34
38
|
}
|
35
39
|
export function useDragDropContextProvider() {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"drag-drop-context.js","sourceRoot":"","sources":["../../../src/helpers/drag-drop/drag-drop-context.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAqC,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,YAAiC,MAAM,iBAAiB,CAAC;AAOhE,gBAAgB;AAChB,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC,aAAa,CAAmB,IAAI,CAAC,CAAC;AAC3E,kCAAkC;AAClC,MAAM,UAAU,0BAA0B;IACtC,MAAM,eAAe,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;IACpD,OAAO,eAAe,CAAC;AAC3B,CAAC;AACD,MAAM,UAAU,kBAAkB,CAGhC,IAGD;IACG,MAAM,eAAe,GAAG,0BAA0B,EAAE,CAAC;IACrD,MAAM,WAAW,GAAG,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtD,MAAM,WAAW,GAAG,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtD,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,aAAJ,IA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from '@fluentui/react-components';
|
1
|
+
import { Divider, DividerProps, makeStyles } from '@fluentui/react-components';
|
2
2
|
import React from 'react';
|
3
3
|
|
4
4
|
const useStyles = makeStyles({
|
@@ -6,11 +6,11 @@ const useStyles = makeStyles({
|
|
6
6
|
flexGrow: 0
|
7
7
|
}
|
8
8
|
});
|
9
|
-
interface IProps {
|
9
|
+
interface IProps extends DividerProps {
|
10
10
|
}
|
11
|
-
export const DividerEX
|
11
|
+
export const DividerEX = React.forwardRef<HTMLDivElement, (React.PropsWithChildren<IProps>)>((props, ref) => {
|
12
12
|
const cssNames = useStyles();
|
13
13
|
return (
|
14
|
-
<Divider {...props} className={cssNames.separator} />
|
14
|
+
<Divider ref={ref} {...props} className={cssNames.separator} />
|
15
15
|
);
|
16
|
-
}
|
16
|
+
});
|
@@ -17,7 +17,7 @@ interface IProps extends ISectionProps {
|
|
17
17
|
wrap?: boolean;
|
18
18
|
nogap?: boolean;
|
19
19
|
}
|
20
|
-
export const Horizontal
|
20
|
+
export const Horizontal = React.forwardRef<HTMLDivElement, React.PropsWithChildren<IProps>>((props, ref) => {
|
21
21
|
const cssNames = useStyles();
|
22
22
|
let css: string[] = [KnownClassNames.horizontal];
|
23
23
|
|
@@ -32,4 +32,4 @@ export const Horizontal: React.FunctionComponent<React.PropsWithChildren<IProps>
|
|
32
32
|
return (
|
33
33
|
<Section {...props} css={css} />
|
34
34
|
);
|
35
|
-
}
|
35
|
+
});
|
@@ -17,7 +17,7 @@ interface IProps extends ISectionProps {
|
|
17
17
|
wrap?: boolean;
|
18
18
|
nogap?: boolean;
|
19
19
|
}
|
20
|
-
export const Vertical
|
20
|
+
export const Vertical = React.forwardRef<HTMLDivElement, React.PropsWithChildren<IProps>>((props, ref) => {
|
21
21
|
const cssNames = useStyles();
|
22
22
|
let css: string[] = [KnownClassNames.vertical];
|
23
23
|
|
@@ -32,4 +32,4 @@ export const Vertical: React.FunctionComponent<React.PropsWithChildren<IProps>>
|
|
32
32
|
return (
|
33
33
|
<Section {...props} css={css} />
|
34
34
|
);
|
35
|
-
}
|
35
|
+
});
|
@@ -30,18 +30,22 @@ export function useDragDropContext<
|
|
30
30
|
const isDroppable = !isNullOrUndefined(info.dropInfo);
|
31
31
|
const drag = useDraggable(info?.dragInfo);
|
32
32
|
const drop = useDroppable(info?.dropInfo);
|
33
|
-
const
|
33
|
+
const expectingDrop = isDroppable && !drag.isDragging && dragDropContext.isDragging
|
34
|
+
//check if item being dragged is allowed in this context...
|
35
|
+
&& info.dropInfo.acceptTypes.indexOf(dragDropContext.dragItem.type) >= 0;
|
34
36
|
|
35
37
|
return {
|
36
38
|
dragDropContext,
|
37
39
|
drag,
|
38
40
|
drop,
|
41
|
+
/** an item that this control can handler is being dragged */
|
42
|
+
expectingDrop,
|
39
43
|
dragDropRef: isDraggable && !isDroppable
|
40
44
|
? drag.dragRef
|
41
45
|
: !isDraggable && isDroppable
|
42
46
|
? drop.dropRef
|
43
47
|
//both drag and drop allowed
|
44
|
-
:
|
48
|
+
: expectingDrop ? drop.dropRef : drag.dragRef
|
45
49
|
};
|
46
50
|
}
|
47
51
|
export function useDragDropContextProvider(): iDragDropContext {
|