Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove enumPropNamesArray #2348

Merged
merged 4 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/core/plop/general/component-stories-js.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import styles from "./{{properCase componentName}}.stories.module.scss";

const metaSettings = createStoryMetaSettingsDecorator({
component: {{properCase componentName}},
enumPropNamesArray: [], // List enum props here
iconPropNamesArray: [], // List props that are typed as icons here
actionPropsArray: [] // List the component's actions here
});
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/jsx-props-no-spreading */
import cx from "classnames";
import { ComponentDefaultTestId, getTestId } from "../../../tests/test-ids-utils";
import React, { FC, useContext } from "react";
Expand Down
5 changes: 2 additions & 3 deletions packages/core/src/components/AttentionBox/AttentionBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import styles from "./AttentionBox.module.scss";

export interface AttentionBoxProps extends VibeComponentProps {
className?: string;
// Will remove when releasing version 2 as BREAKING CHANGES
// TODO: [breaking] remove prop
withIconWithoutHeader?: boolean;
/** we support 5 types of attention boxes */
type?: AttentionBoxType;
Expand All @@ -28,6 +28,7 @@ export interface AttentionBoxProps extends VibeComponentProps {
title?: string;
text?: string;
children?: ElementContent;
// TODO: [breaking] remove prop
withoutIcon?: boolean;
onClose?: (event: React.MouseEvent) => void;
compact?: boolean;
Expand All @@ -39,15 +40,13 @@ const AttentionBox: React.FC<AttentionBoxProps> & {
iconTypes?: typeof IconTypeEnum;
} = ({
className,
// TODO Remove in next major as breaking change
withIconWithoutHeader = false,
type = "primary",
icon,
iconType = "svg",
title,
text,
children,
// TODO Remove in next major as breaking change
withoutIcon = false,
onClose,
compact = false,
Expand Down
4 changes: 0 additions & 4 deletions packages/core/src/components/Avatar/AvatarBadge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ export interface AvatarBadgeProps extends VibeComponentProps {
* Use to provide SVG Components
*/
icon?: SubIcon;
// TODO Remove in next major as breaking change
ariaLabel?: string;
tabIndex?: string | number;
className?: string;
size?: AvatarSize;
Expand All @@ -29,8 +27,6 @@ export const AvatarBadge: React.FC<AvatarBadgeProps> & {
} = ({
src,
icon,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
ariaLabel,
tabIndex = 0,
className,
size = "large",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import "./Avatar.stories.scss";

const metaSettings = createStoryMetaSettingsDecorator({
component: Avatar,
enumPropNamesArray: ["type", "size"],
iconPropNamesArray: ["icon"]
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ import { createComponentTemplate, StoryDescription } from "vibe-storybook-compon

const metaSettings = createStoryMetaSettingsDecorator({
component: Badge,
enumPropNamesArray: ["anchor", "alignment", "type"],
iconPropNamesArray: [],
actionPropsArray: [],
ignoreControlsPropNamesArray: ["children"]
});

Expand Down
28 changes: 1 addition & 27 deletions packages/core/src/components/Box/__stories__/Box.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,7 @@ import { createStoryMetaSettingsDecorator } from "../../../storybook";
import styles from "./Box.stories.module.scss";

const metaSettings = createStoryMetaSettingsDecorator({
component: Box,
enumPropNamesArray: [
"className",
"id",
"children",
"disabled",
"border",
"borderColor",
"rounded",
"shadow",
"margin",
"marginX",
"marginY",
"marginTop",
"marginEnd",
"marginBottom",
"marginStart",
"padding",
"paddingX",
"paddingY",
"paddingTop",
"paddingEnd",
"paddingBottom",
"paddingStart",
"backgroundColor",
"textColor"
]
component: Box
});

export default {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable jsx-a11y/no-noninteractive-tabindex */
import React, { ForwardedRef, forwardRef, useCallback, useMemo } from "react";
import { keyCodes } from "../../../../constants";
import { SubIcon, VibeComponentProps } from "../../../../types";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import { createStoryMetaSettingsDecorator } from "../../../storybook/functions/c
import "./BreadcrumbsBar.stories.scss";

const metaSettings = createStoryMetaSettingsDecorator({
component: BreadcrumbsBar,
enumPropNamesArray: ["type"]
component: BreadcrumbsBar
});

const breadcrumbsBarTemplate = (args: BreadcrumbBarProps) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ type Story = StoryObj<typeof Button>;

const metaSettings = createStoryMetaSettingsDecorator({
component: Button,
enumPropNamesArray: ["kind", "size", "color", "type"],
iconPropNamesArray: ["leftIcon", "rightIcon", "successIcon"],
actionPropsArray: ["onClick"]
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ type Story = StoryObj<typeof ButtonGroup>;

const metaSettings = createStoryMetaSettingsDecorator({
component: ButtonGroup,
enumPropNamesArray: ["kind", "size"],
actionPropsArray: ["onSelect"]
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import styles from "./Chips.stories.module.scss";

const metaSettings = createStoryMetaSettingsDecorator({
component: Chips,
enumPropNamesArray: ["color"],
iconPropNamesArray: ["rightIcon", "leftIcon"],
actionPropsArray: ["onDelete", "onMouseDown", "onClick"]
});
Expand Down
5 changes: 2 additions & 3 deletions packages/core/src/components/Clickable/Clickable.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable jsx-a11y/no-noninteractive-tabindex */
import cx from "classnames";
import React, { AriaRole, forwardRef } from "react";
import { noop as NOOP } from "lodash-es";
Expand Down Expand Up @@ -26,10 +25,10 @@ export interface ClickableProps extends VibeComponentProps {
* Is the element and its content should be hidden from screen readers and other assistive technologies
*/
ariaHidden?: boolean;
// TODO remove string in Vibe 2.0
// TODO: [breaking] remove string type
ariaHasPopup?: boolean | string;
ariaExpanded?: boolean;
// TODO remove string in Vibe 2.0
// TODO: [breaking] remove string type
tabIndex?: string | number;
disabled?: boolean;
style?: React.CSSProperties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { createComponentTemplate } from "vibe-storybook-components";

const metaSettings = createStoryMetaSettingsDecorator({
component: ColorPicker,
enumPropNamesArray: ["colorStyle", "colorSize", "colorShape"],
iconPropNamesArray: ["ColorIndicatorIcon", "SelectedIndicatorIcon", "NoColorIcon"],
actionPropsArray: [{ name: "onSave", linkedToPropValue: "value" }]
});
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/components/Combobox/Combobox.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable jsx-a11y/click-events-have-key-events */
import { camelCase } from "lodash-es";
import cx from "classnames";
import React, { useRef, useState, forwardRef, useMemo, useCallback } from "react";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ export function comboboxItemRenderer({
item: IComboboxItem;
style: CSSProperties;
optionEvents: IComboboxOptionEvents;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
optionRenderData: any;
isVirtualized: boolean;
stickyCategories?: boolean;
Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/components/Combobox/ComboboxService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export const getOptionsByCategories = (
if (result[categoryId]) {
result[categoryId].push(option);
} else {
// eslint-disable-next-line no-param-reassign
result[categoryId] = [option];
}

Expand All @@ -27,7 +26,6 @@ export const getOptionsByCategories = (

// reorder the keys according to the categories order
return Object.keys(categories).reduce((result: OptionsByCategories, categoryId) => {
// eslint-disable-next-line no-param-reassign
if (optionsByCategories[categoryId]) result[categoryId] = optionsByCategories[categoryId];

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import "./Combobox.stories.scss";

const metaSettings = createStoryMetaSettingsDecorator({
component: Combobox,
enumPropNamesArray: ["size"],
iconPropNamesArray: ["searchIcon"],
actionPropsArray: ["onOptionHover", "onOptionLeave", "onFilterChanged"]
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,6 @@ async function onSelectExistFilterClearsFilterTest(canvas) {
expect(option1).toBeInTheDocument();
}

// there is no story which is not overview which activate this ability
// eslint-disable-next-line no-unused-vars
async function onSelectOptionClearsFilterTest(canvas) {
const { comboboxElement, searchElement } = await getComponentElements(canvas);
await typeText(searchElement, "Option");
const optionToClick = getByText(comboboxElement, "Option 1");
await clickElement(optionToClick);
expect(searchElement).toHaveValue("");
const option1 = getByText("Option 1");
expect(option1).toBeTruthy();
}

async function onNavigateBetweenOptionsByArrowsAriaUpdates(canvas) {
const { comboboxElement, searchElement } = await getComponentElements(canvas);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import Avatar from "../../Avatar/Avatar";
import "./Counter.stories.scss";

const metaSettings = createStoryMetaSettingsDecorator({
component: Counter,
enumPropNamesArray: ["size", "color", "kind"]
component: Counter
});

const counterTemplate = createComponentTemplate(Counter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from "react";
import Button from "../../Button/Button";
import styles from "./YearPicker.module.scss";

// eslint-disable-next-line @typescript-eslint/no-empty-function
const NOOP = () => {};

export interface YearsListProps {
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/components/Dialog/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,6 @@ export default class Dialog extends PureComponent<DialogProps, DialogState> {
enabled: true,
phase: "write",
fn({ state }) {
// eslint-disable-next-line no-param-reassign
if (!state.styles.arrow) {
return state;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface DialogContentProps extends VibeComponentProps {
position?: PopperJS.Placement;
wrapperClassName?: string;
isOpen?: boolean;
// TODO breaking change convert to enum
// TODO: [breaking] use type
startingEdge?: any;
animationType?: DialogAnimationType;
onEsc?: (event: React.KeyboardEvent) => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ import { HideShowEvent } from "../DialogConstants";
import { DialogProps } from "../Dialog";

const metaSettings = createStoryMetaSettingsDecorator({
component: Dialog,
enumPropNamesArray: [], // List enum props here
iconPropNamesArray: [], // List props that are typed as icons here
actionPropsArray: [] // List the component's actions here
component: Dialog
});

const showHideArgTypes = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import DialogContentContainerExample from "./DialogContentContainerExample";

const metaSettings = createStoryMetaSettingsDecorator({
component: DialogContentContainer,
enumPropNamesArray: ["type", "size"],
ignoreControlsPropNamesArray: ["children"]
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { createStoryMetaSettingsDecorator } from "../../../storybook";
import styles from "./Divider.stories.module.scss";

const metaSettings = createStoryMetaSettingsDecorator({
component: Divider,
enumPropNamesArray: ["direction"]
component: Divider
});

const dividerTemplate = (args: DividerProps) => (
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/components/Dropdown/Dropdown.styles.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-param-reassign */
import { SIZES } from "../../constants/sizes";
import { getCSSVar } from "../../services/themes";
import { getScrollableParent } from "../../utils/dom-utils";
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/components/Dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/require-default-props,react/forbid-prop-types */
import { ComponentDefaultTestId, getTestId } from "../../tests/test-ids-utils";
import cx from "classnames";
import { BaseSizes, SIZES_VALUES } from "../../constants";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { fakeFetchUsers } from "./Dropdown.stories.helpers";

const metaSettings = createStoryMetaSettingsDecorator({
component: Dropdown,
enumPropNamesArray: ["size", "menuPosition", "menuPlacement"],
actionPropsArray: [
"onMenuOpen",
"onMenuClose",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ describe("Dropdown renders correctly", () => {
});

it("with tabIndex", () => {
// eslint-disable-next-line jsx-a11y/tabindex-no-positive
const tree = renderer.create(<Dropdown tabIndex={9999} />).toJSON();
expect(tree).toMatchSnapshot();
});
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/components/Dropdown/__tests__/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export default class DropdownDriver {
constructor() {
this.props = { className: "dropdown-story" };

// eslint-disable-next-line no-constructor-return
return this;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/jsx-props-no-spreading */
import React from "react";
import { components } from "react-select";
import Icon from "../../../Icon/Icon";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/jsx-props-no-spreading */
import React from "react";
import { components } from "react-select";
import Icon from "../../../Icon/Icon";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/no-unstable-nested-components */
import React, { useCallback, useEffect, useState } from "react";
import { components } from "react-select";
import cx from "classnames";
Expand Down Expand Up @@ -79,6 +78,7 @@ export default function Container({ children, selectProps, ...otherProps }) {
/>
) : null;
}),
// eslint-disable-next-line react-hooks/exhaustive-deps
[selectedOptions, chipClassName, isDisabled, readOnly, withMandatoryDefaultOptions, onDelete, size]
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/jsx-props-no-spreading */
import React from "react";
import cx from "classnames";
import { components } from "react-select";
Expand Down
Loading