Skip to content

Commit

Permalink
review: fix typo and logic
Browse files Browse the repository at this point in the history
  • Loading branch information
inomdzhon committed Dec 4, 2023
1 parent 50628be commit eb01699
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions packages/vkui/src/components/ChipsInputBase/Chip/Chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ export const Chip = ({
...restProps
}: ChipProps) => {
const { sizeY = 'none' } = useAdaptivity();
// const [focusVisible, setFocusVisible] = React.useState(false);
const { focusVisible, onFocus, onBlur } = useFocusVisible(true);
const { focusVisible, onFocus, onBlur } = useFocusVisible();
const focusVisibleClassName = useFocusVisibleClassName({ focusVisible });
const removeLabel = `${removeAriaLabel} ${getTitleFromChildren(children)}`;

Expand Down
10 changes: 5 additions & 5 deletions packages/vkui/src/components/ChipsSelect/useChipsSelect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ export interface UseChipsSelectProps<O extends ChipOption = ChipOption>
extends UseChipsInputProps<O> {
presets?: O[];
/**
* Возможность создавать чипы которых нет в спискеЖ
* - `true` – по кнопки Enter
* - `string` – через кнопку в пункте меню.
* Возможность создавать чипы которых нет в списке:
* - `true` – добавление по кнопке Enter;
* - `<текст>` – помимо возможности добавления через Enter, в пункте меню появится кнопка с текстом.
* Текст для пункта создающего чипы при клике, так же отвечает за то будет ли показан этот пункт (показывается после того как в списке не останется опций).
*/
creatable?: boolean | string;
Expand Down Expand Up @@ -200,8 +200,8 @@ function transformPresets<O extends ChipOption>({
: presetsProp;

Check warning on line 200 in packages/vkui/src/components/ChipsSelect/useChipsSelect.ts

View check run for this annotation

Codecov / codecov/patch

packages/vkui/src/components/ChipsSelect/useChipsSelect.ts#L200

Added line #L200 was not covered by tests

if (filteredPresetsProp.length === 0) {
if (inputValue !== DEFAULT_INPUT_VALUE && creatable) {
return [{ actionText: typeof creatable === 'string' ? creatable : '' }];
if (inputValue !== DEFAULT_INPUT_VALUE && typeof creatable === 'string') {
return [{ actionText: creatable }];

Check warning on line 204 in packages/vkui/src/components/ChipsSelect/useChipsSelect.ts

View check run for this annotation

Codecov / codecov/patch

packages/vkui/src/components/ChipsSelect/useChipsSelect.ts#L204

Added line #L204 was not covered by tests
}
return [{ placeholder: emptyText }];
}
Expand Down

0 comments on commit eb01699

Please sign in to comment.