diff --git a/superset-frontend/src/components/Select/Select.stories.tsx b/superset-frontend/src/components/Select/Select.stories.tsx index 8454712ca5..9925148daa 100644 --- a/superset-frontend/src/components/Select/Select.stories.tsx +++ b/superset-frontend/src/components/Select/Select.stories.tsx @@ -17,7 +17,8 @@ * under the License. */ import React, { ReactNode, useState, useCallback } from 'react'; -import Select, { SelectProps, OptionsPromiseResult } from './Select'; +import ControlHeader from 'src/explore/components/ControlHeader'; +import Select, { SelectProps, OptionsType, OptionsTypePage } from './Select'; export default { title: 'Select', @@ -66,6 +67,98 @@ const selectPositions = [ }, ]; +const ARG_TYPES = { + options: { + defaultValue: options, + table: { + disable: true, + }, + }, + ariaLabel: { + table: { + disable: true, + }, + }, + name: { + table: { + disable: true, + }, + }, + notFoundContent: { + table: { + disable: true, + }, + }, + mode: { + defaultValue: 'single', + control: { + type: 'inline-radio', + options: ['single', 'multiple'], + }, + }, +}; + +const mountHeader = (type: String) => { + let header; + if (type === 'text') { + header = 'Text header'; + } else if (type === 'control') { + header = ( + + ); + } + return header; +}; + +export const InteractiveSelect = (args: SelectProps & { header: string }) => ( +
+ +
+
+
- {requests.map(request => ( -

{request}

+ {requests.map((request, index) => ( +

{request}

))}
@@ -255,20 +425,38 @@ export const AsyncSelect = ( AsyncSelect.args = { withError: false, - allowNewOptions: false, paginatedFetch: false, + pageSize: 10, + allowNewOptions: false, }; AsyncSelect.argTypes = { - mode: { - control: { type: 'select', options: ['single', 'multiple', 'tags'] }, + ...ARG_TYPES, + header: { + table: { + disable: true, + }, + }, + invertSelection: { + table: { + disable: true, + }, + }, + pageSize: { + defaultValue: 10, + control: { + type: 'range', + min: 10, + max: 50, + step: 10, + }, }, responseTime: { - defaultValue: 1, + defaultValue: 0.5, name: 'responseTime (seconds)', control: { type: 'range', - min: 1, + min: 0.5, max: 5, }, }, @@ -281,33 +469,3 @@ AsyncSelect.story = { }, }, }; - -export const InteractiveSelect = (args: SelectProps) => ( -
-