@innovaccer/design-system 2.6.0 → 2.7.0-0
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/.eslintrc.json +10 -9
- package/.github/workflows/chromatic.yml +5 -0
- package/.github/workflows/pull_request.yml +1 -1
- package/.storybook/main.js +4 -0
- package/.vscode/settings.json +11 -0
- package/CHANGELOG.md +36 -0
- package/CONTRIBUTING.md +7 -1
- package/core/accessibility/utils/useAccessibilityProps.ts +4 -2
- package/core/common.type.tsx +22 -0
- package/core/components/atoms/_chip/__tests__/__snapshots__/_chip.test.tsx.snap +9 -9
- package/core/components/atoms/_chip/index.tsx +17 -3
- package/core/components/atoms/avatar/Avatar.tsx +4 -14
- package/core/components/atoms/avatar/__stories__/variants/Appearance.story.tsx +3 -2
- package/core/components/atoms/avatar/__tests__/Avatar.test.tsx +14 -9
- package/core/components/atoms/avatarGroup/AvatarGroup.tsx +3 -5
- package/core/components/atoms/badge/Badge.tsx +2 -12
- package/core/components/atoms/badge/__tests__/Badge.test.tsx +22 -7
- package/core/components/atoms/badge/_stories_/variants/Appearance.story.tsx +3 -2
- package/core/components/atoms/badge/_stories_/variants/Subtle.story.tsx +3 -2
- package/core/components/atoms/button/Button.tsx +10 -7
- package/core/components/atoms/button/__stories__/index.story.tsx +1 -1
- package/core/components/atoms/button/__stories__/variants/Appearance.story.tsx +2 -2
- package/core/components/atoms/button/__stories__/variants/Expanded.story.tsx +2 -2
- package/core/components/atoms/button/__stories__/variants/icon/IconLeft.story.tsx +2 -2
- package/core/components/atoms/button/__stories__/variants/icon/IconRight.story.tsx +2 -2
- package/core/components/atoms/button/__tests__/Button.test.tsx +1 -1
- package/core/components/atoms/button/__tests__/__snapshots__/Button.test.tsx.snap +0 -137
- package/core/components/atoms/card/__stories__/empty.story.tsx +1 -1
- package/core/components/atoms/card/__stories__/nested.story.tsx +1 -1
- package/core/components/atoms/card/__stories__/scroll.story.tsx +1 -1
- package/core/components/atoms/checkbox/Checkbox.tsx +8 -9
- package/core/components/atoms/checkbox/__stories__/variants/Size.story.tsx +2 -2
- package/core/components/atoms/chip/Chip.tsx +3 -2
- package/core/components/atoms/chip/__stories__/variants/Selection.story.tsx +17 -0
- package/core/components/atoms/chip/__stories__/variants/Type.story.tsx +2 -2
- package/core/components/atoms/chip/__tests__/Chip.test.tsx +7 -0
- package/core/components/atoms/chipGroup/__tests__/__snapshots__/chipGroup.test.tsx.snap +5 -5
- package/core/components/atoms/chipGroup/__tests__/chipGroup.test.tsx +2 -2
- package/core/components/atoms/chipGroup/_stories_/index.story.tsx +2 -2
- package/core/components/atoms/dropdown/Dropdown.tsx +18 -17
- package/core/components/atoms/dropdown/DropdownButton.tsx +2 -2
- package/core/components/atoms/dropdown/DropdownList.tsx +10 -5
- package/core/components/atoms/dropdown/Loading.tsx +1 -1
- package/core/components/atoms/dropdown/__stories__/CustomSearchPlaceholder.story.tsx +45 -0
- package/core/components/atoms/dropdown/__stories__/_common_/types.tsx +3 -0
- package/core/components/atoms/dropdown/__stories__/variants/Size.story.tsx +2 -2
- package/core/components/atoms/dropdown/__stories__/variants/controlledDropdown/MultiSelect.story.tsx +1 -1
- package/core/components/atoms/dropdown/__tests__/Dropdown.test.tsx +12 -1
- package/core/components/atoms/dropdown/__tests__/Loading.test.tsx +0 -1
- package/core/components/atoms/dropdown/option/index.tsx +1 -1
- package/core/components/atoms/heading/Heading.tsx +4 -4
- package/core/components/atoms/heading/__stories__/variants/Appearance.story.tsx +3 -2
- package/core/components/atoms/heading/__tests__/Heading.test.tsx +4 -3
- package/core/components/atoms/icon/Icon.tsx +3 -3
- package/core/components/atoms/input/Input.tsx +3 -3
- package/core/components/atoms/input/__stories__/InputWithCaption.story.tsx +62 -0
- package/core/components/atoms/input/__stories__/LabelPosition.story.tsx +38 -0
- package/core/components/atoms/input/__stories__/variants/controlledInput.story.tsx +46 -0
- package/core/components/atoms/input/__stories__/variants/types/BasicInput.story.tsx +2 -2
- package/core/components/atoms/input/__stories__/variants/types/IconLeft.story.tsx +2 -10
- package/core/components/atoms/input/__stories__/variants/types/WithLabel.story.tsx +1 -9
- package/core/components/atoms/label/Label.tsx +1 -1
- package/core/components/atoms/legend/Legend.tsx +2 -2
- package/core/components/atoms/legend/__stories__/variants/labelAppearance.story.tsx +2 -2
- package/core/components/atoms/link/Link.tsx +4 -4
- package/core/components/atoms/message/Message.tsx +12 -12
- package/core/components/atoms/message/__stories__/index.story.tsx +1 -1
- package/core/components/atoms/message/__stories__/variants/Appearance.story.tsx +1 -1
- package/core/components/atoms/message/__stories__/variants/AppearanceTitle.story.tsx +1 -1
- package/core/components/atoms/message/__tests__/Message.test.tsx +1 -6
- package/core/components/atoms/message/__tests__/__snapshots__/Message.test.tsx.snap +0 -45
- package/core/components/atoms/metaList/__tests__/MetaList.test.tsx +2 -2
- package/core/components/atoms/metricInput/MetricInput.tsx +5 -5
- package/core/components/atoms/multiSlider/SliderUtils.tsx +1 -4
- package/core/components/atoms/multiSlider/index.tsx +3 -4
- package/core/components/atoms/outsideClick/OutsideClick.tsx +1 -2
- package/core/components/atoms/paragraph/Paragraph.tsx +2 -2
- package/core/components/atoms/paragraph/__stories__/variants/Appearance.story.tsx +2 -2
- package/core/components/atoms/paragraph/__tests__/Paragraph.test.tsx +2 -2
- package/core/components/atoms/pills/Pills.tsx +2 -12
- package/core/components/atoms/pills/__stories__/variants/Appearance.story.tsx +3 -2
- package/core/components/atoms/pills/__stories__/variants/Subtle.story.tsx +3 -2
- package/core/components/atoms/pills/__tests__/Pills.test.tsx +3 -2
- package/core/components/atoms/placeholderImage/PlaceholderImage.tsx +2 -2
- package/core/components/atoms/placeholderImage/__stories__/variants/Size.story.tsx +2 -2
- package/core/components/atoms/placeholderParagraph/PlaceholderParagraph.tsx +2 -2
- package/core/components/atoms/placeholderParagraph/__stories__/variants/Size.story.tsx +2 -2
- package/core/components/atoms/popperWrapper/PopperWrapper.tsx +2 -6
- package/core/components/atoms/progressRing/ProgressRing.tsx +2 -2
- package/core/components/atoms/progressRing/__stories__/variants/Size.story.tsx +1 -1
- package/core/components/atoms/radio/Radio.tsx +4 -5
- package/core/components/atoms/rangeSlider/RangeSlider.tsx +1 -2
- package/core/components/atoms/rangeSlider/__stories__/index.story.tsx +1 -2
- package/core/components/atoms/rangeSlider/__stories__/variants/Controlled.story.tsx +1 -2
- package/core/components/atoms/rangeSlider/__stories__/variants/CustomLabels.story.tsx +1 -2
- package/core/components/atoms/spinner/Spinner.tsx +4 -4
- package/core/components/atoms/spinner/__stories__/variants/Appearance.story.tsx +2 -2
- package/core/components/atoms/spinner/__stories__/variants/Size.story.tsx +1 -1
- package/core/components/atoms/statusHint/StatusHint.tsx +2 -3
- package/core/components/atoms/statusHint/__stories__/variants/Appearance.story.tsx +3 -2
- package/core/components/atoms/statusHint/__tests__/StatusHint.test.tsx +3 -2
- package/core/components/atoms/subheading/Subheading.tsx +2 -2
- package/core/components/atoms/subheading/__stories__/variants/Appearance.story.tsx +3 -2
- package/core/components/atoms/subheading/__tests__/Subheading.test.tsx +3 -2
- package/core/components/atoms/switchInput/Switch.tsx +7 -8
- package/core/components/atoms/text/Text.tsx +4 -4
- package/core/components/atoms/text/__stories__/variants/Appearance.story.tsx +2 -2
- package/core/components/atoms/text/__tests__/Text.test.tsx +2 -3
- package/core/components/atoms/toast/ActionButton.tsx +2 -2
- package/core/components/atoms/toast/Toast.tsx +11 -6
- package/core/components/atoms/toast/__stories__/index.story.tsx +2 -6
- package/core/components/atoms/toast/__stories__/variants/Appearance.story.tsx +3 -2
- package/core/components/atoms/toast/__stories__/variants/ToastMessage.story.tsx +3 -2
- package/core/components/atoms/toast/__stories__/variants/ToastWithAction.story.tsx +3 -2
- package/core/components/atoms/toast/__tests__/Toast.test.tsx +1 -1
- package/core/components/atoms/toast/__tests__/__snapshots__/Toast.test.tsx.snap +0 -131
- package/core/components/css-utilities/Schema.tsx +1 -1
- package/core/components/css-utilities/Spacing/Schema.tsx +1 -1
- package/core/components/molecules/chipInput/__tests__/__snapshots__/ChipInput.test.tsx.snap +2 -2
- package/core/components/molecules/dropzone/Dropzone.tsx +3 -3
- package/core/components/molecules/dropzone/DropzoneBase.tsx +22 -38
- package/core/components/molecules/dropzone/__stories__/index.story.tsx +151 -41
- package/core/components/molecules/dropzone/__tests__/Dropzone.test.tsx +2 -2
- package/core/components/molecules/dropzone/utils.tsx +6 -4
- package/core/components/molecules/editableChipInput/__tests__/__snapshots__/EditableChipInput.test.tsx.snap +4 -4
- package/core/components/molecules/emptyState/EmptyState.tsx +4 -4
- package/core/components/molecules/emptyState/__stories__/pageNotLoadedWithSVG.story.tsx +26 -26
- package/core/components/molecules/fileList/FileListItem.tsx +1 -2
- package/core/components/molecules/fileUploader/FileUploaderItem.tsx +1 -2
- package/core/components/molecules/fileUploader/FileUploaderStatus.tsx +1 -1
- package/core/components/molecules/fileUploader/__stories__/_common_/types.tsx +3 -0
- package/core/components/molecules/fileUploader/__stories__/index.story.tsx +3 -222
- package/core/components/molecules/fullscreenModal/FullscreenModal.tsx +5 -7
- package/core/components/molecules/inputMask/InputMask.tsx +212 -146
- package/core/components/molecules/inputMask/__stories__/index.story.tsx +24 -0
- package/core/components/molecules/modal/Modal.tsx +4 -6
- package/core/components/molecules/modal/__stories__/Confirmation.story.tsx +1 -1
- package/core/components/molecules/placeholder/Placeholder.tsx +2 -2
- package/core/components/molecules/popover/Popover.tsx +2 -9
- package/core/components/molecules/sidesheet/Sidesheet.tsx +5 -7
- package/core/components/molecules/sidesheet/__stories__/variants/CustomHeader.story.tsx +172 -0
- package/core/components/molecules/tooltip/Tooltip.tsx +4 -4
- package/core/components/organisms/calendar/__stories__/variants/firstDayOfWeek.story.tsx +2 -2
- package/core/components/organisms/calendar/utility.ts +3 -3
- package/core/components/organisms/choiceList/ChoiceList.tsx +11 -11
- package/core/components/organisms/datePicker/DatePicker.tsx +1 -1
- package/core/components/organisms/datePicker/Trigger.tsx +1 -5
- package/core/components/organisms/dateRangePicker/DateRangePicker.tsx +9 -10
- package/core/components/organisms/dateRangePicker/SingleInputTrigger.tsx +0 -1
- package/core/components/organisms/dateRangePicker/Trigger.tsx +2 -2
- package/core/components/organisms/dateRangePicker/__stories__/variants/monthsInView.story.tsx +2 -2
- package/core/components/organisms/dateRangePicker/__tests__/__snapshots__/DateRangePicker.test.tsx.snap +16 -16
- package/core/components/organisms/grid/Cell.tsx +19 -19
- package/core/components/organisms/grid/Grid.tsx +3 -4
- package/core/components/organisms/grid/GridBody.tsx +0 -1
- package/core/components/organisms/grid/GridContext.ts +1 -1
- package/core/components/organisms/grid/__stories__/_common_/editableSchema.tsx +1 -3
- package/core/components/organisms/grid/__stories__/_common_/fetchData.ts +1 -1
- package/core/components/organisms/grid/__stories__/_common_/loaderSchema.ts +0 -2
- package/core/components/organisms/grid/__stories__/_common_/schema.tsx +1 -3
- package/core/components/organisms/grid/__stories__/_common_/simpleLoaderSchema.ts +0 -2
- package/core/components/organisms/grid/__stories__/_common_/statusSchema.ts +0 -2
- package/core/components/organisms/inlineMessage/InlineMessage.tsx +2 -2
- package/core/components/organisms/inlineMessage/__tests__/InlineMessage.test.tsx +3 -2
- package/core/components/organisms/list/__stories__/_common_/types.tsx +3 -0
- package/core/components/organisms/list/__stories__/index.story.tsx +0 -16
- package/core/components/organisms/table/Table.tsx +2 -2
- package/core/components/organisms/table/__stories__/CompressedTable.story.tsx +1 -1
- package/core/components/organisms/table/__stories__/DataTable.story.tsx +1 -1
- package/core/components/organisms/table/__stories__/NestedTableWithNestedCard.story.tsx +1 -1
- package/core/components/organisms/table/__stories__/PinnedColumn.story.tsx +1 -1
- package/core/components/organisms/table/__stories__/ResourceTable.story.tsx +1 -1
- package/core/components/organisms/table/__stories__/StandardTable.story.tsx +1 -1
- package/core/components/organisms/table/__stories__/TableAsDescriptionList.story.tsx +1 -1
- package/core/components/organisms/table/__stories__/TableAsOptionList.story.tsx +1 -1
- package/core/components/organisms/table/__stories__/TightStory.story.tsx +1 -1
- package/core/components/organisms/table/__stories__/_common_/types.tsx +3 -0
- package/core/components/organisms/table/__stories__/variants/showHead.story.tsx +2 -2
- package/core/components/organisms/table/__stories__/variants/showMenu.story.tsx +2 -2
- package/core/components/organisms/table/__stories__/variants/size.story.tsx +2 -2
- package/core/components/organisms/table/__stories__/variants/type.story.tsx +2 -2
- package/core/components/organisms/table/__stories__/variants/withCheckbox.story.tsx +2 -2
- package/core/components/organisms/table/__stories__/variants/withPagination.story.tsx +2 -2
- package/core/components/organisms/timePicker/TimePicker.tsx +3 -7
- package/core/components/organisms/verticalNav/__stories__/schema.tsx +0 -2
- package/core/components/organisms/verticalNav/__tests__/VerticalNav.test.tsx +1 -2
- package/core/global.d.ts +9 -0
- package/core/index.tsx +1 -1
- package/core/utils/__tests__/__snapshots__/TS.test.tsx.snap +18 -5
- package/core/utils/docPage/generateImports.tsx +2 -3
- package/core/utils/docPage/index.tsx +30 -20
- package/core/utils/docPage/sandbox.tsx +14 -7
- package/core/utils/overlayHelper.ts +7 -3
- package/core/utils/testHelper.ts +1 -1
- package/core/utils/types.tsx +1 -1
- package/css/dist/index.css +48 -30
- package/css/dist/index.css.map +1 -1
- package/css/src/components/button.css +5 -5
- package/css/src/components/calendar.css +1 -1
- package/css/src/components/chip.css +6 -4
- package/css/src/components/fullscreenModal.css +4 -3
- package/css/src/components/message.css +0 -5
- package/css/src/components/switch.css +23 -2
- package/css/src/components/toast.css +0 -5
- package/css/src/variables/index.css +5 -2
- package/dist/core/accessibility/utils/useAccessibilityProps.d.ts +4 -1
- package/dist/core/common.type.d.ts +12 -0
- package/dist/core/components/atoms/avatar/Avatar.d.ts +4 -4
- package/dist/core/components/atoms/avatarGroup/AvatarGroup.d.ts +2 -3
- package/dist/core/components/atoms/badge/Badge.d.ts +2 -2
- package/dist/core/components/atoms/button/Button.d.ts +6 -6
- package/dist/core/components/atoms/checkbox/Checkbox.d.ts +3 -3
- package/dist/core/components/atoms/chip/Chip.d.ts +2 -2
- package/dist/core/components/atoms/dropdown/Dropdown.d.ts +18 -17
- package/dist/core/components/atoms/dropdown/DropdownButton.d.ts +2 -2
- package/dist/core/components/atoms/dropdown/DropdownList.d.ts +4 -3
- package/dist/core/components/atoms/dropdown/option/index.d.ts +1 -1
- package/dist/core/components/atoms/heading/Heading.d.ts +4 -4
- package/dist/core/components/atoms/icon/Icon.d.ts +2 -2
- package/dist/core/components/atoms/input/Input.d.ts +3 -3
- package/dist/core/components/atoms/legend/Legend.d.ts +2 -2
- package/dist/core/components/atoms/link/Link.d.ts +4 -4
- package/dist/core/components/atoms/message/Message.d.ts +2 -2
- package/dist/core/components/atoms/metricInput/MetricInput.d.ts +3 -3
- package/dist/core/components/atoms/multiSlider/SliderUtils.d.ts +1 -1
- package/dist/core/components/atoms/multiSlider/index.d.ts +3 -3
- package/dist/core/components/atoms/paragraph/Paragraph.d.ts +2 -2
- package/dist/core/components/atoms/pills/Pills.d.ts +2 -2
- package/dist/core/components/atoms/placeholderImage/PlaceholderImage.d.ts +2 -2
- package/dist/core/components/atoms/placeholderParagraph/PlaceholderParagraph.d.ts +2 -2
- package/dist/core/components/atoms/popperWrapper/PopperWrapper.d.ts +1 -2
- package/dist/core/components/atoms/progressRing/ProgressRing.d.ts +2 -2
- package/dist/core/components/atoms/radio/Radio.d.ts +4 -4
- package/dist/core/components/atoms/rangeSlider/RangeSlider.d.ts +1 -1
- package/dist/core/components/atoms/spinner/Spinner.d.ts +4 -4
- package/dist/core/components/atoms/statusHint/StatusHint.d.ts +2 -2
- package/dist/core/components/atoms/subheading/Subheading.d.ts +2 -2
- package/dist/core/components/atoms/switchInput/Switch.d.ts +6 -6
- package/dist/core/components/atoms/text/Text.d.ts +4 -4
- package/dist/core/components/atoms/toast/ActionButton.d.ts +2 -2
- package/dist/core/components/atoms/toast/Toast.d.ts +2 -2
- package/dist/core/components/molecules/dropzone/Dropzone.d.ts +3 -3
- package/dist/core/components/molecules/dropzone/DropzoneBase.d.ts +1 -1
- package/dist/core/components/molecules/dropzone/utils.d.ts +5 -3
- package/dist/core/components/molecules/emptyState/EmptyState.d.ts +4 -4
- package/dist/core/components/molecules/fileList/FileListItem.d.ts +1 -1
- package/dist/core/components/molecules/fileUploader/FileUploaderItem.d.ts +1 -1
- package/dist/core/components/molecules/fileUploader/FileUploaderStatus.d.ts +1 -1
- package/dist/core/components/molecules/fullscreenModal/FullscreenModal.d.ts +4 -7
- package/dist/core/components/molecules/inputMask/InputMask.d.ts +10 -2
- package/dist/core/components/molecules/modal/Modal.d.ts +3 -6
- package/dist/core/components/molecules/placeholder/Placeholder.d.ts +2 -2
- package/dist/core/components/molecules/popover/Popover.d.ts +0 -1
- package/dist/core/components/molecules/sidesheet/Sidesheet.d.ts +3 -6
- package/dist/core/components/molecules/tooltip/Tooltip.d.ts +3 -3
- package/dist/core/components/organisms/choiceList/ChoiceList.d.ts +5 -6
- package/dist/core/components/organisms/dateRangePicker/DateRangePicker.d.ts +24 -0
- package/dist/core/components/organisms/grid/Cell.d.ts +1 -1
- package/dist/core/components/organisms/grid/Grid.d.ts +3 -3
- package/dist/core/components/organisms/grid/GridContext.d.ts +1 -1
- package/dist/core/components/organisms/inlineMessage/InlineMessage.d.ts +2 -2
- package/dist/core/components/organisms/table/Table.d.ts +2 -2
- package/dist/core/components/patterns/dateRangePicker/withCustomPopover.story.d.ts +5 -1
- package/dist/core/utils/docPage/generateImports.d.ts +1 -1
- package/dist/core/utils/overlayHelper.d.ts +1 -1
- package/dist/core/utils/types.d.ts +1 -1
- package/dist/index.esm.js +221 -245
- package/dist/index.js +225 -233
- 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/dts.config.js +11 -2
- package/package.json +20 -18
- package/tsconfig.json +3 -16
- package/tsconfig.type.json +2 -1
- package/types/index.d.ts +2217 -0
- package/types/{innovaccer-design-system/tsconfig.json → tsconfig.json} +1 -1
- package/types/{innovaccer-design-system/tslint.json → tslint.json} +0 -0
- package/types/types-tests.tsx +936 -0
- package/core/components/atoms/button/__stories__/variants/state/Success.story.tsx +0 -89
- package/core/components/atoms/message/__stories__/default.story.tsx +0 -16
- package/core/components/atoms/toast/__stories__/DefaultToast.story.tsx +0 -16
- package/core/components/molecules/dropzone/__stories__/variants/DropzoneWithFileList.story.tsx +0 -176
- package/core/components/molecules/fileUploader/__stories__/variants/FileUploaderList.story.tsx +0 -80
- package/types/innovaccer-design-system/index.d.ts +0 -39
- package/types/innovaccer-design-system/innovaccer-design-system-tests.ts +0 -0
|
@@ -2,8 +2,8 @@ import * as React from 'react';
|
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { Icon, Text } from '@/index';
|
|
4
4
|
import { BaseProps, extractBaseProps } from '@/utils/types';
|
|
5
|
+
import { MessageAppearance } from '@/common.type';
|
|
5
6
|
|
|
6
|
-
export type Appearance = 'default' | 'alert' | 'info' | 'success' | 'warning';
|
|
7
7
|
const IconMapping = {
|
|
8
8
|
success: 'check_circle',
|
|
9
9
|
info: 'info',
|
|
@@ -15,7 +15,7 @@ export interface InlineMessageProps extends BaseProps {
|
|
|
15
15
|
/**
|
|
16
16
|
* Color of `Inline Message`
|
|
17
17
|
*/
|
|
18
|
-
appearance:
|
|
18
|
+
appearance: MessageAppearance;
|
|
19
19
|
/**
|
|
20
20
|
* Description of `Inline Message`
|
|
21
21
|
*/
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import { testHelper, filterUndefined, valueHelper, testMessageHelper } from '@/utils/testHelper';
|
|
4
|
-
import {
|
|
4
|
+
import { InlineMessage } from '../InlineMessage';
|
|
5
5
|
import { InlineMessageProps as Props } from '@/index.type';
|
|
6
|
+
import { MessageAppearance } from '@/common.type';
|
|
6
7
|
|
|
7
|
-
const appearance:
|
|
8
|
+
const appearance: MessageAppearance[] = ['default', 'alert', 'info', 'success', 'warning'];
|
|
8
9
|
|
|
9
10
|
const description = 'Inline Message here.';
|
|
10
11
|
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { SyncListProps, AsyncListProps } from '@/components/organisms/list';
|
|
2
2
|
|
|
3
|
+
// TODO(eslint): Fix this
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3
5
|
export const SyncList = (_props: SyncListProps) => {};
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4
7
|
export const AsyncList = (_props: AsyncListProps) => {};
|
|
@@ -12,22 +12,8 @@ import { SyncList, AsyncList } from './_common_/types';
|
|
|
12
12
|
export const all = () => {
|
|
13
13
|
const async = boolean('async', true);
|
|
14
14
|
|
|
15
|
-
let loading;
|
|
16
|
-
let error;
|
|
17
|
-
let applyData;
|
|
18
|
-
let applySchema;
|
|
19
15
|
const applyLoaderSchema = boolean('applyLoaderSchema', true);
|
|
20
16
|
|
|
21
|
-
if (!async) {
|
|
22
|
-
loading = boolean('loading', false);
|
|
23
|
-
|
|
24
|
-
error = boolean('error', false);
|
|
25
|
-
|
|
26
|
-
applySchema = boolean('applySchema', true);
|
|
27
|
-
|
|
28
|
-
applyData = boolean('applyData', true);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
17
|
const type = select('type', ['resource', 'data'], 'resource');
|
|
32
18
|
|
|
33
19
|
const size = select('size', ['comfortable', 'standard', 'compressed', 'tight'], 'comfortable');
|
|
@@ -46,8 +32,6 @@ export const all = () => {
|
|
|
46
32
|
|
|
47
33
|
const multipleSorting = boolean('multipleSorting', false);
|
|
48
34
|
|
|
49
|
-
const headCellTooltip = boolean('headCellTooltip', false);
|
|
50
|
-
|
|
51
35
|
const separator = boolean('separator', false);
|
|
52
36
|
|
|
53
37
|
let dataAttr = {};
|
|
@@ -23,7 +23,7 @@ export interface ErrorTemplateProps {
|
|
|
23
23
|
|
|
24
24
|
export type FilterPosition = 'GRID' | 'HEADER';
|
|
25
25
|
|
|
26
|
-
interface
|
|
26
|
+
interface TableSyncProps {
|
|
27
27
|
/**
|
|
28
28
|
* <pre className="DocPage-codeBlock">
|
|
29
29
|
* Data: RowData[]
|
|
@@ -326,7 +326,7 @@ interface SharedTableProps extends BaseProps {
|
|
|
326
326
|
filterPosition: FilterPosition;
|
|
327
327
|
}
|
|
328
328
|
|
|
329
|
-
export type SyncTableProps = SharedTableProps &
|
|
329
|
+
export type SyncTableProps = SharedTableProps & TableSyncProps;
|
|
330
330
|
export type AsyncTableProps = SharedTableProps & AsyncProps;
|
|
331
331
|
export type TableProps = AsyncTableProps & SyncTableProps;
|
|
332
332
|
|
|
@@ -135,7 +135,7 @@ export const resourceTable = () => {
|
|
|
135
135
|
<div style={{ width: 'var(--spacing-3)' }} className="ml-6">
|
|
136
136
|
<Dropdown
|
|
137
137
|
triggerOptions={{
|
|
138
|
-
customTrigger: (
|
|
138
|
+
customTrigger: () => <Button icon="more_horiz" appearance="transparent" />,
|
|
139
139
|
}}
|
|
140
140
|
menu={true}
|
|
141
141
|
align="left"
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { SyncTableProps, AsyncTableProps } from '@/components/organisms/table';
|
|
2
2
|
|
|
3
|
+
// TODO(eslint): Fix this
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3
5
|
export const SyncTable = (_props: SyncTableProps) => {};
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4
7
|
export const AsyncTable = (_props: AsyncTableProps) => {};
|
|
@@ -12,10 +12,10 @@ export const showHead = () => {
|
|
|
12
12
|
const style = {
|
|
13
13
|
display: 'flex',
|
|
14
14
|
flexWrap: 'wrap',
|
|
15
|
-
};
|
|
15
|
+
} as const;
|
|
16
|
+
// to freeze the object for typescript
|
|
16
17
|
|
|
17
18
|
return (
|
|
18
|
-
// @ts-ignore
|
|
19
19
|
<div style={style}>
|
|
20
20
|
{values.map((v, index) => (
|
|
21
21
|
<div
|
|
@@ -12,10 +12,10 @@ export const showMenu = () => {
|
|
|
12
12
|
const style = {
|
|
13
13
|
display: 'flex',
|
|
14
14
|
flexWrap: 'wrap',
|
|
15
|
-
};
|
|
15
|
+
} as const;
|
|
16
|
+
// to freeze the object for typescript
|
|
16
17
|
|
|
17
18
|
return (
|
|
18
|
-
// @ts-ignore
|
|
19
19
|
<div style={style}>
|
|
20
20
|
{values.map((v, index) => (
|
|
21
21
|
<div
|
|
@@ -13,10 +13,10 @@ export const withCheckbox = () => {
|
|
|
13
13
|
const style = {
|
|
14
14
|
display: 'flex',
|
|
15
15
|
flexWrap: 'wrap',
|
|
16
|
-
};
|
|
16
|
+
} as const;
|
|
17
|
+
// to freeze the object for typescript
|
|
17
18
|
|
|
18
19
|
return (
|
|
19
|
-
// @ts-ignore
|
|
20
20
|
<div style={style}>
|
|
21
21
|
{values.map((v, index) => (
|
|
22
22
|
<div
|
|
@@ -13,10 +13,10 @@ export const withPagination = () => {
|
|
|
13
13
|
const style = {
|
|
14
14
|
display: 'flex',
|
|
15
15
|
flexWrap: 'wrap',
|
|
16
|
-
};
|
|
16
|
+
} as const;
|
|
17
|
+
// to freeze the object for typescript
|
|
17
18
|
|
|
18
19
|
return (
|
|
19
|
-
// @ts-ignore
|
|
20
20
|
<div style={style}>
|
|
21
21
|
{values.map((v, index) => (
|
|
22
22
|
<div
|
|
@@ -57,7 +57,7 @@ export const TimePicker = (props: TimePickerProps) => {
|
|
|
57
57
|
setTime(updatedTime);
|
|
58
58
|
}, [timeProp]);
|
|
59
59
|
|
|
60
|
-
const onChangeHandler = (e: React.ChangeEvent<HTMLInputElement>, val
|
|
60
|
+
const onChangeHandler = (e: React.ChangeEvent<HTMLInputElement>, val = '') => {
|
|
61
61
|
const updatedTime = val?.toUpperCase();
|
|
62
62
|
setTime(updatedTime);
|
|
63
63
|
|
|
@@ -66,7 +66,7 @@ export const TimePicker = (props: TimePickerProps) => {
|
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
-
const onBlurHandler = (e: React.ChangeEvent<HTMLInputElement>, val
|
|
69
|
+
const onBlurHandler = (e: React.ChangeEvent<HTMLInputElement>, val = '') => {
|
|
70
70
|
const updatedTime = translateToTime(inputFormat, time);
|
|
71
71
|
setInit(true);
|
|
72
72
|
|
|
@@ -102,11 +102,7 @@ export const TimePicker = (props: TimePickerProps) => {
|
|
|
102
102
|
{...inputOptions}
|
|
103
103
|
mask={mask}
|
|
104
104
|
value={
|
|
105
|
-
time
|
|
106
|
-
? translateToTime(inputFormat, time)
|
|
107
|
-
: init // @ts-ignore
|
|
108
|
-
? InputMask.utils.getDefaultValue(mask, placeholderChar)
|
|
109
|
-
: ''
|
|
105
|
+
time ? translateToTime(inputFormat, time) : init ? InputMask.utils.getDefaultValue(mask, placeholderChar) : ''
|
|
110
106
|
}
|
|
111
107
|
validators={inputValidator}
|
|
112
108
|
onChange={onChangeHandler}
|
|
@@ -240,7 +240,6 @@ describe('Vertical Navigation component prop: onClick', () => {
|
|
|
240
240
|
const activeMenu = getAllByTestId('DesignSystem-VerticalNav--Item')[menuClicked];
|
|
241
241
|
fireEvent.click(activeMenu);
|
|
242
242
|
expect(onClick).toHaveBeenCalled();
|
|
243
|
-
|
|
244
|
-
expect(onClick).toHaveBeenCalledWith(menus[menuClicked].subMenu[0]);
|
|
243
|
+
expect(onClick).toHaveBeenCalledWith(menus[menuClicked].subMenu![0]);
|
|
245
244
|
});
|
|
246
245
|
});
|
package/core/global.d.ts
ADDED
package/core/index.tsx
CHANGED
|
@@ -82,5 +82,5 @@ export { VerificationCodeInput } from './components/molecules/verificationCodeIn
|
|
|
82
82
|
export { InlineMessage } from './components/organisms/inlineMessage';
|
|
83
83
|
export { ChoiceList } from './components/organisms/choiceList';
|
|
84
84
|
export { Divider } from './components/atoms/divider';
|
|
85
|
-
|
|
85
|
+
|
|
86
86
|
export { version } from '../package.json';
|
|
@@ -926,12 +926,19 @@ exports[`TS renders children 1`] = `
|
|
|
926
926
|
Hello World!
|
|
927
927
|
</a>
|
|
928
928
|
<div
|
|
929
|
-
class="Message Message--
|
|
929
|
+
class="Message Message--info"
|
|
930
930
|
data-test="DesignSystem-Message"
|
|
931
931
|
>
|
|
932
|
+
<i
|
|
933
|
+
class="material-icons material-icons-round Icon Icon--info Message-icon Message-icon--info"
|
|
934
|
+
data-test="DesignSystem-Message--Icon"
|
|
935
|
+
style="font-size: 16px; width: 16px;"
|
|
936
|
+
>
|
|
937
|
+
info_round
|
|
938
|
+
</i>
|
|
932
939
|
<div>
|
|
933
940
|
<span
|
|
934
|
-
class="Text Text--default Text--regular Message-text Message-text--
|
|
941
|
+
class="Text Text--default Text--regular Message-text Message-text--info"
|
|
935
942
|
data-test="DesignSystem-Message--Description"
|
|
936
943
|
>
|
|
937
944
|
Hello World!
|
|
@@ -1482,8 +1489,14 @@ exports[`TS renders children 1`] = `
|
|
|
1482
1489
|
rows="3"
|
|
1483
1490
|
/>
|
|
1484
1491
|
<div
|
|
1485
|
-
class="Toast Toast--
|
|
1492
|
+
class="Toast Toast--info"
|
|
1486
1493
|
>
|
|
1494
|
+
<i
|
|
1495
|
+
class="material-icons material-icons-round Icon Toast-icon Toast-icon--left Toast-icon--info"
|
|
1496
|
+
style="font-size: 16px; width: 16px;"
|
|
1497
|
+
>
|
|
1498
|
+
info_round
|
|
1499
|
+
</i>
|
|
1487
1500
|
<div
|
|
1488
1501
|
class="Toast-body"
|
|
1489
1502
|
>
|
|
@@ -1491,13 +1504,13 @@ exports[`TS renders children 1`] = `
|
|
|
1491
1504
|
class="Toast-title"
|
|
1492
1505
|
>
|
|
1493
1506
|
<h5
|
|
1494
|
-
class="Heading Heading--s Heading--white Toast-heading Toast-heading--
|
|
1507
|
+
class="Heading Heading--s Heading--white Toast-heading Toast-heading--info"
|
|
1495
1508
|
data-test="DesignSystem-Heading"
|
|
1496
1509
|
>
|
|
1497
1510
|
Hello World!
|
|
1498
1511
|
</h5>
|
|
1499
1512
|
<i
|
|
1500
|
-
class="material-icons material-icons-round Icon Icon--white Toast-icon Toast-icon--right Toast-icon--
|
|
1513
|
+
class="material-icons material-icons-round Icon Icon--white Toast-icon Toast-icon--right Toast-icon--info"
|
|
1501
1514
|
role="button"
|
|
1502
1515
|
style="font-size: 16px; width: 16px;"
|
|
1503
1516
|
tabindex="0"
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
const generateImports = (str = '', lib = {}, libName: string) => {
|
|
1
|
+
const generateImports = (str = '', lib: Record<string, unknown> = {}, libName: string) => {
|
|
3
2
|
const regexp = /<[A-Z]\w*/g;
|
|
4
|
-
const matchedArray =
|
|
3
|
+
const matchedArray = Array.from(str.matchAll(regexp));
|
|
5
4
|
|
|
6
5
|
const componentsMap = matchedArray
|
|
7
6
|
.flatMap((item) => item[0].replace('<', ''))
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
|
|
3
1
|
import * as React from 'react';
|
|
4
2
|
import { Title, Description, Canvas, ArgsTable } from '@storybook/addon-docs/blocks';
|
|
5
3
|
import { renderToStaticMarkup } from 'react-dom/server';
|
|
@@ -7,7 +5,7 @@ import reactElementToJSXString from 'react-element-to-jsx-string';
|
|
|
7
5
|
import { html as beautifyHTML } from 'js-beautify';
|
|
8
6
|
import SyntaxHighlighter from 'react-syntax-highlighter';
|
|
9
7
|
import { vs2015 } from 'react-syntax-highlighter/dist/esm/styles/hljs';
|
|
10
|
-
import * as DS from '
|
|
8
|
+
import * as DS from '@';
|
|
11
9
|
import { Button, Card, TabsWrapper, Tab, Heading } from '@/index';
|
|
12
10
|
import vsDark from 'prism-react-renderer/themes/vsDark';
|
|
13
11
|
import { LiveProvider, LiveEditor, LiveError, LivePreview, withLive } from 'react-live';
|
|
@@ -59,7 +57,9 @@ const JSXtoStringOptions = {
|
|
|
59
57
|
|
|
60
58
|
const copyCode = (val: string) => navigator.clipboard.writeText(val);
|
|
61
59
|
|
|
62
|
-
|
|
60
|
+
type OnClickType = (e: React.MouseEvent) => void;
|
|
61
|
+
|
|
62
|
+
const CopyComp = (props: { onClick: OnClickType }) => {
|
|
63
63
|
const { onClick } = props;
|
|
64
64
|
return (
|
|
65
65
|
<div
|
|
@@ -88,7 +88,7 @@ const buttonStyles = {
|
|
|
88
88
|
background: 'white',
|
|
89
89
|
};
|
|
90
90
|
|
|
91
|
-
const ShowMoreLessButton = ({ onClick, text = 'More' }) => (
|
|
91
|
+
const ShowMoreLessButton = ({ onClick, text = 'More' }: { onClick: OnClickType; text: string }) => (
|
|
92
92
|
<div
|
|
93
93
|
style={{
|
|
94
94
|
display: 'grid',
|
|
@@ -132,7 +132,7 @@ const getStory = () => {
|
|
|
132
132
|
return { storyId, story };
|
|
133
133
|
};
|
|
134
134
|
|
|
135
|
-
const getRawPreviewCode = (customCode, comp) => {
|
|
135
|
+
const getRawPreviewCode = (customCode: string, comp: React.ReactNode) => {
|
|
136
136
|
if (customCode) {
|
|
137
137
|
return `${generateImports(customCode, componentLib, '@innovaccer/design-system')}
|
|
138
138
|
${customCode}
|
|
@@ -155,11 +155,17 @@ ${jsx
|
|
|
155
155
|
return code;
|
|
156
156
|
};
|
|
157
157
|
|
|
158
|
-
const StoryComp = (props
|
|
158
|
+
const StoryComp = (props: {
|
|
159
|
+
noHtml: boolean;
|
|
160
|
+
customCode: string;
|
|
161
|
+
noSandbox: boolean;
|
|
162
|
+
isEmbed: boolean;
|
|
163
|
+
imports: string[];
|
|
164
|
+
}) => {
|
|
159
165
|
const { customCode, noHtml, noSandbox, isEmbed } = props;
|
|
160
166
|
const { story } = getStory();
|
|
161
167
|
// const comp = sp.storySource.source;
|
|
162
|
-
const comp = story.
|
|
168
|
+
const comp = story.originalStoryFn();
|
|
163
169
|
const html = !noHtml ? beautifyHTML(renderToStaticMarkup(comp), beautifyHTMLOptions) : '';
|
|
164
170
|
|
|
165
171
|
const [activeTab, setActiveTab] = React.useState<number>(0);
|
|
@@ -168,7 +174,7 @@ const StoryComp = (props) => {
|
|
|
168
174
|
const [isExpanded, setIsExpanded] = React.useState(isEmbed);
|
|
169
175
|
const [showMore, setShowMore] = React.useState<boolean>(false);
|
|
170
176
|
const [shouldShowMore, setShouldShowMore] = React.useState<boolean>(false);
|
|
171
|
-
const codePanel = React.useRef(null);
|
|
177
|
+
const codePanel = React.useRef<HTMLDivElement>(null);
|
|
172
178
|
|
|
173
179
|
const importScope = props.imports;
|
|
174
180
|
|
|
@@ -179,11 +185,11 @@ const StoryComp = (props) => {
|
|
|
179
185
|
return <></>;
|
|
180
186
|
};
|
|
181
187
|
|
|
182
|
-
const TabsWrap = withLive(({ live,
|
|
188
|
+
const TabsWrap = withLive<{ live?: any; activeTab: number }>(({ live, activeTab }) => {
|
|
183
189
|
const { error, element: Element } = live;
|
|
184
190
|
|
|
185
191
|
React.useEffect(() => {
|
|
186
|
-
if (!error &&
|
|
192
|
+
if (!error && activeTab === 1) {
|
|
187
193
|
try {
|
|
188
194
|
const htmlValue = beautifyHTML(renderToStaticMarkup(<Element />), beautifyHTMLOptions);
|
|
189
195
|
setHtmlCode(htmlValue);
|
|
@@ -191,10 +197,10 @@ const StoryComp = (props) => {
|
|
|
191
197
|
return;
|
|
192
198
|
}
|
|
193
199
|
}
|
|
194
|
-
}, [
|
|
200
|
+
}, [activeTab]);
|
|
195
201
|
|
|
196
202
|
React.useEffect(() => {
|
|
197
|
-
if (codePanel.current?.clientHeight >
|
|
203
|
+
if (codePanel.current?.clientHeight && codePanel.current?.clientHeight > 250) {
|
|
198
204
|
setShouldShowMore(true);
|
|
199
205
|
}
|
|
200
206
|
}, [codePanel]);
|
|
@@ -209,7 +215,7 @@ const StoryComp = (props) => {
|
|
|
209
215
|
const actions = [
|
|
210
216
|
{
|
|
211
217
|
title: 'Edit in sandbox',
|
|
212
|
-
onClick: (ev) => {
|
|
218
|
+
onClick: (ev: React.MouseEvent) => {
|
|
213
219
|
ev.preventDefault();
|
|
214
220
|
openSandbox(jsxCode);
|
|
215
221
|
},
|
|
@@ -223,12 +229,13 @@ const StoryComp = (props) => {
|
|
|
223
229
|
onClick: () => {
|
|
224
230
|
setIsExpanded(!isExpanded);
|
|
225
231
|
},
|
|
232
|
+
disabled: false,
|
|
226
233
|
});
|
|
227
234
|
}
|
|
228
235
|
|
|
229
236
|
const imports = React.useMemo(() => ({ ...DS, ...importScope }), []);
|
|
230
237
|
|
|
231
|
-
const tabChangeHandler = (tab) => {
|
|
238
|
+
const tabChangeHandler = (tab: number) => {
|
|
232
239
|
setActiveTab(tab);
|
|
233
240
|
setShouldShowMore(false);
|
|
234
241
|
};
|
|
@@ -238,9 +245,9 @@ const StoryComp = (props) => {
|
|
|
238
245
|
<LiveProvider code={jsxCode} scope={imports}>
|
|
239
246
|
<Canvas
|
|
240
247
|
className="my-0"
|
|
241
|
-
withSource="none"
|
|
242
248
|
withToolbar={true}
|
|
243
249
|
isExpanded={isExpanded}
|
|
250
|
+
withSource={'none' as any}
|
|
244
251
|
additionalActions={actions}
|
|
245
252
|
>
|
|
246
253
|
<LivePreview />
|
|
@@ -260,11 +267,13 @@ const StoryComp = (props) => {
|
|
|
260
267
|
}}
|
|
261
268
|
className="DocPage-editorTabs"
|
|
262
269
|
>
|
|
263
|
-
<TabsWrapper
|
|
270
|
+
<TabsWrapper active={activeTab} onTabChange={tabChangeHandler}>
|
|
264
271
|
<Tab label={'React'}>
|
|
265
272
|
<CopyComp
|
|
266
273
|
onClick={() => {
|
|
267
|
-
const editor = document.querySelector(
|
|
274
|
+
const editor = document.querySelector(
|
|
275
|
+
'.npm__react-simple-code-editor__textarea'
|
|
276
|
+
) as HTMLTextAreaElement;
|
|
268
277
|
if (editor) copyCode(editor.value);
|
|
269
278
|
}}
|
|
270
279
|
/>
|
|
@@ -301,17 +310,18 @@ export const docPage = () => {
|
|
|
301
310
|
imports,
|
|
302
311
|
a11yProps,
|
|
303
312
|
} = sp.docs.docPage || {};
|
|
304
|
-
const { component: { displayName } = {} } =
|
|
313
|
+
const { component: { displayName = '' } = {} } = story;
|
|
305
314
|
const pageClassnames = classNames({
|
|
306
315
|
DocPage: true,
|
|
307
316
|
'pt-8 pb-8': !(isEmbed || isEmbedWithProp),
|
|
308
317
|
});
|
|
318
|
+
const docPageTitle: string = title || displayName;
|
|
309
319
|
|
|
310
320
|
return (
|
|
311
321
|
<div className={pageClassnames}>
|
|
312
322
|
{!isEmbed && !isEmbedWithProp && (
|
|
313
323
|
<>
|
|
314
|
-
<Title>
|
|
324
|
+
<Title>{docPageTitle}</Title>
|
|
315
325
|
<Description>{description}</Description>
|
|
316
326
|
</>
|
|
317
327
|
)}
|
|
@@ -24,14 +24,21 @@ const getParameters = (options: { files: IFiles }) => {
|
|
|
24
24
|
return compress(JSON.stringify(options));
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
+
const replaceAll = function (original: string, matchString: string, replaceString: string) {
|
|
28
|
+
// If a regex pattern
|
|
29
|
+
if (Object.prototype.toString.call(matchString).toLowerCase() === '[object regexp]') {
|
|
30
|
+
return original.replace(matchString, replaceString);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// If a string
|
|
34
|
+
return original.replace(new RegExp(matchString, 'g'), replaceString);
|
|
35
|
+
};
|
|
36
|
+
|
|
27
37
|
export default (jsxStoryCode: string) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
.replace('() => {', 'const App = () => {')
|
|
33
|
-
.replaceAll('<>', '<React.Fragment>')
|
|
34
|
-
.replaceAll('</>', '</React.Fragment>');
|
|
38
|
+
let structuredCode = replaceAll(jsxStoryCode.trim(), '// import', 'import').replace('() => {', 'const App = () => {');
|
|
39
|
+
structuredCode = replaceAll(structuredCode, '<>', '<React.Fragment>');
|
|
40
|
+
structuredCode = replaceAll(structuredCode, '</>', '</React.Fragment>');
|
|
41
|
+
|
|
35
42
|
const code = `
|
|
36
43
|
import ReactDOM from "react-dom";
|
|
37
44
|
import React from "react";
|
|
@@ -33,12 +33,16 @@ export const getUpdatedZIndex = (ele: elementData): number | undefined => {
|
|
|
33
33
|
return zIndex > 0 ? zIndex : undefined;
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
// keyboard event, boolean?, (event: Event) => void
|
|
37
|
+
export const closeOnEscapeKeypress = (
|
|
38
|
+
event: KeyboardEvent,
|
|
39
|
+
isTopOverlay: boolean | undefined,
|
|
40
|
+
onClose: (event: Event) => void
|
|
41
|
+
) => {
|
|
38
42
|
if (event.key === 'Escape' && isTopOverlay) {
|
|
39
43
|
onClose(event);
|
|
40
44
|
|
|
41
45
|
// prevent browser-specific escape key behavior (Safari exits fullscreen)
|
|
42
46
|
event.preventDefault();
|
|
43
47
|
}
|
|
44
|
-
}
|
|
48
|
+
};
|
package/core/utils/testHelper.ts
CHANGED
|
@@ -42,7 +42,7 @@ const getCombinations = (Props: Record<string, any>): Record<string, any>[] => {
|
|
|
42
42
|
const combinations: Record<string, any>[] = [];
|
|
43
43
|
const propNames = Object.keys(Props);
|
|
44
44
|
|
|
45
|
-
const iterateProps = (curr: Record<string, any> = {}, propIndex
|
|
45
|
+
const iterateProps = (curr: Record<string, any> = {}, propIndex = 0): void => {
|
|
46
46
|
const iterateValues = (propValues: any[]) => {
|
|
47
47
|
for (const propValue of propValues) {
|
|
48
48
|
if (isMapper(propValue)) {
|
package/core/utils/types.tsx
CHANGED
|
@@ -2,7 +2,7 @@ export type SingleOrArray<T> = T | T[];
|
|
|
2
2
|
|
|
3
3
|
export type MakeRequired<T> = Exclude<T, null | undefined>;
|
|
4
4
|
|
|
5
|
-
export type MakeOptional<T extends
|
|
5
|
+
export type MakeOptional<T extends object, K extends keyof any> = Omit<T, K> & {
|
|
6
6
|
[OK in keyof T & K]?: T[OK];
|
|
7
7
|
};
|
|
8
8
|
|