Skip to content

Commit

Permalink
Fix react select import since it is a commonJS module
Browse files Browse the repository at this point in the history
  • Loading branch information
MosheZemah committed Oct 15, 2024
1 parent 100ae62 commit 4c5f0c4
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 12 deletions.
6 changes: 5 additions & 1 deletion packages/core/src/components/Dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ComponentDefaultTestId, getTestId } from "../../tests/test-ids-utils";
import cx from "classnames";
import { BaseSizes, SIZES_VALUES } from "../../constants";
import React, { forwardRef, useCallback, useMemo, useRef, useState, useEffect } from "react";
import Select, { InputProps, components, createFilter, ActionMeta } from "react-select";
import * as ReactSelectPackage from "react-select";
import AsyncSelect from "react-select/async";
import BaseSelect from "react-select/base";
import { noop as NOOP } from "lodash-es";
Expand Down Expand Up @@ -37,6 +37,10 @@ import {
DropdownComponentProps
} from "./Dropdown.types";
import { VibeComponent, withStaticProps } from "../../types";
import type { InputProps, ActionMeta } from "react-select";

const Select = ReactSelectPackage.default;
const { components, createFilter } = ReactSelectPackage;

const Dropdown: VibeComponent<DropdownComponentProps, HTMLElement> & {
sizes?: typeof BaseSizes;
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/components/Dropdown/Dropdown.types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import {
import React, { UIEventHandler, WheelEventHandler } from "react";
import { VibeComponentProps } from "../../types";
import type {
ActionMeta,
FocusEventHandler,
InputActionMeta,
Expand All @@ -8,8 +10,6 @@ import {
OptionTypeBase,
SingleValueProps
} from "react-select";
import React, { UIEventHandler, WheelEventHandler } from "react";
import { VibeComponentProps } from "../../types";

export type DropdownOption = any;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import React from "react";
import { components } from "react-select";
import * as ReactSelectPackage from "react-select";
import Icon from "../../../Icon/Icon";
import { CloseSmall } from "@vibe/icons";
import { getIndicatorSize } from "../../Dropdown.styles";

const { components } = ReactSelectPackage;

const ClearIndicator = props => {
const { size } = props;
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React from "react";
import { components } from "react-select";
import * as ReactSelectPackage from "react-select";
import Tooltip from "../../../Tooltip/Tooltip";

const { components } = ReactSelectPackage;

const Control = props => {
const { selectProps } = props;
const control = <components.Control {...props} />;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import React from "react";
import { components } from "react-select";
import * as ReactSelectPackage from "react-select";
import Icon from "../../../Icon/Icon";
import { DropdownChevronDown } from "@vibe/icons";
import { getIndicatorSize } from "../../Dropdown.styles";

const { components } = ReactSelectPackage;

const DropdownIndicator = props => {
const { isDisabled, size } = props;
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React from "react";
import { components } from "react-select";
import * as ReactSelectPackage from "react-select";

const { components } = ReactSelectPackage;

const MultiValue = props => {
const { Renderer, data } = props;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useCallback, useEffect, useState } from "react";
import { components } from "react-select";
import * as ReactSelectPackage from "react-select";
import cx from "classnames";
import { useHiddenOptionsData } from "../../hooks/useHiddenOptionsData";
import Counter from "../../../Counter/Counter";
Expand All @@ -8,6 +8,7 @@ import DialogContentContainer from "../../../DialogContentContainer/DialogConten
import Chips from "../../../Chips/Chips";
import classes from "./MultiValueContainer.module.scss";

const { components } = ReactSelectPackage;
const DIALOG_OFFSET_Y = 5;

export default function Container({ children, selectProps, ...otherProps }) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import cx from "classnames";
import React from "react";
import { components } from "react-select";
import * as ReactSelectPackage from "react-select";
import styles from "./menu.module.scss";

const { components } = ReactSelectPackage;

const Menu = ({ children, Renderer, selectProps, dropdownMenuWrapperClassName, id, ariaLabel, ...props }) => {
const rendererProps = {
children,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import cx from "classnames";
import React, { useEffect } from "react";
import { components } from "react-select";
import * as ReactSelectPackage from "react-select";
import Tooltip from "../../../Tooltip/Tooltip";
import { ChildrenContent } from "../ChildrenContent/ChildrenContent";
import styles from "./option.module.scss";

const { components } = ReactSelectPackage;

const Option = ({ Renderer, data, children, setFocusedOptionId, optionWrapperClassName, ...props }) => {
const tooltipProps = data?.tooltipProps || {};
const rendererProps = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import React from "react";
import cx from "classnames";
import { components } from "react-select";
import * as ReactSelectPackage from "react-select";
import { ChildrenContent } from "../ChildrenContent/ChildrenContent";
import styles from "./singleValue.module.scss";

const { components } = ReactSelectPackage;

const SingleValue = ({ Renderer, data, children, readOnly, singleValueWrapperClassName, ...props }) => {
const rendererProps = { children, readOnly, data, ...props };
const value = Renderer ? (
Expand Down

0 comments on commit 4c5f0c4

Please sign in to comment.