@ws-ui/shared 1.12.4 → 1.13.0-rc2

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 (46) hide show
  1. package/dist/components/Grid.d.ts +26 -0
  2. package/dist/components/Image.d.ts +5 -0
  3. package/dist/components/Panel.d.ts +3 -2
  4. package/dist/components/SearchInput.d.ts +12 -0
  5. package/dist/components/ToolbarIcon/index.d.ts +2 -0
  6. package/dist/components/ToolbarIcon/interfaces.d.ts +21 -0
  7. package/dist/components/Tooltip.d.ts +7 -3
  8. package/dist/components/index.d.ts +4 -3
  9. package/dist/hooks/index.d.ts +8 -0
  10. package/dist/hooks/use-boolean.d.ts +5 -0
  11. package/dist/hooks/use-callback-ref.d.ts +1 -0
  12. package/dist/hooks/use-controllable-state.d.ts +7 -0
  13. package/dist/hooks/use-ds-change-renderer.d.ts +10 -0
  14. package/dist/hooks/use-ds-renderer.d.ts +7 -0
  15. package/dist/hooks/use-form-control-props.d.ts +15 -0
  16. package/dist/hooks/use-safe-layout-effect.d.ts +2 -0
  17. package/dist/hooks/use-update-effect.d.ts +2 -0
  18. package/dist/index.cjs.js +166 -115
  19. package/dist/index.cjs.js.map +1 -1
  20. package/dist/index.d.ts +1 -0
  21. package/dist/index.es.js +26379 -15223
  22. package/dist/index.es.js.map +1 -1
  23. package/dist/providers/index.d.ts +2 -0
  24. package/dist/providers/studio-context.d.ts +7 -0
  25. package/dist/providers/toast-provider.d.ts +18 -0
  26. package/dist/shared.css +1 -1
  27. package/dist/types/adapter.d.ts +12 -0
  28. package/dist/types/explorer.d.ts +31 -0
  29. package/dist/types/index.d.ts +3 -0
  30. package/dist/types/modal.d.ts +11 -4
  31. package/dist/types/roles.d.ts +111 -0
  32. package/dist/types/settings.d.ts +28 -0
  33. package/dist/types/webform-editor.d.ts +132 -1
  34. package/dist/types/welcome-tour.d.ts +3 -0
  35. package/dist/utils/catalog.d.ts +1 -0
  36. package/dist/utils/chakra-utils.d.ts +21 -0
  37. package/dist/utils/common.d.ts +1 -0
  38. package/dist/utils/explorer.d.ts +4 -1
  39. package/dist/utils/index.d.ts +4 -0
  40. package/dist/utils/roles.d.ts +54 -0
  41. package/dist/utils/webform-editor.d.ts +91 -0
  42. package/package.json +6 -6
  43. package/dist/components/Checkbox/index.d.ts +0 -16
  44. package/dist/components/ControlledSwitch.d.ts +0 -10
  45. package/dist/components/FloatingTooltip/index.d.ts +0 -11
  46. package/dist/components/Modal/Button.d.ts +0 -10
