Skip to content

Commit

Permalink
fix(docs): Change proptable and check types after json generate
Browse files Browse the repository at this point in the history
  • Loading branch information
iljs committed Jun 13, 2024
1 parent ca77d81 commit b8e7a17
Show file tree
Hide file tree
Showing 29 changed files with 256 additions and 117 deletions.
30 changes: 24 additions & 6 deletions packages/caldera-online/api/caldera-online.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { dsplMBold } from '@salutejs/caldera-online-themes/tokens';
import { dsplS } from '@salutejs/caldera-online-themes/tokens';
import { dsplSBold } from '@salutejs/caldera-online-themes/tokens';
import { Filter } from '@salutejs/plasma-new-hope/types/engines/types';
import { ForwardRefExoticComponent } from 'react';
import type { ForwardRefExoticComponent } from 'react';
import { FunctionComponent } from 'react';
import { h1 } from '@salutejs/caldera-online-themes/tokens';
import { h1Bold } from '@salutejs/caldera-online-themes/tokens';
Expand Down Expand Up @@ -68,7 +68,7 @@ import { ShowToastArgs } from '@salutejs/plasma-new-hope/styled-components';
import { SpacingProps } from '@salutejs/plasma-new-hope/styled-components';
import { SSRProvider } from '@salutejs/plasma-new-hope/styled-components';
import { StyledComponent } from 'styled-components';
import type { SwitchProps } from '@salutejs/plasma-core';
import { SwitchProps as SwitchProps_2 } from '@salutejs/plasma-new-hope/styled-components';
import { textL } from '@salutejs/caldera-online-themes/tokens';
import { textLBold } from '@salutejs/caldera-online-themes/tokens';
import { textM } from '@salutejs/caldera-online-themes/tokens';
Expand Down Expand Up @@ -581,11 +581,29 @@ export type SpinnerProps = HTMLAttributes<HTMLDivElement> & {
export { SSRProvider }

// @public (undocumented)
export const Switch: ForwardRefExoticComponent< {
defaultChecked: boolean;
} & SwitchProps & RefAttributes<HTMLInputElement>>;
export const Switch: FunctionComponent<PropsType< {
size: {
m: string;
};
view: {
default: string;
};
labelPosition: {
before: string;
after: string;
};
disabled: {
true: string;
};
focused: {
true: string;
};
}> & SwitchProps_2 & RefAttributes<HTMLInputElement>>;

export { SwitchProps }
// Warning: (ae-forgotten-export) The symbol "SwitchComponent" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export type SwitchProps = ComponentProps<typeof SwitchComponent>;

// @public (undocumented)
export const TextL: FunctionComponent<PropsType< {
Expand Down
12 changes: 3 additions & 9 deletions packages/caldera-online/src/components/Switch/Switch.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import { switchConfig, component, mergeConfig } from '@salutejs/plasma-new-hope/styled-components';
import type { SwitchProps } from '@salutejs/plasma-core';
import { ComponentProps } from 'react';

import { config } from './Switch.config';

type SwitchPropsCustom = {
defaultChecked: boolean;
} & SwitchProps;

const mergedConfig = mergeConfig(switchConfig, config);
const SwitchComponent = component(mergedConfig);

export const Switch = SwitchComponent as React.ForwardRefExoticComponent<
SwitchPropsCustom & React.RefAttributes<HTMLInputElement>
>;
export type { SwitchProps };
export const Switch = SwitchComponent;
export type SwitchProps = ComponentProps<typeof SwitchComponent>;
29 changes: 23 additions & 6 deletions packages/plasma-asdk/api/plasma-asdk.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { ButtonHTMLAttributes } from 'react';
import { CheckboxProps as CheckboxProps_2 } from '@salutejs/plasma-new-hope/types/components/Checkbox/Checkbox.types';
import { ComponentProps } from 'react';
import { Filter } from '@salutejs/plasma-new-hope/types/engines/types';
import { ForwardRefExoticComponent } from 'react';
import { FunctionComponent } from 'react';
import { HTMLAttributes } from 'react';
import { InputHTMLAttributes } from '@salutejs/plasma-new-hope/types/types';
Expand All @@ -27,7 +26,7 @@ import { SpacingProps } from '@salutejs/plasma-new-hope/styled-components';
import { SSRProvider } from '@salutejs/plasma-new-hope/styled-components';
import { StyledComponent } from 'styled-components';
import { SubtitleProps } from '@salutejs/plasma-new-hope/styled-components';
import type { SwitchProps } from '@salutejs/plasma-core';
import { SwitchProps as SwitchProps_2 } from '@salutejs/plasma-new-hope/styled-components';
import { TypographyOldProps } from '@salutejs/plasma-new-hope/types/components/Typography/Old/TypographyOld';

// @public (undocumented)
Expand Down Expand Up @@ -437,11 +436,29 @@ m: string;
}> & SubtitleProps & RefAttributes<HTMLDivElement>>;

// @public (undocumented)
export const Switch: ForwardRefExoticComponent< {
defaultChecked: boolean;
} & SwitchProps & RefAttributes<HTMLInputElement>>;
export const Switch: FunctionComponent<PropsType< {
size: {
m: string;
};
view: {
default: string;
};
labelPosition: {
before: string;
after: string;
};
disabled: {
true: string;
};
focused: {
true: string;
};
}> & SwitchProps_2 & RefAttributes<HTMLInputElement>>;

export { SwitchProps }
// Warning: (ae-forgotten-export) The symbol "SwitchComponent" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export type SwitchProps = ComponentProps<typeof SwitchComponent>;

// @public (undocumented)
export const TextL: FunctionComponent<PropsType< {
Expand Down
12 changes: 3 additions & 9 deletions packages/plasma-asdk/src/components/Switch/Switch.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import { switchConfig, component, mergeConfig } from '@salutejs/plasma-new-hope/styled-components';
import type { SwitchProps } from '@salutejs/plasma-core';
import { ComponentProps } from 'react';

import { config } from './Switch.config';

type SwitchPropsCustom = {
defaultChecked: boolean;
} & SwitchProps;

const mergedConfig = mergeConfig(switchConfig, config);
const SwitchComponent = component(mergedConfig);

export const Switch = SwitchComponent as React.ForwardRefExoticComponent<
SwitchPropsCustom & React.RefAttributes<HTMLInputElement>
>;
export type { SwitchProps };
export const Switch = SwitchComponent;
export type SwitchProps = ComponentProps<typeof SwitchComponent>;
28 changes: 23 additions & 5 deletions packages/plasma-b2c/api/plasma-b2c.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ import { StyledCard } from '@salutejs/plasma-hope';
import { StyledComponent } from 'styled-components';
import { StyledPreviewGallery } from '@salutejs/plasma-hope';
import { SubtitleProps } from '@salutejs/plasma-new-hope/styled-components';
import type { SwitchProps } from '@salutejs/plasma-core';
import { SwitchProps as SwitchProps_2 } from '@salutejs/plasma-new-hope/styled-components';
import { syntheticFocus } from '@salutejs/plasma-core';
import { TabItemProps } from '@salutejs/plasma-new-hope/styled-components';
import { TabItemRefs } from '@salutejs/plasma-new-hope/styled-components';
Expand Down Expand Up @@ -1873,11 +1873,29 @@ m: string;
}> & SubtitleProps & RefAttributes<HTMLDivElement>>;

// @public (undocumented)
export const Switch: ForwardRefExoticComponent< {
defaultChecked: boolean;
} & SwitchProps & RefAttributes<HTMLInputElement>>;
export const Switch: FunctionComponent<PropsType< {
size: {
m: string;
};
view: {
default: string;
};
labelPosition: {
before: string;
after: string;
};
disabled: {
true: string;
};
focused: {
true: string;
};
}> & SwitchProps_2 & RefAttributes<HTMLInputElement>>;

export { SwitchProps }
// Warning: (ae-forgotten-export) The symbol "SwitchComponent" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export type SwitchProps = ComponentProps<typeof SwitchComponent>;

export { syntheticFocus }

Expand Down
12 changes: 3 additions & 9 deletions packages/plasma-b2c/src/components/Switch/Switch.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import { switchConfig, component, mergeConfig } from '@salutejs/plasma-new-hope/styled-components';
import type { SwitchProps } from '@salutejs/plasma-core';
import { ComponentProps } from 'react';

import { config } from './Switch.config';

type SwitchPropsCustom = {
defaultChecked: boolean;
} & SwitchProps;

const mergedConfig = mergeConfig(switchConfig, config);
const SwitchComponent = component(mergedConfig);

export const Switch = SwitchComponent as React.ForwardRefExoticComponent<
SwitchPropsCustom & React.RefAttributes<HTMLInputElement>
>;
export type { SwitchProps };
export const Switch = SwitchComponent;
export type SwitchProps = ComponentProps<typeof SwitchComponent>;
8 changes: 5 additions & 3 deletions packages/plasma-new-hope/src/components/Switch/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const switchRoot = (Root: RootProps<HTMLInputElement, SwitchProps>) =>
size,
view,
focused,
outlined,
disabled,
labelPosition,

Expand All @@ -42,20 +43,21 @@ export const switchRoot = (Root: RootProps<HTMLInputElement, SwitchProps>) =>
// singleLine,

checked,
pressed,
defaultChecked,

...rest
} = props;

