@veritone-ce/design-system 2.0.0 → 2.0.1
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/esm-next/Icon/factory.js +4 -1
- package/dist/esm-next/Tooltip/index.js +2 -1
- package/dist/types/src-next/Icon/factory.d.ts +7 -9
- package/dist/types/src-next/Icon/internal.d.ts +6 -1
- package/dist/types/src-next/Icon/shared.d.ts +3 -3
- package/dist/types/src-next/Icon/wrappers.d.ts +2 -2
- package/dist/types/src-next/Tooltip/index.d.ts +3 -1
- package/package.json +1 -1
|
@@ -10,7 +10,10 @@ function createIconComponent({
|
|
|
10
10
|
fallback = DefaultIconFallback
|
|
11
11
|
}) {
|
|
12
12
|
return forwardRef(function Icon({ name, ...genericProps }, ref) {
|
|
13
|
-
const ResolvedIcon = React__default.useMemo(
|
|
13
|
+
const ResolvedIcon = React__default.useMemo(
|
|
14
|
+
() => iconMap[name] ?? fallback,
|
|
15
|
+
[name]
|
|
16
|
+
);
|
|
14
17
|
return /* @__PURE__ */ jsx(ResolvedIcon, { ref, name, ...genericProps });
|
|
15
18
|
});
|
|
16
19
|
}
|
|
@@ -8,13 +8,14 @@ import { defaultThemeCssVariableUsages } from '../styles/defaultTheme.js';
|
|
|
8
8
|
import '@mui/system';
|
|
9
9
|
import '../styles/styled.js';
|
|
10
10
|
|
|
11
|
-
function Tooltip(props) {
|
|
11
|
+
function Tooltip({ placement = "bottom", ...props }) {
|
|
12
12
|
const [_isOpen, setIsOpen] = React__default.useState(false);
|
|
13
13
|
const isOpen = props.isOpen ?? _isOpen;
|
|
14
14
|
const arrowRef = React__default.useRef(null);
|
|
15
15
|
const { refs, floatingStyles, context } = useFloating({
|
|
16
16
|
open: isOpen,
|
|
17
17
|
onOpenChange: setIsOpen,
|
|
18
|
+
placement,
|
|
18
19
|
middleware: [
|
|
19
20
|
shift(),
|
|
20
21
|
flip(),
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { CommonIconProps, GenericIconComponent } from './shared.js';
|
|
3
|
-
export type IconMap = {
|
|
4
|
-
[key: string]: GenericIconComponent
|
|
3
|
+
export type IconMap<ExtraProps extends object = {}> = {
|
|
4
|
+
[key: string]: GenericIconComponent<ExtraProps>;
|
|
5
5
|
};
|
|
6
6
|
export declare const DefaultIconFallback: GenericIconComponent;
|
|
7
|
-
export type IconProps = CommonIconProps & {
|
|
7
|
+
export type IconProps<ExtraProps extends object = {}> = CommonIconProps<ExtraProps> & {
|
|
8
8
|
name: string;
|
|
9
9
|
};
|
|
10
|
-
export type IconFactoryOptions = {
|
|
11
|
-
iconMap?: IconMap
|
|
12
|
-
fallback?: GenericIconComponent
|
|
10
|
+
export type IconFactoryOptions<ExtraProps extends object = {}> = {
|
|
11
|
+
iconMap?: IconMap<ExtraProps>;
|
|
12
|
+
fallback?: GenericIconComponent<ExtraProps>;
|
|
13
13
|
};
|
|
14
|
-
export declare function createIconComponent({ iconMap, fallback }: IconFactoryOptions): React.ForwardRefExoticComponent<
|
|
15
|
-
name: string;
|
|
16
|
-
} & React.RefAttributes<HTMLSpanElement>>;
|
|
14
|
+
export declare function createIconComponent<ExtraProps extends object = {}>({ iconMap, fallback }: IconFactoryOptions<ExtraProps>): React.ForwardRefExoticComponent<React.PropsWithoutRef<IconProps<ExtraProps>> & React.RefAttributes<HTMLSpanElement>>;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare const DSIcon: React.ForwardRefExoticComponent<
|
|
2
|
+
export declare const DSIcon: React.ForwardRefExoticComponent<{
|
|
3
|
+
name?: string | undefined;
|
|
4
|
+
size?: import("./wrappers.js").IconSize | undefined;
|
|
5
|
+
style?: React.CSSProperties | undefined;
|
|
6
|
+
className?: string | undefined;
|
|
7
|
+
} & {
|
|
3
8
|
name: string;
|
|
4
9
|
} & React.RefAttributes<HTMLSpanElement>>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { type ForwardRefExoticComponent } from 'react';
|
|
2
2
|
import type { IconSize } from './wrappers.js';
|
|
3
|
-
export type CommonIconProps = {
|
|
3
|
+
export type CommonIconProps<ExtraProps extends object = {}> = {
|
|
4
4
|
name?: string;
|
|
5
5
|
size?: IconSize;
|
|
6
6
|
style?: React.CSSProperties;
|
|
7
7
|
className?: string;
|
|
8
|
-
};
|
|
9
|
-
export type GenericIconComponent = ForwardRefExoticComponent<CommonIconProps & React.RefAttributes<HTMLSpanElement>>;
|
|
8
|
+
} & ExtraProps;
|
|
9
|
+
export type GenericIconComponent<ExtraProps extends object = {}> = ForwardRefExoticComponent<CommonIconProps<ExtraProps> & React.RefAttributes<HTMLSpanElement>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import SVGIcon from '@mui/material/SvgIcon';
|
|
3
2
|
import type { GenericIconComponent } from './shared.js';
|
|
3
|
+
import type { SvgIconProps } from '@mui/material';
|
|
4
4
|
export type IconSize = 'large' | 'medium' | 'small' | 'inherit';
|
|
5
|
-
export declare function adaptMuiSvgIcon(MuiIcon:
|
|
5
|
+
export declare function adaptMuiSvgIcon(MuiIcon: React.ComponentType<SvgIconProps>): GenericIconComponent;
|
|
6
6
|
export declare function adaptSvgIcon(svg: React.JSX.Element): GenericIconComponent;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { PopoverPlacement } from '../popover/index.js';
|
|
2
3
|
export type TooltipProps = {
|
|
3
4
|
isOpen?: boolean;
|
|
4
5
|
children?: React.ReactNode;
|
|
5
6
|
tooltip?: React.ReactNode;
|
|
7
|
+
placement?: PopoverPlacement;
|
|
6
8
|
style?: React.CSSProperties;
|
|
7
9
|
className?: string;
|
|
8
10
|
};
|
|
9
|
-
declare function Tooltip(props: TooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare function Tooltip({ placement, ...props }: TooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
10
12
|
export default Tooltip;
|