reshaped 3.8.0-canary.0 → 3.8.0-canary.2

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.
Files changed (27) hide show
  1. package/CHANGELOG.md +25 -8
  2. package/README.md +2 -2
  3. package/dist/bundle.css +1 -1
  4. package/dist/bundle.js +11 -11
  5. package/dist/components/DropdownMenu/DropdownMenu.types.d.ts +1 -1
  6. package/dist/components/Flyout/Flyout.types.d.ts +3 -0
  7. package/dist/components/Flyout/FlyoutControlled.js +2 -1
  8. package/dist/components/Flyout/tests/Flyout.stories.d.ts +4 -0
  9. package/dist/components/Flyout/tests/Flyout.stories.js +59 -1
  10. package/dist/components/Flyout/useFlyout.d.ts +1 -0
  11. package/dist/components/Flyout/useFlyout.js +3 -1
  12. package/dist/components/Flyout/utilities/calculatePosition.d.ts +1 -1
  13. package/dist/components/Flyout/utilities/calculatePosition.js +52 -28
  14. package/dist/components/Flyout/utilities/flyout.js +22 -18
  15. package/dist/components/Flyout/utilities/helpers.d.ts +7 -0
  16. package/dist/components/Flyout/utilities/helpers.js +14 -0
  17. package/dist/components/Flyout/utilities/isFullyVisible.d.ts +5 -1
  18. package/dist/components/Flyout/utilities/isFullyVisible.js +1 -1
  19. package/dist/components/PinField/PinField.module.css +1 -1
  20. package/dist/components/PinField/tests/PinField.stories.d.ts +24 -3
  21. package/dist/components/PinField/tests/PinField.stories.js +194 -47
  22. package/dist/components/Popover/Popover.types.d.ts +1 -1
  23. package/dist/components/Reshaped/Reshaped.css +1 -1
  24. package/dist/components/ToggleButton/ToggleButton.types.d.ts +1 -1
  25. package/package.json +39 -28
  26. package/dist/components/PinField/tests/PinField.test.stories.d.ts +0 -29
  27. package/dist/components/PinField/tests/PinField.test.stories.js +0 -177
@@ -3,7 +3,7 @@ import type { PopoverProps, PopoverInstance } from "../Popover";
3
3
  import type { MenuItemProps } from "../MenuItem";
4
4
  import type { FlyoutContentProps } from "../Flyout";
5
5
  export type Instance = PopoverInstance;
