Skip to content

Commit

Permalink
fix(components): fix checkbox types (sdds-serv, caldera-online, plasm…
Browse files Browse the repository at this point in the history
…a-asdk)
  • Loading branch information
iljs committed May 28, 2024
1 parent c00640c commit b6ed5bf
Show file tree
Hide file tree
Showing 23 changed files with 284 additions and 68 deletions.
63 changes: 55 additions & 8 deletions packages/caldera-online/api/caldera-online.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { addFocus } from '@salutejs/plasma-new-hope/styled-components';
import { AnchorHTMLAttributes } from 'react';
import type { BaseboxProps } from '@salutejs/plasma-new-hope/styled-components';
import { BaseboxProps } from '@salutejs/plasma-new-hope/styled-components';
import { bodyL } from '@salutejs/caldera-online-themes/tokens';
import { bodyLBold } from '@salutejs/caldera-online-themes/tokens';
import { bodyM } from '@salutejs/caldera-online-themes/tokens';
Expand All @@ -22,6 +22,8 @@ import { bodyXXSBold } from '@salutejs/caldera-online-themes/tokens';
import { BoldProps } from '@salutejs/plasma-new-hope/types/components/Typography/Typography.types';
import { ButtonHTMLAttributes } from 'react';
import { ButtonProps as ButtonProps_2 } from '@salutejs/plasma-new-hope/styled-components';
import { CheckboxProps as CheckboxProps_2 } from '@salutejs/plasma-new-hope/types/components/Checkbox/Checkbox.types';
import { ComponentProps } from 'react';
import { CustomToastProps } from '@salutejs/plasma-new-hope/types/components/Toast/Toast.types';
import { DropdownProps } from '@salutejs/plasma-new-hope/styled-components';
import { dsplL } from '@salutejs/caldera-online-themes/tokens';
Expand All @@ -45,7 +47,8 @@ import { h4Bold } from '@salutejs/caldera-online-themes/tokens';
import { h5 } from '@salutejs/caldera-online-themes/tokens';
import { h5Bold } from '@salutejs/caldera-online-themes/tokens';
import { HTMLAttributes } from 'react';
import type { InputHTMLAttributes } from 'react';
import { InputHTMLAttributes } from '@salutejs/plasma-new-hope/types/types';
import type { InputHTMLAttributes as InputHTMLAttributes_2 } from 'react';
import { LinkCustomProps } from '@salutejs/plasma-new-hope/types/components/Link/Link';
import { mediaQuery } from '@salutejs/plasma-new-hope/styled-components';
import { modalClasses } from '@salutejs/plasma-new-hope/styled-components';
Expand Down Expand Up @@ -195,12 +198,34 @@ fixed: string;
export type ButtonProps = typeof ButtonComponent;

// @public
export const Checkbox: FunctionComponent<BaseboxProps>;
export const Checkbox: FunctionComponent<PropsType< {
size: {
s: string;
m: string;
};
view: {
default: string;
primary: string;
secondary: string;
tertiary: string;
paragraph: string;
accent: string;
positive: string;
warning: string;
negative: string;
};
disabled: {
true: string;
};
focused: {
true: string;
};
}> & CheckboxProps_2 & RefAttributes<HTMLInputElement>>;

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

// @public (undocumented)
export const Dropdown: FunctionComponent<PropsType< {
Expand Down Expand Up @@ -371,12 +396,34 @@ export { PopupProps }
export { PopupProvider }

// @public
export const Radiobox: FunctionComponent<Omit<BaseboxProps, "indeterminate">>;
export const Radiobox: FunctionComponent<PropsType< {
size: {
s: string;
m: string;
};
view: {
default: string;
primary: string;
secondary: string;
tertiary: string;
paragraph: string;
accent: string;
positive: string;
warning: string;
negative: string;
};
disabled: {
true: string;
};
focused: {
true: string;
};
}> & Filter<InputHTMLAttributes<HTMLInputElement>, "size"> & Omit<BaseboxProps, "indeterminate"> & RefAttributes<HTMLInputElement>>;

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

export { RadioGroup }

Expand Down Expand Up @@ -511,7 +558,7 @@ true: string;
focused: {
true: string;
};
}> & Filter<InputHTMLAttributes<HTMLInputElement>, "size"> & SwitchPropsVariations & RefAttributes<HTMLInputElement>>;
}> & Filter<InputHTMLAttributes_2<HTMLInputElement>, "size"> & SwitchPropsVariations & RefAttributes<HTMLInputElement>>;