@@ -0,0 +1,26 @@
1
+ import { CSSProperties, HTMLAttributes } from 'react';
2
+ type GridValue = number | string | undefined;
3
+ export interface GridProps extends HTMLAttributes<HTMLDivElement> {
4
+ rowGap?: GridValue;
5
+ columnGap?: GridValue;
6
+ templateColumns?: string;
7
+ templateRows?: string;
8
+ height?: GridValue;
9
+ width?: GridValue;
10
+ }
11
+ export declare function Grid({ rowGap, columnGap, templateColumns, templateRows, height, width, style, ...props }: GridProps): import("react/jsx-runtime").JSX.Element;
12
+ export interface GridItemProps extends HTMLAttributes<HTMLDivElement> {
13
+ colStart?: number;
14
+ colSpan?: number;
15
+ rowStart?: number;
16
+ rowSpan?: number;
17
+ sx?: CSSProperties;
18
+ }
19
+ export declare function GridItem({ colStart, colSpan, rowStart, rowSpan, sx, style, ...props }: GridItemProps): import("react/jsx-runtime").JSX.Element;
20
+ export interface SimpleGridProps extends HTMLAttributes<HTMLDivElement> {
21
+ columns?: number;
22
+ spacingX?: GridValue;
23
+ spacingY?: GridValue;
24
+ }
25
+ export declare function SimpleGrid({ columns, spacingX, spacingY, style, ...props }: SimpleGridProps): import("react/jsx-runtime").JSX.Element;
26
+ export {};
@@ -0,0 +1,5 @@
1
+ import { ImgHTMLAttributes, ReactNode } from 'react';
2
+ export interface ImageProps extends Omit<ImgHTMLAttributes<HTMLImageElement>, 'children'> {
3
+ fallback?: ReactNode;
4
+ }
5
+ export declare const Image: import('react').ForwardRefExoticComponent<ImageProps & import('react').RefAttributes<HTMLImageElement>>;
@@ -1,6 +1,7 @@
1
1
  import { FC, PropsWithChildren, ReactNode } from 'react';
2
- export declare const PANEL_INITIAL_HEIGHT = 30;
3
- export declare const PANEL_EXPANDED_HEIGHT = 500;
2
+ export declare const PANEL_COLLAPSED_HEIGHT = 30;
3
+ export declare const PANEL_INITIAL_OPEN_RATIO = 0.3;
4
+ export declare const PANEL_MAX_RATIO = 0.6;
4
5
  export interface ICommonPanelProps {
5
6
  headerRightSide?: ReactNode;
6
7
  }
@@ -0,0 +1,12 @@
1
+ interface ISearchInputProps {
2
+ onChange: (value: string) => void;
3
+ value: string;
4
+ placeholder?: string;
5
+ delay?: number;
6
+ containerClassName?: string;
7
+ onFocusInput?: () => void;
8
+ icon?: string;
9
+ 'data-cy'?: string;
10
+ }
11
+ export declare const SearchInput: React.FC<ISearchInputProps>;
12
+ export {};
@@ -0,0 +1,2 @@
1
+ import { RefForwardingComponent, ToolbarIconProps } from './interfaces';
2
+ export declare const ToolbarIcon: RefForwardingComponent<'span', ToolbarIconProps>;
@@ -0,0 +1,21 @@
1
+ import { IconType } from '@ws-ui/ui-components';
2
+ export type Omit<T, U> = Pick<T, Exclude<keyof T, keyof U>>;
3
+ export type ReplaceProps<Inner extends React.ElementType, P> = Omit<React.ComponentPropsWithRef<Inner>, P> & P;
4
+ export interface WithAsProps<As extends React.ElementType | string = React.ElementType> {
5
+ /** You can use a custom element for this component */
6
+ as?: As;
7
+ }
8
+ export interface RefForwardingComponent<T extends React.ElementType, P> {
9
+ <As extends React.ElementType = T>(props: React.PropsWithChildren<ReplaceProps<As, WithAsProps<As> & P>>, context?: any): React.ReactElement | null;
10
+ propTypes?: any;
11
+ contextTypes?: any;
12
+ displayName?: string;
13
+ }
14
+ export interface ToolbarIconProps<As extends React.ElementType | string = React.ElementType> {
15
+ label: string;
16
+ disabled?: boolean;
17
+ disableHover?: boolean;
18
+ Icon: IconType;
19
+ iconClassname?: string;
20
+ as?: As;
21
+ }
@@ -1,11 +1,15 @@
1
- import { default as React } from 'react';
1
+ import { FC } from 'react';
2
2
  import { Placement } from '@popperjs/core';
3
3
  interface ITooltip {
4
- label: string;
4
+ label: string | JSX.Element;
5
5
  placement?: Placement;
6
6
  className?: string;
7
7
  isDisabled?: boolean;
8
8
  container?: Element;
9
9
  }
10
- export declare const Tooltip: React.FC<ITooltip>;
10
+ export declare const Tooltip: FC<ITooltip>;
11
+ export declare const PopperTooltip: FC<{
12
+ referenceElement: HTMLElement | null;
13
+ label: string;
14
+ }>;
11
15
  export {};
