|
| 1 | +import { ICONS } from '@/assets'; |
| 2 | +import { CATEGORY_CONTROL } from '@/constants/categoryControl'; |
| 3 | +import { IThemeObjectVariants } from '@/designSystem/themesObject'; |
| 4 | +import { objectFlip } from '@/storybook/utils/utils'; |
| 5 | +import { ArgTypesReturn } from '@/types'; |
| 6 | + |
| 7 | +export const argtypes = ( |
| 8 | + variantsObject: IThemeObjectVariants, |
| 9 | + themeSelected: string |
| 10 | +): ArgTypesReturn => { |
| 11 | + return { |
| 12 | + variant: { |
| 13 | + description: 'VirtualKeyboard variant', |
| 14 | + type: { name: 'string', required: true }, |
| 15 | + control: { type: 'select' }, |
| 16 | + options: Object.keys(variantsObject[themeSelected].VirtualKeyboardVariantType || {}), |
| 17 | + table: { |
| 18 | + type: { |
| 19 | + summary: 'string', |
| 20 | + }, |
| 21 | + category: CATEGORY_CONTROL.MODIFIERS, |
| 22 | + }, |
| 23 | + }, |
| 24 | + digits: { |
| 25 | + description: 'There will be range number buttons from 0 value to 9 value placed randomly.', |
| 26 | + type: { name: 'array', required: true }, |
| 27 | + control: { type: 'object' }, |
| 28 | + table: { |
| 29 | + type: { |
| 30 | + summary: 'string[]', |
| 31 | + }, |
| 32 | + category: CATEGORY_CONTROL.MODIFIERS, |
| 33 | + }, |
| 34 | + }, |
| 35 | + icon: { |
| 36 | + description: 'Icon of the remove button', |
| 37 | + type: { name: 'string' }, |
| 38 | + control: { type: 'select', labels: objectFlip(ICONS) }, |
| 39 | + options: Object.values(ICONS), |
| 40 | + table: { |
| 41 | + type: { |
| 42 | + summary: 'string', |
| 43 | + }, |
| 44 | + category: CATEGORY_CONTROL.CONTENT, |
| 45 | + }, |
| 46 | + }, |
| 47 | + iconAltText: { |
| 48 | + description: 'Alt text of the icon', |
| 49 | + type: { name: 'string' }, |
| 50 | + control: { type: 'text' }, |
| 51 | + table: { |
| 52 | + type: { |
| 53 | + summary: 'string', |
| 54 | + }, |
| 55 | + category: CATEGORY_CONTROL.ACCESIBILITY, |
| 56 | + }, |
| 57 | + }, |
| 58 | + onDigitButtonClick: { |
| 59 | + description: 'The event occurs when the user clicks on the digit button', |
| 60 | + type: { name: 'function', required: true }, |
| 61 | + control: false, |
| 62 | + table: { |
| 63 | + type: { |
| 64 | + summary: |
| 65 | + '(digit: string, event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void', |
| 66 | + }, |
| 67 | + category: CATEGORY_CONTROL.FUNCTIONS, |
| 68 | + }, |
| 69 | + }, |
| 70 | + onRemoveButtonClick: { |
| 71 | + description: |
| 72 | + 'User can remove what they have clicked. The event occurs when the user clicks on the remove button', |
| 73 | + type: { name: 'function', required: true }, |
| 74 | + control: false, |
| 75 | + table: { |
| 76 | + type: { |
| 77 | + summary: 'React.MouseEventHandler<HTMLButtonElement>', |
| 78 | + }, |
| 79 | + category: CATEGORY_CONTROL.FUNCTIONS, |
| 80 | + }, |
| 81 | + }, |
| 82 | + id: { |
| 83 | + description: 'Identifier of the virtual keyboard', |
| 84 | + type: { name: 'string' }, |
| 85 | + control: { type: 'text' }, |
| 86 | + table: { |
| 87 | + type: { |
| 88 | + summary: 'string', |
| 89 | + }, |
| 90 | + category: CATEGORY_CONTROL.ACCESIBILITY, |
| 91 | + }, |
| 92 | + }, |
| 93 | + dataTestId: { |
| 94 | + description: |
| 95 | + 'Test id of the virtual keyboard. Internal components will concatenate from this test id', |
| 96 | + type: { name: 'string' }, |
| 97 | + control: { type: 'text' }, |
| 98 | + table: { |
| 99 | + type: { |
| 100 | + summary: 'string', |
| 101 | + }, |
| 102 | + defaultValue: { |
| 103 | + summary: 'virtualkeyboard', |
| 104 | + }, |
| 105 | + category: CATEGORY_CONTROL.TESTING, |
| 106 | + }, |
| 107 | + }, |
| 108 | + ctv: { |
| 109 | + description: 'Object used for update variant styles', |
| 110 | + type: { name: 'object' }, |
| 111 | + control: { type: 'object' }, |
| 112 | + table: { |
| 113 | + type: { |
| 114 | + summary: 'object', |
| 115 | + }, |
| 116 | + category: CATEGORY_CONTROL.CUSTOMIZATION, |
| 117 | + }, |
| 118 | + }, |
| 119 | + }; |
| 120 | +}; |
0 commit comments