@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
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { useState } from
|
|
2
|
-
import { Heading, Icon, Tooltip } from
|
|
3
|
-
import { copyMessage, copyMessageSuccess } from
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Heading, Icon, Tooltip } from '@innovaccer/design-system';
|
|
3
|
+
import { copyMessage, copyMessageSuccess } from '../util/constants.js';
|
|
4
4
|
|
|
5
5
|
const copyToClipboard = (str) => {
|
|
6
6
|
navigator.clipboard.writeText(str);
|
|
@@ -23,22 +23,20 @@ const MDXHeading = ({ size, headingInfo }) => {
|
|
|
23
23
|
|
|
24
24
|
if (currURL.includes(id)) {
|
|
25
25
|
copyToClipboard(currURL);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
else {
|
|
31
|
-
copyToClipboard(currURL + "#" + id);
|
|
26
|
+
} else if (currURL.includes('#')) {
|
|
27
|
+
copyToClipboard(currURL.slice(0, currURL.indexOf('#') + 1) + id);
|
|
28
|
+
} else {
|
|
29
|
+
copyToClipboard(currURL + '#' + id);
|
|
32
30
|
}
|
|
33
31
|
setTooltipActive(true);
|
|
34
32
|
setTooltipName(copyMessageSuccess);
|
|
35
33
|
};
|
|
36
34
|
|
|
37
35
|
const sizeMarginMapper = {
|
|
38
|
-
s:
|
|
39
|
-
m:
|
|
40
|
-
l:
|
|
41
|
-
}
|
|
36
|
+
s: 'mt-4',
|
|
37
|
+
m: 'mt-4',
|
|
38
|
+
l: 'mt-6',
|
|
39
|
+
};
|
|
42
40
|
|
|
43
41
|
return (
|
|
44
42
|
<div
|
|
@@ -47,11 +45,7 @@ const MDXHeading = ({ size, headingInfo }) => {
|
|
|
47
45
|
onMouseLeave={onMouseLeaveHandler}
|
|
48
46
|
className={`d-inline-flex w-100 align-items-center ${sizeMarginMapper[size]}`}
|
|
49
47
|
>
|
|
50
|
-
<Heading
|
|
51
|
-
className="mr-4"
|
|
52
|
-
size={size}
|
|
53
|
-
{...headingInfo}
|
|
54
|
-
/>
|
|
48
|
+
<Heading className="mr-4" size={size} {...headingInfo} />
|
|
55
49
|
<div className="cursor-pointer d-flex">
|
|
56
50
|
{isHovered && (
|
|
57
51
|
<Tooltip
|
|
@@ -6,7 +6,7 @@ const favicon = '/icons/favicon_io/favicon-16x16.png';
|
|
|
6
6
|
const faviconLarge = '/icons/favicon_io/favicon-32x32.png';
|
|
7
7
|
const faviconApple = '/icons/favicon_io/apple-touch-icon.png';
|
|
8
8
|
const cardImage = '/icons/card-image.png';
|
|
9
|
-
const GA_MEASUREMENT_ID =
|
|
9
|
+
const GA_MEASUREMENT_ID = 'G-HTLCYE0XZT';
|
|
10
10
|
|
|
11
11
|
const Meta = ({ docTitle, docDescription, pageKeywords, titleType, frontmatter, relativePagePath }) => {
|
|
12
12
|
const { title, description, keywords, lang } = useMetadata();
|
|
@@ -32,9 +32,11 @@ const Meta = ({ docTitle, docDescription, pageKeywords, titleType, frontmatter,
|
|
|
32
32
|
|
|
33
33
|
function embedGoogleAnalytics() {
|
|
34
34
|
// <!-- Global site tag (gtag.js) - Google Analytics -->
|
|
35
|
-
if (typeof window !==
|
|
35
|
+
if (typeof window !== 'undefined') {
|
|
36
36
|
window.dataLayer = window.dataLayer || [];
|
|
37
|
-
function gtag() {
|
|
37
|
+
function gtag() {
|
|
38
|
+
window.dataLayer && window.dataLayer.push(arguments);
|
|
39
|
+
}
|
|
38
40
|
gtag('js', new Date());
|
|
39
41
|
gtag('config', GA_MEASUREMENT_ID);
|
|
40
42
|
}
|
|
@@ -105,14 +107,12 @@ const Meta = ({ docTitle, docDescription, pageKeywords, titleType, frontmatter,
|
|
|
105
107
|
]}
|
|
106
108
|
>
|
|
107
109
|
<html lang={lang} />
|
|
108
|
-
<link rel=
|
|
109
|
-
<link rel=
|
|
110
|
-
<link rel=
|
|
110
|
+
<link rel="icon" href={favicon} />
|
|
111
|
+
<link rel="icon" href={faviconLarge} />
|
|
112
|
+
<link rel="icon" href={faviconApple} />
|
|
111
113
|
{/* <!-- Global site tag (gtag.js) - Google Analytics --> */}
|
|
112
114
|
<script async src={`https://www.googletagmanager.com/gtag/js?id=${GA_MEASUREMENT_ID}`}></script>
|
|
113
|
-
<script>
|
|
114
|
-
{embedGoogleAnalytics()}
|
|
115
|
-
</script>
|
|
115
|
+
<script>{embedGoogleAnalytics()}</script>
|
|
116
116
|
</Helmet>
|
|
117
117
|
);
|
|
118
118
|
};
|
|
@@ -63,13 +63,9 @@ export const Table = styled.table(({ theme }) => ({
|
|
|
63
63
|
}));
|
|
64
64
|
|
|
65
65
|
export const ArgJsDoc: FC<ArgJsDocArgs> = ({ tags }) => {
|
|
66
|
-
const params = (tags.params || []).filter(
|
|
67
|
-
(x) => x.description
|
|
68
|
-
);
|
|
66
|
+
const params = (tags.params || []).filter((x) => x.description);
|
|
69
67
|
const hasDisplayableParams = params.length !== 0;
|
|
70
|
-
const hasDisplayableReturns =
|
|
71
|
-
tags.returns != null &&
|
|
72
|
-
tags.returns.description != null;
|
|
68
|
+
const hasDisplayableReturns = tags.returns != null && tags.returns.description != null;
|
|
73
69
|
|
|
74
70
|
if (!hasDisplayableParams && !hasDisplayableReturns) {
|
|
75
71
|
return null;
|
|
@@ -44,15 +44,13 @@ const Description = styled.div(() => ({
|
|
|
44
44
|
},
|
|
45
45
|
}));
|
|
46
46
|
|
|
47
|
-
const Type = styled.div<{ hasDescription: boolean }>(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
theme.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
})
|
|
55
|
-
);
|
|
47
|
+
const Type = styled.div<{ hasDescription: boolean }>(({ hasDescription }) => ({
|
|
48
|
+
color:
|
|
49
|
+
theme.base === 'light'
|
|
50
|
+
? transparentize(0.1, theme.color.defaultText)
|
|
51
|
+
: transparentize(0.2, theme.color.defaultText),
|
|
52
|
+
marginTop: hasDescription ? 4 : 0,
|
|
53
|
+
}));
|
|
56
54
|
|
|
57
55
|
const TypeWithJsDoc = styled.div<{
|
|
58
56
|
hasDescription: boolean;
|
|
@@ -65,35 +63,24 @@ const TypeWithJsDoc = styled.div<{
|
|
|
65
63
|
marginBottom: 12,
|
|
66
64
|
}));
|
|
67
65
|
|
|
68
|
-
const StyledTd = styled.td<{ expandable: boolean }>(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
})
|
|
72
|
-
);
|
|
66
|
+
const StyledTd = styled.td<{ expandable: boolean }>(({ expandable }) => ({
|
|
67
|
+
paddingLeft: '20px',
|
|
68
|
+
}));
|
|
73
69
|
|
|
74
70
|
export const ArgRow: FC<ArgRowProps> = (props) => {
|
|
75
|
-
const {
|
|
76
|
-
row,
|
|
77
|
-
updateArgs,
|
|
78
|
-
compact,
|
|
79
|
-
initialExpandedArgs,
|
|
80
|
-
} = props;
|
|
71
|
+
const { row, updateArgs, compact, initialExpandedArgs } = props;
|
|
81
72
|
const { name, description } = row;
|
|
82
73
|
const table = (row.table || {}) as TableAnnotation;
|
|
83
74
|
const type = table.type || row.type;
|
|
84
|
-
const defaultValue =
|
|
85
|
-
table.defaultValue || row.defaultValue;
|
|
75
|
+
const defaultValue = table.defaultValue || row.defaultValue;
|
|
86
76
|
const required = row.type?.required;
|
|
87
|
-
const hasDescription =
|
|
88
|
-
description != null && description !== '';
|
|
77
|
+
const hasDescription = description != null && description !== '';
|
|
89
78
|
|
|
90
79
|
return (
|
|
91
80
|
<tr>
|
|
92
81
|
<StyledTd expandable={true}>
|
|
93
82
|
<Name>{name}</Name>
|
|
94
|
-
{required ?
|
|
95
|
-
<Required title="Required">*</Required>
|
|
96
|
-
) : null}
|
|
83
|
+
{required ? <Required title="Required">*</Required> : null}
|
|
97
84
|
</StyledTd>
|
|
98
85
|
{compact ? null : (
|
|
99
86
|
<td>
|
|
@@ -104,39 +91,24 @@ export const ArgRow: FC<ArgRowProps> = (props) => {
|
|
|
104
91
|
)}
|
|
105
92
|
{table.jsDocTags != null ? (
|
|
106
93
|
<>
|
|
107
|
-
<TypeWithJsDoc
|
|
108
|
-
|
|
109
|
-
>
|
|
110
|
-
<ArgValue
|
|
111
|
-
value={type}
|
|
112
|
-
initialExpandedArgs={initialExpandedArgs}
|
|
113
|
-
/>
|
|
94
|
+
<TypeWithJsDoc hasDescription={hasDescription}>
|
|
95
|
+
<ArgValue value={type} initialExpandedArgs={initialExpandedArgs} />
|
|
114
96
|
</TypeWithJsDoc>
|
|
115
97
|
<ArgJsDoc tags={table.jsDocTags} />
|
|
116
98
|
</>
|
|
117
99
|
) : (
|
|
118
100
|
<Type hasDescription={hasDescription}>
|
|
119
|
-
<ArgValue
|
|
120
|
-
value={type}
|
|
121
|
-
initialExpandedArgs={initialExpandedArgs}
|
|
122
|
-
/>
|
|
101
|
+
<ArgValue value={type} initialExpandedArgs={initialExpandedArgs} />
|
|
123
102
|
</Type>
|
|
124
103
|
)}
|
|
125
104
|
</td>
|
|
126
105
|
)}
|
|
127
106
|
{compact ? null : (
|
|
128
107
|
<td>
|
|
129
|
-
<ArgValue
|
|
130
|
-
value={defaultValue}
|
|
131
|
-
initialExpandedArgs={initialExpandedArgs}
|
|
132
|
-
/>
|
|
108
|
+
<ArgValue value={defaultValue} initialExpandedArgs={initialExpandedArgs} />
|
|
133
109
|
</td>
|
|
134
110
|
)}
|
|
135
|
-
{updateArgs ? (
|
|
136
|
-
<td>
|
|
137
|
-
{/* <ArgControl {...(props as ArgControlProps)} /> */}
|
|
138
|
-
</td>
|
|
139
|
-
) : null}
|
|
111
|
+
{updateArgs ? <td>{/* <ArgControl {...(props as ArgControlProps)} /> */}</td> : null}
|
|
140
112
|
</tr>
|
|
141
113
|
);
|
|
142
114
|
};
|
|
@@ -22,39 +22,34 @@ interface ArgSummaryProps {
|
|
|
22
22
|
|
|
23
23
|
const ITEMS_BEFORE_EXPANSION = 8;
|
|
24
24
|
|
|
25
|
-
const Summary = styled.div<{ isExpanded?: boolean }>(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
border: '0 none',
|
|
54
|
-
paddingLeft: 0,
|
|
55
|
-
}),
|
|
56
|
-
})
|
|
57
|
-
);
|
|
25
|
+
const Summary = styled.div<{ isExpanded?: boolean }>(({ isExpanded }) => ({
|
|
26
|
+
display: 'flex',
|
|
27
|
+
flexDirection: isExpanded ? 'column' : 'row',
|
|
28
|
+
flexWrap: 'wrap',
|
|
29
|
+
alignItems: 'flex-start',
|
|
30
|
+
marginBottom: '-4px',
|
|
31
|
+
minWidth: 100,
|
|
32
|
+
}));
|
|
33
|
+
|
|
34
|
+
const Text = styled.span<{ simple?: boolean }>(codeCommon, ({ simple = false }) => ({
|
|
35
|
+
flex: '0 0 auto',
|
|
36
|
+
fontFamily: theme.typography.fonts.mono,
|
|
37
|
+
fontSize: '12px',
|
|
38
|
+
wordBreak: 'break-word',
|
|
39
|
+
whiteSpace: 'normal',
|
|
40
|
+
maxWidth: '100%',
|
|
41
|
+
margin: 0,
|
|
42
|
+
marginRight: '4px',
|
|
43
|
+
marginBottom: '4px',
|
|
44
|
+
paddingTop: '2px',
|
|
45
|
+
paddingBottom: '2px',
|
|
46
|
+
lineHeight: '13px',
|
|
47
|
+
...(simple && {
|
|
48
|
+
background: 'transparent',
|
|
49
|
+
border: '0 none',
|
|
50
|
+
paddingLeft: 0,
|
|
51
|
+
}),
|
|
52
|
+
}));
|
|
58
53
|
|
|
59
54
|
const ExpandButton = styled.button<{}>(() => ({
|
|
60
55
|
fontFamily: theme.typography?.fonts.mono,
|
|
@@ -64,18 +59,15 @@ const ExpandButton = styled.button<{}>(() => ({
|
|
|
64
59
|
border: 'none',
|
|
65
60
|
}));
|
|
66
61
|
|
|
67
|
-
const Expandable = styled.div<{}>(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
alignItems: 'center',
|
|
77
|
-
})
|
|
78
|
-
);
|
|
62
|
+
const Expandable = styled.div<{}>(codeCommon, ({ theme }) => ({
|
|
63
|
+
fontFamily: theme.typography?.fonts.mono,
|
|
64
|
+
color: theme.color?.secondary,
|
|
65
|
+
fontSize: theme.typography?.size.s1, // overrides codeCommon
|
|
66
|
+
margin: 0,
|
|
67
|
+
whiteSpace: 'nowrap',
|
|
68
|
+
display: 'flex',
|
|
69
|
+
alignItems: 'center',
|
|
70
|
+
}));
|
|
79
71
|
|
|
80
72
|
const EmptyArg = () => {
|
|
81
73
|
return <span>-</span>;
|
|
@@ -88,50 +80,32 @@ const ArgText: FC<ArgTextProps> = ({ text, simple }) => {
|
|
|
88
80
|
const getSummaryItems = (summary: string) => {
|
|
89
81
|
if (!summary) return [summary];
|
|
90
82
|
const splittedItems = summary.split('|');
|
|
91
|
-
const summaryItems = splittedItems.map((value) =>
|
|
92
|
-
value.trim()
|
|
93
|
-
);
|
|
83
|
+
const summaryItems = splittedItems.map((value) => value.trim());
|
|
94
84
|
|
|
95
85
|
return uniq(summaryItems);
|
|
96
86
|
};
|
|
97
87
|
|
|
98
|
-
const renderSummaryItems = (
|
|
99
|
-
summaryItems: string[],
|
|
100
|
-
isExpanded = true
|
|
101
|
-
) => {
|
|
88
|
+
const renderSummaryItems = (summaryItems: string[], isExpanded = true) => {
|
|
102
89
|
let items = summaryItems;
|
|
103
90
|
if (!isExpanded) {
|
|
104
91
|
items = summaryItems.slice(0, ITEMS_BEFORE_EXPANSION);
|
|
105
92
|
}
|
|
106
93
|
|
|
107
|
-
return items.map((item) =>
|
|
108
|
-
<ArgText key={item} text={item === '' ? '""' : item} />
|
|
109
|
-
));
|
|
94
|
+
return items.map((item) => <ArgText key={item} text={item === '' ? '""' : item} />);
|
|
110
95
|
};
|
|
111
96
|
|
|
112
|
-
const ArgSummary: FC<ArgSummaryProps> = ({
|
|
113
|
-
value,
|
|
114
|
-
initialExpandedArgs,
|
|
115
|
-
}) => {
|
|
97
|
+
const ArgSummary: FC<ArgSummaryProps> = ({ value, initialExpandedArgs }) => {
|
|
116
98
|
const { summary, detail } = value;
|
|
117
99
|
|
|
118
|
-
const [isExpanded, setIsExpanded] = useState(
|
|
119
|
-
initialExpandedArgs || false
|
|
120
|
-
);
|
|
100
|
+
const [isExpanded, setIsExpanded] = useState(initialExpandedArgs || false);
|
|
121
101
|
|
|
122
|
-
if (summary === undefined || summary === null)
|
|
123
|
-
return null;
|
|
102
|
+
if (summary === undefined || summary === null) return null;
|
|
124
103
|
// summary is used for the default value
|
|
125
104
|
// below check fixes not displaying default values for boolean typescript vars
|
|
126
|
-
const summaryAsString =
|
|
127
|
-
typeof summary.toString === 'function'
|
|
128
|
-
? summary.toString()
|
|
129
|
-
: summary;
|
|
105
|
+
const summaryAsString = typeof summary.toString === 'function' ? summary.toString() : summary;
|
|
130
106
|
|
|
131
107
|
if (detail == null) {
|
|
132
|
-
const cannotBeSafelySplitted = /[(){}[\]<>]/.test(
|
|
133
|
-
summaryAsString
|
|
134
|
-
);
|
|
108
|
+
const cannotBeSafelySplitted = /[(){}[\]<>]/.test(summaryAsString);
|
|
135
109
|
|
|
136
110
|
if (cannotBeSafelySplitted) {
|
|
137
111
|
return <ArgText text={summaryAsString} />;
|
|
@@ -139,20 +113,13 @@ const ArgSummary: FC<ArgSummaryProps> = ({
|
|
|
139
113
|
|
|
140
114
|
const summaryItems = getSummaryItems(summaryAsString);
|
|
141
115
|
const itemsCount = summaryItems.length;
|
|
142
|
-
const hasManyItems =
|
|
143
|
-
itemsCount > ITEMS_BEFORE_EXPANSION;
|
|
116
|
+
const hasManyItems = itemsCount > ITEMS_BEFORE_EXPANSION;
|
|
144
117
|
|
|
145
118
|
return hasManyItems ? (
|
|
146
119
|
<Summary isExpanded={isExpanded}>
|
|
147
120
|
{renderSummaryItems(summaryItems, isExpanded)}
|
|
148
|
-
<ExpandButton
|
|
149
|
-
|
|
150
|
-
>
|
|
151
|
-
{isExpanded
|
|
152
|
-
? 'Show less...'
|
|
153
|
-
: `Show ${
|
|
154
|
-
itemsCount - ITEMS_BEFORE_EXPANSION
|
|
155
|
-
} more...`}
|
|
121
|
+
<ExpandButton onClick={() => setIsExpanded(!isExpanded)}>
|
|
122
|
+
{isExpanded ? 'Show less...' : `Show ${itemsCount - ITEMS_BEFORE_EXPANSION} more...`}
|
|
156
123
|
</ExpandButton>
|
|
157
124
|
</Summary>
|
|
158
125
|
) : (
|
|
@@ -167,16 +134,6 @@ const ArgSummary: FC<ArgSummaryProps> = ({
|
|
|
167
134
|
);
|
|
168
135
|
};
|
|
169
136
|
|
|
170
|
-
export const ArgValue: FC<ArgValueProps> = ({
|
|
171
|
-
value
|
|
172
|
-
initialExpandedArgs,
|
|
173
|
-
}) => {
|
|
174
|
-
return value == null ? (
|
|
175
|
-
<EmptyArg />
|
|
176
|
-
) : (
|
|
177
|
-
<ArgSummary
|
|
178
|
-
value={value}
|
|
179
|
-
initialExpandedArgs={initialExpandedArgs}
|
|
180
|
-
/>
|
|
181
|
-
);
|
|
137
|
+
export const ArgValue: FC<ArgValueProps> = ({ value, initialExpandedArgs }) => {
|
|
138
|
+
return value == null ? <EmptyArg /> : <ArgSummary value={value} initialExpandedArgs={initialExpandedArgs} />;
|
|
182
139
|
};
|
|
@@ -3,8 +3,7 @@ import { styled } from '@storybook/theming';
|
|
|
3
3
|
import { withReset } from './Shared';
|
|
4
4
|
|
|
5
5
|
const Wrapper = styled.div<{}>(withReset, ({ theme }) => ({
|
|
6
|
-
backgroundColor:
|
|
7
|
-
theme.base === 'light' ? 'rgba(0,0,0,.01)' : 'rgba(255,255,255,.01)',
|
|
6
|
+
backgroundColor: theme.base === 'light' ? 'rgba(0,0,0,.01)' : 'rgba(255,255,255,.01)',
|
|
8
7
|
borderRadius: theme.appBorderRadius,
|
|
9
8
|
border: `1px dashed ${theme.appBorderColor}`,
|
|
10
9
|
display: 'flex',
|
|
@@ -17,6 +16,4 @@ const Wrapper = styled.div<{}>(withReset, ({ theme }) => ({
|
|
|
17
16
|
// fontSize: theme.typography.size.s2,
|
|
18
17
|
}));
|
|
19
18
|
|
|
20
|
-
export const EmptyBlock = (props: any) =>
|
|
21
|
-
<Wrapper {...props} className="docblock-emptyblock" />
|
|
22
|
-
);
|
|
19
|
+
export const EmptyBlock = (props: any) => <Wrapper {...props} className="docblock-emptyblock" />;
|
|
@@ -80,28 +80,21 @@ export const SectionRow: FC<SectionRowProps> = ({
|
|
|
80
80
|
colSpan = 3,
|
|
81
81
|
}) => {
|
|
82
82
|
const [expanded, setExpanded] = useState(initialExpanded);
|
|
83
|
-
const Level =
|
|
84
|
-
level === 'subsection' ? Subsection : Section;
|
|
83
|
+
const Level = level === 'subsection' ? Subsection : Section;
|
|
85
84
|
// @ts-ignore
|
|
86
85
|
const itemCount = children?.length || 0;
|
|
87
|
-
const caption =
|
|
88
|
-
level === 'subsection'
|
|
89
|
-
? `${itemCount} item${itemCount !== 1 ? 's' : ''}`
|
|
90
|
-
: '';
|
|
86
|
+
const caption = level === 'subsection' ? `${itemCount} item${itemCount !== 1 ? 's' : ''}` : '';
|
|
91
87
|
const icon = expanded ? 'arrowdown' : 'arrowright';
|
|
92
88
|
|
|
93
|
-
const helperText = `${expanded ? 'Hide' : 'Side'} ${
|
|
94
|
-
|
|
95
|
-
}
|
|
89
|
+
const helperText = `${expanded ? 'Hide' : 'Side'} ${level === 'subsection' ? itemCount : label} item${
|
|
90
|
+
itemCount !== 1 ? 's' : ''
|
|
91
|
+
}`;
|
|
96
92
|
|
|
97
93
|
return (
|
|
98
94
|
<>
|
|
99
95
|
<StyledTr title={helperText}>
|
|
100
96
|
<Level colSpan={1}>
|
|
101
|
-
<ClickIntercept
|
|
102
|
-
onClick={(e) => setExpanded(!expanded)}
|
|
103
|
-
tabIndex={0}
|
|
104
|
-
>
|
|
97
|
+
<ClickIntercept onClick={(e) => setExpanded(!expanded)} tabIndex={0}>
|
|
105
98
|
{helperText}
|
|
106
99
|
</ClickIntercept>
|
|
107
100
|
<FlexWrapper>
|
|
@@ -110,11 +103,7 @@ export const SectionRow: FC<SectionRowProps> = ({
|
|
|
110
103
|
</FlexWrapper>
|
|
111
104
|
</Level>
|
|
112
105
|
<StyledTd colSpan={colSpan - 1}>
|
|
113
|
-
<ClickIntercept
|
|
114
|
-
onClick={(e) => setExpanded(!expanded)}
|
|
115
|
-
tabIndex={-1}
|
|
116
|
-
style={{ outline: 'none' }}
|
|
117
|
-
>
|
|
106
|
+
<ClickIntercept onClick={(e) => setExpanded(!expanded)} tabIndex={-1} style={{ outline: 'none' }}>
|
|
118
107
|
{helperText}
|
|
119
108
|
</ClickIntercept>
|
|
120
109
|
{expanded ? null : caption}
|