const exactChecked = Boolean(checked !== undefined ? checked : defaultChecked);
const exactChecked = Boolean((checked ?? pressed) !== undefined ? checked ?? pressed : defaultChecked);
// const singleLineClass = singleLine ? 'single-line' : '';

return (
<Root
view={view}
size={size}
disabled={disabled}
focused={focused}
focused={focused ?? outlined}
labelPosition={labelPosition}
id={id}
style={style}
Expand All @@ -67,7 +69,7 @@ export const switchRoot = (Root: RootProps<HTMLInputElement, SwitchProps>) =>
role="switch"
aria-checked={exactChecked}
type="checkbox"
checked={checked}
checked={checked ?? pressed}
defaultChecked={defaultChecked}
disabled={disabled}
/>
Expand Down
22 changes: 18 additions & 4 deletions packages/plasma-new-hope/src/components/Switch/Switch.types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { InputHTMLAttributes } from 'react';

import { Filter } from '../../engines/types';
import type { InputHTMLAttributes } from '../../types';

export interface SwitchPropsPropsBase {
/**
Expand All @@ -23,7 +21,23 @@ export interface SwitchPropsVariations extends SwitchPropsPropsBase {
*/
labelPosition?: 'before' | 'after';

/**
* Добавить рамку при фокусе
*/
focused?: boolean;

/**
* Нажатие на компонент
* @deprecated
*/
pressed?: boolean;

/**
* Добавить рамку при фокусе
* @deprecated
*/
outlined?: boolean;
}

export type SwitchProps = Filter<InputHTMLAttributes<HTMLInputElement>, 'size'> & SwitchPropsVariations;
// export type SwitchProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> & SwitchPropsVariations;
export interface SwitchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'>, SwitchPropsVariations {}
1 change: 1 addition & 0 deletions packages/plasma-new-hope/src/components/Switch/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { labelPosition_Before } from './_label-position/before';

export { switchRoot, switchConfig } from './Switch';
export { tokens as switchTokens } from './Switch.tokens';
export type { SwitchProps } from './Switch.types';

// TODO: Think how we could name such things
export { labelPosition_Before as Switch_LabelPosition_Before };
Expand Down
28 changes: 23 additions & 5 deletions packages/plasma-web/api/plasma-web.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ import { StyledCard } from '@salutejs/plasma-hope';
import { StyledComponent } from 'styled-components';
import { StyledPreviewGallery } from '@salutejs/plasma-hope';
import { SubtitleProps } from '@salutejs/plasma-new-hope/styled-components';
import type { SwitchProps } from '@salutejs/plasma-core';
import { SwitchProps as SwitchProps_2 } from '@salutejs/plasma-new-hope/styled-components';
import { syntheticFocus } from '@salutejs/plasma-core';
import { TabItemProps } from '@salutejs/plasma-new-hope/styled-components';
import { TabItemRefs } from '@salutejs/plasma-new-hope/styled-components';
Expand Down Expand Up @@ -1875,11 +1875,29 @@ m: string;
}> & SubtitleProps & RefAttributes<HTMLDivElement>>;

