diff --git a/superset-frontend/src/components/DropdownContainer/DropdownContainer.stories.tsx b/superset-frontend/src/components/DropdownContainer/DropdownContainer.stories.tsx new file mode 100644 index 0000000000000..eed8f166356df --- /dev/null +++ b/superset-frontend/src/components/DropdownContainer/DropdownContainer.stories.tsx @@ -0,0 +1,103 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import React, { useEffect, useState } from 'react'; +import { isEqual } from 'lodash'; +import { css } from '@superset-ui/core'; +import Select from '../Select/Select'; +import DropdownContainer, { DropdownContainerProps } from '.'; + +export default { + title: 'DropdownContainer', + component: DropdownContainer, +}; + +const ITEMS_COUNT = 6; +const ITEM_OPTIONS = 10; +const MIN_WIDTH = 700; +const MAX_WIDTH = 1500; + +const itemsOptions = Array.from({ length: ITEM_OPTIONS }).map((_, i) => ({ + label: `Option ${i}`, + value: `option-${i}`, +})); + +type ItemsType = Pick['items']; + +type OverflowingState = { notOverflowed: string[]; overflowed: string[] }; + +const generateItems = (overflowingState?: OverflowingState) => + Array.from({ length: ITEMS_COUNT }).map((_, i) => ({ + id: `el-${i}`, + element: ( +
+