react-modal-sheet 5.3.1 → 5.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/types.tsx CHANGED
@@ -7,7 +7,6 @@ import {
7
7
  } from 'motion/react';
8
8
  import {
9
9
  type ComponentPropsWithoutRef,
10
- type CSSProperties,
11
10
  type ForwardRefExoticComponent,
12
11
  type FunctionComponent,
13
12
  type HTMLAttributes,
@@ -108,9 +107,10 @@ export interface SheetContextType {
108
107
  currentSnap?: number;
109
108
  detent: SheetDetent;
110
109
  disableDrag: boolean;
111
- dragProps?: SheetDragProps;
110
+ dragProps: SheetDragProps;
112
111
  indicatorRotation: MotionValue<number>;
113
112
  avoidKeyboard: boolean;
113
+ prefersReducedMotion: boolean;
114
114
  sheetBoundsRef: (node: HTMLDivElement | null) => void;
115
115
  sheetRef: RefObject<any>;
116
116
  unstyled: boolean;
package/src/utils.ts CHANGED
@@ -88,3 +88,29 @@ export function waitForElement(
88
88
  }, interval);
89
89
  });
90
90
  }
91
+
92
+ // HTML input types that do not cause the software keyboard to appear.
93
+ const nonTextInputTypes = new Set([
94
+ 'checkbox',
95
+ 'radio',
96
+ 'range',
97
+ 'color',
98
+ 'file',
99
+ 'image',
100
+ 'button',
101
+ 'submit',
102
+ 'reset',
103
+ ]);
104
+
105
+ export function willOpenKeyboard(target: Element) {
106
+ return (
107
+ (target instanceof HTMLInputElement &&
108
+ !nonTextInputTypes.has(target.type)) ||
109
+ target instanceof HTMLTextAreaElement ||
110
+ (target instanceof HTMLElement && target.isContentEditable)
111
+ );
112
+ }
113
+
114
+ export function isHTTPS() {
115
+ return typeof window !== 'undefined' && window.isSecureContext;
116
+ }