// @public (undocumented)
export const Switch: ForwardRefExoticComponent< {
defaultChecked: boolean;
} & SwitchProps & RefAttributes<HTMLInputElement>>;
export const Switch: FunctionComponent<PropsType< {
size: {
m: string;
};
view: {
default: string;
};
labelPosition: {
before: string;
after: string;
};
disabled: {
true: string;
};
focused: {
true: string;
};
}> & SwitchProps_2 & RefAttributes<HTMLInputElement>>;

export { SwitchProps }
// Warning: (ae-forgotten-export) The symbol "SwitchComponent" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export type SwitchProps = ComponentProps<typeof SwitchComponent>;

export { syntheticFocus }

Expand Down
12 changes: 3 additions & 9 deletions packages/plasma-web/src/components/Switch/Switch.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import { switchConfig, component, mergeConfig } from '@salutejs/plasma-new-hope/styled-components';
import type { SwitchProps } from '@salutejs/plasma-core';
import { ComponentProps } from 'react';

import { config } from './Switch.config';

type SwitchPropsCustom = {
defaultChecked: boolean;
} & SwitchProps;

const mergedConfig = mergeConfig(switchConfig, config);
const SwitchComponent = component(mergedConfig);

export const Switch = SwitchComponent as React.ForwardRefExoticComponent<
SwitchPropsCustom & React.RefAttributes<HTMLInputElement>
>;
export type { SwitchProps };
export const Switch = SwitchComponent;
export type SwitchProps = ComponentProps<typeof SwitchComponent>;
28 changes: 23 additions & 5 deletions packages/sdds-serv/api/sdds-serv.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ import { SpacingProps } from '@salutejs/plasma-new-hope/styled-components';
import { SSRProvider } from '@salutejs/plasma-new-hope/styled-components';
import { StatusLabels } from '@salutejs/plasma-new-hope/types/components/Avatar/Avatar.types';
import { StyledComponent } from 'styled-components';
import type { SwitchProps } from '@salutejs/plasma-core';
import { SwitchProps as SwitchProps_2 } from '@salutejs/plasma-new-hope/styled-components';
import { TabItemProps } from '@salutejs/plasma-new-hope/styled-components';
import { TabItemRefs } from '@salutejs/plasma-new-hope/styled-components';
import { TabsContext } from '@salutejs/plasma-new-hope/styled-components';
Expand Down Expand Up @@ -1387,11 +1387,29 @@ export type SpinnerProps = HTMLAttributes<HTMLDivElement> & {
export { SSRProvider }

// @public (undocumented)
export const Switch: ForwardRefExoticComponent< {
defaultChecked: boolean;
} & SwitchProps & RefAttributes<HTMLInputElement>>;
export const Switch: FunctionComponent<PropsType< {
size: {
m: string;
};
view: {
default: string;
};
labelPosition: {
before: string;
after: string;
};
disabled: {
true: string;
};
focused: {
true: string;
};
}> & SwitchProps_2 & RefAttributes<HTMLInputElement>>;

export { SwitchProps }
// Warning: (ae-forgotten-export) The symbol "SwitchComponent" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export type SwitchProps = ComponentProps<typeof SwitchComponent>;

// @public
export const TabItem: FunctionComponent<PropsType< {
Expand Down
Loading

0 comments on commit b8e7a17

Please sign in to comment.