@innovaccer/design-system 2.13.2 → 2.13.4-1
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.
- package/core/components/atoms/checkbox/__stories__/Alignment.story.jsx +11 -13
- package/core/components/atoms/dropdown/Dropdown.tsx +18 -2
- package/core/components/atoms/dropdown/DropdownList.tsx +47 -57
- package/core/components/atoms/dropdown/__stories__/LabelInline.story.jsx +58 -0
- package/core/components/atoms/dropdown/__stories__/{LabelPositionInDropdown.story.jsx → LabelOnTop.story.jsx} +8 -9
- package/core/components/atoms/dropdown/option/DefaultOption.tsx +1 -1
- package/core/components/atoms/dropdown/utility.tsx +6 -0
- package/core/components/atoms/icon/__stories__/variants/Image.story.jsx +3 -3
- package/core/components/css-utilities/Miscellaneous/Miscellaneous.story.tsx +4 -0
- package/core/components/molecules/dropzone/FileSelectorUtils.tsx +3 -0
- package/core/components/molecules/sidesheet/__stories__/variants/twoSteps.story.jsx +6 -4
- package/core/components/organisms/calendar/__stories__/index.story.jsx +4 -6
- package/core/components/organisms/dateRangePicker/__stories__/variants/withSingleInput.story.jsx +3 -0
- package/core/components/organisms/horizontalNav/__stories__/leftAlign.story.jsx +35 -19
- package/core/components/organisms/pageHeader/__stories__/Responsiveness.story.jsx +2 -2
- package/core/components/organisms/pageHeader/__stories__/variants/withNavigation.story.jsx +2 -2
- package/core/components/organisms/pageHeader/__stories__/variants/withNavigationL1.story.jsx +2 -2
- package/core/components/organisms/pageHeader/__stories__/variants/withStepper.story.jsx +2 -2
- package/core/components/organisms/pageHeader/__stories__/variants/withStepperL1.story.jsx +2 -2
- package/core/components/organisms/pageHeader/__stories__/variants/withTabs.story.jsx +2 -2
- package/core/components/organisms/pageHeader/__stories__/variants/withTabsL1.story.jsx +2 -2
- package/core/components/organisms/pageHeader/__stories__/withFilter.story.jsx +2 -2
- package/core/components/organisms/pageHeader/__stories__/withFilterL1.story.jsx +2 -2
- package/core/components/organisms/pageHeader/__stories__/withNavigation.story.jsx +2 -2
- package/core/components/organisms/pageHeader/__stories__/withNavigationL1.story.jsx +2 -2
- package/core/components/organisms/pageHeader/__stories__/withStepperL1.story.jsx +4 -4
- package/core/components/organisms/table/__stories__/TableAsDescriptionList.story.jsx +4 -4
- package/core/components/organisms/timePicker/TimePicker.tsx +6 -113
- package/core/components/organisms/timePicker/TimePickerWithInput.tsx +124 -0
- package/core/components/organisms/timePicker/TimePickerWithSearch.tsx +198 -0
- package/core/components/organisms/timePicker/__stories__/TimeIntervals.story.jsx +52 -0
- package/core/components/organisms/timePicker/__stories__/disabledOption.story.jsx +52 -0
- package/core/components/organisms/timePicker/__stories__/fromTo.story.jsx +72 -0
- package/core/components/organisms/timePicker/__stories__/showDuration.story.jsx +52 -0
- package/core/components/organisms/timePicker/__stories__/withDatePicker.story.jsx +88 -0
- package/core/components/organisms/timePicker/__stories__/{index.story.jsx → withInput.story.jsx} +6 -3
- package/core/components/organisms/timePicker/__stories__/withSearch.story.jsx +89 -0
- package/core/components/organisms/timePicker/__tests__/TimePickerWithSearch.test.tsx +486 -0
- package/core/components/organisms/timePicker/__tests__/__snapshots__/TimePickerWithSearch.test.tsx.snap +169 -0
- package/core/components/organisms/timePicker/index.tsx +2 -0
- package/core/components/organisms/timePicker/utility/searchUtils.tsx +295 -0
- package/core/components/organisms/timePicker/utility/timePickerUtility.tsx +219 -0
- package/core/components/organisms/timePicker/utils.tsx +1 -1
- package/core/index.tsx +1 -0
- package/css/dist/index.css +4 -10
- package/css/dist/index.css.map +1 -1
- package/css/src/components/dropdown.css +2 -6
- package/css/src/components/metricInput.css +1 -0
- package/css/src/components/modal.css +1 -2
- package/dist/core/components/atoms/dropdown/Dropdown.d.ts +2 -0
- package/dist/core/components/atoms/dropdown/DropdownList.d.ts +1 -0
- package/dist/core/components/atoms/dropdown/utility.d.ts +1 -0
- package/dist/core/components/atoms/popperWrapper/PopperWrapper.d.ts +22 -22
- package/dist/core/components/organisms/timePicker/TimePicker.d.ts +5 -13
- package/dist/core/components/organisms/timePicker/TimePickerWithInput.d.ts +24 -0
- package/dist/core/components/organisms/timePicker/TimePickerWithSearch.d.ts +32 -0
- package/dist/core/components/organisms/timePicker/index.d.ts +2 -0
- package/dist/core/components/organisms/timePicker/utility/searchUtils.d.ts +7 -0
- package/dist/core/components/organisms/timePicker/utility/timePickerUtility.d.ts +19 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/index.esm.js +709 -46
- package/dist/index.js +638 -68
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.br +0 -0
- package/dist/index.umd.js.gz +0 -0
- package/docs/.eslintrc.json +32 -1
- package/docs/.prettierrc +6 -0
- package/docs/README.md +14 -0
- package/docs/cypress/e2e/main.cy.js +35 -0
- package/docs/cypress/fixtures/example.json +5 -0
- package/docs/cypress/support/commands.ts +37 -0
- package/docs/cypress/support/e2e.ts +20 -0
- package/docs/cypress.config.js +9 -0
- package/docs/package.json +16 -2
- package/docs/src/components/Colors/Colors.js +13 -41
- package/docs/src/components/Container/ComponentsContainer.js +10 -30
- package/docs/src/components/Container/Container.js +10 -41
- package/docs/src/components/ErrorBoundary.js +9 -3
- package/docs/src/components/Footer/Footer.js +11 -10
- package/docs/src/components/GlobalSearch/index.js +47 -44
- package/docs/src/components/Header/Header.css +4 -0
- package/docs/src/components/Header/Header.js +25 -19
- package/docs/src/components/Layout.js +110 -172
- package/docs/src/components/LeftNav/LeftNav.js +12 -28
- package/docs/src/components/Logos/Logos.js +12 -26
- package/docs/src/components/MDXHeading.js +12 -18
- package/docs/src/components/Meta.js +9 -9
- package/docs/src/components/PropsTable/ArgJsDoc.tsx +2 -6
- package/docs/src/components/PropsTable/ArgRow.tsx +19 -47
- package/docs/src/components/PropsTable/ArgValue.tsx +50 -93
- package/docs/src/components/PropsTable/EmptyBlock.tsx +2 -5
- package/docs/src/components/PropsTable/SectionRow.tsx +7 -18
- package/docs/src/components/PropsTable/Table.tsx +43 -130
- package/docs/src/components/PropsTable/generateImports.tsx +1 -3
- package/docs/src/components/PropsTable/index.js +94 -140
- package/docs/src/components/PropsTable/prism.css +19 -20
- package/docs/src/components/Rules/DONTs.js +1 -6
- package/docs/src/components/Rules/DOs.js +1 -6
- package/docs/src/components/Rules/IconWrapper.js +6 -7
- package/docs/src/components/Rules/InlineMessage.js +1 -5
- package/docs/src/components/Rules/Rules.js +18 -28
- package/docs/src/components/TableOfContent/TableOfContent.js +49 -54
- package/docs/src/components/css/global.css +1 -1
- package/docs/src/components/css/prism.css +1 -1
- package/docs/src/components/css/style.css +7 -3
- package/docs/src/components/templates/Default.js +1 -1
- package/docs/src/components/templates/Homepage.js +4 -6
- package/docs/src/data/components/Overview.js +49 -56
- package/docs/src/data/components/images/Calendar.png +0 -0
- package/docs/src/data/components/images/MetaList.png +0 -0
- package/docs/src/data/components/images/PageHeader.png +0 -0
- package/docs/src/data/components/images/TimePicker.png +0 -0
- package/docs/src/data/components/images/mobile/Badge.png +0 -0
- package/docs/src/data/components/images/mobile/Dropdown.png +0 -0
- package/docs/src/data/components/images/mobile/Message.png +0 -0
- package/docs/src/data/components/images/mobile/MetaList.png +0 -0
- package/docs/src/data/components/images/mobile/Slider.png +0 -0
- package/docs/src/data/components/images/mobile/StatusHint.png +0 -0
- package/docs/src/data/components/images/mobile/Stepper.png +0 -0
- package/docs/src/data/components/index.js +168 -321
- package/docs/src/data/components/mobile.js +85 -125
- package/docs/src/data/components/overview.css +4 -2
- package/docs/src/data/components/patterns.js +25 -59
- package/docs/src/data/header-items.yaml +1 -0
- package/docs/src/data/nav/components.yaml +1 -7
- package/docs/src/pages/404.js +7 -17
- package/docs/src/pages/components/avatar/usage.mdx +1 -0
- package/docs/src/pages/components/button/usage.mdx +2 -2
- package/docs/src/pages/components/calendar/usage.mdx +3 -3
- package/docs/src/pages/components/chips/images/actionchip-state.png +0 -0
- package/docs/src/pages/components/chips/images/inputchips-state.png +0 -0
- package/docs/src/pages/components/chips/images/selectionchip-state.png +0 -0
- package/docs/src/pages/components/chips/usage.mdx +24 -2
- package/docs/src/pages/components/datePicker/images/datePicker-3.png +0 -0
- package/docs/src/pages/components/datePicker/images/datePicker-6.png +0 -0
- package/docs/src/pages/components/datePicker/usage.mdx +9 -2
- package/docs/src/pages/components/inlineEditableFields/images/inlineEditableField-2.png +0 -0
- package/docs/src/pages/components/inlineEditableFields/images/inlineEditableField-3.png +0 -0
- package/docs/src/pages/components/inlineEditableFields/images/inlineEditableFields-1.png +0 -0
- package/docs/src/pages/components/inlineEditableFields/images/inlineEditableFields-4.png +0 -0
- package/docs/src/pages/components/inlineEditableFields/usage.mdx +4 -4
- package/docs/src/pages/components/inputs/usage.mdx +7 -7
- package/docs/src/pages/components/tabs/images/tabs-1.png +0 -0
- package/docs/src/pages/content/button-guidelines/tabs/button-glossary.mdx +1776 -1
- package/docs/src/pages/content/button-guidelines/tabs/confusing-buttons.mdx +479 -8
- package/docs/src/pages/content/email-guidelines.mdx +3 -3
- package/docs/src/pages/content/house-rules/tabs/date,-time-&-numbers.mdx +24 -0
- package/docs/src/pages/content/house-rules/tabs/grammer.mdx +42 -2
- package/docs/src/pages/content/house-rules/tabs/punctuations.mdx +32 -0
- package/docs/src/pages/foundations/colors.mdx +338 -24
- package/docs/src/pages/foundations/layout/index.mdx +57 -82
- package/docs/src/pages/foundations/response-time.mdx +32 -77
- package/docs/src/pages/index.js +92 -121
- package/docs/src/pages/mobile/components/badges/images/badge-1.png +0 -0
- package/docs/src/pages/mobile/components/badges/images/badge-2.png +0 -0
- package/docs/src/pages/mobile/components/badges/images/badge-3.png +0 -0
- package/docs/src/pages/mobile/components/badges/images/badge-4.png +0 -0
- package/docs/src/pages/mobile/components/badges/images/badge-5.png +0 -0
- package/docs/src/pages/mobile/components/badges/usage.mdx +100 -0
- package/docs/src/pages/mobile/components/card/images/mcard-1.png +0 -0
- package/docs/src/pages/mobile/components/card/images/mcard-2.png +0 -0
- package/docs/src/pages/mobile/components/card/images/mcard-3.png +0 -0
- package/docs/src/pages/mobile/components/card/images/mcard-4.png +0 -0
- package/docs/src/pages/mobile/components/card/images/mcard-5.png +0 -0
- package/docs/src/pages/mobile/components/card/images/mcard-6.png +0 -0
- package/docs/src/pages/mobile/components/card/usage.mdx +54 -67
- package/docs/src/pages/mobile/components/checkbox/images/checkbox-1.png +0 -0
- package/docs/src/pages/mobile/components/checkbox/usage.mdx +26 -2
- package/docs/src/pages/mobile/components/dropdowns/images/dropdown-1.png +0 -0
- package/docs/src/pages/mobile/components/dropdowns/images/dropdown-10.png +0 -0
- package/docs/src/pages/mobile/components/dropdowns/images/dropdown-11.png +0 -0
- package/docs/src/pages/mobile/components/dropdowns/images/dropdown-2.png +0 -0
- package/docs/src/pages/mobile/components/dropdowns/images/dropdown-3.png +0 -0
- package/docs/src/pages/mobile/components/dropdowns/images/dropdown-4.png +0 -0
- package/docs/src/pages/mobile/components/dropdowns/images/dropdown-5.png +0 -0
- package/docs/src/pages/mobile/components/dropdowns/images/dropdown-6.png +0 -0
- package/docs/src/pages/mobile/components/dropdowns/images/dropdown-7.png +0 -0
- package/docs/src/pages/mobile/components/dropdowns/images/dropdown-8.png +0 -0
- package/docs/src/pages/mobile/components/dropdowns/images/dropdown-9.png +0 -0
- package/docs/src/pages/mobile/components/dropdowns/usage.mdx +88 -0
- package/docs/src/pages/mobile/components/message/images/messages-1.png +0 -0
- package/docs/src/pages/mobile/components/message/images/messages-10.png +0 -0
- package/docs/src/pages/mobile/components/message/images/messages-11.png +0 -0
- package/docs/src/pages/mobile/components/message/images/messages-12.png +0 -0
- package/docs/src/pages/mobile/components/message/images/messages-2.png +0 -0
- package/docs/src/pages/mobile/components/message/images/messages-3.png +0 -0
- package/docs/src/pages/mobile/components/message/images/messages-4.png +0 -0
- package/docs/src/pages/mobile/components/message/images/messages-5.png +0 -0
- package/docs/src/pages/mobile/components/message/images/messages-6.png +0 -0
- package/docs/src/pages/mobile/components/message/images/messages-7.png +0 -0
- package/docs/src/pages/mobile/components/message/images/messages-8.png +0 -0
- package/docs/src/pages/mobile/components/message/images/messages-9.png +0 -0
- package/docs/src/pages/mobile/components/message/usage.mdx +170 -0
- package/docs/src/pages/mobile/components/metaList/images/metaList-1.png +0 -0
- package/docs/src/pages/mobile/components/metaList/images/metaList-2.png +0 -0
- package/docs/src/pages/mobile/components/metaList/images/metaList-3.png +0 -0
- package/docs/src/pages/mobile/components/metaList/images/metaList-4.png +0 -0
- package/docs/src/pages/mobile/components/metaList/usage.mdx +71 -0
- package/docs/src/pages/mobile/components/slider/images/slider-1.png +0 -0
- package/docs/src/pages/mobile/components/slider/images/slider-2.png +0 -0
- package/docs/src/pages/mobile/components/slider/images/slider-3.png +0 -0
- package/docs/src/pages/mobile/components/slider/images/slider-4.png +0 -0
- package/docs/src/pages/mobile/components/slider/images/slider-5.png +0 -0
- package/docs/src/pages/mobile/components/slider/usage.mdx +83 -0
- package/docs/src/pages/mobile/components/statusHint/images/statushint-1.png +0 -0
- package/docs/src/pages/mobile/components/statusHint/images/statushint-2.png +0 -0
- package/docs/src/pages/mobile/components/statusHint/images/statushint-3.png +0 -0
- package/docs/src/pages/mobile/components/statusHint/images/statushint-4.png +0 -0
- package/docs/src/pages/mobile/components/statusHint/images/statushint-5.png +0 -0
- package/docs/src/pages/mobile/components/statusHint/images/statushint-6.png +0 -0
- package/docs/src/pages/mobile/components/statusHint/images/statushint-7.png +0 -0
- package/docs/src/pages/mobile/components/statusHint/usage.mdx +108 -0
- package/docs/src/pages/mobile/components/steppers/images/stepper-1.png +0 -0
- package/docs/src/pages/mobile/components/steppers/images/stepper-2.png +0 -0
- package/docs/src/pages/mobile/components/steppers/images/stepper-3.png +0 -0
- package/docs/src/pages/mobile/components/steppers/images/stepper-4.png +0 -0
- package/docs/src/pages/mobile/components/steppers/images/stepper-5.png +0 -0
- package/docs/src/pages/mobile/components/steppers/images/stepper-6.png +0 -0
- package/docs/src/pages/mobile/components/steppers/usage.mdx +111 -0
- package/docs/src/pages/mobile/foundations/layout/images/layout-2.png +0 -0
- package/docs/src/pages/mobile/foundations/layout/index.mdx +3 -1
- package/docs/src/pages/mobile/foundations/page-types/index.mdx +0 -214
- package/docs/src/pages/mobile/foundations/spacing/index.mdx +5 -0
- package/docs/src/pages/mobile/foundations/typography.mdx +1 -1
- package/docs/src/pages/patterns/uiStates/usage.mdx +92 -0
- package/docs/src/util/Frontmatter.js +4 -4
- package/docs/src/util/HeaderItems.js +2 -1
- package/docs/src/util/Helpers.js +3 -3
- package/docs/src/util/HomeIcons.js +91 -53
- package/docs/src/util/InPageNavItems.js +2 -6
- package/docs/src/util/Logos.js +2 -2
- package/docs/src/util/MdsChangelog.js +5 -10
- package/docs/src/util/MediumBlogs.js +13 -13
- package/docs/src/util/NavItems.js +14 -17
- package/docs/src/util/Search.js +2 -2
- package/docs/src/util/StorybookData.js +2 -4
- package/docs/src/util/constants.js +1 -5
- package/docs/src/util/context/NavContext.js +1 -4
- package/docs/src/util/hooks/useMetadata.js +1 -1
- package/package.json +1 -1
- package/docs/src/pages/components/inlineEditableFields/images/inlineEditableFields-2.png +0 -0
- package/docs/src/pages/components/inlineEditableFields/images/inlineEditableFields-3.png +0 -0
package/core/components/organisms/pageHeader/__stories__/variants/withNavigationL1.story.jsx
CHANGED
|
@@ -59,7 +59,7 @@ export const withNavigation = () => {
|
|
|
59
59
|
meta: <MetaList list={[{ label: 'Meta data' }]} seperator={true} />,
|
|
60
60
|
};
|
|
61
61
|
return (
|
|
62
|
-
<div className="w-100
|
|
62
|
+
<div className="w-100 py-6 bg-secondary-lightest">
|
|
63
63
|
<PageHeader {...options} />
|
|
64
64
|
</div>
|
|
65
65
|
);
|
|
@@ -134,7 +134,7 @@ const customCode = `() => {
|
|
|
134
134
|
)
|
|
135
135
|
};
|
|
136
136
|
return (
|
|
137
|
-
<div className="w-100
|
|
137
|
+
<div className="w-100 py-6 bg-secondary-lightest">
|
|
138
138
|
<PageHeader {...options} />
|
|
139
139
|
</div>
|
|
140
140
|
);
|
|
@@ -51,7 +51,7 @@ export const withStepper = () => {
|
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
return (
|
|
54
|
-
<div className="w-100
|
|
54
|
+
<div className="w-100 py-6 bg-secondary-lightest">
|
|
55
55
|
<PageHeader {...options} />
|
|
56
56
|
</div>
|
|
57
57
|
);
|
|
@@ -100,7 +100,7 @@ const customCode = `() => {
|
|
|
100
100
|
};
|
|
101
101
|
|
|
102
102
|
return (
|
|
103
|
-
<div className="w-100
|
|
103
|
+
<div className="w-100 py-6 bg-secondary-lightest">
|
|
104
104
|
<PageHeader {...options} />
|
|
105
105
|
</div>
|
|
106
106
|
);
|
|
@@ -65,7 +65,7 @@ export const withStepper = () => {
|
|
|
65
65
|
};
|
|
66
66
|
|
|
67
67
|
return (
|
|
68
|
-
<div className="w-100
|
|
68
|
+
<div className="w-100 py-6 bg-secondary-lightest">
|
|
69
69
|
<PageHeader {...options} />
|
|
70
70
|
</div>
|
|
71
71
|
);
|
|
@@ -144,7 +144,7 @@ const customCode = `() => {
|
|
|
144
144
|
};
|
|
145
145
|
|
|
146
146
|
return (
|
|
147
|
-
<div className="w-100
|
|
147
|
+
<div className="w-100 py-6 bg-secondary-lightest">
|
|
148
148
|
<PageHeader {...options} />
|
|
149
149
|
</div>
|
|
150
150
|
);
|
|
@@ -67,7 +67,7 @@ export const withTabs = () => {
|
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
return (
|
|
70
|
-
<div className="w-100
|
|
70
|
+
<div className="w-100 py-6 bg-secondary-lightest">
|
|
71
71
|
<PageHeader {...options} />
|
|
72
72
|
</div>
|
|
73
73
|
);
|
|
@@ -136,7 +136,7 @@ const customCode = `() => {
|
|
|
136
136
|
};
|
|
137
137
|
|
|
138
138
|
return (
|
|
139
|
-
<div className="w-100
|
|
139
|
+
<div className="w-100 py-6 bg-secondary-lightest">
|
|
140
140
|
<PageHeader {...options} />
|
|
141
141
|
</div>
|
|
142
142
|
);
|
|
@@ -78,7 +78,7 @@ export const withTabs = () => {
|
|
|
78
78
|
meta: <MetaList list={[{ label: 'Meta data' }]} seperator={true} />,
|
|
79
79
|
};
|
|
80
80
|
return (
|
|
81
|
-
<div className="w-100
|
|
81
|
+
<div className="w-100 py-6 bg-secondary-lightest">
|
|
82
82
|
<PageHeader {...options} />
|
|
83
83
|
</div>
|
|
84
84
|
);
|
|
@@ -174,7 +174,7 @@ const customCode = `() => {
|
|
|
174
174
|
)
|
|
175
175
|
};
|
|
176
176
|
return (
|
|
177
|
-
<div className="w-100
|
|
177
|
+
<div className="w-100 py-6 bg-secondary-lightest">
|
|
178
178
|
<PageHeader {...options} />
|
|
179
179
|
</div>
|
|
180
180
|
);
|
|
@@ -31,7 +31,7 @@ export const level0WithFilter = () => {
|
|
|
31
31
|
);
|
|
32
32
|
|
|
33
33
|
return (
|
|
34
|
-
<div className="
|
|
34
|
+
<div className="py-6 bg-secondary-lightest" style={{ width: '900px' }}>
|
|
35
35
|
<PageHeader title="Users" separator={true} tabs={tab} actions={actions} />
|
|
36
36
|
</div>
|
|
37
37
|
);
|
|
@@ -71,7 +71,7 @@ const customCode = `() => {
|
|
|
71
71
|
);
|
|
72
72
|
|
|
73
73
|
return (
|
|
74
|
-
<div className="
|
|
74
|
+
<div className="py-6 bg-secondary-lightest" style={{width:'900px'}}>
|
|
75
75
|
<PageHeader
|
|
76
76
|
title="Users"
|
|
77
77
|
separator={true}
|
|
@@ -35,7 +35,7 @@ export const level1WithFilter = () => {
|
|
|
35
35
|
);
|
|
36
36
|
|
|
37
37
|
return (
|
|
38
|
-
<div className="
|
|
38
|
+
<div className="py-6 bg-secondary-lightest" style={{ width: '900px' }}>
|
|
39
39
|
<PageHeader title="Sender creation report" separator={true} tabs={tab} breadcrumbs={breadcrumbs} />
|
|
40
40
|
</div>
|
|
41
41
|
);
|
|
@@ -78,7 +78,7 @@ const customCode = `() => {
|
|
|
78
78
|
);
|
|
79
79
|
|
|
80
80
|
return (
|
|
81
|
-
<div className="
|
|
81
|
+
<div className="py-6 bg-secondary-lightest" style={{width:'900px'}}>
|
|
82
82
|
<PageHeader
|
|
83
83
|
title="Sender creation report"
|
|
84
84
|
separator={true}
|
|
@@ -29,7 +29,7 @@ export const level0WithNavigation = () => {
|
|
|
29
29
|
);
|
|
30
30
|
|
|
31
31
|
return (
|
|
32
|
-
<div className="
|
|
32
|
+
<div className="py-6 bg-secondary-lightest" style={{ width: '900px' }}>
|
|
33
33
|
<PageHeader title="Dashboard" separator={true} navigation={navigation} actions={actions} />
|
|
34
34
|
</div>
|
|
35
35
|
);
|
|
@@ -64,7 +64,7 @@ const customCode = `() => {
|
|
|
64
64
|
);
|
|
65
65
|
|
|
66
66
|
return (
|
|
67
|
-
<div className="
|
|
67
|
+
<div className="py-6 bg-secondary-lightest" style={{width:'900px'}}>
|
|
68
68
|
<PageHeader
|
|
69
69
|
title="Dashboard"
|
|
70
70
|
separator={true}
|
|
@@ -42,7 +42,7 @@ export const level1WithNavigation = () => {
|
|
|
42
42
|
);
|
|
43
43
|
const meta = <MetaList list={[{ label: 'Text' }, { label: 'Email' }]} />;
|
|
44
44
|
return (
|
|
45
|
-
<div className="
|
|
45
|
+
<div className="py-5 bg-secondary-lightest" style={{ width: '900px' }}>
|
|
46
46
|
<PageHeader
|
|
47
47
|
title="Covid-19"
|
|
48
48
|
separator={true}
|
|
@@ -107,7 +107,7 @@ const customCode = `() => {
|
|
|
107
107
|
/>
|
|
108
108
|
);
|
|
109
109
|
return (
|
|
110
|
-
<div className="
|
|
110
|
+
<div className="py-5 bg-secondary-lightest" style={{width:'900px'}}>
|
|
111
111
|
<PageHeader
|
|
112
112
|
title="Covid-19"
|
|
113
113
|
separator={true}
|
|
@@ -71,10 +71,10 @@ export const level1WithStepper = () => {
|
|
|
71
71
|
/>
|
|
72
72
|
);
|
|
73
73
|
const badge = <Badge appearance="secondary">Message</Badge>;
|
|
74
|
-
const meta = <MetaList list={[{ label: 'Draft' }]} seperator={
|
|
74
|
+
const meta = <MetaList list={[{ label: 'Draft' }]} seperator={false} />;
|
|
75
75
|
|
|
76
76
|
return (
|
|
77
|
-
<div className="w-100
|
|
77
|
+
<div className="w-100 py-6 bg-secondary-lightest">
|
|
78
78
|
<PageHeader
|
|
79
79
|
title="Annual Wellness Visit"
|
|
80
80
|
separator={true}
|
|
@@ -163,12 +163,12 @@ const customCode = `() => {
|
|
|
163
163
|
const meta = (
|
|
164
164
|
<MetaList
|
|
165
165
|
list={[{ label: 'Draft' }]}
|
|
166
|
-
seperator={
|
|
166
|
+
seperator={false}
|
|
167
167
|
/>
|
|
168
168
|
);
|
|
169
169
|
|
|
170
170
|
return (
|
|
171
|
-
<div className="
|
|
171
|
+
<div className="py-6 bg-secondary-lightest" style={{width:'1200px'}}>
|
|
172
172
|
<PageHeader
|
|
173
173
|
title="Annual Wellness Visit"
|
|
174
174
|
separator={true}
|
|
@@ -29,7 +29,7 @@ export const tableAsDescriptionList = () => {
|
|
|
29
29
|
{
|
|
30
30
|
name: 'info',
|
|
31
31
|
displayName: 'Info',
|
|
32
|
-
width: '
|
|
32
|
+
width: '75%',
|
|
33
33
|
cellType: 'AVATAR_WITH_META_LIST',
|
|
34
34
|
translate: (a) => ({
|
|
35
35
|
firstName: a.firstName,
|
|
@@ -41,7 +41,7 @@ export const tableAsDescriptionList = () => {
|
|
|
41
41
|
{
|
|
42
42
|
name: 'rights',
|
|
43
43
|
displayName: 'Rights',
|
|
44
|
-
width: '
|
|
44
|
+
width: '25%',
|
|
45
45
|
cellRenderer: (props) => {
|
|
46
46
|
const renderRights = () => {
|
|
47
47
|
if (props.data.owner) {
|
|
@@ -132,7 +132,7 @@ const customCode = `() => {
|
|
|
132
132
|
{
|
|
133
133
|
name: 'info',
|
|
134
134
|
displayName: 'Info',
|
|
135
|
-
width: '
|
|
135
|
+
width: '75%',
|
|
136
136
|
cellType: 'AVATAR_WITH_META_LIST',
|
|
137
137
|
translate: a => ({
|
|
138
138
|
firstName: a.firstName,
|
|
@@ -144,7 +144,7 @@ const customCode = `() => {
|
|
|
144
144
|
{
|
|
145
145
|
name: 'rights',
|
|
146
146
|
displayName: 'Rights',
|
|
147
|
-
width: '
|
|
147
|
+
width: '25%',
|
|
148
148
|
cellRenderer: (props) => {
|
|
149
149
|
const renderRights = () => {
|
|
150
150
|
if (props.data.owner) {
|
|
@@ -1,123 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { Validators } from '@/utils/types';
|
|
2
|
+
import TimePickerWithSearch, { TimePickerDropdownProps } from './TimePickerWithSearch';
|
|
3
|
+
import TimePickerWithInput, { TimePickerInputProps } from './TimePickerWithInput';
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export type AMPMType = 'AM' | 'PM';
|
|
9
|
-
export type TimeFormat = 'hh:mm AM' | 'hh:mm';
|
|
10
|
-
export type TimeType = number | string;
|
|
11
|
-
|
|
12
|
-
export interface TimePickerProps {
|
|
13
|
-
/**
|
|
14
|
-
* Selected time
|
|
15
|
-
*
|
|
16
|
-
* `number` - number of milliseconds elapsed since January 1, 1970, 00:00:00 UTC
|
|
17
|
-
*
|
|
18
|
-
* **`string` - Time string value as per `inputFormat`**
|
|
19
|
-
*/
|
|
20
|
-
time?: TimeType;
|
|
21
|
-
/**
|
|
22
|
-
* Props to be used for `InputMask`
|
|
23
|
-
*/
|
|
24
|
-
inputOptions: Omit<InputMaskProps, 'mask' | 'value' | 'validators'>;
|
|
25
|
-
/**
|
|
26
|
-
* Should be used if `time` is of type `string`
|
|
27
|
-
*
|
|
28
|
-
* Also determines mask format
|
|
29
|
-
*/
|
|
30
|
-
inputFormat: TimeFormat;
|
|
31
|
-
/**
|
|
32
|
-
* Should be used to translate `time` to desired format for `onTimeChange` callback
|
|
33
|
-
*/
|
|
34
|
-
outputFormat: TimeFormat;
|
|
35
|
-
/**
|
|
36
|
-
* custom Validator for `TimePicker`
|
|
37
|
-
* `boolean | ((val?: string) => boolean)`
|
|
38
|
-
*/
|
|
39
|
-
validators: Validators;
|
|
40
|
-
/**
|
|
41
|
-
* Callback function called when input field is blurred
|
|
42
|
-
*/
|
|
43
|
-
onTimeChange?: (timeVal?: string) => void;
|
|
44
|
-
}
|
|
5
|
+
export type TimePickerProps = TimePickerInputProps & TimePickerDropdownProps;
|
|
45
6
|
|
|
46
7
|
export const TimePicker = (props: TimePickerProps) => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const [time, setTime] = React.useState(timeProp);
|
|
50
|
-
const [init, setInit] = React.useState(false);
|
|
51
|
-
const { placeholderChar = '_' } = inputOptions;
|
|
52
|
-
|
|
53
|
-
React.useEffect(() => {
|
|
54
|
-
const timeStr = translateToTime(inputFormat, time);
|
|
55
|
-
const updatedTime = timeProp === undefined && timeStr.includes(placeholderChar) ? time : timeProp;
|
|
56
|
-
|
|
57
|
-
setTime(updatedTime);
|
|
58
|
-
}, [timeProp]);
|
|
59
|
-
|
|
60
|
-
const onChangeHandler = (e: React.ChangeEvent<HTMLInputElement>, val = '') => {
|
|
61
|
-
const updatedTime = val?.toUpperCase();
|
|
62
|
-
setTime(updatedTime);
|
|
63
|
-
|
|
64
|
-
if (inputOptions.onChange) {
|
|
65
|
-
inputOptions.onChange(e, val);
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const onBlurHandler = (e: React.ChangeEvent<HTMLInputElement>, val = '') => {
|
|
70
|
-
const updatedTime = translateToTime(inputFormat, time);
|
|
71
|
-
setInit(true);
|
|
72
|
-
|
|
73
|
-
if (onTimeChange) {
|
|
74
|
-
const outputTimeStr =
|
|
75
|
-
updatedTime && !isPlaceholderPresent(placeholderChar, updatedTime)
|
|
76
|
-
? getOutputTimeString(inputFormat, outputFormat, updatedTime)
|
|
77
|
-
: undefined;
|
|
78
|
-
|
|
79
|
-
onTimeChange(outputTimeStr);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (inputOptions.onBlur) inputOptions.onBlur(e, val);
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
const onClearHandler = (e: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>) => {
|
|
86
|
-
const updatedTime = '';
|
|
87
|
-
setInit(true);
|
|
88
|
-
|
|
89
|
-
if (onTimeChange) onTimeChange(updatedTime);
|
|
90
|
-
if (inputOptions.onClear) inputOptions.onClear(e);
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
const inputValidator = (val: string): boolean => {
|
|
94
|
-
return Utils.validators.isValid(validators, val, inputFormat);
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
const mask = Utils.masks.time[inputFormat];
|
|
98
|
-
return (
|
|
99
|
-
<InputMask
|
|
100
|
-
placeholder={placeholders[inputFormat]}
|
|
101
|
-
placeholderChar={placeholderChar}
|
|
102
|
-
{...inputOptions}
|
|
103
|
-
mask={mask}
|
|
104
|
-
value={
|
|
105
|
-
time ? translateToTime(inputFormat, time) : init ? InputMask.utils.getDefaultValue(mask, placeholderChar) : ''
|
|
106
|
-
}
|
|
107
|
-
validators={inputValidator}
|
|
108
|
-
onChange={onChangeHandler}
|
|
109
|
-
onClear={onClearHandler}
|
|
110
|
-
onBlur={onBlurHandler}
|
|
111
|
-
id="parent-TimePicker"
|
|
112
|
-
/>
|
|
113
|
-
);
|
|
8
|
+
return props.withSearch ? <TimePickerWithSearch {...props} /> : <TimePickerWithInput {...props} />;
|
|
114
9
|
};
|
|
115
10
|
|
|
116
11
|
TimePicker.defaultProps = {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
inputOptions: {},
|
|
120
|
-
validators: [Utils.validators.time],
|
|
12
|
+
...TimePickerWithInput.defaultProps,
|
|
13
|
+
...TimePickerWithSearch.defaultProps,
|
|
121
14
|
};
|
|
122
15
|
|
|
123
16
|
TimePicker.displayName = 'TimePicker';
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { InputMask, Utils } from '@/index';
|
|
3
|
+
import { InputMaskProps } from '@/index.type';
|
|
4
|
+
import { Validators } from '@/utils/types';
|
|
5
|
+
|
|
6
|
+
import { translateToTime, getOutputTimeString, placeholders, isPlaceholderPresent } from './utils';
|
|
7
|
+
|
|
8
|
+
export type AMPMType = 'AM' | 'PM';
|
|
9
|
+
export type InputFormat = 'hh:mm AM' | 'hh:mm';
|
|
10
|
+
export type TimeType = number | string;
|
|
11
|
+
|
|
12
|
+
export interface TimePickerInputProps {
|
|
13
|
+
/**
|
|
14
|
+
* Selected time
|
|
15
|
+
*
|
|
16
|
+
* `number` - number of milliseconds elapsed since January 1, 1970, 00:00:00 UTC
|
|
17
|
+
*
|
|
18
|
+
* **`string` - Time string value as per `inputFormat`**
|
|
19
|
+
*/
|
|
20
|
+
time?: TimeType;
|
|
21
|
+
/**
|
|
22
|
+
* Props to be used for `InputMask`
|
|
23
|
+
*/
|
|
24
|
+
inputOptions: Omit<InputMaskProps, 'mask' | 'value' | 'validators'>;
|
|
25
|
+
/**
|
|
26
|
+
* Should be used if `time` is of type `string`
|
|
27
|
+
*
|
|
28
|
+
* Also determines mask format
|
|
29
|
+
*/
|
|
30
|
+
inputFormat: InputFormat;
|
|
31
|
+
/**
|
|
32
|
+
* Should be used to translate `time` to desired format for `onTimeChange` callback
|
|
33
|
+
*/
|
|
34
|
+
outputFormat: InputFormat;
|
|
35
|
+
/**
|
|
36
|
+
* custom Validator for `TimePicker`
|
|
37
|
+
* `boolean | ((val?: string) => boolean)`
|
|
38
|
+
*/
|
|
39
|
+
validators: Validators;
|
|
40
|
+
/**
|
|
41
|
+
* Callback function called when input field is blurred
|
|
42
|
+
*/
|
|
43
|
+
onTimeChange?: (timeVal?: string) => void;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const TimePickerWithInput = (props: TimePickerInputProps) => {
|
|
47
|
+
const { validators, inputOptions, inputFormat, outputFormat, onTimeChange, time: timeProp } = props;
|
|
48
|
+
|
|
49
|
+
const [time, setTime] = React.useState(timeProp);
|
|
50
|
+
const [init, setInit] = React.useState(false);
|
|
51
|
+
const { placeholderChar = '_' } = inputOptions;
|
|
52
|
+
|
|
53
|
+
React.useEffect(() => {
|
|
54
|
+
const timeStr = translateToTime(inputFormat, time);
|
|
55
|
+
const updatedTime = timeProp === undefined && timeStr.includes(placeholderChar) ? time : timeProp;
|
|
56
|
+
|
|
57
|
+
setTime(updatedTime);
|
|
58
|
+
}, [timeProp]);
|
|
59
|
+
|
|
60
|
+
const onChangeHandler = (e: React.ChangeEvent<HTMLInputElement>, val = '') => {
|
|
61
|
+
const updatedTime = val?.toUpperCase();
|
|
62
|
+
setTime(updatedTime);
|
|
63
|
+
|
|
64
|
+
if (inputOptions.onChange) {
|
|
65
|
+
inputOptions.onChange(e, val);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const onBlurHandler = (e: React.ChangeEvent<HTMLInputElement>, val = '') => {
|
|
70
|
+
const updatedTime = translateToTime(inputFormat, time);
|
|
71
|
+
setInit(true);
|
|
72
|
+
|
|
73
|
+
if (onTimeChange) {
|
|
74
|
+
const outputTimeStr =
|
|
75
|
+
updatedTime && !isPlaceholderPresent(placeholderChar, updatedTime)
|
|
76
|
+
? getOutputTimeString(inputFormat, outputFormat, updatedTime)
|
|
77
|
+
: undefined;
|
|
78
|
+
|
|
79
|
+
onTimeChange(outputTimeStr);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (inputOptions.onBlur) inputOptions.onBlur(e, val);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const onClearHandler = (e: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>) => {
|
|
86
|
+
const updatedTime = '';
|
|
87
|
+
setInit(true);
|
|
88
|
+
|
|
89
|
+
if (onTimeChange) onTimeChange(updatedTime);
|
|
90
|
+
if (inputOptions.onClear) inputOptions.onClear(e);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const inputValidator = (val: string): boolean => {
|
|
94
|
+
return Utils.validators.isValid(validators, val, inputFormat);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const mask = Utils.masks.time[inputFormat];
|
|
98
|
+
return (
|
|
99
|
+
<InputMask
|
|
100
|
+
placeholder={placeholders[inputFormat]}
|
|
101
|
+
placeholderChar={placeholderChar}
|
|
102
|
+
{...inputOptions}
|
|
103
|
+
mask={mask}
|
|
104
|
+
value={
|
|
105
|
+
time ? translateToTime(inputFormat, time) : init ? InputMask.utils.getDefaultValue(mask, placeholderChar) : ''
|
|
106
|
+
}
|
|
107
|
+
validators={inputValidator}
|
|
108
|
+
onChange={onChangeHandler}
|
|
109
|
+
onClear={onClearHandler}
|
|
110
|
+
onBlur={onBlurHandler}
|
|
111
|
+
id="parent-TimePicker"
|
|
112
|
+
/>
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
TimePickerWithInput.defaultProps = {
|
|
117
|
+
inputFormat: 'hh:mm AM',
|
|
118
|
+
outputFormat: 'hh:mm AM',
|
|
119
|
+
inputOptions: {},
|
|
120
|
+
validators: [Utils.validators.time],
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
TimePickerWithInput.displayName = 'TimePickerWithInput';
|
|
124
|
+
export default TimePickerWithInput;
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Dropdown } from '@/index';
|
|
3
|
+
import { BaseProps } from '@/utils/types';
|
|
4
|
+
import { getScrollIndex } from './utility/searchUtils';
|
|
5
|
+
import { OptionSchema } from '@/components/atoms/dropdown/option';
|
|
6
|
+
import { scrollToOptionIndex } from '@/components/atoms/dropdown/utility';
|
|
7
|
+
import { getDropdownOptionList, isFormat12Hour, convert24To12HourFormat } from './utility/timePickerUtility';
|
|
8
|
+
|
|
9
|
+
type fetchOptionsFunction = (searchTerm: string) => Promise<{
|
|
10
|
+
count: number;
|
|
11
|
+
searchTerm?: string;
|
|
12
|
+
scrollToIndex?: number;
|
|
13
|
+
options: OptionSchema[];
|
|
14
|
+
}>;
|
|
15
|
+
|
|
16
|
+
export type TimeFormat = '12-Hour' | '24-Hour';
|
|
17
|
+
|
|
18
|
+
export interface TimePickerDropdownProps extends BaseProps {
|
|
19
|
+
/**
|
|
20
|
+
* Set as `true` to show timePicker with search
|
|
21
|
+
*/
|
|
22
|
+
withSearch?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Indicates the start time for the options in particular time format `hh:mm [AM | PM]` or `hh:mm`
|
|
25
|
+
*/
|
|
26
|
+
startTime?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Indicates the end time for the options in particular time format `hh:mm [AM | PM]` or `hh:mm`
|
|
29
|
+
*/
|
|
30
|
+
endTime?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Depicts the time interval in `minutes` between options
|
|
33
|
+
*/
|
|
34
|
+
interval: number;
|
|
35
|
+
/**
|
|
36
|
+
* Indicates time format for options list
|
|
37
|
+
*/
|
|
38
|
+
timeFormat: TimeFormat;
|
|
39
|
+
/**
|
|
40
|
+
* Determines if the `TimePicker Popover` is open
|
|
41
|
+
*/
|
|
42
|
+
open?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Display message when there is no result
|
|
45
|
+
*/
|
|
46
|
+
noResultMessage?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Set as `true` to display time difference in option label w.r.t start time
|
|
49
|
+
*/
|
|
50
|
+
showDuration?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Specify list of options in `hh:mm [AM | PM]` or `hh:mm` time format which need to be set as disabled
|
|
53
|
+
*/
|
|
54
|
+
disabledSlotList?: string[];
|
|
55
|
+
/**
|
|
56
|
+
* Callback function which is called when options are selected from dropdown.
|
|
57
|
+
*/
|
|
58
|
+
onChange?: (selected: any[] | any, name?: string | number) => void;
|
|
59
|
+
/**
|
|
60
|
+
* Callback function to fetch options list from API based on search term
|
|
61
|
+
*
|
|
62
|
+
* <pre className="DocPage-codeBlock p-4">
|
|
63
|
+
* fetchOptionsFunction: (searchTerm: string) => Promise<{
|
|
64
|
+
* searchTerm?: string;
|
|
65
|
+
* count: number,
|
|
66
|
+
* options: OptionSchema[];
|
|
67
|
+
* scrollToIndex?: number;
|
|
68
|
+
* }>;
|
|
69
|
+
* <br/> <br/>
|
|
70
|
+
*
|
|
71
|
+
* OptionSchema: {
|
|
72
|
+
* label: string;
|
|
73
|
+
* value: React.ReactText;
|
|
74
|
+
* icon?: string;
|
|
75
|
+
* subInfo?: string | [MetaListProps]
|
|
76
|
+
* optionType?: OptionType;
|
|
77
|
+
* selected?: boolean;
|
|
78
|
+
* disabled?: boolean;
|
|
79
|
+
* group?: string;
|
|
80
|
+
* }
|
|
81
|
+
* </pre>
|
|
82
|
+
*
|
|
83
|
+
*/
|
|
84
|
+
fetchTimeOptions?: fetchOptionsFunction;
|
|
85
|
+
/**
|
|
86
|
+
* Provide unique ID in case of using multiple timePicker together
|
|
87
|
+
*/
|
|
88
|
+
id?: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export const TimePickerWithSearch = (props: TimePickerDropdownProps) => {
|
|
92
|
+
const {
|
|
93
|
+
open,
|
|
94
|
+
endTime,
|
|
95
|
+
interval,
|
|
96
|
+
onChange,
|
|
97
|
+
startTime,
|
|
98
|
+
timeFormat,
|
|
99
|
+
showDuration,
|
|
100
|
+
noResultMessage,
|
|
101
|
+
disabledSlotList,
|
|
102
|
+
fetchTimeOptions,
|
|
103
|
+
} = props;
|
|
104
|
+
|
|
105
|
+
const [tabIndex, setTabIndex] = React.useState(0);
|
|
106
|
+
const [openPopover, setOpenPopover] = React.useState(false);
|
|
107
|
+
const [selectedIndex, setSelectedIndex] = React.useState(-1);
|
|
108
|
+
const [counter, setCounter] = React.useState(0);
|
|
109
|
+
|
|
110
|
+
const dropdownOptionList = getDropdownOptionList(props);
|
|
111
|
+
|
|
112
|
+
React.useEffect(() => {
|
|
113
|
+
open !== undefined && setOpenPopover(open);
|
|
114
|
+
}, [open]);
|
|
115
|
+
|
|
116
|
+
React.useEffect(() => {
|
|
117
|
+
let timer: any;
|
|
118
|
+
|
|
119
|
+
if (openPopover && selectedIndex != -1) {
|
|
120
|
+
setTabIndex(selectedIndex);
|
|
121
|
+
|
|
122
|
+
timer = setTimeout(() => {
|
|
123
|
+
scrollToOptionIndex(selectedIndex, dropdownOptionList);
|
|
124
|
+
}, 100);
|
|
125
|
+
}
|
|
126
|
+
return () => {
|
|
127
|
+
clearTimeout(timer);
|
|
128
|
+
};
|
|
129
|
+
}, [openPopover]);
|
|
130
|
+
|
|
131
|
+
// Required to re-render dropdown forcefully whenever props changes
|
|
132
|
+
React.useEffect(() => {
|
|
133
|
+
setCounter(counter + 1);
|
|
134
|
+
}, [startTime, endTime, interval, showDuration, disabledSlotList]);
|
|
135
|
+
|
|
136
|
+
const onChangeHandler = (props: string) => {
|
|
137
|
+
let time = props;
|
|
138
|
+
|
|
139
|
+
if (isFormat12Hour(timeFormat)) {
|
|
140
|
+
time = convert24To12HourFormat(time);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const selectIndex = dropdownOptionList.findIndex((option) => option.value === props);
|
|
144
|
+
setSelectedIndex(selectIndex);
|
|
145
|
+
onChange && onChange(time);
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
const getOptionList = (searchTerm: string) => {
|
|
149
|
+
let scrollIndex;
|
|
150
|
+
const indexValue = getScrollIndex(dropdownOptionList, searchTerm);
|
|
151
|
+
|
|
152
|
+
if (searchTerm === '' && selectedIndex != -1) {
|
|
153
|
+
scrollIndex = selectedIndex;
|
|
154
|
+
setTabIndex(selectedIndex);
|
|
155
|
+
} else {
|
|
156
|
+
scrollIndex = indexValue;
|
|
157
|
+
setTabIndex(indexValue);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return Promise.resolve({
|
|
161
|
+
options: indexValue === -1 ? [] : dropdownOptionList,
|
|
162
|
+
count: dropdownOptionList.length,
|
|
163
|
+
scrollToIndex: scrollIndex === 0 ? scrollIndex + 1 : scrollIndex,
|
|
164
|
+
searchTerm,
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
const fetchOptionList = () => {
|
|
169
|
+
return fetchTimeOptions ? fetchTimeOptions : getOptionList;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
return (
|
|
173
|
+
<Dropdown
|
|
174
|
+
key={counter}
|
|
175
|
+
maxHeight={160}
|
|
176
|
+
loadersCount={0}
|
|
177
|
+
withSearch={true}
|
|
178
|
+
open={openPopover}
|
|
179
|
+
tabIndex={tabIndex}
|
|
180
|
+
searchPlaceholder="Search"
|
|
181
|
+
onChange={onChangeHandler}
|
|
182
|
+
fetchOptions={fetchOptionList()}
|
|
183
|
+
noResultMessage={noResultMessage}
|
|
184
|
+
staticLimit={dropdownOptionList.length}
|
|
185
|
+
onPopperToggle={() => {
|
|
186
|
+
setOpenPopover(!openPopover);
|
|
187
|
+
}}
|
|
188
|
+
/>
|
|
189
|
+
);
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
TimePickerWithSearch.defaultProps = {
|
|
193
|
+
timeFormat: '12-Hour',
|
|
194
|
+
interval: 15,
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
TimePickerWithSearch.displayName = 'TimePickerWithSearch';
|
|
198
|
+
export default TimePickerWithSearch;
|