@innovaccer/design-system 2.13.4-1 → 2.13.4-4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/core/components/atoms/button/__stories__/SplitButton.story.jsx +1 -2
  2. package/core/components/atoms/checkbox/__stories__/Alignment.story.jsx +28 -24
  3. package/core/components/atoms/checkbox/__stories__/variants/Controlled.story.jsx +2 -2
  4. package/core/components/atoms/chip/__stories__/index.story.jsx +2 -2
  5. package/core/components/atoms/chip/__stories__/variants/Action.story.jsx +2 -2
  6. package/core/components/atoms/chip/__stories__/variants/Input.story.jsx +2 -2
  7. package/core/components/atoms/chip/__stories__/variants/Selection.story.jsx +6 -6
  8. package/core/components/atoms/chip/__stories__/variants/Type.story.jsx +2 -2
  9. package/core/components/atoms/chipGroup/_stories_/index.story.jsx +1 -1
  10. package/core/components/atoms/collapsible/__stories__/CustomTrigger.story.jsx +5 -71
  11. package/core/components/atoms/dropdown/__stories__/CustomSearchPlaceholder.story.jsx +4 -4
  12. package/core/components/atoms/dropdown/__stories__/DropdownItemsWithCheckbox.story.jsx +1 -3
  13. package/core/components/atoms/dropdown/__stories__/DropdownItemsWithIcon.story.jsx +2 -4
  14. package/core/components/atoms/dropdown/__stories__/DropdownItemsWithInfo.story.jsx +2 -5
  15. package/core/components/atoms/dropdown/__stories__/DropdownWIthIcon.story.jsx +3 -4
  16. package/core/components/atoms/dropdown/__stories__/DropdownWithActionButtons.story.jsx +9 -9
  17. package/core/components/atoms/dropdown/__stories__/DropdownWithCaption.story.jsx +7 -7
  18. package/core/components/atoms/dropdown/__stories__/Gender.story.jsx +6 -6
  19. package/core/components/atoms/dropdown/__stories__/Languages.story.jsx +6 -6
  20. package/core/components/atoms/dropdown/__stories__/Menu.story.jsx +5 -6
  21. package/core/components/atoms/dropdown/__stories__/MenuWithInfo.story.jsx +35 -0
  22. package/core/components/atoms/dropdown/__stories__/Options.tsx +36 -11
  23. package/core/components/atoms/dropdown/__stories__/OptionsLessThan50.story.jsx +3 -7
  24. package/core/components/atoms/dropdown/__stories__/OptionsMoreThan50.story.jsx +2 -2
  25. package/core/components/atoms/dropdown/__stories__/SearchInDropdown.story.jsx +3 -5
  26. package/core/components/atoms/dropdown/__stories__/StandardDropdown.story.jsx +2 -2
  27. package/core/components/atoms/dropdown/__stories__/StatusWithoutLabel.story.jsx +3 -3
  28. package/core/components/atoms/dropdown/__stories__/WithCheckboxAndSubInfo.story.jsx +2 -4
  29. package/core/components/atoms/dropdown/__stories__/index.story.jsx +2 -2
  30. package/core/components/atoms/dropdown/__stories__/variants/CustomOption.story.jsx +2 -2
  31. package/core/components/atoms/dropdown/__stories__/variants/LoadingType.story.jsx +0 -1
  32. package/core/components/atoms/dropdown/__stories__/variants/PreSelection.story.jsx +2 -2
  33. package/core/components/atoms/dropdown/__stories__/variants/StaticLimit.story.jsx +2 -2
  34. package/core/components/atoms/dropdown/__stories__/variants/controlledDropdown/BulkMultiSelectWithApply.story.jsx +2 -2
  35. package/core/components/atoms/dropdown/__stories__/variants/controlledDropdown/MultiSelect.story.jsx +2 -2
  36. package/core/components/atoms/dropdown/__stories__/variants/controlledDropdown/SingleSelect.story.jsx +4 -4
  37. package/core/components/atoms/dropdown/__tests__/Option.test.tsx +1 -1
  38. package/core/components/atoms/dropdown/option/index.tsx +1 -1
  39. package/core/components/atoms/icon/__stories__/variants/Image.story.jsx +1 -6
  40. package/core/components/atoms/input/__stories__/variants/Size.story.jsx +9 -9
  41. package/core/components/atoms/input/__stories__/variants/controlledInput.story.jsx +3 -3
  42. package/core/components/atoms/metaList/_stories_/index.story.jsx +0 -1
  43. package/core/components/atoms/rangeSlider/__stories__/index.story.jsx +2 -2
  44. package/core/components/atoms/rangeSlider/__stories__/variants/Controlled.story.jsx +2 -2
  45. package/core/components/atoms/slider/__stories__/variants/Controlled.story.jsx +2 -2
  46. package/core/components/atoms/toast/Toast.tsx +1 -1
  47. package/core/components/atoms/toast/__tests__/__snapshots__/Toast.test.tsx.snap +3 -3
  48. package/core/components/molecules/dropzone/FileSelectorUtils.tsx +112 -3
  49. package/core/components/molecules/editableDropdown/__stories__/index.story.jsx +2 -2
  50. package/core/components/molecules/fullscreenModal/__stories__/DefaultWidth.story.jsx +4 -2
  51. package/core/components/molecules/fullscreenModal/__stories__/LargeWidth.story.jsx +4 -2
  52. package/core/components/molecules/fullscreenModal/__stories__/Layering.story.jsx +3 -1
  53. package/core/components/molecules/fullscreenModal/__stories__/Scrolling.story.jsx +4 -2
  54. package/core/components/molecules/fullscreenModal/__stories__/TwoStepWorkflow.story.jsx +1 -2
  55. package/core/components/molecules/fullscreenModal/__stories__/twoSteps.story.jsx +0 -1
  56. package/core/components/molecules/fullscreenModal/__stories__/variants/dimension/Large.story.jsx +0 -1
  57. package/core/components/molecules/fullscreenModal/__stories__/variants/dimension/Medium.story.jsx +0 -1
  58. package/core/components/molecules/inputMask/InputMask.tsx +1 -1
  59. package/core/components/molecules/modal/__stories__/Alert.story.jsx +3 -1
  60. package/core/components/molecules/modal/__stories__/Confirmation.story.jsx +3 -1
  61. package/core/components/molecules/modal/__stories__/Dialog.story.jsx +3 -1
  62. package/core/components/molecules/modal/__stories__/Input.story.jsx +3 -1
  63. package/core/components/molecules/modal/__stories__/Layering.story.jsx +3 -1
  64. package/core/components/molecules/modal/__stories__/NoFooter.story.jsx +3 -1
  65. package/core/components/molecules/modal/__stories__/Scrolling.story.jsx +4 -2
  66. package/core/components/molecules/modal/__stories__/index.story.jsx +3 -1
  67. package/core/components/molecules/modal/__stories__/old.story.jsx +3 -1
  68. package/core/components/molecules/modal/__stories__/variants/dimension/Large.story.jsx +3 -1
  69. package/core/components/molecules/modal/__stories__/variants/dimension/Medium.story.jsx +3 -1
  70. package/core/components/molecules/modal/__stories__/variants/dimension/Small.story.jsx +3 -1
  71. package/core/components/molecules/popover/__stories__/Actions.story.jsx +1 -6
  72. package/core/components/molecules/popover/__stories__/Inputs.story.jsx +1 -6
  73. package/core/components/molecules/popover/__stories__/Light.story.jsx +1 -6
  74. package/core/components/molecules/popover/__stories__/variants/boundaryElement.story.jsx +1 -1
  75. package/core/components/molecules/sidesheet/__stories__/index.story.jsx +3 -1
  76. package/core/components/molecules/sidesheet/__stories__/variants/CustomHeader.story.jsx +3 -1
  77. package/core/components/molecules/sidesheet/__stories__/variants/Layering.story.jsx +3 -1
  78. package/core/components/molecules/sidesheet/__stories__/variants/LayeringWithModal.story.jsx +3 -1
  79. package/core/components/molecules/sidesheet/__stories__/variants/dimension/Large.story.jsx +3 -1
  80. package/core/components/molecules/sidesheet/__stories__/variants/dimension/Regular.story.jsx +4 -2
  81. package/core/components/molecules/sidesheet/__stories__/variants/stickyFooter.story.jsx +3 -1
  82. package/core/components/molecules/tabs/__stories__/DismissibleTab.story.jsx +1 -0
  83. package/core/components/molecules/tooltip/__stories__/variants/Position.story.jsx +2 -13
  84. package/core/components/molecules/verificationCodeInput/VerificationCodeInput.tsx +5 -0
  85. package/core/components/molecules/verificationCodeInput/__tests__/VerificationCodeInput.test.tsx +48 -9
  86. package/core/components/molecules/verificationCodeInput/__tests__/__snapshots__/VerificationCodeInput.test.tsx.snap +2996 -1
  87. package/core/components/organisms/calendar/__stories__/index.story.jsx +36 -1
  88. package/core/components/organisms/calendar/__stories__/variants/size.story.jsx +2 -3
  89. package/core/components/organisms/datePicker/DatePicker.tsx +1 -1
  90. package/core/components/organisms/datePicker/Trigger.tsx +1 -0
  91. package/core/components/organisms/datePicker/__tests__/DatePicker.test.tsx +8 -0
  92. package/core/components/organisms/grid/__stories__/_common_/nestedRowRenderer.tsx +2 -1
  93. package/core/components/organisms/inlineMessage/__stories__/variants/Default.story.jsx +1 -3
  94. package/core/components/organisms/inlineMessage/__stories__/variants/Error.story.jsx +1 -3
  95. package/core/components/organisms/inlineMessage/__stories__/variants/Info.story.jsx +1 -3
  96. package/core/components/organisms/inlineMessage/__stories__/variants/Success.story.jsx +1 -3
  97. package/core/components/organisms/inlineMessage/__stories__/variants/Warning.story.jsx +1 -3
  98. package/core/components/organisms/pageHeader/__stories__/withNavigationL1.story.jsx +7 -1
  99. package/core/components/organisms/table/__stories__/NestedTableWithNestedCard.story.jsx +2 -2
  100. package/core/components/organisms/table/__stories__/variants/nestedRows.story.jsx +8 -5
  101. package/core/components/organisms/timePicker/__stories__/withDatePicker.story.jsx +1 -1
  102. package/core/components/organisms/timePicker/__tests__/TimePickerWithSearch.test.tsx +0 -22
  103. package/core/components/organisms/verticalNav/MenuItem.tsx +11 -6
  104. package/core/components/organisms/verticalNav/__stories__/CustomOptionsRenderer.story.jsx +10 -9
  105. package/core/components/organisms/verticalNav/__stories__/CustomTrigger.story.jsx +14 -12
  106. package/core/components/organisms/verticalNav/__stories__/FlatEdgedVerticalNav.story.jsx +5 -5
  107. package/core/components/organisms/verticalNav/__stories__/LabelOverflowBehaviour.story.jsx +9 -15
  108. package/core/components/organisms/verticalNav/__tests__/__snapshots__/VerticalNav.test.tsx.snap +26 -24
  109. package/css/dist/MaterialIcons-Regular.ttf +0 -0
  110. package/css/dist/MaterialIconsOutlined-Regular.otf +0 -0
  111. package/css/dist/MaterialIconsRound-Regular.otf +0 -0
  112. package/css/dist/MaterialIconsSharp-Regular.otf +0 -0
  113. package/css/dist/MaterialIconsTwoTone-Regular.otf +0 -0
  114. package/css/dist/index.css +24 -1
  115. package/css/dist/index.css.map +1 -1
  116. package/css/material-design-icons/iconfont/MaterialIcons-Regular.ttf +0 -0
  117. package/css/material-design-icons/iconfont/MaterialIconsOutlined-Regular.otf +0 -0
  118. package/css/material-design-icons/iconfont/MaterialIconsRound-Regular.otf +0 -0
  119. package/css/material-design-icons/iconfont/MaterialIconsSharp-Regular.otf +0 -0
  120. package/css/material-design-icons/iconfont/MaterialIconsTwoTone-Regular.otf +0 -0
  121. package/css/src/components/dropdown.css +4 -0
  122. package/css/src/components/grid.css +18 -1
  123. package/css/src/components/verticalNav.css +2 -0
  124. package/dist/core/components/molecules/verificationCodeInput/VerificationCodeInput.d.ts +4 -0
  125. package/dist/core/components/organisms/datePicker/DatePicker.d.ts +1 -1
  126. package/dist/index.esm.js +29 -15
  127. package/dist/index.js +25 -15
  128. package/dist/index.js.map +1 -1
  129. package/dist/index.umd.js +1 -1
  130. package/dist/index.umd.js.br +0 -0
  131. package/dist/index.umd.js.gz +0 -0
  132. package/docs/package.json +1 -2
  133. package/docs/src/components/Colors/Colors.css +4 -0
  134. package/docs/src/components/Colors/Colors.js +54 -31
  135. package/docs/src/components/Footer/Footer.js +1 -1
  136. package/docs/src/components/Layout.js +10 -192
  137. package/docs/src/components/LeftNav/LeftNav.js +2 -2
  138. package/docs/src/components/MDXComponents.js +213 -0
  139. package/docs/src/components/TableOfContent/TableOfContent.css +8 -1
  140. package/docs/src/components/TableOfContent/TableOfContent.js +22 -8
  141. package/docs/src/components/css/style.css +6 -2
  142. package/docs/src/data/nav/components.yaml +1 -1
  143. package/docs/src/pages/404.js +8 -2
  144. package/docs/src/pages/components/avatar/usage.mdx +23 -20
  145. package/docs/src/pages/components/checkbox/usage.mdx +1 -1
  146. package/docs/src/pages/components/dropdowns/usage.mdx +1 -1
  147. package/docs/src/pages/components/table/images/table-1.png +0 -0
  148. package/docs/src/pages/components/table/images/table-2.png +0 -0
  149. package/docs/src/pages/components/table/usage.mdx +41 -92
  150. package/docs/src/pages/components/tabs/images/tabs-10.png +0 -0
  151. package/docs/src/pages/components/tabs/images/tabs-11.png +0 -0
  152. package/docs/src/pages/components/tabs/images/tabs-9.png +0 -0
  153. package/docs/src/pages/components/tabs/usage.mdx +37 -28
  154. package/docs/src/pages/foundations/typography.mdx +166 -0
  155. package/docs/src/pages/introduction/get-started/designers.mdx +28 -188
  156. package/docs/src/pages/introduction/get-started/images/designers-1.png +0 -0
  157. package/docs/src/pages/introduction/get-started/images/designers-2.png +0 -0
  158. package/docs/src/pages/introduction/what's-new.mdx +322 -15
  159. package/docs/tools/build.sh +1 -0
  160. package/docs/tools/changelog.sh +1 -1
  161. package/package.json +3 -3
  162. package/docs/src/pages/components/index.mdx +0 -11
  163. package/docs/src/pages/content/button-guidelines/index.mdx +0 -7
  164. package/docs/src/pages/content/voice-and-tone-guidelines/index.mdx +0 -7
  165. package/docs/src/pages/introduction/get-started/images/designers-3.png +0 -0
  166. package/docs/src/pages/introduction/get-started/images/designers-4.png +0 -0
  167. package/docs/src/pages/introduction/get-started/images/designers-5.png +0 -0
  168. package/docs/src/pages/introduction/get-started/images/designers-6.png +0 -0
  169. package/docs/src/pages/introduction/get-started/images/designers-7.png +0 -0
  170. package/docs/src/pages/introduction/get-started/images/designers-8.png +0 -0