// @public (undocumented)
export type SwitchProps = {
Expand All @@ -525,7 +572,7 @@ export type SwitchProps = {
pressed?: boolean;
focused?: boolean;
outlined?: boolean;
} & FocusProps & Omit<React.LabelHTMLAttributes<HTMLLabelElement>, 'onChange' | 'onFocus' | 'onBlur'> & Pick<InputHTMLAttributes<HTMLInputElement>, 'name' | 'value' | 'checked' | 'disabled' | 'readOnly' | 'onChange' | 'onFocus' | 'onBlur'>;
} & FocusProps & Omit<React.LabelHTMLAttributes<HTMLLabelElement>, 'onChange' | 'onFocus' | 'onBlur'> & Pick<InputHTMLAttributes_2<HTMLInputElement>, 'name' | 'value' | 'checked' | 'disabled' | 'readOnly' | 'onChange' | 'onFocus' | 'onBlur'>;

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

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

const mergedConfig = mergeConfig(checkboxConfig, config);
const CheckboxComponent = component(mergedConfig) as React.FunctionComponent<BaseboxProps>;
const CheckboxComponent = component(mergedConfig);

export type CheckboxProps = typeof CheckboxComponent;
export type CheckboxProps = ComponentProps<typeof CheckboxComponent>;

/**
* Флажок или чекбокс. Позволяет пользователю управлять параметром с двумя состояниями — ☑ включено и ☐ отключено.
Expand Down
6 changes: 3 additions & 3 deletions packages/caldera-online/src/components/Radiobox/Radiobox.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { radioboxConfig, component, mergeConfig } from '@salutejs/plasma-new-hope/styled-components';
import type { BaseboxProps } from '@salutejs/plasma-new-hope/styled-components';
import { ComponentProps } from 'react';

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

const mergedConfig = mergeConfig(radioboxConfig, config);
const RadioboxComponent = component(mergedConfig) as React.FunctionComponent<Omit<BaseboxProps, 'indeterminate'>>;
const RadioboxComponent = component(mergedConfig);

export type RadioboxProps = typeof RadioboxComponent;
export type RadioboxProps = ComponentProps<typeof RadioboxComponent>;

/**
* Переключатель, или *радиокнопка*.
Expand Down
47 changes: 39 additions & 8 deletions packages/plasma-asdk/api/plasma-asdk.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@
/// <reference types="react" />

import { AnchorHTMLAttributes } from 'react';
import type { BaseboxProps } from '@salutejs/plasma-new-hope/styled-components';
import { BaseboxProps } from '@salutejs/plasma-new-hope/styled-components';
import { BoldProps } from '@salutejs/plasma-new-hope/types/components/Typography/Typography.types';
import { ButtonProps as ButtonProps_2 } from '@salutejs/plasma-new-hope/styled-components';
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 { FocusProps } from '@salutejs/plasma-new-hope/styled-components';
import { FunctionComponent } from 'react';
import { HTMLAttributes } from 'react';
import type { InputHTMLAttributes } from 'react';
import { InputHTMLAttributes } from '@salutejs/plasma-new-hope/types/types';
import type { InputHTMLAttributes as InputHTMLAttributes_2 } from 'react';
import { LinkCustomProps } from '@salutejs/plasma-new-hope/types/components/Link/Link';
import { PropsType } from '@salutejs/plasma-new-hope/types/engines/types';
import { RadioGroup } from '@salutejs/plasma-new-hope/styled-components';
Expand Down Expand Up @@ -155,12 +158,26 @@ m: string;
}> & TypographyOldProps & RefAttributes<HTMLDivElement>>;

// @public
export const Checkbox: FunctionComponent<BaseboxProps>;
export const Checkbox: FunctionComponent<PropsType< {
size: {
s: string;
m: string;
};
view: {
accent: string;
};
disabled: {
true: string;
};
focused: {
true: string;
};
}> & CheckboxProps_2 & RefAttributes<HTMLInputElement>>;

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

// @public (undocumented)
export const DsplL: FunctionComponent<PropsType< {
Expand Down Expand Up @@ -312,12 +329,26 @@ paragraph2: string;
}> & TypographyOldProps & RefAttributes<HTMLDivElement>>;

// @public
export const Radiobox: FunctionComponent<Omit<BaseboxProps, "indeterminate">>;
export const Radiobox: FunctionComponent<PropsType< {
size: {
s: string;
m: string;
};
view: {
accent: string;
};
disabled: {
true: string;
};
focused: {
true: string;
};
}> & Filter<InputHTMLAttributes<HTMLInputElement>, "size"> & Omit<BaseboxProps, "indeterminate"> & RefAttributes<HTMLInputElement>>;

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

export { RadioGroup }

Expand Down Expand Up @@ -380,7 +411,7 @@ true: string;
focused: {
true: string;
};
}> & Filter<InputHTMLAttributes<HTMLInputElement>, "size"> & SwitchPropsVariations & RefAttributes<HTMLInputElement>>;
}> & Filter<InputHTMLAttributes_2<HTMLInputElement>, "size"> & SwitchPropsVariations & RefAttributes<HTMLInputElement>>;

// @public (undocumented)
export type SwitchProps = {
Expand All @@ -394,7 +425,7 @@ export type SwitchProps = {
pressed?: boolean;
focused?: boolean;
outlined?: boolean;
} & FocusProps & Omit<React.LabelHTMLAttributes<HTMLLabelElement>, 'onChange' | 'onFocus' | 'onBlur'> & Pick<InputHTMLAttributes<HTMLInputElement>, 'name' | 'value' | 'checked' | 'disabled' | 'readOnly' | 'onChange' | 'onFocus' | 'onBlur'>;
} & FocusProps & Omit<React.LabelHTMLAttributes<HTMLLabelElement>, 'onChange' | 'onFocus' | 'onBlur'> & Pick<InputHTMLAttributes_2<HTMLInputElement>, 'name' | 'value' | 'checked' | 'disabled' | 'readOnly' | 'onChange' | 'onFocus' | 'onBlur'>;

// @public (undocumented)
export const TextL: FunctionComponent<PropsType< {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { useState } from 'react';
import type { ComponentProps } from 'react';
import type { StoryObj, Meta } from '@storybook/react';
import { action } from '@storybook/addon-actions';

Expand Down Expand Up @@ -33,7 +32,7 @@ const onChange = action('onChange');
const onFocus = action('onFocus');
const onBlur = action('onBlur');

type CheckboxProps = ComponentProps<Base>;
type CheckboxProps = Base;

const meta: Meta<CheckboxProps> = {
title: 'Controls/Checkbox',
Expand Down
6 changes: 3 additions & 3 deletions packages/plasma-asdk/src/components/Checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { checkboxConfig, component, mergeConfig } from '@salutejs/plasma-new-hope/styled-components';
import type { BaseboxProps } from '@salutejs/plasma-new-hope/styled-components';
import { ComponentProps } from 'react';

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

const mergedConfig = mergeConfig(checkboxConfig, config);
const CheckboxComponent = component(mergedConfig) as React.FunctionComponent<BaseboxProps>;
const CheckboxComponent = component(mergedConfig);

export type CheckboxProps = typeof CheckboxComponent;
export type CheckboxProps = ComponentProps<typeof CheckboxComponent>;

/**
* Флажок или чекбокс. Позволяет пользователю управлять параметром с двумя состояниями — ☑ включено и ☐ отключено.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { useState } from 'react';
import type { ComponentProps } from 'react';
import type { StoryObj, Meta } from '@storybook/react';
import { action } from '@storybook/addon-actions';

Expand All @@ -14,7 +13,7 @@ const onChange = action('onChange');
const onFocus = action('onFocus');
const onBlur = action('onBlur');

type RadioboxProps = ComponentProps<Base>;
type RadioboxProps = Base;

const meta: Meta<RadioboxProps> = {
title: 'Controls/Radiobox',
Expand Down
7 changes: 3 additions & 4 deletions packages/plasma-asdk/src/components/Radiobox/Radiobox.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { radioboxConfig, component, mergeConfig } from '@salutejs/plasma-new-hope/styled-components';
import type { BaseboxProps } from '@salutejs/plasma-new-hope/styled-components';
import { ComponentProps } from 'react';

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

const mergedConfig = mergeConfig(radioboxConfig, config);
const RadioboxComponent = component(mergedConfig) as React.FunctionComponent<Omit<BaseboxProps, 'indeterminate'>>;

export type RadioboxProps = typeof RadioboxComponent;
const RadioboxComponent = component(mergedConfig);

export type RadioboxProps = ComponentProps<typeof RadioboxComponent>;
/**
* Переключатель, или *радиокнопка*.
*/
Expand Down
12 changes: 7 additions & 5 deletions packages/plasma-b2c/api/plasma-b2c.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ import { ColSizeProps } from '@salutejs/plasma-new-hope/styled-components';
import { ComboboxPrimitiveValue } from '@salutejs/plasma-new-hope/styled-components';
import { ComboboxProps } from '@salutejs/plasma-new-hope/styled-components';
import { ComponentClass } from 'react';
import { ComponentProps } from 'react';
import { GridProps as ContainerProps } from '@salutejs/plasma-new-hope/styled-components';
import { convertRoundnessMatrix } from '@salutejs/plasma-core';
import { CounterProps } from '@salutejs/plasma-new-hope/styled-components';
Expand Down Expand Up @@ -127,6 +128,7 @@ import { ImageProps } from '@salutejs/plasma-new-hope/styled-components';
import { ImgHTMLAttributes } from 'react';
import { IndicatorProps } from '@salutejs/plasma-new-hope/styled-components';
import { InputHTMLAttributes } from '@salutejs/plasma-core';
import { InputHTMLAttributes as InputHTMLAttributes_2 } from '@salutejs/plasma-new-hope/types/types';
import { JSXElementConstructor } from 'react';
import { LineSkeletonProps } from '@salutejs/plasma-new-hope/styled-components';
import { LinkCustomProps } from '@salutejs/plasma-new-hope/types/components/Link/Link';
Expand Down Expand Up @@ -724,7 +726,7 @@ true: string;
// Warning: (ae-forgotten-export) The symbol "CheckboxComponent" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export type CheckboxProps = typeof CheckboxComponent;
export type CheckboxProps = ComponentProps<typeof CheckboxComponent>;