@@ -5,12 +5,13 @@ export * from './Tree';
5
5
  export * from './Incase';
6
6
  export * from './Tips';
7
7
  export * from './Tips/provider';
8
- export * from './ControlledSwitch';
9
8
  export * from './Tooltip';
10
9
  export * from './AppLoader';
11
10
  export * from './Modal';
12
11
  export * from './ZoomComponent';
13
- export * from './FloatingTooltip';
14
12
  export * from './Panel';
15
- export * from './Checkbox';
16
13
  export * from './InvalidJsonError';
14
+ export * from './SearchInput';
15
+ export * from './ToolbarIcon';
16
+ export * from './Grid';
17
+ export * from './Image';
@@ -9,3 +9,11 @@ export * from './useIdentity';
9
9
  export * from './useStateObject';
10
10
  export * from './useDoubleClick';
11
11
  export * from './use-enhanced-state/useEnhancedState';
12
+ export * from './use-ds-renderer';
13
+ export * from './use-ds-change-renderer';
14
+ export * from './use-boolean';
15
+ export * from './use-callback-ref';
16
+ export * from './use-controllable-state';
17
+ export * from './use-safe-layout-effect';
18
+ export * from './use-update-effect';
19
+ export * from './use-form-control-props';
@@ -0,0 +1,5 @@
1
+ export declare function useBoolean(defaultValue?: boolean): readonly [boolean, {
2
+ on: () => void;
3
+ off: () => void;
4
+ toggle: () => void;
5
+ }];
@@ -0,0 +1 @@
1
+ export declare function useCallbackRef<T extends (...args: any[]) => any>(callback: T | undefined): T;
@@ -0,0 +1,7 @@
1
+ import { Dispatch, SetStateAction } from 'react';
2
+ export declare function useControllableProp<T>(prop: T | undefined, state: T): readonly [boolean, T];
3
+ export declare function useControllableState<T>({ value, defaultValue, onChange, }: {
4
+ value?: T;
5
+ defaultValue: T;
6
+ onChange?: (value: T) => void;
7
+ }): readonly [T, Dispatch<SetStateAction<T>>];
@@ -0,0 +1,10 @@
1
+ interface IUseOnDsChange {
2
+ datasourceId: string;
3
+ isDsBuild?: boolean;
4
+ onChange?: (newValue: any) => void;
5
+ }
6
+ export declare const useDsChangeRenderer: ({ datasourceId, isDsBuild, onChange, }: IUseOnDsChange) => {
7
+ loaded: boolean;
8
+ setCurrentSource: (property: string, value: any) => void;
9
+ };
10
+ export {};
@@ -0,0 +1,7 @@
1
+ declare const useDsRendererAdapter: (datasourceId: string) => {
2
+ actions: {
3
+ setProperty: (property: string, value: any) => void;
4
+ getValue: () => datasources.DataSource | undefined;
5
+ };
6
+ };
7
+ export { useDsRendererAdapter };
@@ -0,0 +1,15 @@
1
+ type FormControlLikeProps = {
2
+ disabled?: boolean;
3
+ isDisabled?: boolean;
4
+ readOnly?: boolean;
5
+ isReadOnly?: boolean;
6
+ required?: boolean;
7
+ isRequired?: boolean;
8
+ isInvalid?: boolean;
9
+ };
10
+ export declare function useFormControlProps<T extends FormControlLikeProps>(props: T): T & {
11
+ isDisabled: boolean | undefined;
12
+ isReadOnly: boolean | undefined;
13
+ isRequired: boolean | undefined;
14
+ };
15
+ export {};
@@ -0,0 +1,2 @@
1
+ import { useEffect } from 'react';
2
+ export declare const useSafeLayoutEffect: typeof useEffect;
@@ -0,0 +1,2 @@
1
+ import { DependencyList, EffectCallback } from 'react';
2
+ export declare function useUpdateEffect(effect: EffectCallback, deps: DependencyList): void;