6
- export type Props = Pick<PopoverProps, "children" | "position" | "forcePosition" | "fallbackPositions" | "triggerType" | "contentGap" | "contentShift" | "onOpen" | "onClose" | "active" | "defaultActive" | "width" | "disableHideAnimation" | "disableCloseOnOutsideClick" | "instanceRef" | "containerRef" | "originCoordinates"> & {
6
+ export type Props = Pick<PopoverProps, "children" | "position" | "forcePosition" | "fallbackPositions" | "fallbackAdjustLayout" | "triggerType" | "contentGap" | "contentShift" | "onOpen" | "onClose" | "active" | "defaultActive" | "width" | "disableHideAnimation" | "disableCloseOnOutsideClick" | "instanceRef" | "containerRef" | "originCoordinates"> & {
7
7
  /** Change component trap focus keyboard behavior and shortcuts */
8
8
  trapFocusMode?: Extract<PopoverProps["trapFocusMode"], "action-menu" | "selection-menu"> | false;
9
9
  };
@@ -21,6 +21,7 @@ export type Options = {
21
21
  container?: HTMLElement | null;
22
22
  rtl: boolean;
23
23
  fallbackPositions?: Position[];
24
+ fallbackAdjustLayout?: boolean;
24
25
  lastUsedPosition: Position;
25
26
  onPositionChoose: (position: Position) => void;
26
27
  contentGap?: number;
@@ -99,6 +100,8 @@ type BaseProps = {
99
100
  forcePosition?: boolean;
100
101
  /** Fallback positions for the content when it doesn't fit into the viewport or container */
101
102
  fallbackPositions?: Position[] | false;
103
+ /** Adjust the content size and shift its position to fit into the container when none of the fallback positions work */
104
+ fallbackAdjustLayout?: boolean;
102
105
  /** Change component trap focus keyboard behavior and shortcuts */
103
106
  trapFocusMode?: TrapMode | false;
104
107
  /** Disable the flyout content interactivity */
@@ -15,7 +15,7 @@ import cooldown from "./utilities/cooldown.js";
15
15
  import { Provider, useFlyoutTriggerContext, useFlyoutContext, useFlyoutContentContext, } from "./Flyout.context.js";
16
16
  import useHandlerRef from "../../hooks/useHandlerRef.js";
17
17
  const FlyoutControlled = (props) => {
18
- const { triggerType = "click", groupTimeouts, onOpen, onClose, children, disabled, forcePosition, trapFocusMode = "dialog", width, disableHideAnimation, disableContentHover, disableCloseOnOutsideClick, autoFocus = true, originCoordinates, contentGap = 2, contentShift, contentClassName, contentAttributes, position: passedPosition, active: passedActive, id: passedId, instanceRef, containerRef, initialFocusRef, } = props;
18
+ const { triggerType = "click", groupTimeouts, onOpen, onClose, children, disabled, forcePosition, fallbackAdjustLayout, trapFocusMode = "dialog", width, disableHideAnimation, disableContentHover, disableCloseOnOutsideClick, autoFocus = true, originCoordinates, contentGap = 2, contentShift, contentClassName, contentAttributes, position: passedPosition, active: passedActive, id: passedId, instanceRef, containerRef, initialFocusRef, } = props;
19
19
  const fallbackPositions = props.fallbackPositions === false || forcePosition ? [] : props.fallbackPositions;
20
20
  const onOpenRef = useHandlerRef(onOpen);
21
21
  const onCloseRef = useHandlerRef(onClose);
@@ -62,6 +62,7 @@ const FlyoutControlled = (props) => {
62
62
  defaultActive: resolvedActive,
63
63
  container: containerRef?.current,
64
64
  fallbackPositions,
65
+ fallbackAdjustLayout,
65
66
  contentGap,
66
67
  contentShift,
67
68
  });
@@ -29,6 +29,10 @@ export declare const positionFallbacks: {
29
29
  name: string;
30
30
  render: () => React.JSX.Element;
31
31
  };
32
+ export declare const fallbackAdjustLayout: {
33
+ name: string;
34
+ render: () => React.JSX.Element;
35
+ };
32
36
  export declare const originCoordinates: {
33
37
  name: string;
34
38
  render: () => React.JSX.Element;
@@ -40,7 +40,7 @@ const Demo = (props) => {
40
40
  export const position = {
41
41
  name: "position",
42
42
  render: () => {
43
- return (<View gap={4} padding={50} align="center" justify="center" height="120vh" width="120%">
43
+ return (<View gap={4} padding={50} align="center" justify="center" height="100vh" width="120%">
44
44
  <View gap={4} direction="row">
45
45
  <Demo position="top-start" defaultActive/>
46
46
  <Demo position="top"/>
@@ -222,6 +222,64 @@ export const positionFallbacks = {
222
222
  </Example>);
223
223
  },
224
224
  };
225
+ const FallbackAdjustLayoutControls = ({ containerRef, }) => (<>
226
+ {/* Left side */}
227
+ <View position="absolute" insetStart={4} insetTop={10} gap={2}>
228
+ <Demo contentHeight="200px" position="end" fallbackPositions={false} fallbackAdjustLayout containerRef={containerRef}/>
229
+ <Demo contentHeight="200px" position="end-bottom" fallbackPositions={false} fallbackAdjustLayout containerRef={containerRef}/>
230
+ </View>
231
+
232
+ <View position="absolute" insetStart={4} insetTop={80} gap={2}>
233
+ <Demo position="bottom-end" fallbackPositions={false} fallbackAdjustLayout contentWidth={300} containerRef={containerRef}/>
234
+ <Demo position="bottom" fallbackPositions={false} fallbackAdjustLayout contentWidth={300} containerRef={containerRef}/>
235
+ </View>
236
+
237
+ <View position="absolute" insetBottom={4} insetStart={4} gap={2}>
238
+ <Demo contentHeight="200px" position="end-top" fallbackPositions={false} fallbackAdjustLayout containerRef={containerRef}/>
239
+ <Demo contentHeight="200px" position="end" fallbackPositions={false} fallbackAdjustLayout containerRef={containerRef}/>
240
+ </View>
241
+
242
+ {/* Right side */}
243
+
244
+ <View position="absolute" insetTop={10} insetEnd={4} gap={2}>
245
+ <Demo contentHeight="200px" position="start" fallbackPositions={false} fallbackAdjustLayout/>
246
+ <Demo contentHeight="200px" position="start-bottom" fallbackPositions={false} fallbackAdjustLayout containerRef={containerRef}/>
247
+ </View>
248
+
249
+ <View position="absolute" insetEnd={4} insetTop={80} gap={2}>
250
+ <Demo position="top-start" fallbackPositions={false} fallbackAdjustLayout contentWidth={300} containerRef={containerRef}/>
251
+ <Demo position="top" fallbackPositions={false} fallbackAdjustLayout contentWidth={300} containerRef={containerRef}/>
252
+ </View>
253
+
254
+ <View position="absolute" insetBottom={4} insetEnd={4} gap={2}>
255
+ <Demo contentHeight="200px" position="start-top" fallbackPositions={false} fallbackAdjustLayout containerRef={containerRef}/>
256
+ <Demo contentHeight="200px" position="start" fallbackPositions={false} fallbackAdjustLayout containerRef={containerRef}/>
257
+ </View>
258
+ </>);
259
+ export const fallbackAdjustLayout = {
260
+ name: "fallbackAdjustLayout",
261
+ render: () => {
262
+ const containerRef = React.useRef(null);
263
+ return (<View gap={10}>
264
+ <View height="95vh" width="100%" align="center" justify="center">
265
+ <View backgroundColor="neutral-faded" borderRadius="medium" height="1000px" width="600px" padding={4} paddingBlock={15} overflow="auto">
266
+ <FallbackAdjustLayoutControls />
267
+ <View height="150%" width="150%" attributes={{ style: { pointerEvents: "none" } }}/>
268
+ </View>
269
+ </View>
270
+
271
+ <View height="95vh" width="100%" align="center" justify="center">
272
+ <View backgroundColor="neutral-faded" borderRadius="medium" height="1000px" width="600px" attributes={{ ref: containerRef }} padding={4} paddingBlock={15} overflow="auto">
273
+ <FallbackAdjustLayoutControls containerRef={containerRef}/>
274
+ <View height="150%" width="150%" attributes={{ style: { pointerEvents: "none" } }}/>
275
+ </View>
276
+ </View>
277
+
278
+ <FallbackAdjustLayoutControls />
279
+ <div style={{ height: "100vh", width: "250%" }}/>
280
+ </View>);
281
+ },
282
+ };
225
283
  export const originCoordinates = {
226
284
  name: "originCoordinates",
227
285
  render: () => {
@@ -6,6 +6,7 @@ type UseFlyout = (args: {
6
6
  position?: T.Position;
7
7
  defaultActive?: boolean;
8
8
  fallbackPositions?: T.Position[];
9
+ fallbackAdjustLayout?: boolean;
9
10
  contentGap?: number;
10
11
  contentShift?: number;
11
12
  container?: HTMLElement | null;
@@ -38,7 +38,7 @@ const flyoutReducer = (state, action) => {
38
38
  };
39
39
  const useFlyout = (args) => {
40
40
  const { triggerElRef, flyoutElRef, triggerBounds, contentGap, contentShift, ...options } = args;
41
- const { position: defaultPosition = "bottom", fallbackPositions, width, container } = options;
41
+ const { position: defaultPosition = "bottom", fallbackPositions, width, container, fallbackAdjustLayout, } = options;
42
42
  const lastUsedPositionRef = React.useRef(defaultPosition);
43
43
  // Memo the array internally to avoid new arrays triggering useCallback
44
44
  const cachedFallbackPositions = React.useMemo(() => fallbackPositions,
@@ -76,6 +76,7 @@ const useFlyout = (args) => {
76
76
  width,
77
77
  position: changePositon ? defaultPosition : lastUsedPositionRef.current,
78
78
  fallbackPositions: changePositon ? cachedFallbackPositions : [],
79
+ fallbackAdjustLayout,
79
80
  lastUsedPosition: lastUsedPositionRef.current,
80
81
  onPositionChoose: handlePosition,
81
82
  rtl: isRTL,
@@ -93,6 +94,7 @@ const useFlyout = (args) => {
93
94
  container,
94
95
  defaultPosition,
95
96
  cachedFallbackPositions,
97
+ fallbackAdjustLayout,
96
98
  isRTL,
97
99
  flyoutElRef,
98
100
  triggerElRef,
@@ -10,7 +10,7 @@ declare const calculatePosition: (args: {
10
10
  };
11
11
  passedContainer?: HTMLElement | null;
12
12
  containerBounds: DOMRect;
13
- } & Pick<T.Options, "position" | "rtl" | "width" | "contentGap" | "contentShift">) => {
13
+ } & Pick<T.Options, "position" | "rtl" | "width" | "contentGap" | "contentShift" | "fallbackAdjustLayout">) => {
14
14
  position: T.Position;
15
15
  styles: {
16
16
  width: string | number | undefined;
@@ -1,22 +1,10 @@
1
- const SCREEN_OFFSET = 16;
2
- const getRTLPosition = (position) => {
3
- if (position.includes("start"))
4
- return position.replace("start", "end");
5
- if (position.includes("end"))
6
- return position.replace("end", "start");
7
- return position;
8
- };
9
- /**
10
- * Get a position value which centers 2 elements vertically or horizontally
11
- */
12
- const centerBySize = (originSize, targetSize) => {
13
- return Math.floor(originSize / 2 - targetSize / 2);
14
- };
1
+ import { getRTLPosition, centerBySize } from "./helpers.js";
2
+ const SCREEN_OFFSET = 8;
15
3
  /**
16
4
  * Calculate styles for the current position
17
5
  */
18
6
  const calculatePosition = (args) => {
19
- const { triggerBounds, flyoutBounds, containerBounds, position: passedPosition, rtl, width, contentGap = 0, contentShift = 0, passedContainer, } = args;
7
+ const { triggerBounds, flyoutBounds, containerBounds, position: passedPosition, rtl, width, contentGap = 0, contentShift = 0, passedContainer, fallbackAdjustLayout, } = args;
20
8
  const isFullWidth = width === "full" || width === "100%";
21
9
  let left = 0;
22
10
  let top = 0;
@@ -29,25 +17,34 @@ const calculatePosition = (args) => {
29
17
  position = position.includes("top") ? "top" : "bottom";
30
18
  }
31
19
  const isHorizontalPosition = !!position.match(/^(start|end)/);
32
- const isVerticalPosition = !!position.match(/^(top|bottom)/);
33
20
  // contentGap adds padding to the flyout to make sure it doesn't disapper while moving the mouse to the content
34
21
  // So its width/height is bigger than the visible part of the content
35
22
  const flyoutWidth = flyoutBounds.width + (isHorizontalPosition ? contentGap : 0);
36
- const flyoutHeight = flyoutBounds.height + (isVerticalPosition ? contentGap : 0);
37
- const triggerHeight = triggerBounds.height;
23
+ const flyoutHeight = flyoutBounds.height + (!isHorizontalPosition ? contentGap : 0);
38
24
  const triggerWidth = triggerBounds.width;
39
- const containerY = passedContainer?.scrollTop || 0;
40
- const containerX = passedContainer?.scrollLeft || 0;
41
- const relativeLeft = triggerBounds.left - containerBounds.left + containerX;
42
- const relativeTop = triggerBounds.top - containerBounds.top + containerY;
43
- const relativeRight = containerBounds.right - triggerBounds.right - containerX;
44
- const relativeBottom = containerBounds.bottom - triggerBounds.bottom - containerY;
25
+ const triggerHeight = triggerBounds.height;
26
+ // Detect passed container scroll to sync the flyout position with it
27
+ const containerX = passedContainer?.scrollLeft;
28
+ const containerY = passedContainer?.scrollTop;
29
+ const scrollX = containerX ?? window.scrollX;
30
+ const scrollY = containerY ?? window.scrollY;
31
+ const renderContainerHeight = passedContainer?.clientHeight ?? window.innerHeight;
32
+ const renderContainerWidth = passedContainer?.clientWidth ?? window.innerWidth;
33
+ // When rendering in the body, bottom bounds will be larrger than the viewport so we calculate it manually
34
+ const containerBoundsBottom = passedContainer
35
+ ? containerBounds.bottom
36
+ : window.innerHeight - scrollY;
37
+ // When inside a container, adjut position based on the container scroll since flyout is rendered outside the scroll area
38
+ const relativeLeft = triggerBounds.left - containerBounds.left + (containerX || 0);
39
+ const relativeRight = containerBounds.right - triggerBounds.right - (containerX || 0);
40
+ const relativeTop = triggerBounds.top - containerBounds.top + (containerY || 0);
41
+ const relativeBottom = containerBoundsBottom - triggerBounds.bottom - (containerY || 0);
45
42
  switch (position) {
46
43
  case "start":
47
44
  case "start-top":
48
45
  case "start-bottom":
49
- right = relativeRight + triggerWidth;
50
46
  left = relativeLeft - flyoutWidth;
47
+ right = relativeRight + triggerWidth;
51
48
  break;
52
49
  case "end":
53
50
  case "end-top":
@@ -64,8 +61,8 @@ const calculatePosition = (args) => {
64
61
  break;
65
62
  case "top-end":
66
63
  case "bottom-end":
67
- right = relativeRight - contentShift;
68
64
  left = relativeLeft + triggerWidth - flyoutWidth + contentShift;
65
+ right = relativeRight - contentShift;
69
66
  break;
70
67
  default:
71
68
  break;
@@ -74,8 +71,8 @@ const calculatePosition = (args) => {
74
71
  case "top":
75
72
  case "top-start":
76
73
  case "top-end":
77
- bottom = relativeBottom + triggerHeight;
78
74
  top = relativeTop - flyoutHeight;
75
+ bottom = relativeBottom + triggerHeight;
79
76
  break;
80
77
  case "bottom":
81
78
  case "bottom-start":
@@ -92,12 +89,39 @@ const calculatePosition = (args) => {
92
89
  break;
93
90
  case "start-bottom":
94
91
  case "end-bottom":
95
- bottom = relativeBottom - contentShift;
96
92
  top = relativeTop + triggerHeight - flyoutHeight + contentShift;
93
+ bottom = relativeBottom - contentShift;
97
94
  break;
98
95
  default:
99
96
  break;
100
97
  }
98
+ if (fallbackAdjustLayout) {
99
+ const topOverflowSize = -top + scrollY + SCREEN_OFFSET;
100
+ const bottomOverflowSize = top + flyoutHeight + SCREEN_OFFSET - scrollY - renderContainerHeight;
101
+ const leftOverflowSize = -left + scrollX + SCREEN_OFFSET;
102
+ const rightOverflowSize = left + flyoutWidth + SCREEN_OFFSET - scrollX - renderContainerWidth;
103
+ if (isHorizontalPosition) {
104
+ if (topOverflowSize > 0) {
105
+ top = SCREEN_OFFSET + scrollY;
106
+ if (bottom !== null)
107
+ bottom = bottom - topOverflowSize;
108
+ }
109
+ else if (bottomOverflowSize > 0) {
110
+ console.log({ bottomOverflowSize, renderContainerHeight });
111
+ top = top - bottomOverflowSize;
112
+ }
113
+ }
114
+ else {
115
+ if (leftOverflowSize > 0) {
116
+ left = SCREEN_OFFSET + scrollX;
117
+ if (right !== null)
118
+ right = right - leftOverflowSize;
119
+ }
120
+ else if (rightOverflowSize > 0) {
121
+ left = left - rightOverflowSize;
122
+ }
123
+ }
124
+ }
101
125
  let widthStyle;
102
126
  if (isFullWidth) {
103
127
  left = SCREEN_OFFSET;
@@ -7,7 +7,7 @@ import { resetStyles } from "../Flyout.constants.js";
7
7
  * Set position of the target element to fit on the screen
8
8
  */
9
9
  const flyout = (args) => {
10
- const { triggerEl, flyoutEl, triggerBounds: passedTriggerBounds, contentShift = 0, contentGap = 0, position, fallbackPositions, width, container: passedContainer, lastUsedPosition, onPositionChoose, rtl, } = args;
10
+ const { triggerEl, flyoutEl, triggerBounds: passedTriggerBounds, contentShift = 0, contentGap = 0, position, fallbackPositions, fallbackAdjustLayout, width, container: passedContainer, lastUsedPosition, onPositionChoose, rtl, } = args;
11
11
  const targetClone = flyoutEl.cloneNode(true);
12
12
  const baseUnit = getComputedStyle(flyoutEl).getPropertyValue("--rs-unit-x1");
13
13
  const unitModifier = baseUnit ? parseInt(baseUnit) : 4;
@@ -42,37 +42,41 @@ const flyout = (args) => {
42
42
  document.body;
43
43
  const renderContainerBounds = container.getBoundingClientRect();
44
44
  const visualContainerBounds = (passedContainer || document.body).getBoundingClientRect();
45
- let calculated = null;
46
- const testOrder = getPositionFallbacks(position, fallbackPositions);
47
- testOrder.some((currentPosition) => {
48
- const tested = calculatePosition({
45
+ const applyPosition = (position) => {
46
+ return calculatePosition({
49
47
  triggerBounds: resolvedTriggerBounds,
50
48
  flyoutBounds,
51
49
  containerBounds: renderContainerBounds,
52
- position: currentPosition,
50
+ position,
53
51
  contentGap: contentGap * unitModifier,
54
52
  contentShift: contentShift * unitModifier,
55
53
  rtl,
56
54
  width,
57
- passedContainer,
55
+ passedContainer: passedContainer ||
56
+ (closestFixedContainer !== document.body ? closestFixedContainer : undefined),
57
+ fallbackAdjustLayout,
58
58
  });
59
- const visible = isFullyVisible({
60
- flyoutBounds: tested.boundaries,
59
+ };
60
+ const testVisibility = (calculated) => {
61
+ return isFullyVisible({
62
+ flyoutBounds: calculated.boundaries,
61
63
  visualContainerBounds,
62
64
  renderContainerBounds,
63
65
  container,
64
66
  });
65
- const validPosition = visible || fallbackPositions?.length === 0;
66
- // Saving first try in case none of the options work
67
- if (validPosition || lastUsedPosition === currentPosition) {
67
+ };
68
+ let calculated = null;
69
+ const testOrder = getPositionFallbacks(position, fallbackPositions);
70
+ testOrder.some((currentPosition) => {
71
+ const tested = applyPosition(currentPosition);
72
+ const visible = testVisibility(tested);
73
+ if (visible)
68
74
  calculated = tested;
69
- onPositionChoose(currentPosition);
70
- }
71
- return validPosition;
75
+ return visible;
72
76
  });
73
- if (!calculated) {
74
- throw new Error(`[Reshaped] Can't calculate styles for the ${position} position`);
75
- }
77
+ if (!calculated)
78
+ calculated = applyPosition(lastUsedPosition);
79
+ onPositionChoose(calculated.position);
76
80
  targetClone.parentNode?.removeChild(targetClone);
77
81
  return calculated;
78
82
  };
@@ -0,0 +1,7 @@
1
+ import type * as T from "../Flyout.types";
2
+ /** Mirror the position for RTL */
3
+ export declare const getRTLPosition: (position: T.Position) => T.Position;
4
+ /**
5
+ * Get a position value which centers 2 elements vertically or horizontally
6
+ */
7
+ export declare const centerBySize: (originSize: number, targetSize: number) => number;
@@ -0,0 +1,14 @@
1
+ /** Mirror the position for RTL */
2
+ export const getRTLPosition = (position) => {
3
+ if (position.includes("start"))
4
+ return position.replace("start", "end");
5
+ if (position.includes("end"))
6
+ return position.replace("end", "start");
7
+ return position;
8
+ };
9
+ /**
10
+ * Get a position value which centers 2 elements vertically or horizontally
11
+ */
12
+ export const centerBySize = (originSize, targetSize) => {
13
+ return Math.floor(originSize / 2 - targetSize / 2);
14
+ };
@@ -1,10 +1,14 @@
1
1
  /**
2
- * Check if element visually fits on the screen
2
+ * Check if element visually fits within its render container
3
3
  */
4
4
  declare const isFullyVisible: (args: {
5
+ /** Bounds of the flyout content */
5
6
  flyoutBounds: Pick<DOMRect, "left" | "top" | "width" | "height">;
7
+ /** Bounds of the container where the flyout content should fit */
6
8
  visualContainerBounds: DOMRect;
9
+ /** Bounds of the container where flyout content is rendered */
7
10
  renderContainerBounds: DOMRect;
11
+ /** Container where the flyout content is rendered */
8
12
  container: HTMLElement;
9
13
  }) => boolean;
10
14
  export default isFullyVisible;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Check if element visually fits on the screen
2
+ * Check if element visually fits within its render container
3
3
  */
4
4
  const isFullyVisible = (args) => {
5
5
  const { flyoutBounds, visualContainerBounds, renderContainerBounds, container } = args;
@@ -1 +1 @@
1
- .root{display:inline-flex}.input,.root{vertical-align:top}.input{background:transparent;border:transparent;caret-color:transparent;color:transparent;font-size:16px;inset:0;outline:none;padding-left:100%;position:absolute}.item{box-sizing:border-box;cursor:text}.item--focused{border-color:var(--rs-color-border-primary);box-shadow:0 0 0 1px var(--rs-color-border-primary)}.item--focused:empty:before{animation:rs-pin-field-caret 1s ease-out infinite;background:var(--rs-color-foreground-neutral);border-radius:var(--rs-radius-circular);content:"";height:var(--rs-font-size-body-2);left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:1px}@media (hover:hover){.root:hover .input{pointer-events:none}}@keyframes rs-pin-field-caret{0%,49.9%,to{opacity:1}50%,99.9%{opacity:0}}
1
+ .root{display:inline-flex}.input,.root{vertical-align:top}.input{background:transparent;border:transparent;caret-color:transparent;clip-path:inset(0 calc(50% + var(--rs-unit-x2)) 0 0);color:transparent;font-size:16px;inset-block:0;inset-inline-start:0;outline:none;padding-left:100%;position:absolute}.item{box-sizing:border-box;cursor:text}.item--focused{border-color:var(--rs-color-border-primary);box-shadow:0 0 0 1px var(--rs-color-border-primary)}.item--focused:empty:before{animation:rs-pin-field-caret 1s ease-out infinite;background:var(--rs-color-foreground-neutral);border-radius:var(--rs-radius-circular);content:"";height:var(--rs-font-size-body-2);left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:1px}@media (hover:hover){.root:hover .input{pointer-events:none}}@keyframes rs-pin-field-caret{0%,49.9%,to{opacity:1}50%,99.9%{opacity:0}}
@@ -1,3 +1,5 @@
1
+ import { StoryObj } from "@storybook/react-vite";
2
+ import { fn } from "storybook/internal/test";
1
3
  declare const _default: {
2
4
  title: string;
3
5
  component: import("react").FC<import("./..").PinFieldProps>;
@@ -8,6 +10,25 @@ declare const _default: {
8
10
  };
9
11
  };
10
12
  export default _default;
11
- export declare const base: () => import("react").JSX.Element;
12
- export declare const variant: () => import("react").JSX.Element;
13
- export declare const size: () => import("react").JSX.Element;
13
+ export declare const base: StoryObj;
14
+ export declare const variant: {
15
+ name: string;
16
+ render: () => import("react").JSX.Element;
17
+ };
18
+ export declare const size: {
19
+ name: string;
20
+ render: () => import("react").JSX.Element;
21
+ };
22
+ export declare const valueLength: StoryObj;
23
+ export declare const defaultValue: StoryObj<{
24
+ handleChange?: ReturnType<typeof fn>;
25
+ }>;
26
+ export declare const value: StoryObj<{
27
+ handleChange?: ReturnType<typeof fn>;
28
+ }>;
29
+ export declare const pattern: StoryObj<{
30
+ handleChange?: ReturnType<typeof fn>;
31
+ }>;
32
+ export declare const className: StoryObj;
33
+ export declare const formControl: StoryObj;
34
+ export declare const keyboard: StoryObj;