// @public
export const Chip: FunctionComponent<PropsType< {
Expand Down Expand Up @@ -781,11 +783,11 @@ l: string;
view: {
default: string;
};
}> & ((Omit<InputHTMLAttributes<HTMLInputElement>, "onChange" | "type" | "target" | "size" | "value" | "checked" | "maxLength" | "minLength"> & CustomComboboxProps & {
}> & ((Omit<InputHTMLAttributes<HTMLInputElement>, "onChange" | "type" | "target" | "size" | "value" | "checked" | "minLength" | "maxLength"> & CustomComboboxProps & {
valueType?: "single" | undefined;
value?: ComboboxPrimitiveValue | undefined;
onChangeValue?: ((value?: ComboboxPrimitiveValue | undefined) => void) | undefined;
} & RefAttributes<HTMLInputElement>) | (Omit<InputHTMLAttributes<HTMLInputElement>, "onChange" | "type" | "target" | "size" | "value" | "checked" | "maxLength" | "minLength"> & CustomComboboxProps & {
} & RefAttributes<HTMLInputElement>) | (Omit<InputHTMLAttributes<HTMLInputElement>, "onChange" | "type" | "target" | "size" | "value" | "checked" | "minLength" | "maxLength"> & CustomComboboxProps & {
valueType: "multiple";
value?: ComboboxPrimitiveValue[] | undefined;
onChangeValue?: ((value?: ComboboxPrimitiveValue[] | undefined) => void) | undefined;
Expand Down Expand Up @@ -1484,12 +1486,12 @@ true: string;
focused: {
true: string;
};
}> & Filter<InputHTMLAttributes<HTMLInputElement>, "size"> & Omit<BaseboxProps, "indeterminate"> & RefAttributes<HTMLInputElement>>;
}> & Filter<InputHTMLAttributes_2<HTMLInputElement>, "size"> & Omit<BaseboxProps, "indeterminate"> & RefAttributes<HTMLInputElement>>;

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

export { RadioGroup }

Expand Down
3 changes: 2 additions & 1 deletion packages/plasma-b2c/src/components/Checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { checkboxConfig, component, mergeConfig } from '@salutejs/plasma-new-hope/styled-components';
import { ComponentProps } from 'react';

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

const mergedConfig = mergeConfig(checkboxConfig, config);
const CheckboxComponent = component(mergedConfig);

export type CheckboxProps = typeof CheckboxComponent;
export type CheckboxProps = ComponentProps<typeof CheckboxComponent>;

/**
* Флажок или чекбокс. Позволяет пользователю управлять параметром с двумя состояниями — ☑ включено и ☐ отключено.
Expand Down
4 changes: 2 additions & 2 deletions packages/plasma-b2c/src/components/Radiobox/Radiobox.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { radioboxConfig, component, mergeConfig } from '@salutejs/plasma-new-hope/styled-components';
import { ComponentProps } from 'react';

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

const mergedConfig = mergeConfig(radioboxConfig, config);
const RadioboxComponent = component(mergedConfig);

export type RadioboxProps = typeof RadioboxComponent;

export type RadioboxProps = ComponentProps<typeof RadioboxComponent>;
/**
* Переключатель, или *радиокнопка*.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { InputHTMLAttributes } from 'react';
import type { InputHTMLAttributes } from '../../types';

export interface BaseboxProps {
/**
Expand Down
Loading

0 comments on commit b6ed5bf

Please sign in to comment.