wabtec-internal-volt-extended-components-react 1.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/dist/basic-components.d.ts +56 -0
- package/dist/basic-components.js +59 -0
- package/dist/components.d.ts +22 -0
- package/dist/components.js +25 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/react-component-lib/createComponent.d.ts +10 -0
- package/dist/react-component-lib/createComponent.js +74 -0
- package/dist/react-component-lib/createControllerComponent.d.ts +41 -0
- package/dist/react-component-lib/createControllerComponent.js +65 -0
- package/dist/react-component-lib/createOverlayComponent.d.ts +21 -0
- package/dist/react-component-lib/createOverlayComponent.js +108 -0
- package/dist/react-component-lib/index.d.ts +2 -0
- package/dist/react-component-lib/index.js +2 -0
- package/dist/react-component-lib/interfaces.d.ts +29 -0
- package/dist/react-component-lib/interfaces.js +1 -0
- package/dist/react-component-lib/utils/attachEventProps.d.ts +8 -0
- package/dist/react-component-lib/utils/attachEventProps.js +76 -0
- package/dist/react-component-lib/utils/attachProps.d.ts +12 -0
- package/dist/react-component-lib/utils/attachProps.js +97 -0
- package/dist/react-component-lib/utils/case.d.ts +2 -0
- package/dist/react-component-lib/utils/case.js +6 -0
- package/dist/react-component-lib/utils/dev.d.ts +2 -0
- package/dist/react-component-lib/utils/dev.js +12 -0
- package/dist/react-component-lib/utils/index.d.ts +10 -0
- package/dist/react-component-lib/utils/index.js +33 -0
- package/package.json +53 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { JSX } from '@volt/volt-basic-components';
|
|
2
|
+
export declare const VdsAvatar: import("react").ForwardRefExoticComponent<JSX.VdsAvatar & Omit<import("react").HTMLAttributes<HTMLVdsAvatarElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsAvatarElement>>;
|
|
3
|
+
export declare const VdsBadgeDot: import("react").ForwardRefExoticComponent<JSX.VdsBadgeDot & Omit<import("react").HTMLAttributes<HTMLVdsBadgeDotElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsBadgeDotElement>>;
|
|
4
|
+
export declare const VdsBadgePill: import("react").ForwardRefExoticComponent<JSX.VdsBadgePill & Omit<import("react").HTMLAttributes<HTMLVdsBadgePillElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsBadgePillElement>>;
|
|
5
|
+
export declare const VdsBasicAccordion: import("react").ForwardRefExoticComponent<JSX.VdsBasicAccordion & Omit<import("react").HTMLAttributes<HTMLVdsBasicAccordionElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsBasicAccordionElement>>;
|
|
6
|
+
export declare const VdsBasicDropdown: import("react").ForwardRefExoticComponent<JSX.VdsBasicDropdown & Omit<import("react").HTMLAttributes<HTMLVdsBasicDropdownElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsBasicDropdownElement>>;
|
|
7
|
+
export declare const VdsBasicDropdownMultiselect: import("react").ForwardRefExoticComponent<JSX.VdsBasicDropdownMultiselect & Omit<import("react").HTMLAttributes<HTMLVdsBasicDropdownMultiselectElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsBasicDropdownMultiselectElement>>;
|
|
8
|
+
export declare const VdsBasicInput: import("react").ForwardRefExoticComponent<JSX.VdsBasicInput & Omit<import("react").HTMLAttributes<HTMLVdsBasicInputElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsBasicInputElement>>;
|
|
9
|
+
export declare const VdsBasicSliderContinuous: import("react").ForwardRefExoticComponent<JSX.VdsBasicSliderContinuous & Omit<import("react").HTMLAttributes<HTMLVdsBasicSliderContinuousElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsBasicSliderContinuousElement>>;
|
|
10
|
+
export declare const VdsBasicTextarea: import("react").ForwardRefExoticComponent<JSX.VdsBasicTextarea & Omit<import("react").HTMLAttributes<HTMLVdsBasicTextareaElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsBasicTextareaElement>>;
|
|
11
|
+
export declare const VdsButton: import("react").ForwardRefExoticComponent<JSX.VdsButton & Omit<import("react").HTMLAttributes<HTMLVdsButtonElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsButtonElement>>;
|
|
12
|
+
export declare const VdsCard: import("react").ForwardRefExoticComponent<JSX.VdsCard & Omit<import("react").HTMLAttributes<HTMLVdsCardElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsCardElement>>;
|
|
13
|
+
export declare const VdsCheckbox: import("react").ForwardRefExoticComponent<JSX.VdsCheckbox & Omit<import("react").HTMLAttributes<HTMLVdsCheckboxElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsCheckboxElement>>;
|
|
14
|
+
export declare const VdsChip: import("react").ForwardRefExoticComponent<JSX.VdsChip & Omit<import("react").HTMLAttributes<HTMLVdsChipElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsChipElement>>;
|
|
15
|
+
export declare const VdsDialog: import("react").ForwardRefExoticComponent<JSX.VdsDialog & Omit<import("react").HTMLAttributes<HTMLVdsDialogElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsDialogElement>>;
|
|
16
|
+
export declare const VdsDialogActionFooter: import("react").ForwardRefExoticComponent<JSX.VdsDialogActionFooter & Omit<import("react").HTMLAttributes<HTMLVdsDialogActionFooterElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsDialogActionFooterElement>>;
|
|
17
|
+
export declare const VdsDialogBody: import("react").ForwardRefExoticComponent<JSX.VdsDialogBody & Omit<import("react").HTMLAttributes<HTMLVdsDialogBodyElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsDialogBodyElement>>;
|
|
18
|
+
export declare const VdsDialogHeader: import("react").ForwardRefExoticComponent<JSX.VdsDialogHeader & Omit<import("react").HTMLAttributes<HTMLVdsDialogHeaderElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsDialogHeaderElement>>;
|
|
19
|
+
export declare const VdsDialogModal: import("react").ForwardRefExoticComponent<JSX.VdsDialogModal & Omit<import("react").HTMLAttributes<HTMLVdsDialogModalElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsDialogModalElement>>;
|
|
20
|
+
export declare const VdsDivider: import("react").ForwardRefExoticComponent<JSX.VdsDivider & Omit<import("react").HTMLAttributes<HTMLVdsDividerElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsDividerElement>>;
|
|
21
|
+
export declare const VdsDrawer: import("react").ForwardRefExoticComponent<JSX.VdsDrawer & Omit<import("react").HTMLAttributes<HTMLVdsDrawerElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsDrawerElement>>;
|
|
22
|
+
export declare const VdsDropdownGroupHeader: import("react").ForwardRefExoticComponent<JSX.VdsDropdownGroupHeader & Omit<import("react").HTMLAttributes<HTMLVdsDropdownGroupHeaderElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsDropdownGroupHeaderElement>>;
|
|
23
|
+
export declare const VdsDropdownItem: import("react").ForwardRefExoticComponent<JSX.VdsDropdownItem & Omit<import("react").HTMLAttributes<HTMLVdsDropdownItemElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsDropdownItemElement>>;
|
|
24
|
+
export declare const VdsField: import("react").ForwardRefExoticComponent<JSX.VdsField & Omit<import("react").HTMLAttributes<HTMLVdsFieldElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsFieldElement>>;
|
|
25
|
+
export declare const VdsFooter: import("react").ForwardRefExoticComponent<JSX.VdsFooter & Omit<import("react").HTMLAttributes<HTMLVdsFooterElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsFooterElement>>;
|
|
26
|
+
export declare const VdsHeader: import("react").ForwardRefExoticComponent<JSX.VdsHeader & Omit<import("react").HTMLAttributes<HTMLVdsHeaderElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsHeaderElement>>;
|
|
27
|
+
export declare const VdsIcon: import("react").ForwardRefExoticComponent<JSX.VdsIcon & Omit<import("react").HTMLAttributes<HTMLVdsIconElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsIconElement>>;
|
|
28
|
+
export declare const VdsIconButton: import("react").ForwardRefExoticComponent<JSX.VdsIconButton & Omit<import("react").HTMLAttributes<HTMLVdsIconButtonElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsIconButtonElement>>;
|
|
29
|
+
export declare const VdsLabel: import("react").ForwardRefExoticComponent<JSX.VdsLabel & Omit<import("react").HTMLAttributes<HTMLVdsLabelElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsLabelElement>>;
|
|
30
|
+
export declare const VdsLink: import("react").ForwardRefExoticComponent<JSX.VdsLink & Omit<import("react").HTMLAttributes<HTMLVdsLinkElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsLinkElement>>;
|
|
31
|
+
export declare const VdsMenu: import("react").ForwardRefExoticComponent<JSX.VdsMenu & Omit<import("react").HTMLAttributes<HTMLVdsMenuElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsMenuElement>>;
|
|
32
|
+
export declare const VdsMenuGroupHeader: import("react").ForwardRefExoticComponent<JSX.VdsMenuGroupHeader & Omit<import("react").HTMLAttributes<HTMLVdsMenuGroupHeaderElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsMenuGroupHeaderElement>>;
|
|
33
|
+
export declare const VdsMenuItem: import("react").ForwardRefExoticComponent<JSX.VdsMenuItem & Omit<import("react").HTMLAttributes<HTMLVdsMenuItemElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsMenuItemElement>>;
|
|
34
|
+
export declare const VdsMenuList: import("react").ForwardRefExoticComponent<JSX.VdsMenuList & Omit<import("react").HTMLAttributes<HTMLVdsMenuListElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsMenuListElement>>;
|
|
35
|
+
export declare const VdsNotification: import("react").ForwardRefExoticComponent<JSX.VdsNotification & Omit<import("react").HTMLAttributes<HTMLVdsNotificationElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsNotificationElement>>;
|
|
36
|
+
export declare const VdsPopover: import("react").ForwardRefExoticComponent<JSX.VdsPopover & Omit<import("react").HTMLAttributes<HTMLVdsPopoverElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsPopoverElement>>;
|
|
37
|
+
export declare const VdsProgressLinear: import("react").ForwardRefExoticComponent<JSX.VdsProgressLinear & Omit<import("react").HTMLAttributes<HTMLVdsProgressLinearElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsProgressLinearElement>>;
|
|
38
|
+
export declare const VdsRadioButton: import("react").ForwardRefExoticComponent<JSX.VdsRadioButton & Omit<import("react").HTMLAttributes<HTMLVdsRadioButtonElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsRadioButtonElement>>;
|
|
39
|
+
export declare const VdsSidenavItem: import("react").ForwardRefExoticComponent<JSX.VdsSidenavItem & Omit<import("react").HTMLAttributes<HTMLVdsSidenavItemElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsSidenavItemElement>>;
|
|
40
|
+
export declare const VdsSidenavItemApp: import("react").ForwardRefExoticComponent<JSX.VdsSidenavItemApp & Omit<import("react").HTMLAttributes<HTMLVdsSidenavItemAppElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsSidenavItemAppElement>>;
|
|
41
|
+
export declare const VdsSidenavItemButton: import("react").ForwardRefExoticComponent<JSX.VdsSidenavItemButton & Omit<import("react").HTMLAttributes<HTMLVdsSidenavItemButtonElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsSidenavItemButtonElement>>;
|
|
42
|
+
export declare const VdsSidenavItemCategory: import("react").ForwardRefExoticComponent<JSX.VdsSidenavItemCategory & Omit<import("react").HTMLAttributes<HTMLVdsSidenavItemCategoryElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsSidenavItemCategoryElement>>;
|
|
43
|
+
export declare const VdsSidenavItemInput: import("react").ForwardRefExoticComponent<JSX.VdsSidenavItemInput & Omit<import("react").HTMLAttributes<HTMLVdsSidenavItemInputElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsSidenavItemInputElement>>;
|
|
44
|
+
export declare const VdsSwitch: import("react").ForwardRefExoticComponent<JSX.VdsSwitch & Omit<import("react").HTMLAttributes<HTMLVdsSwitchElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsSwitchElement>>;
|
|
45
|
+
export declare const VdsTab: import("react").ForwardRefExoticComponent<JSX.VdsTab & Omit<import("react").HTMLAttributes<HTMLVdsTabElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsTabElement>>;
|
|
46
|
+
export declare const VdsTabsGroup: import("react").ForwardRefExoticComponent<JSX.VdsTabsGroup & Omit<import("react").HTMLAttributes<HTMLVdsTabsGroupElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsTabsGroupElement>>;
|
|
47
|
+
export declare const VdsTooltip: import("react").ForwardRefExoticComponent<JSX.VdsTooltip & Omit<import("react").HTMLAttributes<HTMLVdsTooltipElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsTooltipElement>>;
|
|
48
|
+
export declare const VdsProgressCircular: import("react").ForwardRefExoticComponent<JSX.VdsProgressCircular & Omit<import("react").HTMLAttributes<HTMLVdsProgressCircularElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsProgressCircularElement>>;
|
|
49
|
+
export declare const VdsAutocompleteItem: import("react").ForwardRefExoticComponent<JSX.VdsAutocompleteItem & Omit<import("react").HTMLAttributes<HTMLVdsAutocompleteItemElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsAutocompleteItemElement>>;
|
|
50
|
+
export declare const VdsBasicAutocomplete: import("react").ForwardRefExoticComponent<JSX.VdsBasicAutocomplete & Omit<import("react").HTMLAttributes<HTMLVdsBasicAutocompleteElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsBasicAutocompleteElement>>;
|
|
51
|
+
export declare const VdsBasicSliderRangeContinuous: import("react").ForwardRefExoticComponent<JSX.VdsBasicSliderRangeContinuous & Omit<import("react").HTMLAttributes<HTMLVdsBasicSliderRangeContinuousElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsBasicSliderRangeContinuousElement>>;
|
|
52
|
+
export declare const VdsSegmentedButton: import("react").ForwardRefExoticComponent<JSX.VdsSegmentedButton & Omit<import("react").HTMLAttributes<HTMLVdsSegmentedButtonElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsSegmentedButtonElement>>;
|
|
53
|
+
export declare const VdsKeyValuePair: import("react").ForwardRefExoticComponent<JSX.VdsKeyValuePair & Omit<import("react").HTMLAttributes<HTMLVdsKeyValuePairElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsKeyValuePairElement>>;
|
|
54
|
+
export declare const VdsUploadItem: import("react").ForwardRefExoticComponent<JSX.VdsUploadItem & Omit<import("react").HTMLAttributes<HTMLVdsUploadItemElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsUploadItemElement>>;
|
|
55
|
+
export declare const VdsSkeletonLoading: import("react").ForwardRefExoticComponent<JSX.VdsSkeletonLoading & Omit<import("react").HTMLAttributes<HTMLVdsSkeletonLoadingElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsSkeletonLoadingElement>>;
|
|
56
|
+
export declare const VdsUploadDrag: import("react").ForwardRefExoticComponent<JSX.VdsUploadDrag & Omit<import("react").HTMLAttributes<HTMLVdsUploadDragElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsUploadDragElement>>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* auto-generated react proxies */
|
|
4
|
+
import { createReactComponent } from './react-component-lib';
|
|
5
|
+
export const VdsAvatar = /*@__PURE__*/ createReactComponent('vds-avatar');
|
|
6
|
+
export const VdsBadgeDot = /*@__PURE__*/ createReactComponent('vds-badge-dot');
|
|
7
|
+
export const VdsBadgePill = /*@__PURE__*/ createReactComponent('vds-badge-pill');
|
|
8
|
+
export const VdsBasicAccordion = /*@__PURE__*/ createReactComponent('vds-basic-accordion');
|
|
9
|
+
export const VdsBasicDropdown = /*@__PURE__*/ createReactComponent('vds-basic-dropdown');
|
|
10
|
+
export const VdsBasicDropdownMultiselect = /*@__PURE__*/ createReactComponent('vds-basic-dropdown-multiselect');
|
|
11
|
+
export const VdsBasicInput = /*@__PURE__*/ createReactComponent('vds-basic-input');
|
|
12
|
+
export const VdsBasicSliderContinuous = /*@__PURE__*/ createReactComponent('vds-basic-slider-continuous');
|
|
13
|
+
export const VdsBasicTextarea = /*@__PURE__*/ createReactComponent('vds-basic-textarea');
|
|
14
|
+
export const VdsButton = /*@__PURE__*/ createReactComponent('vds-button');
|
|
15
|
+
export const VdsCard = /*@__PURE__*/ createReactComponent('vds-card');
|
|
16
|
+
export const VdsCheckbox = /*@__PURE__*/ createReactComponent('vds-checkbox');
|
|
17
|
+
export const VdsChip = /*@__PURE__*/ createReactComponent('vds-chip');
|
|
18
|
+
export const VdsDialog = /*@__PURE__*/ createReactComponent('vds-dialog');
|
|
19
|
+
export const VdsDialogActionFooter = /*@__PURE__*/ createReactComponent('vds-dialog-action-footer');
|
|
20
|
+
export const VdsDialogBody = /*@__PURE__*/ createReactComponent('vds-dialog-body');
|
|
21
|
+
export const VdsDialogHeader = /*@__PURE__*/ createReactComponent('vds-dialog-header');
|
|
22
|
+
export const VdsDialogModal = /*@__PURE__*/ createReactComponent('vds-dialog-modal');
|
|
23
|
+
export const VdsDivider = /*@__PURE__*/ createReactComponent('vds-divider');
|
|
24
|
+
export const VdsDrawer = /*@__PURE__*/ createReactComponent('vds-drawer');
|
|
25
|
+
export const VdsDropdownGroupHeader = /*@__PURE__*/ createReactComponent('vds-dropdown-group-header');
|
|
26
|
+
export const VdsDropdownItem = /*@__PURE__*/ createReactComponent('vds-dropdown-item');
|
|
27
|
+
export const VdsField = /*@__PURE__*/ createReactComponent('vds-field');
|
|
28
|
+
export const VdsFooter = /*@__PURE__*/ createReactComponent('vds-footer');
|
|
29
|
+
export const VdsHeader = /*@__PURE__*/ createReactComponent('vds-header');
|
|
30
|
+
export const VdsIcon = /*@__PURE__*/ createReactComponent('vds-icon');
|
|
31
|
+
export const VdsIconButton = /*@__PURE__*/ createReactComponent('vds-icon-button');
|
|
32
|
+
export const VdsLabel = /*@__PURE__*/ createReactComponent('vds-label');
|
|
33
|
+
export const VdsLink = /*@__PURE__*/ createReactComponent('vds-link');
|
|
34
|
+
export const VdsMenu = /*@__PURE__*/ createReactComponent('vds-menu');
|
|
35
|
+
export const VdsMenuGroupHeader = /*@__PURE__*/ createReactComponent('vds-menu-group-header');
|
|
36
|
+
export const VdsMenuItem = /*@__PURE__*/ createReactComponent('vds-menu-item');
|
|
37
|
+
export const VdsMenuList = /*@__PURE__*/ createReactComponent('vds-menu-list');
|
|
38
|
+
export const VdsNotification = /*@__PURE__*/ createReactComponent('vds-notification');
|
|
39
|
+
export const VdsPopover = /*@__PURE__*/ createReactComponent('vds-popover');
|
|
40
|
+
export const VdsProgressLinear = /*@__PURE__*/ createReactComponent('vds-progress-linear');
|
|
41
|
+
export const VdsRadioButton = /*@__PURE__*/ createReactComponent('vds-radio-button');
|
|
42
|
+
export const VdsSidenavItem = /*@__PURE__*/ createReactComponent('vds-sidenav-item');
|
|
43
|
+
export const VdsSidenavItemApp = /*@__PURE__*/ createReactComponent('vds-sidenav-item-app');
|
|
44
|
+
export const VdsSidenavItemButton = /*@__PURE__*/ createReactComponent('vds-sidenav-item-button');
|
|
45
|
+
export const VdsSidenavItemCategory = /*@__PURE__*/ createReactComponent('vds-sidenav-item-category');
|
|
46
|
+
export const VdsSidenavItemInput = /*@__PURE__*/ createReactComponent('vds-sidenav-item-input');
|
|
47
|
+
export const VdsSwitch = /*@__PURE__*/ createReactComponent('vds-switch');
|
|
48
|
+
export const VdsTab = /*@__PURE__*/ createReactComponent('vds-tab');
|
|
49
|
+
export const VdsTabsGroup = /*@__PURE__*/ createReactComponent('vds-tabs-group');
|
|
50
|
+
export const VdsTooltip = /*@__PURE__*/ createReactComponent('vds-tooltip');
|
|
51
|
+
export const VdsProgressCircular = /*@__PURE__*/ createReactComponent('vds-progress-circular');
|
|
52
|
+
export const VdsAutocompleteItem = /*@__PURE__*/ createReactComponent('vds-autocomplete-item');
|
|
53
|
+
export const VdsBasicAutocomplete = /*@__PURE__*/ createReactComponent('vds-basic-autocomplete');
|
|
54
|
+
export const VdsBasicSliderRangeContinuous = /*@__PURE__*/ createReactComponent('vds-basic-slider-range-continuous');
|
|
55
|
+
export const VdsSegmentedButton = /*@__PURE__*/ createReactComponent('vds-segmented-button');
|
|
56
|
+
export const VdsKeyValuePair = /*@__PURE__*/ createReactComponent('vds-key-value-pair');
|
|
57
|
+
export const VdsUploadItem = /*@__PURE__*/ createReactComponent('vds-upload-item');
|
|
58
|
+
export const VdsSkeletonLoading = /*@__PURE__*/ createReactComponent('vds-skeleton-loading');
|
|
59
|
+
export const VdsUploadDrag = /*@__PURE__*/ createReactComponent('vds-upload-drag');
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { JSX } from '@volt/volt-extended-components';
|
|
2
|
+
export declare const VdsAccordionGroup: import("react").ForwardRefExoticComponent<JSX.VdsAccordionGroup & Omit<import("react").HTMLAttributes<HTMLVdsAccordionGroupElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsAccordionGroupElement>>;
|
|
3
|
+
export declare const VdsAutocomplete: import("react").ForwardRefExoticComponent<JSX.VdsAutocomplete & Omit<import("react").HTMLAttributes<HTMLVdsAutocompleteElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsAutocompleteElement>>;
|
|
4
|
+
export declare const VdsAvatarGroup: import("react").ForwardRefExoticComponent<JSX.VdsAvatarGroup & Omit<import("react").HTMLAttributes<HTMLVdsAvatarGroupElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsAvatarGroupElement>>;
|
|
5
|
+
export declare const VdsCalendar: import("react").ForwardRefExoticComponent<JSX.VdsCalendar & Omit<import("react").HTMLAttributes<HTMLVdsCalendarElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsCalendarElement>>;
|
|
6
|
+
export declare const VdsCalendarDayCell: import("react").ForwardRefExoticComponent<JSX.VdsCalendarDayCell & Omit<import("react").HTMLAttributes<HTMLVdsCalendarDayCellElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsCalendarDayCellElement>>;
|
|
7
|
+
export declare const VdsCheckboxGroup: import("react").ForwardRefExoticComponent<JSX.VdsCheckboxGroup & Omit<import("react").HTMLAttributes<HTMLVdsCheckboxGroupElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsCheckboxGroupElement>>;
|
|
8
|
+
export declare const VdsDatePicker: import("react").ForwardRefExoticComponent<JSX.VdsDatePicker & Omit<import("react").HTMLAttributes<HTMLVdsDatePickerElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsDatePickerElement>>;
|
|
9
|
+
export declare const VdsDropdown: import("react").ForwardRefExoticComponent<JSX.VdsDropdown & Omit<import("react").HTMLAttributes<HTMLVdsDropdownElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsDropdownElement>>;
|
|
10
|
+
export declare const VdsInput: import("react").ForwardRefExoticComponent<JSX.VdsInput & Omit<import("react").HTMLAttributes<HTMLVdsInputElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsInputElement>>;
|
|
11
|
+
export declare const VdsInputDate: import("react").ForwardRefExoticComponent<JSX.VdsInputDate & Omit<import("react").HTMLAttributes<HTMLVdsInputDateElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsInputDateElement>>;
|
|
12
|
+
export declare const VdsInputDateTime: import("react").ForwardRefExoticComponent<JSX.VdsInputDateTime & Omit<import("react").HTMLAttributes<HTMLVdsInputDateTimeElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsInputDateTimeElement>>;
|
|
13
|
+
export declare const VdsInputTime: import("react").ForwardRefExoticComponent<JSX.VdsInputTime & Omit<import("react").HTMLAttributes<HTMLVdsInputTimeElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsInputTimeElement>>;
|
|
14
|
+
export declare const VdsNotificationToast: import("react").ForwardRefExoticComponent<JSX.VdsNotificationToast & Omit<import("react").HTMLAttributes<HTMLVdsNotificationToastElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsNotificationToastElement>>;
|
|
15
|
+
export declare const VdsRadioGroup: import("react").ForwardRefExoticComponent<JSX.VdsRadioGroup & Omit<import("react").HTMLAttributes<HTMLVdsRadioGroupElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsRadioGroupElement>>;
|
|
16
|
+
export declare const VdsSegmentedGroup: import("react").ForwardRefExoticComponent<JSX.VdsSegmentedGroup & Omit<import("react").HTMLAttributes<HTMLVdsSegmentedGroupElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsSegmentedGroupElement>>;
|
|
17
|
+
export declare const VdsSidenav: import("react").ForwardRefExoticComponent<JSX.VdsSidenav & Omit<import("react").HTMLAttributes<HTMLVdsSidenavElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsSidenavElement>>;
|
|
18
|
+
export declare const VdsSwitchGroup: import("react").ForwardRefExoticComponent<JSX.VdsSwitchGroup & Omit<import("react").HTMLAttributes<HTMLVdsSwitchGroupElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsSwitchGroupElement>>;
|
|
19
|
+
export declare const VdsTextarea: import("react").ForwardRefExoticComponent<JSX.VdsTextarea & Omit<import("react").HTMLAttributes<HTMLVdsTextareaElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsTextareaElement>>;
|
|
20
|
+
export declare const VdsTimePanel: import("react").ForwardRefExoticComponent<JSX.VdsTimePanel & Omit<import("react").HTMLAttributes<HTMLVdsTimePanelElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsTimePanelElement>>;
|
|
21
|
+
export declare const VdsTimePicker: import("react").ForwardRefExoticComponent<JSX.VdsTimePicker & Omit<import("react").HTMLAttributes<HTMLVdsTimePickerElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsTimePickerElement>>;
|
|
22
|
+
export declare const VdsUpload: import("react").ForwardRefExoticComponent<JSX.VdsUpload & Omit<import("react").HTMLAttributes<HTMLVdsUploadElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVdsUploadElement>>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* auto-generated react proxies */
|
|
4
|
+
import { createReactComponent } from './react-component-lib';
|
|
5
|
+
export const VdsAccordionGroup = /*@__PURE__*/ createReactComponent('vds-accordion-group');
|
|
6
|
+
export const VdsAutocomplete = /*@__PURE__*/ createReactComponent('vds-autocomplete');
|
|
7
|
+
export const VdsAvatarGroup = /*@__PURE__*/ createReactComponent('vds-avatar-group');
|
|
8
|
+
export const VdsCalendar = /*@__PURE__*/ createReactComponent('vds-calendar');
|
|
9
|
+
export const VdsCalendarDayCell = /*@__PURE__*/ createReactComponent('vds-calendar-day-cell');
|
|
10
|
+
export const VdsCheckboxGroup = /*@__PURE__*/ createReactComponent('vds-checkbox-group');
|
|
11
|
+
export const VdsDatePicker = /*@__PURE__*/ createReactComponent('vds-date-picker');
|
|
12
|
+
export const VdsDropdown = /*@__PURE__*/ createReactComponent('vds-dropdown');
|
|
13
|
+
export const VdsInput = /*@__PURE__*/ createReactComponent('vds-input');
|
|
14
|
+
export const VdsInputDate = /*@__PURE__*/ createReactComponent('vds-input-date');
|
|
15
|
+
export const VdsInputDateTime = /*@__PURE__*/ createReactComponent('vds-input-date-time');
|
|
16
|
+
export const VdsInputTime = /*@__PURE__*/ createReactComponent('vds-input-time');
|
|
17
|
+
export const VdsNotificationToast = /*@__PURE__*/ createReactComponent('vds-notification-toast');
|
|
18
|
+
export const VdsRadioGroup = /*@__PURE__*/ createReactComponent('vds-radio-group');
|
|
19
|
+
export const VdsSegmentedGroup = /*@__PURE__*/ createReactComponent('vds-segmented-group');
|
|
20
|
+
export const VdsSidenav = /*@__PURE__*/ createReactComponent('vds-sidenav');
|
|
21
|
+
export const VdsSwitchGroup = /*@__PURE__*/ createReactComponent('vds-switch-group');
|
|
22
|
+
export const VdsTextarea = /*@__PURE__*/ createReactComponent('vds-textarea');
|
|
23
|
+
export const VdsTimePanel = /*@__PURE__*/ createReactComponent('vds-time-panel');
|
|
24
|
+
export const VdsTimePicker = /*@__PURE__*/ createReactComponent('vds-time-picker');
|
|
25
|
+
export const VdsUpload = /*@__PURE__*/ createReactComponent('vds-upload');
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface HTMLStencilElement extends HTMLElement {
|
|
3
|
+
componentOnReady(): Promise<this>;
|
|
4
|
+
}
|
|
5
|
+
interface StencilReactInternalProps<ElementType> extends React.HTMLAttributes<ElementType> {
|
|
6
|
+
forwardedRef: React.RefObject<ElementType>;
|
|
7
|
+
ref?: React.Ref<any>;
|
|
8
|
+
}
|
|
9
|
+
export declare const createReactComponent: <PropType, ElementType extends HTMLStencilElement, ContextStateType = {}, ExpandedPropsTypes = {}>(tagName: string, ReactComponentContext?: React.Context<ContextStateType>, manipulatePropsFunction?: (originalProps: StencilReactInternalProps<ElementType>, propsToPass: any) => ExpandedPropsTypes, defineCustomElement?: () => void) => React.ForwardRefExoticComponent<React.PropsWithoutRef<import("./utils").StencilReactExternalProps<PropType, ElementType>> & React.RefAttributes<ElementType>>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React, { createElement } from 'react';
|
|
13
|
+
import { attachProps, camelToDashCase, createForwardRef, dashToPascalCase, isCoveredByReact, mergeRefs, } from './utils';
|
|
14
|
+
export const createReactComponent = (tagName, ReactComponentContext, manipulatePropsFunction, defineCustomElement) => {
|
|
15
|
+
if (defineCustomElement !== undefined) {
|
|
16
|
+
defineCustomElement();
|
|
17
|
+
}
|
|
18
|
+
const displayName = dashToPascalCase(tagName);
|
|
19
|
+
const ReactComponent = class extends React.Component {
|
|
20
|
+
constructor(props) {
|
|
21
|
+
super(props);
|
|
22
|
+
this.setComponentElRef = (element) => {
|
|
23
|
+
this.componentEl = element;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
componentDidMount() {
|
|
27
|
+
this.componentDidUpdate(this.props);
|
|
28
|
+
}
|
|
29
|
+
componentDidUpdate(prevProps) {
|
|
30
|
+
attachProps(this.componentEl, this.props, prevProps);
|
|
31
|
+
}
|
|
32
|
+
render() {
|
|
33
|
+
const _a = this.props, { children, forwardedRef, style, className, ref } = _a, cProps = __rest(_a, ["children", "forwardedRef", "style", "className", "ref"]);
|
|
34
|
+
let propsToPass = Object.keys(cProps).reduce((acc, name) => {
|
|
35
|
+
const value = cProps[name];
|
|
36
|
+
if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
|
|
37
|
+
const eventName = name.substring(2).toLowerCase();
|
|
38
|
+
if (typeof document !== 'undefined' && isCoveredByReact(eventName)) {
|
|
39
|
+
acc[name] = value;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
// we should only render strings, booleans, and numbers as attrs in html.
|
|
44
|
+
// objects, functions, arrays etc get synced via properties on mount.
|
|
45
|
+
const type = typeof value;
|
|
46
|
+
if (type === 'string' || type === 'boolean' || type === 'number') {
|
|
47
|
+
acc[camelToDashCase(name)] = value;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return acc;
|
|
51
|
+
}, {});
|
|
52
|
+
if (manipulatePropsFunction) {
|
|
53
|
+
propsToPass = manipulatePropsFunction(this.props, propsToPass);
|
|
54
|
+
}
|
|
55
|
+
const newProps = Object.assign(Object.assign({}, propsToPass), { ref: mergeRefs(forwardedRef, this.setComponentElRef), style });
|
|
56
|
+
/**
|
|
57
|
+
* We use createElement here instead of
|
|
58
|
+
* React.createElement to work around a
|
|
59
|
+
* bug in Vite (https://github.com/vitejs/vite/issues/6104).
|
|
60
|
+
* React.createElement causes all elements to be rendered
|
|
61
|
+
* as <tagname> instead of the actual Web Component.
|
|
62
|
+
*/
|
|
63
|
+
return createElement(tagName, newProps, children);
|
|
64
|
+
}
|
|
65
|
+
static get displayName() {
|
|
66
|
+
return displayName;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
// If context was passed to createReactComponent then conditionally add it to the Component Class
|
|
70
|
+
if (ReactComponentContext) {
|
|
71
|
+
ReactComponent.contextType = ReactComponentContext;
|
|
72
|
+
}
|
|
73
|
+
return createForwardRef(ReactComponent, displayName);
|
|
74
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface LoadingElement {
|
|
3
|
+
present: () => any;
|
|
4
|
+
dismiss: () => any;
|
|
5
|
+
}
|
|
6
|
+
interface ReactControllerProps<E> {
|
|
7
|
+
isOpen: boolean;
|
|
8
|
+
onDidDismiss: (event: CustomEvent<E>) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function createControllerComponent<OptionsType extends object, LoadingElementType extends LoadingElement, OverlayEventDetail>(displayName: string, controller: {
|
|
11
|
+
create: (options: any) => Promise<LoadingElementType>;
|
|
12
|
+
}): {
|
|
13
|
+
new (props: OptionsType & ReactControllerProps<OverlayEventDetail>): {
|
|
14
|
+
controller?: LoadingElementType;
|
|
15
|
+
componentDidMount(): Promise<void>;
|
|
16
|
+
componentDidUpdate(prevProps: OptionsType & ReactControllerProps<OverlayEventDetail>): Promise<void>;
|
|
17
|
+
present(prevProps?: OptionsType & ReactControllerProps<OverlayEventDetail>): Promise<void>;
|
|
18
|
+
render(): null;
|
|
19
|
+
context: unknown;
|
|
20
|
+
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<OptionsType & ReactControllerProps<OverlayEventDetail>>) => {} | Pick<{}, K>) | Pick<{}, K>, callback?: () => void): void;
|
|
21
|
+
forceUpdate(callback?: () => void): void;
|
|
22
|
+
readonly props: Readonly<OptionsType & ReactControllerProps<OverlayEventDetail>>;
|
|
23
|
+
state: Readonly<{}>;
|
|
24
|
+
refs: {
|
|
25
|
+
[key: string]: React.ReactInstance;
|
|
26
|
+
};
|
|
27
|
+
shouldComponentUpdate?(nextProps: Readonly<OptionsType & ReactControllerProps<OverlayEventDetail>>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
28
|
+
componentWillUnmount?(): void;
|
|
29
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
30
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<OptionsType & ReactControllerProps<OverlayEventDetail>>, prevState: Readonly<{}>): any;
|
|
31
|
+
componentWillMount?(): void;
|
|
32
|
+
UNSAFE_componentWillMount?(): void;
|
|
33
|
+
componentWillReceiveProps?(nextProps: Readonly<OptionsType & ReactControllerProps<OverlayEventDetail>>, nextContext: any): void;
|
|
34
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<OptionsType & ReactControllerProps<OverlayEventDetail>>, nextContext: any): void;
|
|
35
|
+
componentWillUpdate?(nextProps: Readonly<OptionsType & ReactControllerProps<OverlayEventDetail>>, nextState: Readonly<{}>, nextContext: any): void;
|
|
36
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<OptionsType & ReactControllerProps<OverlayEventDetail>>, nextState: Readonly<{}>, nextContext: any): void;
|
|
37
|
+
};
|
|
38
|
+
readonly displayName: string;
|
|
39
|
+
contextType?: React.Context<any>;
|
|
40
|
+
};
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
+
var t = {};
|
|
12
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
+
t[p] = s[p];
|
|
14
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
+
t[p[i]] = s[p[i]];
|
|
18
|
+
}
|
|
19
|
+
return t;
|
|
20
|
+
};
|
|
21
|
+
import React from 'react';
|
|
22
|
+
import { attachEventProps } from './utils/attachEventProps';
|
|
23
|
+
export function createControllerComponent(displayName, controller) {
|
|
24
|
+
const dismissEventName = `on${displayName}DidDismiss`;
|
|
25
|
+
return class ReactControllerComponent extends React.Component {
|
|
26
|
+
constructor(props) {
|
|
27
|
+
super(props);
|
|
28
|
+
}
|
|
29
|
+
static get displayName() {
|
|
30
|
+
return displayName;
|
|
31
|
+
}
|
|
32
|
+
componentDidMount() {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
const { isOpen } = this.props;
|
|
35
|
+
if (isOpen) {
|
|
36
|
+
this.present();
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
componentDidUpdate(prevProps) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
if (prevProps.isOpen !== this.props.isOpen && this.props.isOpen === true) {
|
|
43
|
+
this.present(prevProps);
|
|
44
|
+
}
|
|
45
|
+
if (this.controller &&
|
|
46
|
+
prevProps.isOpen !== this.props.isOpen &&
|
|
47
|
+
this.props.isOpen === false) {
|
|
48
|
+
yield this.controller.dismiss();
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
present(prevProps) {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
const _a = this.props, { isOpen, onDidDismiss } = _a, cProps = __rest(_a, ["isOpen", "onDidDismiss"]);
|
|
55
|
+
const elementProps = Object.assign(Object.assign({}, cProps), { [dismissEventName]: onDidDismiss });
|
|
56
|
+
this.controller = yield controller.create(Object.assign({}, elementProps));
|
|
57
|
+
attachEventProps(this.controller, elementProps, prevProps);
|
|
58
|
+
this.controller.present();
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
render() {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { OverlayEventDetail } from './interfaces';
|
|
3
|
+
import { StencilReactForwardedRef } from './utils';
|
|
4
|
+
interface OverlayElement extends HTMLElement {
|
|
5
|
+
present: () => Promise<void>;
|
|
6
|
+
dismiss: (data?: any, role?: string | undefined) => Promise<boolean>;
|
|
7
|
+
}
|
|
8
|
+
export interface ReactOverlayProps {
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
isOpen: boolean;
|
|
11
|
+
onDidDismiss?: (event: CustomEvent<OverlayEventDetail>) => void;
|
|
12
|
+
onDidPresent?: (event: CustomEvent<OverlayEventDetail>) => void;
|
|
13
|
+
onWillDismiss?: (event: CustomEvent<OverlayEventDetail>) => void;
|
|
14
|
+
onWillPresent?: (event: CustomEvent<OverlayEventDetail>) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const createOverlayComponent: <OverlayComponent extends object, OverlayType extends OverlayElement>(tagName: string, controller: {
|
|
17
|
+
create: (options: any) => Promise<OverlayType>;
|
|
18
|
+
}, customElement?: any) => React.ForwardRefExoticComponent<React.PropsWithoutRef<OverlayComponent & ReactOverlayProps & {
|
|
19
|
+
forwardedRef?: StencilReactForwardedRef<OverlayType>;
|
|
20
|
+
}> & React.RefAttributes<OverlayType>>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
+
var t = {};
|
|
12
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
+
t[p] = s[p];
|
|
14
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
+
t[p[i]] = s[p[i]];
|
|
18
|
+
}
|
|
19
|
+
return t;
|
|
20
|
+
};
|
|
21
|
+
import React from 'react';
|
|
22
|
+
import ReactDOM from 'react-dom';
|
|
23
|
+
import { attachProps, dashToPascalCase, defineCustomElement, setRef, } from './utils';
|
|
24
|
+
export const createOverlayComponent = (tagName, controller, customElement) => {
|
|
25
|
+
defineCustomElement(tagName, customElement);
|
|
26
|
+
const displayName = dashToPascalCase(tagName);
|
|
27
|
+
const didDismissEventName = `on${displayName}DidDismiss`;
|
|
28
|
+
const didPresentEventName = `on${displayName}DidPresent`;
|
|
29
|
+
const willDismissEventName = `on${displayName}WillDismiss`;
|
|
30
|
+
const willPresentEventName = `on${displayName}WillPresent`;
|
|
31
|
+
let isDismissing = false;
|
|
32
|
+
class Overlay extends React.Component {
|
|
33
|
+
constructor(props) {
|
|
34
|
+
super(props);
|
|
35
|
+
if (typeof document !== 'undefined') {
|
|
36
|
+
this.el = document.createElement('div');
|
|
37
|
+
}
|
|
38
|
+
this.handleDismiss = this.handleDismiss.bind(this);
|
|
39
|
+
}
|
|
40
|
+
static get displayName() {
|
|
41
|
+
return displayName;
|
|
42
|
+
}
|
|
43
|
+
componentDidMount() {
|
|
44
|
+
if (this.props.isOpen) {
|
|
45
|
+
this.present();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
componentWillUnmount() {
|
|
49
|
+
if (this.overlay) {
|
|
50
|
+
this.overlay.dismiss();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
handleDismiss(event) {
|
|
54
|
+
if (this.props.onDidDismiss) {
|
|
55
|
+
this.props.onDidDismiss(event);
|
|
56
|
+
}
|
|
57
|
+
setRef(this.props.forwardedRef, null);
|
|
58
|
+
}
|
|
59
|
+
shouldComponentUpdate(nextProps) {
|
|
60
|
+
// Check if the overlay component is about to dismiss
|
|
61
|
+
if (this.overlay && nextProps.isOpen !== this.props.isOpen && nextProps.isOpen === false) {
|
|
62
|
+
isDismissing = true;
|
|
63
|
+
}
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
componentDidUpdate(prevProps) {
|
|
67
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
if (this.overlay) {
|
|
69
|
+
attachProps(this.overlay, this.props, prevProps);
|
|
70
|
+
}
|
|
71
|
+
if (prevProps.isOpen !== this.props.isOpen && this.props.isOpen === true) {
|
|
72
|
+
this.present(prevProps);
|
|
73
|
+
}
|
|
74
|
+
if (this.overlay && prevProps.isOpen !== this.props.isOpen && this.props.isOpen === false) {
|
|
75
|
+
yield this.overlay.dismiss();
|
|
76
|
+
isDismissing = false;
|
|
77
|
+
/**
|
|
78
|
+
* Now that the overlay is dismissed
|
|
79
|
+
* we need to render again so that any
|
|
80
|
+
* inner components will be unmounted
|
|
81
|
+
*/
|
|
82
|
+
this.forceUpdate();
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
present(prevProps) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
const _a = this.props, { children, isOpen, onDidDismiss, onDidPresent, onWillDismiss, onWillPresent } = _a, cProps = __rest(_a, ["children", "isOpen", "onDidDismiss", "onDidPresent", "onWillDismiss", "onWillPresent"]);
|
|
89
|
+
const elementProps = Object.assign(Object.assign({}, cProps), { ref: this.props.forwardedRef, [didDismissEventName]: this.handleDismiss, [didPresentEventName]: (e) => this.props.onDidPresent && this.props.onDidPresent(e), [willDismissEventName]: (e) => this.props.onWillDismiss && this.props.onWillDismiss(e), [willPresentEventName]: (e) => this.props.onWillPresent && this.props.onWillPresent(e) });
|
|
90
|
+
this.overlay = yield controller.create(Object.assign(Object.assign({}, elementProps), { component: this.el, componentProps: {} }));
|
|
91
|
+
setRef(this.props.forwardedRef, this.overlay);
|
|
92
|
+
attachProps(this.overlay, elementProps, prevProps);
|
|
93
|
+
yield this.overlay.present();
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
render() {
|
|
97
|
+
/**
|
|
98
|
+
* Continue to render the component even when
|
|
99
|
+
* overlay is dismissing otherwise component
|
|
100
|
+
* will be hidden before animation is done.
|
|
101
|
+
*/
|
|
102
|
+
return ReactDOM.createPortal(this.props.isOpen || isDismissing ? this.props.children : null, this.el);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return React.forwardRef((props, ref) => {
|
|
106
|
+
return React.createElement(Overlay, Object.assign({}, props, { forwardedRef: ref }));
|
|
107
|
+
});
|
|
108
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface EventEmitter<T = any> {
|
|
2
|
+
emit: (data?: T) => CustomEvent<T>;
|
|
3
|
+
}
|
|
4
|
+
export interface StyleReactProps {
|
|
5
|
+
class?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
style?: {
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export interface OverlayEventDetail<T = any> {
|
|
12
|
+
data?: T;
|
|
13
|
+
role?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface OverlayInterface {
|
|
16
|
+
el: HTMLElement;
|
|
17
|
+
animated: boolean;
|
|
18
|
+
keyboardClose: boolean;
|
|
19
|
+
overlayIndex: number;
|
|
20
|
+
presented: boolean;
|
|
21
|
+
enterAnimation?: any;
|
|
22
|
+
leaveAnimation?: any;
|
|
23
|
+
didPresent: EventEmitter<void>;
|
|
24
|
+
willPresent: EventEmitter<void>;
|
|
25
|
+
willDismiss: EventEmitter<OverlayEventDetail>;
|
|
26
|
+
didDismiss: EventEmitter<OverlayEventDetail>;
|
|
27
|
+
present(): Promise<void>;
|
|
28
|
+
dismiss(data?: any, role?: string): Promise<boolean>;
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function attachEventProps(node: HTMLElement, newProps: any, oldProps?: any): void;
|
|
2
|
+
export declare function getClassName(classList: DOMTokenList, newProps: any, oldProps: any): string;
|
|
3
|
+
/**
|
|
4
|
+
* Checks if an event is supported in the current execution environment.
|
|
5
|
+
* @license Modernizr 3.0.0pre (Custom Build) | MIT
|
|
6
|
+
*/
|
|
7
|
+
export declare function isCoveredByReact(eventNameSuffix: string, doc?: Document): boolean;
|
|
8
|
+
export declare function syncEvent(node: Element, eventName: string, newEventHandler: (e: Event) => any): void;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export function attachEventProps(node, newProps, oldProps = {}) {
|
|
2
|
+
const className = getClassName(node.classList, newProps, oldProps);
|
|
3
|
+
if (className) {
|
|
4
|
+
node.className = className;
|
|
5
|
+
}
|
|
6
|
+
Object.keys(newProps).forEach(name => {
|
|
7
|
+
if (name === 'children' || name === 'style' || name === 'ref' || name === 'className') {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
|
|
11
|
+
const eventName = name.substring(2);
|
|
12
|
+
const eventNameLc = eventName[0].toLowerCase() + eventName.substring(1);
|
|
13
|
+
if (!isCoveredByReact(eventNameLc)) {
|
|
14
|
+
syncEvent(node, eventNameLc, newProps[name]);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
node[name] = newProps[name];
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export function getClassName(classList, newProps, oldProps) {
|
|
23
|
+
// map the classes to Maps for performance
|
|
24
|
+
const currentClasses = arrayToMap(classList);
|
|
25
|
+
const incomingPropClasses = arrayToMap(newProps.className ? newProps.className.split(' ') : []);
|
|
26
|
+
const oldPropClasses = arrayToMap(oldProps.className ? oldProps.className.split(' ') : []);
|
|
27
|
+
const finalClassNames = [];
|
|
28
|
+
// loop through each of the current classes on the component
|
|
29
|
+
// to see if it should be a part of the classNames added
|
|
30
|
+
currentClasses.forEach(currentClass => {
|
|
31
|
+
if (incomingPropClasses.has(currentClass)) {
|
|
32
|
+
// add it as its already included in classnames coming in from newProps
|
|
33
|
+
finalClassNames.push(currentClass);
|
|
34
|
+
incomingPropClasses.delete(currentClass);
|
|
35
|
+
}
|
|
36
|
+
else if (!oldPropClasses.has(currentClass)) {
|
|
37
|
+
// add it as it has NOT been removed by user
|
|
38
|
+
finalClassNames.push(currentClass);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
incomingPropClasses.forEach(s => finalClassNames.push(s));
|
|
42
|
+
return finalClassNames.join(' ');
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Checks if an event is supported in the current execution environment.
|
|
46
|
+
* @license Modernizr 3.0.0pre (Custom Build) | MIT
|
|
47
|
+
*/
|
|
48
|
+
export function isCoveredByReact(eventNameSuffix, doc = document) {
|
|
49
|
+
const eventName = 'on' + eventNameSuffix;
|
|
50
|
+
let isSupported = eventName in doc;
|
|
51
|
+
if (!isSupported) {
|
|
52
|
+
const element = doc.createElement('div');
|
|
53
|
+
element.setAttribute(eventName, 'return;');
|
|
54
|
+
isSupported = typeof element[eventName] === 'function';
|
|
55
|
+
}
|
|
56
|
+
return isSupported;
|
|
57
|
+
}
|
|
58
|
+
export function syncEvent(node, eventName, newEventHandler) {
|
|
59
|
+
const eventStore = node.__events || (node.__events = {});
|
|
60
|
+
const oldEventHandler = eventStore[eventName];
|
|
61
|
+
// Remove old listener so they don't double up.
|
|
62
|
+
if (oldEventHandler) {
|
|
63
|
+
node.removeEventListener(eventName, oldEventHandler);
|
|
64
|
+
}
|
|
65
|
+
if (newEventHandler != null) {
|
|
66
|
+
// Bind new listener.
|
|
67
|
+
node.addEventListener(eventName, (eventStore[eventName] = function handler(e) {
|
|
68
|
+
newEventHandler.call(this, e);
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function arrayToMap(arr) {
|
|
73
|
+
const map = new Map();
|
|
74
|
+
arr.forEach((s) => map.set(s, s));
|
|
75
|
+
return map;
|
|
76
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const attachProps: (node: HTMLElement, newProps: any, oldProps?: any) => void;
|
|
2
|
+
export declare const getClassName: (classList: DOMTokenList, newProps: any, oldProps: any) => string;
|
|
3
|
+
/**
|
|
4
|
+
* Checks if an event is supported in the current execution environment.
|
|
5
|
+
* @license Modernizr 3.0.0pre (Custom Build) | MIT
|
|
6
|
+
*/
|
|
7
|
+
export declare const isCoveredByReact: (eventNameSuffix: string) => boolean;
|
|
8
|
+
export declare const syncEvent: (node: Element & {
|
|
9
|
+
__events?: {
|
|
10
|
+
[key: string]: (e: Event) => any;
|
|
11
|
+
};
|
|
12
|
+
}, eventName: string, newEventHandler?: (e: Event) => any) => void;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { camelToDashCase } from './case';
|
|
2
|
+
export const attachProps = (node, newProps, oldProps = {}) => {
|
|
3
|
+
// some test frameworks don't render DOM elements, so we test here to make sure we are dealing with DOM first
|
|
4
|
+
if (node instanceof Element) {
|
|
5
|
+
// add any classes in className to the class list
|
|
6
|
+
const className = getClassName(node.classList, newProps, oldProps);
|
|
7
|
+
if (className !== '') {
|
|
8
|
+
node.className = className;
|
|
9
|
+
}
|
|
10
|
+
Object.keys(newProps).forEach((name) => {
|
|
11
|
+
if (name === 'children' ||
|
|
12
|
+
name === 'style' ||
|
|
13
|
+
name === 'ref' ||
|
|
14
|
+
name === 'class' ||
|
|
15
|
+
name === 'className' ||
|
|
16
|
+
name === 'forwardedRef') {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
|
|
20
|
+
const eventName = name.substring(2);
|
|
21
|
+
const eventNameLc = eventName[0].toLowerCase() + eventName.substring(1);
|
|
22
|
+
if (!isCoveredByReact(eventNameLc)) {
|
|
23
|
+
syncEvent(node, eventNameLc, newProps[name]);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
node[name] = newProps[name];
|
|
28
|
+
const propType = typeof newProps[name];
|
|
29
|
+
if (propType === 'string') {
|
|
30
|
+
node.setAttribute(camelToDashCase(name), newProps[name]);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
export const getClassName = (classList, newProps, oldProps) => {
|
|
37
|
+
const newClassProp = newProps.className || newProps.class;
|
|
38
|
+
const oldClassProp = oldProps.className || oldProps.class;
|
|
39
|
+
// map the classes to Maps for performance
|
|
40
|
+
const currentClasses = arrayToMap(classList);
|
|
41
|
+
const incomingPropClasses = arrayToMap(newClassProp ? newClassProp.split(' ') : []);
|
|
42
|
+
const oldPropClasses = arrayToMap(oldClassProp ? oldClassProp.split(' ') : []);
|
|
43
|
+
const finalClassNames = [];
|
|
44
|
+
// loop through each of the current classes on the component
|
|
45
|
+
// to see if it should be a part of the classNames added
|
|
46
|
+
currentClasses.forEach((currentClass) => {
|
|
47
|
+
if (incomingPropClasses.has(currentClass)) {
|
|
48
|
+
// add it as its already included in classnames coming in from newProps
|
|
49
|
+
finalClassNames.push(currentClass);
|
|
50
|
+
incomingPropClasses.delete(currentClass);
|
|
51
|
+
}
|
|
52
|
+
else if (!oldPropClasses.has(currentClass)) {
|
|
53
|
+
// add it as it has NOT been removed by user
|
|
54
|
+
finalClassNames.push(currentClass);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
incomingPropClasses.forEach((s) => finalClassNames.push(s));
|
|
58
|
+
return finalClassNames.join(' ');
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Checks if an event is supported in the current execution environment.
|
|
62
|
+
* @license Modernizr 3.0.0pre (Custom Build) | MIT
|
|
63
|
+
*/
|
|
64
|
+
export const isCoveredByReact = (eventNameSuffix) => {
|
|
65
|
+
if (typeof document === 'undefined') {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
const eventName = 'on' + eventNameSuffix;
|
|
70
|
+
let isSupported = eventName in document;
|
|
71
|
+
if (!isSupported) {
|
|
72
|
+
const element = document.createElement('div');
|
|
73
|
+
element.setAttribute(eventName, 'return;');
|
|
74
|
+
isSupported = typeof element[eventName] === 'function';
|
|
75
|
+
}
|
|
76
|
+
return isSupported;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
export const syncEvent = (node, eventName, newEventHandler) => {
|
|
80
|
+
const eventStore = node.__events || (node.__events = {});
|
|
81
|
+
const oldEventHandler = eventStore[eventName];
|
|
82
|
+
// Remove old listener so they don't double up.
|
|
83
|
+
if (oldEventHandler) {
|
|
84
|
+
node.removeEventListener(eventName, oldEventHandler);
|
|
85
|
+
}
|
|
86
|
+
// Bind new listener.
|
|
87
|
+
node.addEventListener(eventName, (eventStore[eventName] = function handler(e) {
|
|
88
|
+
if (newEventHandler) {
|
|
89
|
+
newEventHandler.call(this, e);
|
|
90
|
+
}
|
|
91
|
+
}));
|
|
92
|
+
};
|
|
93
|
+
const arrayToMap = (arr) => {
|
|
94
|
+
const map = new Map();
|
|
95
|
+
arr.forEach((s) => map.set(s, s));
|
|
96
|
+
return map;
|
|
97
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const isDevMode = () => {
|
|
2
|
+
return process && process.env && process.env.NODE_ENV === 'development';
|
|
3
|
+
};
|
|
4
|
+
const warnings = {};
|
|
5
|
+
export const deprecationWarning = (key, message) => {
|
|
6
|
+
if (isDevMode()) {
|
|
7
|
+
if (!warnings[key]) {
|
|
8
|
+
console.warn(message);
|
|
9
|
+
warnings[key] = true;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { StyleReactProps } from '../interfaces';
|
|
3
|
+
export declare type StencilReactExternalProps<PropType, ElementType> = PropType & Omit<React.HTMLAttributes<ElementType>, 'style'> & StyleReactProps;
|
|
4
|
+
export declare type StencilReactForwardedRef<T> = ((instance: T | null) => void) | React.MutableRefObject<T | null> | null;
|
|
5
|
+
export declare const setRef: (ref: StencilReactForwardedRef<any> | React.Ref<any> | undefined, value: any) => void;
|
|
6
|
+
export declare const mergeRefs: (...refs: (StencilReactForwardedRef<any> | React.Ref<any> | undefined)[]) => React.RefCallback<any>;
|
|
7
|
+
export declare const createForwardRef: <PropType, ElementType>(ReactComponent: any, displayName: string) => React.ForwardRefExoticComponent<React.PropsWithoutRef<StencilReactExternalProps<PropType, ElementType>> & React.RefAttributes<ElementType>>;
|
|
8
|
+
export declare const defineCustomElement: (tagName: string, customElement: any) => void;
|
|
9
|
+
export * from './attachProps';
|
|
10
|
+
export * from './case';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export const setRef = (ref, value) => {
|
|
3
|
+
if (typeof ref === 'function') {
|
|
4
|
+
ref(value);
|
|
5
|
+
}
|
|
6
|
+
else if (ref != null) {
|
|
7
|
+
// Cast as a MutableRef so we can assign current
|
|
8
|
+
ref.current = value;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
export const mergeRefs = (...refs) => {
|
|
12
|
+
return (value) => {
|
|
13
|
+
refs.forEach(ref => {
|
|
14
|
+
setRef(ref, value);
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export const createForwardRef = (ReactComponent, displayName) => {
|
|
19
|
+
const forwardRef = (props, ref) => {
|
|
20
|
+
return React.createElement(ReactComponent, Object.assign({}, props, { forwardedRef: ref }));
|
|
21
|
+
};
|
|
22
|
+
forwardRef.displayName = displayName;
|
|
23
|
+
return React.forwardRef(forwardRef);
|
|
24
|
+
};
|
|
25
|
+
export const defineCustomElement = (tagName, customElement) => {
|
|
26
|
+
if (customElement !== undefined &&
|
|
27
|
+
typeof customElements !== 'undefined' &&
|
|
28
|
+
!customElements.get(tagName)) {
|
|
29
|
+
customElements.define(tagName, customElement);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
export * from './attachProps';
|
|
33
|
+
export * from './case';
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "wabtec-internal-volt-extended-components-react",
|
|
3
|
+
"sideEffects": false,
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"description": "React component library for the Volt Extended components",
|
|
6
|
+
"repository": {},
|
|
7
|
+
"author": "Wilmer Contreras <wilmer.contreras@wabtec.com>",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "npm run clean && npm run compile",
|
|
11
|
+
"clean": "rm -rf dist",
|
|
12
|
+
"compile": "npm run tsc",
|
|
13
|
+
"tsc": "tsc -p ."
|
|
14
|
+
},
|
|
15
|
+
"main": "./dist/index.js",
|
|
16
|
+
"module": "./dist/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"files": [
|
|
19
|
+
"dist/"
|
|
20
|
+
],
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/jest": "^23.3.9",
|
|
23
|
+
"@types/node": "^13.5.0",
|
|
24
|
+
"@types/react": "^18.0.9",
|
|
25
|
+
"@types/react-dom": "^18.0.4",
|
|
26
|
+
"jest": "^25.1.0",
|
|
27
|
+
"jest-dom": "^3.0.2",
|
|
28
|
+
"prettier": "1.19.1",
|
|
29
|
+
"react": "^16.12.0",
|
|
30
|
+
"react-dom": "^16.12.0",
|
|
31
|
+
"rollup": "^1.21.2",
|
|
32
|
+
"rollup-plugin-node-resolve": "^5.2.0",
|
|
33
|
+
"typescript": "^4.4.4"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"wabtec-internal-volt-extended-components": "1.0.0",
|
|
37
|
+
"react": "^16.12.0",
|
|
38
|
+
"react-dom": "^16.12.0"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"wabtec-internal-volt-extended-components": "1.0.0",
|
|
42
|
+
"react": "^16.7.0",
|
|
43
|
+
"react-dom": "^16.7.0"
|
|
44
|
+
},
|
|
45
|
+
"jest": {
|
|
46
|
+
"preset": "ts-jest",
|
|
47
|
+
"setupTestFrameworkScriptFile": "<rootDir>/jest.setup.js",
|
|
48
|
+
"testPathIgnorePatterns": [
|
|
49
|
+
"node_modules",
|
|
50
|
+
"dist"
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
}
|