@vaadin/react-components 25.0.0-alpha19 → 25.0.0-alpha20
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/Dialog.d.ts +1 -1
- package/Popover.d.ts +1 -1
- package/Select.js.map +2 -2
- package/package.json +65 -65
- package/renderers/useRenderer.js +1 -1
- package/renderers/useRenderer.js.map +2 -2
- package/utils/createComponent.js +1 -1
- package/utils/createComponent.js.map +1 -1
package/Dialog.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ declare const ForwardedDialog: import("react").ForwardRefExoticComponent<Partial
|
|
|
17
17
|
onDragged: import("@lit/react").EventName<import("@vaadin/dialog").DialogEventMap["dragged"]>;
|
|
18
18
|
onResize: import("@lit/react").EventName<import("@vaadin/dialog").DialogEventMap["resize"]>;
|
|
19
19
|
onOpenedChanged: import("@lit/react").EventName<import("@vaadin/dialog").DialogEventMap["opened-changed"]>;
|
|
20
|
-
}>>>, "accessKey" | "dir" | "hidden" | "lang" | "title" | "translate" | "prefix" | "children" | "style" | "contentEditable" | "enterKeyHint" | "inputMode" | "nonce" | "tabIndex" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "autoCapitalize" | "autoFocus" | "contextMenu" | "spellCheck" | "radioGroup" | "about" | "content" | "datatype" | "inlist" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "
|
|
20
|
+
}>>>, "accessKey" | "dir" | "hidden" | "inert" | "lang" | "popover" | "title" | "translate" | "part" | "prefix" | "children" | "style" | "contentEditable" | "enterKeyHint" | "inputMode" | "nonce" | "tabIndex" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "autoCapitalize" | "autoFocus" | "contextMenu" | "spellCheck" | "radioGroup" | "about" | "content" | "datatype" | "inlist" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popoverTargetAction" | "popoverTarget" | "is" | "exportparts" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onScrollEnd" | "onScrollEndCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onToggle" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture" | "renderer" | "headerRenderer" | "footerRenderer">> & Readonly<{
|
|
21
21
|
children?: ReactNode | ComponentType<DialogReactRendererProps>;
|
|
22
22
|
footer?: ReactNode;
|
|
23
23
|
footerRenderer?: ComponentType<DialogReactRendererProps> | null;
|
package/Popover.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export type PopoverProps = Partial<Omit<_PopoverProps, 'children' | 'renderer' |
|
|
|
14
14
|
declare const ForwardedPopover: import("react").ForwardRefExoticComponent<Partial<Omit<Partial<import("./utils/createComponent.js").ThemedWebComponentProps<PopoverElement, Readonly<{
|
|
15
15
|
onClosed: import("@lit/react").EventName<import("@vaadin/popover").PopoverEventMap["closed"]>;
|
|
16
16
|
onOpenedChanged: import("@lit/react").EventName<import("@vaadin/popover").PopoverEventMap["opened-changed"]>;
|
|
17
|
-
}>>>, "accessKey" | "dir" | "draggable" | "hidden" | "lang" | "title" | "translate" | "prefix" | "children" | "style" | "contentEditable" | "enterKeyHint" | "inputMode" | "nonce" | "tabIndex" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "autoCapitalize" | "autoFocus" | "contextMenu" | "spellCheck" | "radioGroup" | "about" | "content" | "datatype" | "inlist" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "
|
|
17
|
+
}>>>, "accessKey" | "dir" | "draggable" | "hidden" | "inert" | "lang" | "popover" | "title" | "translate" | "part" | "prefix" | "children" | "style" | "contentEditable" | "enterKeyHint" | "inputMode" | "nonce" | "tabIndex" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "autoCapitalize" | "autoFocus" | "contextMenu" | "spellCheck" | "radioGroup" | "about" | "content" | "datatype" | "inlist" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popoverTargetAction" | "popoverTarget" | "is" | "exportparts" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onScrollEnd" | "onScrollEndCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onToggle" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture" | "renderer">> & Readonly<{
|
|
18
18
|
children?: ReactNode | ComponentType<PopoverReactRendererProps>;
|
|
19
19
|
/**
|
|
20
20
|
* @deprecated Pass children directly to the popover instead
|
package/Select.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["src/Select.tsx", "src/generated/Select.ts"],
|
|
4
|
-
"sourcesContent": ["export * from \"@vaadin/select/vaadin-select.js\";\nimport {\n type ComponentType,\n type ForwardedRef,\n forwardRef,\n isValidElement,\n type ReactElement,\n type ReactNode,\n useEffect,\n useRef,\n} from 'react';\nimport { Select as _Select, type SelectElement, type SelectProps as _SelectProps } from './generated/Select.js';\nimport { useSimpleOrChildrenRenderer } from './renderers/useSimpleOrChildrenRenderer.js';\nimport type { ReactSimpleRendererProps } from './renderers/useSimpleRenderer.js';\nimport useMergedRefs from './utils/useMergedRefs.js';\n\nexport * from './generated/Select.js';\n\nexport type SelectReactRendererProps = ReactSimpleRendererProps<SelectElement>;\n\ntype SelectRenderer = ComponentType<SelectReactRendererProps>;\n\nexport type SelectProps = Partial<Omit<_SelectProps, 'children' | 'renderer'>> &\n Readonly<{\n children?: ReactNode | SelectRenderer | Array<ReactNode | SelectRenderer>;\n renderer?: SelectRenderer | null;\n }>;\n\nfunction Select(props: SelectProps, ref: ForwardedRef<SelectElement>): ReactElement | null {\n // React.Children.toArray() doesn't allow functions, so we convert manually.\n const children = Array.isArray(props.children) ? props.children : [props.children];\n\n // Components with slot attribute should stay in light DOM.\n const slottedChildren = children.filter((child): child is ReactNode => {\n return isValidElement(child) && child.props.slot;\n });\n\n // Component without slot attribute should go to the overlay.\n const overlayChildren = children.filter((child): child is ReactNode => {\n return isValidElement(child) && !slottedChildren.includes(child);\n });\n\n const renderFn = children.find((child) => typeof child === 'function');\n\n const innerRef = useRef<SelectElement>(null);\n const [portals, renderer] = useSimpleOrChildrenRenderer(\n props.renderer,\n renderFn || (overlayChildren.length ? overlayChildren : undefined),\n );\n const finalRef = useMergedRefs(innerRef, ref);\n\n useEffect(() => {\n if (props.renderer || props.children) {\n innerRef.current?.requestContentUpdate();\n }\n }, [innerRef.current, props.renderer, props.children]);\n\n return (\n <_Select {...props} ref={finalRef} renderer={renderer}>\n {slottedChildren}\n {portals}\n </_Select>\n );\n}\n\nconst ForwardedSelect = forwardRef(Select);\n\nexport { ForwardedSelect as Select };\n", "import type { EventName } from \"@lit/react\";\nimport { Select as SelectElement, type SelectEventMap as _SelectEventMap, } from \"@vaadin/select/vaadin-select.js\";\nimport * as React from \"react\";\nimport { createComponent, type WebComponentProps } from \"../utils/createComponent.js\";\nexport { SelectElement, };\nexport type SelectEventMap = Readonly<{\n onValidated: EventName<_SelectEventMap[\"validated\"]>;\n onChange: EventName<_SelectEventMap[\"change\"]>;\n onInvalidChanged: EventName<_SelectEventMap[\"invalid-changed\"]>;\n onOpenedChanged: EventName<_SelectEventMap[\"opened-changed\"]>;\n onValueChanged: EventName<_SelectEventMap[\"value-changed\"]>;\n}>;\nconst events = { onValidated: \"validated\", onChange: \"change\", onInvalidChanged: \"invalid-changed\", onOpenedChanged: \"opened-changed\", onValueChanged: \"value-changed\" } as SelectEventMap;\nexport type SelectProps = WebComponentProps<SelectElement, SelectEventMap>;\nexport const Select = createComponent({\n elementClass: SelectElement, events, react: React, tagName: \"vaadin-select\"\n});\n"],
|
|
5
|
-
"mappings": "AAAA,WAAc,kCACd,OAGE,cAAAA,EACA,kBAAAC,EAGA,aAAAC,EACA,UAAAC,MACK,QCTP,OAAS,UAAUC,MAA8D,kCACjF,UAAYC,MAAW,QACvB,OAAS,mBAAAC,MAA+C,6BASxD,IAAMC,EAAS,CAAE,YAAa,YAAa,SAAU,SAAU,iBAAkB,kBAAmB,gBAAiB,iBAAkB,eAAgB,eAAgB,EAE1JC,EAASC,EAAgB,CAClC,aAAcC,EAAe,OAAAH,EAAQ,MAAOI,EAAO,QAAS,eAChE,CAAC,EDJD,OAAS,+BAAAC,MAAmC,6CAE5C,OAAOC,MAAmB,2BA4CtB,eAAAC,MAAA,oBA9BJ,SAASC,EAAOC,EAAoBC,EAAuD,CAEzF,IAAMC,EAAW,MAAM,QAAQF,EAAM,QAAQ,EAAIA,EAAM,SAAW,CAACA,EAAM,QAAQ,EAG3EG,EAAkBD,EAAS,OAAQE,GAChCC,EAAeD,CAAK,
|
|
4
|
+
"sourcesContent": ["export * from \"@vaadin/select/vaadin-select.js\";\nimport {\n type ComponentType,\n type ForwardedRef,\n forwardRef,\n isValidElement,\n type ReactElement,\n type ReactNode,\n useEffect,\n useRef,\n} from 'react';\nimport { Select as _Select, type SelectElement, type SelectProps as _SelectProps } from './generated/Select.js';\nimport { useSimpleOrChildrenRenderer } from './renderers/useSimpleOrChildrenRenderer.js';\nimport type { ReactSimpleRendererProps } from './renderers/useSimpleRenderer.js';\nimport useMergedRefs from './utils/useMergedRefs.js';\n\nexport * from './generated/Select.js';\n\nexport type SelectReactRendererProps = ReactSimpleRendererProps<SelectElement>;\n\ntype SelectRenderer = ComponentType<SelectReactRendererProps>;\n\nexport type SelectProps = Partial<Omit<_SelectProps, 'children' | 'renderer'>> &\n Readonly<{\n children?: ReactNode | SelectRenderer | Array<ReactNode | SelectRenderer>;\n renderer?: SelectRenderer | null;\n }>;\n\nfunction Select(props: SelectProps, ref: ForwardedRef<SelectElement>): ReactElement | null {\n // React.Children.toArray() doesn't allow functions, so we convert manually.\n const children = Array.isArray(props.children) ? props.children : [props.children];\n\n // Components with slot attribute should stay in light DOM.\n const slottedChildren = children.filter((child): child is ReactNode => {\n return isValidElement(child) && (child.props as any).slot;\n });\n\n // Component without slot attribute should go to the overlay.\n const overlayChildren = children.filter((child): child is ReactNode => {\n return isValidElement(child) && !slottedChildren.includes(child);\n });\n\n const renderFn = children.find((child) => typeof child === 'function');\n\n const innerRef = useRef<SelectElement>(null);\n const [portals, renderer] = useSimpleOrChildrenRenderer(\n props.renderer,\n renderFn || (overlayChildren.length ? overlayChildren : undefined),\n );\n const finalRef = useMergedRefs(innerRef, ref);\n\n useEffect(() => {\n if (props.renderer || props.children) {\n innerRef.current?.requestContentUpdate();\n }\n }, [innerRef.current, props.renderer, props.children]);\n\n return (\n <_Select {...props} ref={finalRef} renderer={renderer}>\n {slottedChildren}\n {portals}\n </_Select>\n );\n}\n\nconst ForwardedSelect = forwardRef(Select);\n\nexport { ForwardedSelect as Select };\n", "import type { EventName } from \"@lit/react\";\nimport { Select as SelectElement, type SelectEventMap as _SelectEventMap, } from \"@vaadin/select/vaadin-select.js\";\nimport * as React from \"react\";\nimport { createComponent, type WebComponentProps } from \"../utils/createComponent.js\";\nexport { SelectElement, };\nexport type SelectEventMap = Readonly<{\n onValidated: EventName<_SelectEventMap[\"validated\"]>;\n onChange: EventName<_SelectEventMap[\"change\"]>;\n onInvalidChanged: EventName<_SelectEventMap[\"invalid-changed\"]>;\n onOpenedChanged: EventName<_SelectEventMap[\"opened-changed\"]>;\n onValueChanged: EventName<_SelectEventMap[\"value-changed\"]>;\n}>;\nconst events = { onValidated: \"validated\", onChange: \"change\", onInvalidChanged: \"invalid-changed\", onOpenedChanged: \"opened-changed\", onValueChanged: \"value-changed\" } as SelectEventMap;\nexport type SelectProps = WebComponentProps<SelectElement, SelectEventMap>;\nexport const Select = createComponent({\n elementClass: SelectElement, events, react: React, tagName: \"vaadin-select\"\n});\n"],
|
|
5
|
+
"mappings": "AAAA,WAAc,kCACd,OAGE,cAAAA,EACA,kBAAAC,EAGA,aAAAC,EACA,UAAAC,MACK,QCTP,OAAS,UAAUC,MAA8D,kCACjF,UAAYC,MAAW,QACvB,OAAS,mBAAAC,MAA+C,6BASxD,IAAMC,EAAS,CAAE,YAAa,YAAa,SAAU,SAAU,iBAAkB,kBAAmB,gBAAiB,iBAAkB,eAAgB,eAAgB,EAE1JC,EAASC,EAAgB,CAClC,aAAcC,EAAe,OAAAH,EAAQ,MAAOI,EAAO,QAAS,eAChE,CAAC,EDJD,OAAS,+BAAAC,MAAmC,6CAE5C,OAAOC,MAAmB,2BA4CtB,eAAAC,MAAA,oBA9BJ,SAASC,EAAOC,EAAoBC,EAAuD,CAEzF,IAAMC,EAAW,MAAM,QAAQF,EAAM,QAAQ,EAAIA,EAAM,SAAW,CAACA,EAAM,QAAQ,EAG3EG,EAAkBD,EAAS,OAAQE,GAChCC,EAAeD,CAAK,GAAMA,EAAM,MAAc,IACtD,EAGKE,EAAkBJ,EAAS,OAAQE,GAChCC,EAAeD,CAAK,GAAK,CAACD,EAAgB,SAASC,CAAK,CAChE,EAEKG,EAAWL,EAAS,KAAME,GAAU,OAAOA,GAAU,UAAU,EAE/DI,EAAWC,EAAsB,IAAI,EACrC,CAACC,EAASC,CAAQ,EAAIf,EAC1BI,EAAM,SACNO,IAAaD,EAAgB,OAASA,EAAkB,OAC1D,EACMM,EAAWf,EAAcW,EAAUP,CAAG,EAE5C,OAAAY,EAAU,IAAM,EACVb,EAAM,UAAYA,EAAM,WAC1BQ,EAAS,SAAS,qBAAqB,CAE3C,EAAG,CAACA,EAAS,QAASR,EAAM,SAAUA,EAAM,QAAQ,CAAC,EAGnDF,EAACC,EAAA,CAAS,GAAGC,EAAO,IAAKY,EAAU,SAAUD,EAC1C,UAAAR,EACAO,GACH,CAEJ,CAEA,IAAMI,EAAkBC,EAAWhB,CAAM",
|
|
6
6
|
"names": ["forwardRef", "isValidElement", "useEffect", "useRef", "SelectElement", "React", "createComponent", "events", "Select", "createComponent", "SelectElement", "React", "useSimpleOrChildrenRenderer", "useMergedRefs", "jsxs", "Select", "props", "ref", "children", "slottedChildren", "child", "isValidElement", "overlayChildren", "renderFn", "innerRef", "useRef", "portals", "renderer", "finalRef", "useEffect", "ForwardedSelect", "forwardRef"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/react-components",
|
|
3
|
-
"version": "25.0.0-
|
|
3
|
+
"version": "25.0.0-alpha20",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -27,74 +27,74 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@lit/react": "^1.0.7",
|
|
30
|
-
"@vaadin/a11y-base": "25.0.0-
|
|
31
|
-
"@vaadin/accordion": "25.0.0-
|
|
32
|
-
"@vaadin/app-layout": "25.0.0-
|
|
33
|
-
"@vaadin/avatar": "25.0.0-
|
|
34
|
-
"@vaadin/avatar-group": "25.0.0-
|
|
35
|
-
"@vaadin/button": "25.0.0-
|
|
36
|
-
"@vaadin/card": "25.0.0-
|
|
37
|
-
"@vaadin/checkbox": "25.0.0-
|
|
38
|
-
"@vaadin/checkbox-group": "25.0.0-
|
|
39
|
-
"@vaadin/combo-box": "25.0.0-
|
|
40
|
-
"@vaadin/component-base": "25.0.0-
|
|
41
|
-
"@vaadin/confirm-dialog": "25.0.0-
|
|
42
|
-
"@vaadin/context-menu": "25.0.0-
|
|
43
|
-
"@vaadin/custom-field": "25.0.0-
|
|
44
|
-
"@vaadin/date-picker": "25.0.0-
|
|
45
|
-
"@vaadin/date-time-picker": "25.0.0-
|
|
46
|
-
"@vaadin/details": "25.0.0-
|
|
47
|
-
"@vaadin/dialog": "25.0.0-
|
|
48
|
-
"@vaadin/email-field": "25.0.0-
|
|
49
|
-
"@vaadin/field-base": "25.0.0-
|
|
50
|
-
"@vaadin/field-highlighter": "25.0.0-
|
|
51
|
-
"@vaadin/form-layout": "25.0.0-
|
|
52
|
-
"@vaadin/grid": "25.0.0-
|
|
53
|
-
"@vaadin/horizontal-layout": "25.0.0-
|
|
54
|
-
"@vaadin/icon": "25.0.0-
|
|
55
|
-
"@vaadin/icons": "25.0.0-
|
|
56
|
-
"@vaadin/input-container": "25.0.0-
|
|
57
|
-
"@vaadin/integer-field": "25.0.0-
|
|
58
|
-
"@vaadin/item": "25.0.0-
|
|
59
|
-
"@vaadin/list-box": "25.0.0-
|
|
60
|
-
"@vaadin/lit-renderer": "25.0.0-
|
|
61
|
-
"@vaadin/login": "25.0.0-
|
|
62
|
-
"@vaadin/markdown": "25.0.0-
|
|
63
|
-
"@vaadin/master-detail-layout": "25.0.0-
|
|
64
|
-
"@vaadin/menu-bar": "25.0.0-
|
|
65
|
-
"@vaadin/message-input": "25.0.0-
|
|
66
|
-
"@vaadin/message-list": "25.0.0-
|
|
67
|
-
"@vaadin/multi-select-combo-box": "25.0.0-
|
|
68
|
-
"@vaadin/notification": "25.0.0-
|
|
69
|
-
"@vaadin/number-field": "25.0.0-
|
|
70
|
-
"@vaadin/overlay": "25.0.0-
|
|
71
|
-
"@vaadin/password-field": "25.0.0-
|
|
72
|
-
"@vaadin/popover": "25.0.0-
|
|
73
|
-
"@vaadin/progress-bar": "25.0.0-
|
|
74
|
-
"@vaadin/radio-group": "25.0.0-
|
|
75
|
-
"@vaadin/scroller": "25.0.0-
|
|
76
|
-
"@vaadin/select": "25.0.0-
|
|
77
|
-
"@vaadin/side-nav": "25.0.0-
|
|
78
|
-
"@vaadin/split-layout": "25.0.0-
|
|
79
|
-
"@vaadin/tabs": "25.0.0-
|
|
80
|
-
"@vaadin/tabsheet": "25.0.0-
|
|
81
|
-
"@vaadin/text-area": "25.0.0-
|
|
82
|
-
"@vaadin/text-field": "25.0.0-
|
|
83
|
-
"@vaadin/time-picker": "25.0.0-
|
|
84
|
-
"@vaadin/tooltip": "25.0.0-
|
|
85
|
-
"@vaadin/upload": "25.0.0-
|
|
86
|
-
"@vaadin/vaadin-lumo-styles": "25.0.0-
|
|
87
|
-
"@vaadin/vaadin-themable-mixin": "25.0.0-
|
|
88
|
-
"@vaadin/vertical-layout": "25.0.0-
|
|
89
|
-
"@vaadin/virtual-list": "25.0.0-
|
|
30
|
+
"@vaadin/a11y-base": "25.0.0-alpha20",
|
|
31
|
+
"@vaadin/accordion": "25.0.0-alpha20",
|
|
32
|
+
"@vaadin/app-layout": "25.0.0-alpha20",
|
|
33
|
+
"@vaadin/avatar": "25.0.0-alpha20",
|
|
34
|
+
"@vaadin/avatar-group": "25.0.0-alpha20",
|
|
35
|
+
"@vaadin/button": "25.0.0-alpha20",
|
|
36
|
+
"@vaadin/card": "25.0.0-alpha20",
|
|
37
|
+
"@vaadin/checkbox": "25.0.0-alpha20",
|
|
38
|
+
"@vaadin/checkbox-group": "25.0.0-alpha20",
|
|
39
|
+
"@vaadin/combo-box": "25.0.0-alpha20",
|
|
40
|
+
"@vaadin/component-base": "25.0.0-alpha20",
|
|
41
|
+
"@vaadin/confirm-dialog": "25.0.0-alpha20",
|
|
42
|
+
"@vaadin/context-menu": "25.0.0-alpha20",
|
|
43
|
+
"@vaadin/custom-field": "25.0.0-alpha20",
|
|
44
|
+
"@vaadin/date-picker": "25.0.0-alpha20",
|
|
45
|
+
"@vaadin/date-time-picker": "25.0.0-alpha20",
|
|
46
|
+
"@vaadin/details": "25.0.0-alpha20",
|
|
47
|
+
"@vaadin/dialog": "25.0.0-alpha20",
|
|
48
|
+
"@vaadin/email-field": "25.0.0-alpha20",
|
|
49
|
+
"@vaadin/field-base": "25.0.0-alpha20",
|
|
50
|
+
"@vaadin/field-highlighter": "25.0.0-alpha20",
|
|
51
|
+
"@vaadin/form-layout": "25.0.0-alpha20",
|
|
52
|
+
"@vaadin/grid": "25.0.0-alpha20",
|
|
53
|
+
"@vaadin/horizontal-layout": "25.0.0-alpha20",
|
|
54
|
+
"@vaadin/icon": "25.0.0-alpha20",
|
|
55
|
+
"@vaadin/icons": "25.0.0-alpha20",
|
|
56
|
+
"@vaadin/input-container": "25.0.0-alpha20",
|
|
57
|
+
"@vaadin/integer-field": "25.0.0-alpha20",
|
|
58
|
+
"@vaadin/item": "25.0.0-alpha20",
|
|
59
|
+
"@vaadin/list-box": "25.0.0-alpha20",
|
|
60
|
+
"@vaadin/lit-renderer": "25.0.0-alpha20",
|
|
61
|
+
"@vaadin/login": "25.0.0-alpha20",
|
|
62
|
+
"@vaadin/markdown": "25.0.0-alpha20",
|
|
63
|
+
"@vaadin/master-detail-layout": "25.0.0-alpha20",
|
|
64
|
+
"@vaadin/menu-bar": "25.0.0-alpha20",
|
|
65
|
+
"@vaadin/message-input": "25.0.0-alpha20",
|
|
66
|
+
"@vaadin/message-list": "25.0.0-alpha20",
|
|
67
|
+
"@vaadin/multi-select-combo-box": "25.0.0-alpha20",
|
|
68
|
+
"@vaadin/notification": "25.0.0-alpha20",
|
|
69
|
+
"@vaadin/number-field": "25.0.0-alpha20",
|
|
70
|
+
"@vaadin/overlay": "25.0.0-alpha20",
|
|
71
|
+
"@vaadin/password-field": "25.0.0-alpha20",
|
|
72
|
+
"@vaadin/popover": "25.0.0-alpha20",
|
|
73
|
+
"@vaadin/progress-bar": "25.0.0-alpha20",
|
|
74
|
+
"@vaadin/radio-group": "25.0.0-alpha20",
|
|
75
|
+
"@vaadin/scroller": "25.0.0-alpha20",
|
|
76
|
+
"@vaadin/select": "25.0.0-alpha20",
|
|
77
|
+
"@vaadin/side-nav": "25.0.0-alpha20",
|
|
78
|
+
"@vaadin/split-layout": "25.0.0-alpha20",
|
|
79
|
+
"@vaadin/tabs": "25.0.0-alpha20",
|
|
80
|
+
"@vaadin/tabsheet": "25.0.0-alpha20",
|
|
81
|
+
"@vaadin/text-area": "25.0.0-alpha20",
|
|
82
|
+
"@vaadin/text-field": "25.0.0-alpha20",
|
|
83
|
+
"@vaadin/time-picker": "25.0.0-alpha20",
|
|
84
|
+
"@vaadin/tooltip": "25.0.0-alpha20",
|
|
85
|
+
"@vaadin/upload": "25.0.0-alpha20",
|
|
86
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha20",
|
|
87
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha20",
|
|
88
|
+
"@vaadin/vertical-layout": "25.0.0-alpha20",
|
|
89
|
+
"@vaadin/virtual-list": "25.0.0-alpha20"
|
|
90
90
|
},
|
|
91
91
|
"author": "Vaadin Ltd.",
|
|
92
92
|
"license": "Apache-2.0",
|
|
93
93
|
"peerDependencies": {
|
|
94
|
-
"@types/react": "^
|
|
95
|
-
"@types/react-dom": "^
|
|
96
|
-
"react": "^
|
|
97
|
-
"react-dom": "^
|
|
94
|
+
"@types/react": "^19.0.0",
|
|
95
|
+
"@types/react-dom": "^19.0.0",
|
|
96
|
+
"react": "^19.0.0",
|
|
97
|
+
"react-dom": "^19.0.0"
|
|
98
98
|
},
|
|
99
99
|
"peerDependenciesMeta": {
|
|
100
100
|
"@types/react": {
|
package/renderers/useRenderer.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as p,useCallback as l,useReducer as i}from"react";import{createPortal as m,flushSync as W}from"react-dom";import{flushMicrotask as c}from"../utils/flushMicrotask.js";const R=new Map;function u(r,[t,...n]){return new Map(r).set(t,n)}function y(r,t,n){const[
|
|
1
|
+
import{createElement as p,useCallback as l,useReducer as i}from"react";import{createPortal as m,flushSync as W}from"react-dom";import{flushMicrotask as c}from"../utils/flushMicrotask.js";const R=new Map;function u(r,[t,...n]){return new Map(r).set(t,n)}function y(r,t,n){const[d,o]=i(u,R),a=l((...e)=>{n?.renderMode==="microtask"?c(()=>o(e)):n?.renderMode==="sync"?W(()=>o(e)):o(e)},[]);return r?[Array.from(d.entries()).filter(([e,s])=>n?.shouldRenderPortal?.(e,...s)??!0).map(([e,s])=>m(t?p(r,t(s)):r,e)),a]:[]}export{y as useRenderer};
|
|
2
2
|
//# sourceMappingURL=useRenderer.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/renderers/useRenderer.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n type ComponentType,\n createElement,\n type PropsWithChildren,\n type ReactElement,\n type ReactNode,\n useCallback,\n useReducer,\n} from 'react';\nimport { createPortal, flushSync } from 'react-dom';\nimport type { Slice, WebComponentRenderer } from './renderer.js';\nimport { flushMicrotask } from '../utils/flushMicrotask.js';\n\nexport type UseRendererResult<W extends WebComponentRenderer> = readonly [\n portals?: ReadonlyArray<ReactElement | null>,\n renderer?: W,\n];\n\nconst initialState = new Map();\n\nfunction rendererReducer<W extends WebComponentRenderer>(\n state: Map<HTMLElement, Slice<Parameters<W>, 1>>,\n [root, ...args]: Parameters<W>,\n): Map<HTMLElement, Slice<Parameters<W>, 1>> {\n return new Map(state).set(root, args as Slice<Parameters<W>, 1>);\n}\n\nexport type RendererConfig<W extends WebComponentRenderer> = {\n renderMode?: 'default' | 'sync' | 'microtask';\n shouldRenderPortal?(root: HTMLElement, ...args: Slice<Parameters<W>, 1>): boolean;\n};\n\nexport function useRenderer<P extends {}, W extends WebComponentRenderer>(\n node: ReactNode,\n convert?: (props: Slice<Parameters<W>, 1>) => PropsWithChildren<P>,\n config?: RendererConfig<W>,\n): UseRendererResult<W>;\nexport function useRenderer<P extends {}, W extends WebComponentRenderer>(\n reactRenderer: ComponentType<P> | null | undefined,\n convert: (props: Slice<Parameters<W>, 1>) => PropsWithChildren<P>,\n config?: RendererConfig<W>,\n): UseRendererResult<W>;\nexport function useRenderer<P extends {}, W extends WebComponentRenderer>(\n reactRendererOrNode: ReactNode | ComponentType<P> | null | undefined,\n convert?: (props: Slice<Parameters<W>, 1>) => PropsWithChildren<P>,\n config?: RendererConfig<W>,\n): UseRendererResult<W> {\n const [map, update] = useReducer
|
|
5
|
-
"mappings": "AAAA,OAEE,iBAAAA,EAIA,eAAAC,EACA,cAAAC,MACK,QACP,OAAS,gBAAAC,EAAc,aAAAC,MAAiB,YAExC,OAAS,kBAAAC,MAAsB,6BAO/B,MAAMC,EAAe,IAAI,IAEzB,SAASC,EACPC,EACA,CAACC,EAAM,GAAGC,CAAI,EAC6B,CAC3C,OAAO,IAAI,IAAIF,CAAK,EAAE,IAAIC,EAAMC,CAA+B,CACjE,CAiBO,SAASC,EACdC,EACAC,EACAC,EACsB,CACtB,KAAM,CAACC,EAAKC,CAAM,EAAId,
|
|
4
|
+
"sourcesContent": ["import {\n type ComponentType,\n createElement,\n type PropsWithChildren,\n type ReactElement,\n type ReactNode,\n useCallback,\n useReducer,\n} from 'react';\nimport { createPortal, flushSync } from 'react-dom';\nimport type { Slice, WebComponentRenderer } from './renderer.js';\nimport { flushMicrotask } from '../utils/flushMicrotask.js';\n\nexport type UseRendererResult<W extends WebComponentRenderer> = readonly [\n portals?: ReadonlyArray<ReactElement | null>,\n renderer?: W,\n];\n\nconst initialState = new Map();\n\nfunction rendererReducer<W extends WebComponentRenderer>(\n state: Map<HTMLElement, Slice<Parameters<W>, 1>>,\n [root, ...args]: Parameters<W>,\n): Map<HTMLElement, Slice<Parameters<W>, 1>> {\n return new Map(state).set(root, args as Slice<Parameters<W>, 1>);\n}\n\nexport type RendererConfig<W extends WebComponentRenderer> = {\n renderMode?: 'default' | 'sync' | 'microtask';\n shouldRenderPortal?(root: HTMLElement, ...args: Slice<Parameters<W>, 1>): boolean;\n};\n\nexport function useRenderer<P extends {}, W extends WebComponentRenderer>(\n node: ReactNode,\n convert?: (props: Slice<Parameters<W>, 1>) => PropsWithChildren<P>,\n config?: RendererConfig<W>,\n): UseRendererResult<W>;\nexport function useRenderer<P extends {}, W extends WebComponentRenderer>(\n reactRenderer: ComponentType<P> | null | undefined,\n convert: (props: Slice<Parameters<W>, 1>) => PropsWithChildren<P>,\n config?: RendererConfig<W>,\n): UseRendererResult<W>;\nexport function useRenderer<P extends {}, W extends WebComponentRenderer>(\n reactRendererOrNode: ReactNode | ComponentType<P> | null | undefined,\n convert?: (props: Slice<Parameters<W>, 1>) => PropsWithChildren<P>,\n config?: RendererConfig<W>,\n): UseRendererResult<W> {\n const [map, update] = useReducer(rendererReducer, initialState);\n const renderer = useCallback(\n ((...args: Parameters<W>) => {\n if (config?.renderMode === 'microtask') {\n flushMicrotask(() => update(args));\n } else if (config?.renderMode === 'sync') {\n flushSync(() => update(args));\n } else {\n update(args);\n }\n }) as W,\n [],\n );\n\n return reactRendererOrNode\n ? [\n Array.from(map.entries())\n .filter(([root, args]) => {\n return config?.shouldRenderPortal?.(root, ...args) ?? true;\n })\n .map(([root, args]) =>\n createPortal(\n convert\n ? createElement<P>(reactRendererOrNode as ComponentType<P>, convert(args))\n : (reactRendererOrNode as ReactNode),\n root,\n ),\n ),\n renderer,\n ]\n : [];\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAEE,iBAAAA,EAIA,eAAAC,EACA,cAAAC,MACK,QACP,OAAS,gBAAAC,EAAc,aAAAC,MAAiB,YAExC,OAAS,kBAAAC,MAAsB,6BAO/B,MAAMC,EAAe,IAAI,IAEzB,SAASC,EACPC,EACA,CAACC,EAAM,GAAGC,CAAI,EAC6B,CAC3C,OAAO,IAAI,IAAIF,CAAK,EAAE,IAAIC,EAAMC,CAA+B,CACjE,CAiBO,SAASC,EACdC,EACAC,EACAC,EACsB,CACtB,KAAM,CAACC,EAAKC,CAAM,EAAId,EAAWK,EAAiBD,CAAY,EACxDW,EAAWhB,EACd,IAAIS,IAAwB,CACvBI,GAAQ,aAAe,YACzBT,EAAe,IAAMW,EAAON,CAAI,CAAC,EACxBI,GAAQ,aAAe,OAChCV,EAAU,IAAMY,EAAON,CAAI,CAAC,EAE5BM,EAAON,CAAI,CAEf,EACA,CAAC,CACH,EAEA,OAAOE,EACH,CACE,MAAM,KAAKG,EAAI,QAAQ,CAAC,EACrB,OAAO,CAAC,CAACN,EAAMC,CAAI,IACXI,GAAQ,qBAAqBL,EAAM,GAAGC,CAAI,GAAK,EACvD,EACA,IAAI,CAAC,CAACD,EAAMC,CAAI,IACfP,EACEU,EACIb,EAAiBY,EAAyCC,EAAQH,CAAI,CAAC,EACtEE,EACLH,CACF,CACF,EACFQ,CACF,EACA,CAAC,CACP",
|
|
6
6
|
"names": ["createElement", "useCallback", "useReducer", "createPortal", "flushSync", "flushMicrotask", "initialState", "rendererReducer", "state", "root", "args", "useRenderer", "reactRendererOrNode", "convert", "config", "map", "update", "renderer"]
|
|
7
7
|
}
|
package/utils/createComponent.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createComponent as n}from"@lit/react";window.Vaadin??={},window.Vaadin.registrations??=[],window.Vaadin.registrations.push({is:"@vaadin/react-components",version:"25.0.0-
|
|
1
|
+
import{createComponent as n}from"@lit/react";window.Vaadin??={},window.Vaadin.registrations??=[],window.Vaadin.registrations.push({is:"@vaadin/react-components",version:"25.0.0-alpha20"});function s(e){const{elementClass:t}=e;return n("_properties"in t?{...e,elementClass:{name:t.name,prototype:{...t._properties,hidden:Boolean}}}:e)}export{s as createComponent};
|
|
2
2
|
//# sourceMappingURL=createComponent.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/utils/createComponent.ts"],
|
|
4
|
-
"sourcesContent": ["import { createComponent as _createComponent, type EventName } from '@lit/react';\nimport type { ThemePropertyMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';\nimport type React from 'react';\nimport type { RefAttributes } from 'react';\n\ndeclare const __VERSION__: string;\n\ndeclare global {\n interface VaadinRegistration {\n is: string;\n version: string;\n }\n\n interface Vaadin {\n registrations?: VaadinRegistration[];\n }\n\n interface Window {\n // @ts-expect-error: Different declaration from one of the dependencies.\n Vaadin?: Vaadin;\n }\n}\n\nwindow.Vaadin ??= {};\nwindow.Vaadin.registrations ??= [];\nwindow.Vaadin.registrations.push({\n is: '@vaadin/react-components',\n version: /* updated-by-script */ '25.0.0-
|
|
4
|
+
"sourcesContent": ["import { createComponent as _createComponent, type EventName } from '@lit/react';\nimport type { ThemePropertyMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';\nimport type React from 'react';\nimport type { RefAttributes } from 'react';\n\ndeclare const __VERSION__: string;\n\ndeclare global {\n interface VaadinRegistration {\n is: string;\n version: string;\n }\n\n interface Vaadin {\n registrations?: VaadinRegistration[];\n }\n\n interface Window {\n // @ts-expect-error: Different declaration from one of the dependencies.\n Vaadin?: Vaadin;\n }\n}\n\nwindow.Vaadin ??= {};\nwindow.Vaadin.registrations ??= [];\nwindow.Vaadin.registrations.push({\n is: '@vaadin/react-components',\n version: /* updated-by-script */ '25.0.0-alpha20',\n});\n\n// TODO: Remove when types from @lit-labs/react are exported\nexport type EventNames = Record<string, EventName | string>;\ntype Constructor<T> = { new (): T; name: string };\ntype PolymerConstructor<T> = Constructor<T> & { _properties: Record<string, unknown> };\ntype Options<I extends HTMLElement, E extends EventNames = {}> = Readonly<{\n displayName?: string;\n elementClass: Constructor<I> | PolymerConstructor<I>;\n events?: E;\n react: typeof window.React;\n tagName: string;\n}>;\n\n// A map of expected event listener types based on EventNames.\ntype EventListeners<R extends EventNames> = {\n [K in keyof R]?: R[K] extends EventName ? (e: R[K]['__eventType']) => void : (e: Event) => void;\n};\n\n// Props derived from custom element class. Currently has limitations of making\n// all properties optional and also surfaces life cycle methods in autocomplete.\n// TODO: LoginOverlay has \"autofocus\" property, so we add it back manually.\ntype ElementProps<I> = Partial<Omit<I, keyof HTMLElement>> & { autofocus?: boolean };\n\n// Acceptable props to the React component.\ntype ComponentProps<I, E extends EventNames = {}> = Omit<\n React.HTMLAttributes<I>,\n // Prefer type of provided event handler props or those on element over\n // built-in HTMLAttributes\n keyof E | keyof ElementProps<I>\n> &\n EventListeners<E> &\n ElementProps<I>;\n\nexport type ThemedWebComponentProps<\n I extends ThemePropertyMixinClass & HTMLElement,\n E extends EventNames = {},\n> = ComponentProps<I, E> & {\n /**\n * Attribute that can be used by the component to apply built-in style variants,\n * or to propagate its value to the sub-components in Shadow DOM.\n *\n * @see ThemePropertyMixinClass#_theme\n */\n theme?: string;\n};\n\ntype AllWebComponentProps<I extends HTMLElement, E extends EventNames = {}> = I extends ThemePropertyMixinClass\n ? ThemedWebComponentProps<I, E>\n : ComponentProps<I, E>;\n\nexport type WebComponentProps<I extends HTMLElement, E extends EventNames = {}> = Partial<AllWebComponentProps<I, E>>;\n\n// We need a separate declaration here; otherwise, the TypeScript fails into the\n// endless loop trying to resolve the typings.\nexport function createComponent<I extends HTMLElement, E extends EventNames = {}>(\n options: Options<I, E>,\n): (props: WebComponentProps<I, E> & RefAttributes<I>) => React.ReactElement | null;\n\nexport function createComponent<I extends HTMLElement, E extends EventNames = {}>(options: Options<I, E>): any {\n const { elementClass } = options;\n\n return _createComponent(\n '_properties' in elementClass\n ? {\n ...options,\n // TODO: improve or remove the Polymer workaround\n // 'createComponent' relies on key presence on the custom element class,\n // but Polymer defines properties on the prototype when the first element\n // is created. Workaround: pass a mock object with properties in\n // the prototype.\n elementClass: {\n // @ts-expect-error: it is a specific workaround for Polymer classes.\n name: elementClass.name,\n prototype: { ...elementClass._properties, hidden: Boolean },\n },\n }\n : options,\n );\n}\n"],
|
|
5
5
|
"mappings": "AAAA,OAAS,mBAAmBA,MAAwC,aAuBpE,OAAO,SAAW,CAAC,EACnB,OAAO,OAAO,gBAAkB,CAAC,EACjC,OAAO,OAAO,cAAc,KAAK,CAC/B,GAAI,2BACJ,QAAiC,gBACnC,CAAC,EA2DM,SAASC,EAAkEC,EAA6B,CAC7G,KAAM,CAAE,aAAAC,CAAa,EAAID,EAEzB,OAAOF,EACL,gBAAiBG,EACb,CACE,GAAGD,EAMH,aAAc,CAEZ,KAAMC,EAAa,KACnB,UAAW,CAAE,GAAGA,EAAa,YAAa,OAAQ,OAAQ,CAC5D,CACF,EACAD,CACN,CACF",
|
|
6
6
|
"names": ["_createComponent", "createComponent", "options", "elementClass"]
|
|
7
7
|
}
|