draft-components 0.60.0 → 0.61.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.
|
@@ -33,4 +33,4 @@ export interface DatePresetPickerPopoverProps {
|
|
|
33
33
|
togglePopover(): void;
|
|
34
34
|
}): JSX.Element;
|
|
35
35
|
}
|
|
36
|
-
export declare
|
|
36
|
+
export declare const DatePresetPickerPopover: import("react").ForwardRefExoticComponent<DatePresetPickerPopoverProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -5,7 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const popover_1 = require("../popover");
|
|
7
7
|
const date_preset_picker_1 = require("./date-preset-picker");
|
|
8
|
-
function DatePresetPickerPopover({ locale, timeZone, defaultIsOpen = false, hideSelectedRange = false, position = 'bottom', alignment = 'start', cancelButtonLabel, confirmButtonLabel, customDatePresetLabel, disableActionButtons, showLoadingIndicator, options, value, onChangeValue, children: render, }) {
|
|
8
|
+
exports.DatePresetPickerPopover = (0, react_1.forwardRef)(function DatePresetPickerPopover({ locale, timeZone, defaultIsOpen = false, hideSelectedRange = false, position = 'bottom', alignment = 'start', cancelButtonLabel, confirmButtonLabel, customDatePresetLabel, disableActionButtons, showLoadingIndicator, options, value, onChangeValue, children: render, }, ref) {
|
|
9
9
|
const [isShown, setIsShown] = (0, react_1.useState)(defaultIsOpen);
|
|
10
10
|
const confirmButtonRef = (0, react_1.useRef)(null);
|
|
11
11
|
const [selectionState, setSelectionState] = (0, react_1.useState)(valueToSelectionState);
|
|
@@ -100,7 +100,7 @@ function DatePresetPickerPopover({ locale, timeZone, defaultIsOpen = false, hide
|
|
|
100
100
|
openPopover();
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
return ((0, jsx_runtime_1.jsx)(popover_1.Popover, Object.assign({ className: "dc-date-preset-picker-popover", isShown: isShown, position: position, alignment: alignment, content: (0, jsx_runtime_1.jsx)(date_preset_picker_1.DatePresetPicker, { confirmButtonRef: confirmButtonRef, locale: locale, formattedDateRange: hideSelectedRange ? null : formattedDateRange, formattedTimeZone: formattedTimeZone, cancelButtonLabel: cancelButtonLabel, confirmButtonLabel: confirmButtonLabel, customDatePresetLabel: customDatePresetLabel, disableActionButtons: disableActionButtons, showLoadingIndicator: showLoadingIndicator, options: options, datePreset: selectionState.option?.datePreset || '', dateRange: selectionState.dateRange, onChangeDatePreset: handleChangeDatePreset, onChangeDateRange: handleChangeDateRange, onCancel: closePopover, onConfirm: handleConfirm }, void 0), focusElementRefAfterOpen: confirmButtonRef, onClose: closePopover }, { children: render({
|
|
103
|
+
return ((0, jsx_runtime_1.jsx)(popover_1.Popover, Object.assign({ ref: ref, className: "dc-date-preset-picker-popover", isShown: isShown, position: position, alignment: alignment, content: (0, jsx_runtime_1.jsx)(date_preset_picker_1.DatePresetPicker, { confirmButtonRef: confirmButtonRef, locale: locale, formattedDateRange: hideSelectedRange ? null : formattedDateRange, formattedTimeZone: formattedTimeZone, cancelButtonLabel: cancelButtonLabel, confirmButtonLabel: confirmButtonLabel, customDatePresetLabel: customDatePresetLabel, disableActionButtons: disableActionButtons, showLoadingIndicator: showLoadingIndicator, options: options, datePreset: selectionState.option?.datePreset || '', dateRange: selectionState.dateRange, onChangeDatePreset: handleChangeDatePreset, onChangeDateRange: handleChangeDateRange, onCancel: closePopover, onConfirm: handleConfirm }, void 0), focusElementRefAfterOpen: confirmButtonRef, onClose: closePopover }, { children: render({
|
|
104
104
|
isShown,
|
|
105
105
|
openPopover,
|
|
106
106
|
closePopover,
|
|
@@ -112,5 +112,4 @@ function DatePresetPickerPopover({ locale, timeZone, defaultIsOpen = false, hide
|
|
|
112
112
|
? `${formattedDatePreset}: ${formattedDateRange}`
|
|
113
113
|
: formattedDateRange,
|
|
114
114
|
}) }), void 0));
|
|
115
|
-
}
|
|
116
|
-
exports.DatePresetPickerPopover = DatePresetPickerPopover;
|
|
115
|
+
});
|
|
@@ -17,5 +17,5 @@ export interface PopoverProps extends BaseProps, BoxProps {
|
|
|
17
17
|
children: RenderFn | JSXElementWithRef;
|
|
18
18
|
onClose?(): void;
|
|
19
19
|
}
|
|
20
|
-
export declare
|
|
20
|
+
export declare const Popover: import("react").ForwardRefExoticComponent<Pick<PopoverProps, "slot" | "style" | "title" | "className" | "color" | "id" | "lang" | "role" | "tabIndex" | "elevation" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "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-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "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" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "hidden" | "content" | "border" | "padding" | "translate" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "placeholder" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "background" | "borderRadius" | "position" | "alignment" | "anchorOffset" | "viewportOffset" | "isShown" | "shouldUpdatePositionWhenScroll" | "isPositionedRelativeToViewport" | "shouldCaptureFocus" | "focusElementRefAfterOpen" | "focusElementRefAfterClose" | "onClose"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
21
21
|
export {};
|
|
@@ -4,13 +4,14 @@ exports.Popover = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const util_1 = require("../../lib/util");
|
|
7
|
+
const guards_1 = require("../../lib/guards");
|
|
7
8
|
const react_helpers_1 = require("../../lib/react-helpers");
|
|
8
9
|
const use_close_on_esc_press_1 = require("../../hooks/use-close-on-esc-press");
|
|
9
10
|
const use_close_on_click_outside_1 = require("../../hooks/use-close-on-click-outside");
|
|
10
11
|
const use_capture_focus_1 = require("../../hooks/use-capture-focus");
|
|
11
12
|
const positioner_1 = require("../positioner");
|
|
12
13
|
const box_1 = require("../box");
|
|
13
|
-
function Popover({ className, isShown, position, alignment, anchorOffset, viewportOffset, shouldCaptureFocus = true, shouldUpdatePositionWhenScroll = false, isPositionedRelativeToViewport = false, focusElementRefAfterOpen, focusElementRefAfterClose, content, children, onClose = util_1.noop, ...props }) {
|
|
14
|
+
exports.Popover = (0, react_1.forwardRef)(function Popover({ className, isShown, position, alignment, anchorOffset, viewportOffset, shouldCaptureFocus = true, shouldUpdatePositionWhenScroll = false, isPositionedRelativeToViewport = false, focusElementRefAfterOpen, focusElementRefAfterClose, content, children, onClose = util_1.noop, ...props }, ref) {
|
|
14
15
|
const anchorRef = (0, react_1.useRef)(null);
|
|
15
16
|
const popoverRef = (0, react_1.useRef)(null);
|
|
16
17
|
(0, use_close_on_esc_press_1.useCloseOnEscPress)(onClose, isShown);
|
|
@@ -25,13 +26,14 @@ function Popover({ className, isShown, position, alignment, anchorOffset, viewpo
|
|
|
25
26
|
focusElementRefAfterRelease: focusElementRefAfterClose,
|
|
26
27
|
});
|
|
27
28
|
function render() {
|
|
28
|
-
if (
|
|
29
|
+
if ((0, guards_1.isFunction)(children)) {
|
|
29
30
|
return children({ ref: anchorRef });
|
|
30
31
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
else {
|
|
33
|
+
return (0, react_1.cloneElement)(children, {
|
|
34
|
+
ref: (0, react_helpers_1.mergeRefs)(children.ref, anchorRef),
|
|
35
|
+
});
|
|
36
|
+
}
|
|
34
37
|
}
|
|
35
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [render(), (0, jsx_runtime_1.jsxs)(positioner_1.Positioner, Object.assign({ className: "dc-popover-container", anchorRef: anchorRef, position: position, alignment: alignment, anchorOffset: anchorOffset, viewportOffset: viewportOffset, isShown: isShown, isPositionedRelativeToViewport: isPositionedRelativeToViewport, shouldUpdatePositionWhenScroll: shouldUpdatePositionWhenScroll }, { children: [(0, jsx_runtime_1.jsx)("div", { tabIndex: 0 }, void 0), (0, jsx_runtime_1.jsx)(box_1.Box, Object.assign({ ref: popoverRef, className: (0, react_helpers_1.classNames)(className, 'dc-popover'), borderRadius: "lg", elevation: "md" }, props, { children: content }), void 0), (0, jsx_runtime_1.jsx)("div", { tabIndex: 0 }, void 0)] }), void 0)] }, void 0));
|
|
36
|
-
}
|
|
37
|
-
exports.Popover = Popover;
|
|
38
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [render(), (0, jsx_runtime_1.jsxs)(positioner_1.Positioner, Object.assign({ className: "dc-popover-container", anchorRef: anchorRef, position: position, alignment: alignment, anchorOffset: anchorOffset, viewportOffset: viewportOffset, isShown: isShown, isPositionedRelativeToViewport: isPositionedRelativeToViewport, shouldUpdatePositionWhenScroll: shouldUpdatePositionWhenScroll }, { children: [(0, jsx_runtime_1.jsx)("div", { tabIndex: 0 }, void 0), (0, jsx_runtime_1.jsx)(box_1.Box, Object.assign({ ref: (0, react_helpers_1.mergeRefs)(ref, popoverRef), className: (0, react_helpers_1.classNames)(className, 'dc-popover'), borderRadius: "lg", elevation: "md" }, props, { children: content }), void 0), (0, jsx_runtime_1.jsx)("div", { tabIndex: 0 }, void 0)] }), void 0)] }, void 0));
|
|
39
|
+
});
|