@@ -3,7 +3,6 @@ import Button from '@/components/atoms/button';
3
3
  import Dropdown from '@/components/atoms/dropdown';
4
4
 
5
5
  export const splitButton = () => {
6
-
7
6
  const options = [
8
7
  {
9
8
  label: 'Download All',
@@ -24,7 +23,7 @@ export const splitButton = () => {
24
23
  <Dropdown menu={true} icon="expand_more" options={options} />
25
24
  </div>
26
25
  </div>
27
- )
26
+ );
28
27
  };
29
28
 
30
29
  export default {
@@ -1,34 +1,38 @@
1
1
  import * as React from 'react';
2
- import { Checkbox, Label, Row, Column, Text, Heading } from '@/index';
2
+ import { Checkbox, Label, Row, Column, Heading } from '@/index';
3
3
 
4
- const days = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
4
+ export const AlignmentOfCheckboxGroup = () => {
5
+ const days = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
5
6
 
6
- export const AlignmentOfCheckboxGroup = () => (
7
- <div>
8
- <Row>
9
- <Column>
10
- <Heading size="s">Horizontal Alignment</Heading>
11
- <Label>Days</Label>
12
- <div className="d-flex">
7
+ return (
8
+ <div>
9
+ <Row>
10
+ <Column>
11
+ <Heading size="s">Horizontal Alignment</Heading>
12
+ <Label>Days</Label>
13
+ <div className="d-flex">
14
+ {days.map((day, index) => {
15
+ return (
16
+ <Checkbox className={index !== 0 ? 'ml-7' : ''} key={index} label={day} defaultChecked={index < 2} />
17
+ );
18
+ })}
19
+ </div>
20
+ </Column>
21
+ </Row>
22
+ <Row>
23
+ <Column className="pt-5 mt-8">
24
+ <Heading size="s">Vertical Alignment</Heading>
25
+ <Label>Days</Label>
13
26
  {days.map((day, index) => {
14
27
  return (
15
- <Checkbox className={index !== 0 ? 'ml-7' : ''} key={index} label={day} defaultChecked={index < 2} />
28
+ <Checkbox key={index} label={day} defaultChecked={index < 2} className={index !== 0 ? 'mt-4' : ''} />
16
29
  );
17
30
  })}
18
- </div>
19
- </Column>
20
- </Row>
21
- <Row>
22
- <Column className="pt-5 mt-8">
23
- <Heading size="s">Vertical Alignment</Heading>
24
- <Label>Days</Label>
25
- {days.map((day, index) => {
26
- return <Checkbox key={index} label={day} defaultChecked={index < 2} className={index !== 0 ? 'mt-4' : ''} />;
27
- })}
28
- </Column>
29
- </Row>
30
- </div>
31
- );
31
+ </Column>
32
+ </Row>
33
+ </div>
34
+ );
35
+ };
32
36
 
33
37
  export default {
34
38
  title: 'Components/Checkbox/Alignment Of Checkbox Group',
@@ -7,7 +7,7 @@ export const controlledCheckbox = () => {
7
7
 
8
8
  const handleParentChange = (event) => {
9
9
  const updatedChecked = event.target.checked;
10
- window.setTimeout(() => {
10
+ this.window.setTimeout(() => {
11
11
  setChecked(updatedChecked);
12
12
  }, 2000);
13
13
  };
@@ -20,7 +20,7 @@ const customCode = `() => {
20
20
 
21
21
  const handleParentChange = (event) => {
22
22
  const updatedChecked = event.target.checked;
23
- window.setTimeout(() => {
23
+ this.window.setTimeout(() => {
24
24
  setChecked(updatedChecked);
25
25
  }, 2000);
26
26
  };
@@ -27,8 +27,8 @@ export const all = () => {
27
27
  clearButton={clearButton}
28
28
  disabled={disabled}
29
29
  type={type}
30
- onClose={action(`onClose: ${name}`)}
31
- onClick={action(`onClick: ${name}`)}
30
+ onClose={action(`onClose: ${label}`)}
31
+ onClick={action(`onClick: ${label}`)}
32
32
  selected={selected}
33
33
  name={'chip'}
34
34
  />
@@ -16,8 +16,8 @@ export const Action = () => {
16
16
  icon={icon}
17
17
  label={label}
18
18
  disabled={booleanvalue}
19
- onClose={action(`onClose: ${name}`)}
20
- onClick={action(`onClick: ${name}`)}
19
+ onClose={action(`onClose: ${label}`)}
20
+ onClick={action(`onClick: ${label}`)}
21
21
  type="action"
22
22
  name={'chip'}
23
23
  />
@@ -17,8 +17,8 @@ export const Input = () => {
17
17
  clearButton={true}
18
18
  disabled={booleanvalue}
19
19
  type="input"
20
- onClose={action(`onClose: ${name}`)}
21
- onClick={action(`onClick: ${name}`)}
20
+ onClose={action(`onClose: ${label}`)}
21
+ onClick={action(`onClick: ${label}`)}
22
22
  name={'chip'}
23
23
  />
24
24
  <br />
@@ -17,8 +17,8 @@ export const Selection = () => {
17
17
  clearButton={true}
18
18
  disabled={booleanvalue}
19
19
  type="selection"
20
- onClose={action(`onClose: ${name}`)}
21
- onClick={action(`onClick: ${name}`)}
20
+ onClose={action(`onClose: ${label}`)}
21
+ onClick={action(`onClick: ${label}`)}
22
22
  selected={false}
23
23
  name={'chip'}
24
24
  />
@@ -33,8 +33,8 @@ export const Selection = () => {
33
33
  label={label}
34
34
  clearButton={true}
35
35
  type="selection"
36
- onClose={action(`onClose: ${name}`)}
37
- onClick={action(`onClick: ${name}`)}
36
+ onClose={action(`onClose: ${label}`)}
37
+ onClick={action(`onClick: ${label}`)}
38
38
  selected={true}
39
39
  name={'chip'}
40
40
  />
@@ -47,8 +47,8 @@ export const Selection = () => {
47
47
  label={label}
48
48
  clearButton={true}
49
49
  type="selection"
50
- onClose={action(`onClose: ${name}`)}
51
- onClick={action(`onClick: ${name}`)}
50
+ onClose={action(`onClose: ${label}`)}
51
+ onClick={action(`onClick: ${label}`)}
52
52
  selected={true}
53
53
  disabled={true}
54
54
  name={'chip'}
@@ -20,8 +20,8 @@ export const Types = () => {
20
20
  clearButton={clearButton}
21
21
  disabled={disabled}
22
22
  type={type}
23
- onClose={action(`onClose: ${name}`)}
24
- onClick={action(`onClick: ${name}`)}
23
+ onClose={action(`onClose: ${label}`)}
24
+ onClick={action(`onClick: ${label}`)}
25
25
  selected={selected}
26
26
  name={'chip'}
27
27
  />
@@ -38,7 +38,7 @@ export const all = () => {
38
38
  },
39
39
  ];
40
40
 
41
- return <ChipGroup onClose={action(`onClose: ${name}`)} onClick={action(`onClick: ${name}`)} list={list} />;
41
+ return <ChipGroup onClose={action(`onClose event`)} onClick={action(`onClick event`)} list={list} />;
42
42
  };
43
43
  export default {
44
44
  title: 'Components/ChipGroup/All',
@@ -1,50 +1,18 @@
1
1
  import * as React from 'react';
2
2
  import Collapsible from '@/components/atoms/collapsible';
3
- import { Icon, VerticalNav, Heading } from '@/index';
3
+ import { Icon, Text, Heading } from '@/index';
4
4
 
5
5
  // CSF format story
6
6
  export const CustomTrigger = () => {
7
7
  const [expanded, setExpanded] = React.useState(false);
8
- const [active, setActive] = React.useState({
9
- name: 'To-do\'s.Due',
10
- });
11
-
12
- const data = [
13
- {
14
- name: 'To-do\'s',
15
- label: 'To-do\'s',
16
- icon: 'assignment_ind',
17
- count: 31,
18
- subMenu: [
19
- {
20
- name: 'To-do\'s.Due',
21
- label: 'Due',
22
- count: 31
23
- },
24
- {
25
- name: 'To-do\'s.Completed',
26
- label: 'Completed',
27
- count: 0
28
- },
29
- ],
30
- },
31
- {
32
- name: 'Received',
33
- label: 'Received',
34
- count: 0
35
- },
36
- {
37
- name: 'Sent',
38
- label: 'Sent',
39
- count: 5
40
- },
41
- ];
42
8
 
43
9
  return (
44
10
  <div>
45
- <div className='d-flex align-items-center mb-3'>
11
+ <div className="d-flex align-items-center mb-3">
46
12
  <Icon name="menu" className="cursor-pointer" onClick={() => setExpanded(!expanded)}></Icon>
47
- <Heading size='s' className="ml-4">Click to Open</Heading>
13
+ <Heading size="s" className="ml-4">
14
+ Click to Open
15
+ </Heading>
48
16
  </div>
49
17
  <Collapsible withTrigger={false} expanded={expanded} height="100vh">
50
18
  <div className="d-flex pt-4">
@@ -58,40 +26,6 @@ export const CustomTrigger = () => {
58
26
 
59
27
  const customCode = `() => {
60
28
  const [expanded, setExpanded] = React.useState(false);
61
- const [active, setActive] = React.useState({
62
- name: 'TODOs.Due',
63
- });
64
-
65
- const data = [
66
- {
67
- name: 'TODOs',
68
- label: 'TODOs',
69
- icon: 'assignment_ind',
70
- count: 31,
71
- subMenu: [
72
- {
73
- name: 'TODOs.Due',
74
- label: 'Due',
75
- count: 31
76
- },
77
- {
78
- name: 'TODOs.Completed',
79
- label: 'Completed',
80
- count: 0
81
- },
82
- ],
83
- },
84
- {
85
- name: 'Received',
86
- label: 'Received',
87
- count: 0
88
- },
89
- {
90
- name: 'Sent',
91
- label: 'Sent',
92
- count: 5
93
- },
94
- ];
95
29
 
96
30
  return (
97
31
  <div>
@@ -23,10 +23,10 @@ export const customSearchPlaceholder = () => {
23
23
  },
24
24
  ];
25
25
  return (
26
- <div className="mb-10 w-25">
27
- <Label withInput={true}>Gender</Label>
28
- <Dropdown options={options} searchPlaceholder="Search Gender" withSearch={true} />
29
- </div>
26
+ <div className="mb-10 w-25">
27
+ <Label withInput={true}>Gender</Label>
28
+ <Dropdown options={options} searchPlaceholder="Search Gender" withSearch={true} />
29
+ </div>
30
30
  );
31
31
  };
32
32
 
@@ -22,9 +22,7 @@ export const dropdownItemsWithCheckbox = () => {
22
22
  value: '56_above',
23
23
  },
24
24
  ];
25
- return (
26
- <Dropdown options={options} withCheckbox={true} className="w-25" placeholder="Select" />
27
- );
25
+ return <Dropdown options={options} withCheckbox={true} className="w-25" placeholder="Select" />;
28
26
  };
29
27
 
30
28
  export default {
@@ -26,10 +26,8 @@ export const dropdownItemsWithIcon = () => {
26
26
  icon: 'check',
27
27
  },
28
28
  ];
29
- return (
30
- <Dropdown options={options} optionType="WITH_ICON" className="w-25" placeholder="Select status" />
31
- );
32
- }
29
+ return <Dropdown options={options} optionType="WITH_ICON" className="w-25" placeholder="Select status" />;
30
+ };
33
31
 
34
32
  export default {
35
33
  title: 'Components/Dropdown/Dropdown Items With Icon',
@@ -3,8 +3,7 @@ import { Dropdown } from '@/index';
3
3
  import { Uncontrolled, Controlled } from './_common_/types';
4
4
 
5
5
  // CSF format story
6
- export const dropdownItemsWithSubInfo = () =>{
7
-
6
+ export const dropdownItemsWithSubInfo = () => {
8
7
  const options = [
9
8
  {
10
9
  label: 'Lawson, Joy',
@@ -23,9 +22,7 @@ export const dropdownItemsWithSubInfo = () =>{
23
22
  },
24
23
  ];
25
24
 
26
- return (
27
- <Dropdown options={options} optionType="WITH_META" className="w-25" placeholder="Select Recipient" />
28
- );
25
+ return <Dropdown options={options} optionType="WITH_META" className="w-25" placeholder="Select Recipient" />;
29
26
  };
30
27
 
31
28
  export default {
@@ -2,9 +2,8 @@ import * as React from 'react';
2
2
  import { Dropdown } from '@/index';
3
3
  import { Uncontrolled, Controlled } from './_common_/types';
4
4
 
5
-
6
5
  // CSF format story
7
- export const dropdownWithIcon = () =>{
6
+ export const dropdownWithIcon = () => {
8
7
  const options = [
9
8
  {
10
9
  label: 'Alabama',
@@ -204,9 +203,9 @@ export const dropdownWithIcon = () =>{
204
203
  },
205
204
  ];
206
205
  return (
207
- <Dropdown options={options} icon="location_on" className="w-25" placeholder="Select state" staticLimit={100} />
206
+ <Dropdown options={options} icon="location_on" className="w-25" placeholder="Select state" staticLimit={100} />
208
207
  );
209
- }
208
+ };
210
209
 
211
210
  export default {
212
211
  title: 'Components/Dropdown/Dropdown With Icon',
@@ -47,16 +47,16 @@ export const dropdownWithActionButtons = () => {
47
47
  },
48
48
  ];
49
49
  return (
50
- <Dropdown
51
- options={options}
52
- withSearch={true}
53
- className="w-25"
54
- placeholder="Select problem"
55
- withCheckbox={true}
56
- showApplyButton={true}
57
- />
50
+ <Dropdown
51
+ options={options}
52
+ withSearch={true}
53
+ className="w-25"
54
+ placeholder="Select problem"
55
+ withCheckbox={true}
56
+ showApplyButton={true}
57
+ />
58
58
  );
59
- }
59
+ };
60
60
 
61
61
  export default {
62
62
  title: 'Components/Dropdown/Dropdown With Action Buttons',
@@ -5,7 +5,7 @@ import Label from '../../label';
5
5
  import Caption from '../../caption';
6
6
 
7
7
  // CSF format story
8
- export const dropdownWithCaption = () =>{
8
+ export const dropdownWithCaption = () => {
9
9
  const options = [
10
10
  {
11
11
  label: 'Alabama (205)',
@@ -49,13 +49,13 @@ export const dropdownWithCaption = () =>{
49
49
  },
50
50
  ];
51
51
  return (
52
- <>
53
- <Label withInput={true}>Area code</Label>
54
- <Dropdown options={options} withSearch={true} className="w-25" placeholder="Select an area code" />
55
- <Caption withInput={true}>If the number with this code is not available, we will use the next best match</Caption>
56
- </>
52
+ <>
53
+ <Label withInput={true}>Area code</Label>
54
+ <Dropdown options={options} withSearch={true} className="w-25" placeholder="Select an area code" />
55
+ <Caption withInput={true}>If the number with this code is not available, we will use the next best match</Caption>
56
+ </>
57
57
  );
58
- }
58
+ };
59
59
 
60
60
  export default {
61
61
  title: 'Components/Dropdown/Dropdown With Caption',
@@ -4,7 +4,7 @@ import Label from '@/components/atoms/label';
4
4
  import { Uncontrolled, Controlled } from './_common_/types';
5
5
 
6
6
  // CSF format story
7
- export const gender = () =>{
7
+ export const gender = () => {
8
8
  const options = [
9
9
  {
10
10
  label: 'Male',
@@ -17,12 +17,12 @@ export const gender = () =>{
17
17
  },
18
18
  ];
19
19
  return (
20
- <div className="mb-10 w-25">
21
- <Label withInput={true}>Gender</Label>
22
- <Dropdown options={options} />
23
- </div>
20
+ <div className="mb-10 w-25">
21
+ <Label withInput={true}>Gender</Label>
22
+ <Dropdown options={options} />
23
+ </div>
24
24
  );
25
- }
25
+ };
26
26
 
27
27
  export default {
28
28
  title: 'Components/Dropdown/Gender',
@@ -4,7 +4,7 @@ import Label from '@/components/atoms/label';
4
4
  import { Uncontrolled, Controlled } from './_common_/types';
5
5
 
6
6
  // CSF format story
7
- export const languages = () =>{
7
+ export const languages = () => {
8
8
  const options = [
9
9
  {
10
10
  label: 'Hindi',
@@ -20,12 +20,12 @@ export const languages = () =>{
20
20
  },
21
21
  ];
22
22
  return (
23
- <div className="mb-11 w-25">
24
- <Label withInput={true}>Select Language</Label>
25
- <Dropdown options={options} />
26
- </div>
23
+ <div className="mb-11 w-25">
24
+ <Label withInput={true}>Select Language</Label>
25
+ <Dropdown options={options} />
26
+ </div>
27
27
  );
28
- }
28
+ };
29
29
 
30
30
  export default {
31
31
  title: 'Components/Dropdown/Languages',
@@ -4,7 +4,6 @@ import { Uncontrolled, Controlled } from './_common_/types';
4
4
 
5
5
  // CSF format story
6
6
  export const dropdownAsMenu = () => {
7
-
8
7
  const options = [
9
8
  {
10
9
  label: 'Edit',
@@ -18,13 +17,13 @@ export const dropdownAsMenu = () => {
18
17
  label: 'Delete',
19
18
  value: 'delete',
20
19
  },
21
- ]
20
+ ];
22
21
  return (
23
22
  <div className="d-flex w-50">
24
- <Dropdown options={options} menu={true} className="mr-5" align="right" maxWidth={130} />
25
- <Dropdown options={options} menu={true} align="left" className="mr-5" maxWidth={130} />
26
- </div>
27
- )
23
+ <Dropdown options={options} menu={true} className="mr-5" align="right" maxWidth={130} />
24
+ <Dropdown options={options} menu={true} align="left" className="mr-5" maxWidth={130} />
25
+ </div>
26
+ );
28
27
  };
29
28
 
30
29
  export default {
@@ -0,0 +1,35 @@
1
+ import * as React from 'react';
2
+ import Dropdown from '../Dropdown';
3
+ import { Uncontrolled, Controlled } from './_common_/types';
4
+
5
+ // CSF format story
6
+ export const dropdownAsMenuWithSubinfo = () => {
7
+ const options = [
8
+ { label: 'Below 18', subInfo: 'People below 18 years old', value: 'below_18', optionType: 'WITH_META' },
9
+ { label: '19 - 35', subInfo: 'People 19-35 years old', value: '19-35', optionType: 'WITH_META' },
10
+ { label: '36 - 55', subInfo: 'People 36-55 years old', value: '36-55', optionType: 'WITH_META' },
11
+ { label: '56 and above', subInfo: 'People above 56 years old', value: '56_above', optionType: 'WITH_META' },
12
+ ];
13
+ return (
14
+ <div className="d-flex w-50">
15
+ <Dropdown options={options} menu={true} className="mr-5" align="right" />
16
+ <Dropdown options={options} menu={true} className="mr-5" align="right" />
17
+ </div>
18
+ );
19
+ };
20
+
21
+ export default {
22
+ title: 'Components/Dropdown/Dropdown As Menu With Subinfo',
23
+ component: Dropdown,
24
+ parameters: {
25
+ docs: {
26
+ docPage: {
27
+ title: 'Dropdown',
28
+ props: {
29
+ components: { Uncontrolled, Controlled },
30
+ exclude: ['showHead'],
31
+ },
32
+ },
33
+ },
34
+ },
35
+ };
@@ -1,12 +1,37 @@
1
1
  import { getSearchedOptions } from '../utility';
2
2
 
3
- export const dropdownOptions = [];
4
- export const preSelectedOptions = [];
5
- export const storyOptions = [];
6
- export const disabledStoryOptions = [];
7
- export const iconOptions = [];
8
- export const subInfoOptions = [];
9
- export const iconWithSubinfoOptions = [];
3
+ type OptionType = 'DEFAULT' | 'WITH_ICON' | 'WITH_META' | 'ICON_WITH_META';
4
+
5
+ interface OptionSchema extends Record<string, any> {
6
+ label: string;
7
+ value: React.ReactText;
8
+ icon: string;
9
+ subInfo: string;
10
+ optionType?: OptionType;
11
+ selected?: boolean;
12
+ disabled?: boolean;
13
+ group?: string;
14
+ }
15
+
16
+ interface SelectedOptionSchema extends Record<string, any> {
17
+ label: string;
18
+ value: React.ReactText;
19
+ selected?: boolean;
20
+ }
21
+
22
+ interface fetchOptionSchema {
23
+ searchTerm?: string | undefined;
24
+ count: number;
25
+ options: OptionSchema[];
26
+ }
27
+
28
+ export const dropdownOptions: OptionSchema[] = [];
29
+ export const preSelectedOptions: SelectedOptionSchema[] = [];
30
+ export const storyOptions: OptionSchema[] = [];
31
+ export const disabledStoryOptions: OptionSchema[] = [];
32
+ export const iconOptions: OptionSchema[] = [];
33
+ export const subInfoOptions: OptionSchema[] = [];
34
+ export const iconWithSubinfoOptions: OptionSchema[] = [];
10
35
 
11
36
  for (let i = 1; i <= 10; i++) {
12
37
  storyOptions.push({
@@ -84,7 +109,7 @@ for (let i = 41; i <= 100; i++) {
84
109
  });
85
110
  }
86
111
 
87
- export const selectedStoryOptions = [];
112
+ export const selectedStoryOptions: SelectedOptionSchema[] = [];
88
113
 
89
114
  for (let i = 1; i <= 10; i++) {
90
115
  selectedStoryOptions.push({
@@ -94,7 +119,7 @@ for (let i = 1; i <= 10; i++) {
94
119
  });
95
120
  }
96
121
 
97
- export const multiSelectedStoryOptions = [];
122
+ export const multiSelectedStoryOptions: SelectedOptionSchema[] = [];
98
123
 
99
124
  for (let i = 1; i <= 10; i++) {
100
125
  multiSelectedStoryOptions.push({
@@ -155,9 +180,9 @@ export const iconItems = [
155
180
  },
156
181
  ];
157
182
 
158
- export const fetchOptions = (searchTerm) => {
183
+ export const fetchOptions = (searchTerm: string) => {
159
184
  const searchedOptions = searchTerm ? getSearchedOptions(dropdownOptions, searchTerm) : dropdownOptions;
160
- return new Promise((resolve) => {
185
+ return new Promise<fetchOptionSchema>((resolve) => {
161
186
  window.setTimeout(() => {
162
187
  resolve({
163
188
  searchTerm,
@@ -2,10 +2,8 @@ import * as React from 'react';
2
2
  import { Dropdown } from '@/index';
3
3
  import { Uncontrolled, Controlled } from './_common_/types';
4
4
 
5
-
6
-
7
5
  // CSF format story
8
- export const dropdownOptionsLessThan50 = () =>{
6
+ export const dropdownOptionsLessThan50 = () => {
9
7
  const options = [];
10
8
  for (let i = 1; i <= 50; i++) {
11
9
  options.push({
@@ -13,10 +11,8 @@ export const dropdownOptionsLessThan50 = () =>{
13
11
  value: `Option${i}`,
14
12
  });
15
13
  }
16
- return (
17
- <Dropdown options={options} withCheckbox={true} withSearch={true} className="w-25" placeholder="Select" />
18
- );
19
- }
14
+ return <Dropdown options={options} withCheckbox={true} withSearch={true} className="w-25" placeholder="Select" />;
15
+ };
20
16
 
21
17
  const customCode = `() => {
22
18
  const options = [];