@terreno/ui 57.6.1 → 57.7.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/src/bunSetup.ts CHANGED
@@ -727,6 +727,8 @@ mock.module("@react-native-async-storage/async-storage", () => ({
727
727
  setItem: mock(() => Promise.resolve()),
728
728
  }));
729
729
 
730
+ const mockPortalContext = React.createContext<unknown>(null);
731
+
730
732
  // Mock the portal host. The real `Host` wraps children in an extra View
731
733
  // whose presence makes snapshots brittle, and individual tests already mock
732
734
  // this to render inline; hoisting the mock to setup keeps test ordering from
@@ -737,6 +739,10 @@ mock.module("./PortalHost", () => ({
737
739
  React.createElement("View", {testID: "portal-host"}, children),
738
740
  Portal: ({children}: MockComponentProps) =>
739
741
  React.createElement("View", {testID: "portal"}, children),
742
+ // Components that only portal when a host is mounted read this context. It defaults to
743
+ // null (no host) so they keep rendering inline; tests that want the portal path wrap the
744
+ // tree in `PortalContext.Provider`.
745
+ PortalContext: mockPortalContext,
740
746
  }));
741
747
 
742
748
  // Mock IconButton component
@@ -7,13 +7,13 @@ import {Box} from "./Box";
7
7
  import {Button} from "./Button";
8
8
  import type {DataTableColumnFilter} from "./Common";
9
9
  import {DateTimeField} from "./DateTimeField";
10
+ import {DropdownPanel} from "./DropdownPanel";
10
11
  import {
11
12
  DATA_TABLE_CHOICE_EMPTY_LABEL,
12
13
  DATA_TABLE_CHOICE_EMPTY_VALUE,
13
14
  endOfUtcDay,
14
15
  startOfUtcDay,
15
16
  } from "./dataTableListQuery";
16
- import {Filter} from "./Filter";
17
17
  import {MultiselectField} from "./MultiselectField";
18
18
  import {NumberField} from "./NumberField";
19
19
  import {TextField} from "./TextField";
@@ -333,7 +333,7 @@ export const DataTableColumnFilterWeb: FC<DataTableColumnFilterWebProps> = ({
333
333
  }
334
334
 
335
335
  return (
336
- <Filter
336
+ <DropdownPanel
337
337
  iconName="filter"
338
338
  iconOnly
339
339
  isOpen={isOpen}
@@ -351,7 +351,7 @@ export const DataTableColumnFilterWeb: FC<DataTableColumnFilterWebProps> = ({
351
351
  filters={[filter]}
352
352
  onDraftChange={setDraftValuesSync}
353
353
  />
354
- </Filter>
354
+ </DropdownPanel>
355
355
  );
356
356
  };
357
357
 
@@ -419,7 +419,7 @@ export const DataTableAdditionalFiltersWeb: FC<DataTableAdditionalFiltersWebProp
419
419
  }
420
420
 
421
421
  return (
422
- <Filter
422
+ <DropdownPanel
423
423
  iconName="filter"
424
424
  isOpen={isOpen}
425
425
  label="More filters"
@@ -436,6 +436,6 @@ export const DataTableAdditionalFiltersWeb: FC<DataTableAdditionalFiltersWebProp
436
436
  onDraftChange={setDraftValuesSync}
437
437
  showFieldClear
438
438
  />
439
- </Filter>
439
+ </DropdownPanel>
440
440
  );
441
441
  };
@@ -0,0 +1,140 @@
1
+ import {describe, expect, it} from "bun:test";
2
+
3
+ import {
4
+ computeDropdownPanelLayout,
5
+ DROPDOWN_PANEL_MIN_HEIGHT,
6
+ DROPDOWN_PANEL_SCREEN_MARGIN,
7
+ } from "./dropdownPanelLayout";
8
+
9
+ const viewport = {viewportHeight: 800, viewportWidth: 1200};
10
+
11
+ describe("computeDropdownPanelLayout", () => {
12
+ it("left-aligns to the trigger when the panel fits", () => {
13
+ const layout = computeDropdownPanelLayout({
14
+ anchor: {height: 40, width: 100, x: 100, y: 60},
15
+ panelWidth: 320,
16
+ ...viewport,
17
+ });
18
+ expect(layout.left).toBe(100);
19
+ expect(layout.top).toBe(104);
20
+ expect(layout.placement).toBe("below");
21
+ });
22
+
23
+ it("right-aligns to the trigger when a left-aligned panel would overflow", () => {
24
+ // The To Do's filter button sits at the right edge of the action row, where a
25
+ // left-aligned panel ran off screen.
26
+ const layout = computeDropdownPanelLayout({
27
+ anchor: {height: 40, width: 120, x: 1040, y: 60},
28
+ panelWidth: 340,
29
+ ...viewport,
30
+ });
31
+ // Right edge of the panel lines up with the right edge of the trigger.
32
+ expect(layout.left).toBe(1040 + 120 - 340);
33
+ });
34
+
35
+ it("clamps a right-aligned panel to the left screen margin", () => {
36
+ const layout = computeDropdownPanelLayout({
37
+ anchor: {height: 40, width: 60, x: 100, y: 60},
38
+ panelWidth: 340,
39
+ viewportHeight: 800,
40
+ viewportWidth: 360,
41
+ });
42
+ expect(layout.left).toBe(DROPDOWN_PANEL_SCREEN_MARGIN);
43
+ });
44
+
45
+ it("narrows a panel wider than the viewport so both edges stay inside the margins", () => {
46
+ const layout = computeDropdownPanelLayout({
47
+ anchor: {height: 40, width: 60, x: 120, y: 60},
48
+ panelWidth: 400,
49
+ viewportHeight: 800,
50
+ viewportWidth: 320,
51
+ });
52
+ expect(layout.left).toBe(DROPDOWN_PANEL_SCREEN_MARGIN);
53
+ // Moving the panel cannot keep a 400px panel on a 320px screen, so it shrinks.
54
+ expect(layout.width).toBe(320 - DROPDOWN_PANEL_SCREEN_MARGIN * 2);
55
+ expect(layout.left + layout.width).toBe(320 - DROPDOWN_PANEL_SCREEN_MARGIN);
56
+ });
57
+
58
+ it("leaves the requested width alone when it fits", () => {
59
+ const layout = computeDropdownPanelLayout({
60
+ anchor: {height: 40, width: 100, x: 100, y: 60},
61
+ panelWidth: 320,
62
+ ...viewport,
63
+ });
64
+ expect(layout.width).toBe(320);
65
+ });
66
+
67
+ it("right-aligns against the narrowed width on a cramped viewport", () => {
68
+ // A trigger near the right edge of a small phone: the panel narrows first, then the
69
+ // right-align uses that narrowed width so it still lines up with the trigger.
70
+ const layout = computeDropdownPanelLayout({
71
+ anchor: {height: 40, width: 80, x: 240, y: 60},
72
+ panelWidth: 340,
73
+ viewportHeight: 800,
74
+ viewportWidth: 320,
75
+ });
76
+ expect(layout.width).toBe(304);
77
+ expect(layout.left).toBe(DROPDOWN_PANEL_SCREEN_MARGIN);
78
+ expect(layout.left + layout.width).toBeLessThanOrEqual(320 - DROPDOWN_PANEL_SCREEN_MARGIN);
79
+ });
80
+
81
+ it("honours an explicit alignment over the auto behaviour", () => {
82
+ const anchor = {height: 40, width: 120, x: 400, y: 60};
83
+ expect(
84
+ computeDropdownPanelLayout({align: "end", anchor, panelWidth: 320, ...viewport}).left
85
+ ).toBe(200);
86
+ expect(
87
+ computeDropdownPanelLayout({align: "start", anchor, panelWidth: 320, ...viewport}).left
88
+ ).toBe(400);
89
+ });
90
+
91
+ it("flips above the trigger when there is no usable room below", () => {
92
+ const layout = computeDropdownPanelLayout({
93
+ anchor: {height: 40, width: 120, x: 100, y: 720},
94
+ panelWidth: 320,
95
+ ...viewport,
96
+ });
97
+ expect(layout.placement).toBe("above");
98
+ expect(layout.top).toBeUndefined();
99
+ expect(layout.bottom).toBe(800 - 720 + 4);
100
+ });
101
+
102
+ it("stays below the trigger when the space above is even smaller", () => {
103
+ const layout = computeDropdownPanelLayout({
104
+ anchor: {height: 40, width: 120, x: 100, y: 10},
105
+ panelWidth: 320,
106
+ viewportHeight: 220,
107
+ viewportWidth: 1200,
108
+ });
109
+ expect(layout.placement).toBe("below");
110
+ });
111
+
112
+ it("caps the panel height to the space available and scrolls the rest", () => {
113
+ const layout = computeDropdownPanelLayout({
114
+ anchor: {height: 40, width: 120, x: 100, y: 60},
115
+ panelWidth: 320,
116
+ ...viewport,
117
+ });
118
+ expect(layout.maxHeight).toBe(800 - 104 - DROPDOWN_PANEL_SCREEN_MARGIN);
119
+ });
120
+
121
+ it("never shrinks below the minimum usable height", () => {
122
+ const layout = computeDropdownPanelLayout({
123
+ anchor: {height: 40, width: 120, x: 100, y: 120},
124
+ panelWidth: 320,
125
+ viewportHeight: 300,
126
+ viewportWidth: 1200,
127
+ });
128
+ expect(layout.maxHeight).toBe(DROPDOWN_PANEL_MIN_HEIGHT);
129
+ });
130
+
131
+ it("applies a caller-supplied height ceiling", () => {
132
+ const layout = computeDropdownPanelLayout({
133
+ anchor: {height: 40, width: 120, x: 100, y: 60},
134
+ maxPanelHeight: 240,
135
+ panelWidth: 320,
136
+ ...viewport,
137
+ });
138
+ expect(layout.maxHeight).toBe(240);
139
+ });
140
+ });
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Positioning math for `DropdownPanel`. Kept free of React and React Native so the
3
+ * clipping rules (right-align on overflow, viewport clamp, flip above) can be unit
4
+ * tested directly on both platforms.
5
+ */
6
+
7
+ /** Trigger box in window coordinates, as returned by `measureInWindow`. */
8
+ export interface DropdownPanelAnchor {
9
+ height: number;
10
+ width: number;
11
+ x: number;
12
+ y: number;
13
+ }
14
+
15
+ /**
16
+ * `start` pins the panel's left edge to the trigger, `end` pins its right edge, and
17
+ * `auto` starts left-aligned and flips to right-aligned when the panel would run past
18
+ * the right edge of the viewport.
19
+ */
20
+ export type DropdownPanelAlign = "auto" | "start" | "end";
21
+
22
+ export interface DropdownPanelLayoutInput {
23
+ align?: DropdownPanelAlign;
24
+ anchor: DropdownPanelAnchor;
25
+ /** Space between the trigger and the panel. */
26
+ gap?: number;
27
+ /** Caller-supplied ceiling, applied on top of the space available on screen. */
28
+ maxPanelHeight?: number;
29
+ panelWidth: number;
30
+ /** Minimum space kept between the panel and every viewport edge. */
31
+ screenMargin?: number;
32
+ viewportHeight: number;
33
+ viewportWidth: number;
34
+ }
35
+
36
+ export interface DropdownPanelLayout {
37
+ /** Set instead of `top` when the panel is flipped above the trigger. */
38
+ bottom?: number;
39
+ left: number;
40
+ maxHeight: number;
41
+ placement: "above" | "below";
42
+ top?: number;
43
+ /**
44
+ * Requested panel width, shrunk to what fits between the screen margins. Moving a
45
+ * panel that is wider than the viewport cannot keep it on screen, so it narrows.
46
+ */
47
+ width: number;
48
+ }
49
+
50
+ export const DROPDOWN_PANEL_GAP = 4;
51
+ export const DROPDOWN_PANEL_SCREEN_MARGIN = 8;
52
+ /**
53
+ * A panel shorter than this is unusable, so a cramped viewport gets a scrolling panel
54
+ * rather than a squashed one.
55
+ */
56
+ export const DROPDOWN_PANEL_MIN_HEIGHT = 160;
57
+
58
+ const clampLeft = ({
59
+ left,
60
+ panelWidth,
61
+ screenMargin,
62
+ viewportWidth,
63
+ }: {
64
+ left: number;
65
+ panelWidth: number;
66
+ screenMargin: number;
67
+ viewportWidth: number;
68
+ }): number => {
69
+ const maxLeft = viewportWidth - panelWidth - screenMargin;
70
+ // A panel wider than the viewport can only honour the left margin.
71
+ if (maxLeft <= screenMargin) {
72
+ return screenMargin;
73
+ }
74
+ return Math.max(screenMargin, Math.min(left, maxLeft));
75
+ };
76
+
77
+ /**
78
+ * Resolves where an open dropdown panel should sit relative to its trigger.
79
+ *
80
+ * The panel is anchored to the trigger, kept inside the viewport on both axes, and
81
+ * flipped above the trigger when the space below is too small to use.
82
+ */
83
+ export const computeDropdownPanelLayout = ({
84
+ align = "auto",
85
+ anchor,
86
+ gap = DROPDOWN_PANEL_GAP,
87
+ maxPanelHeight,
88
+ panelWidth,
89
+ screenMargin = DROPDOWN_PANEL_SCREEN_MARGIN,
90
+ viewportHeight,
91
+ viewportWidth,
92
+ }: DropdownPanelLayoutInput): DropdownPanelLayout => {
93
+ // Everything downstream positions the panel at the width it will actually render at,
94
+ // so a panel too wide for the viewport narrows instead of running past the margin.
95
+ const availableWidth = viewportWidth - screenMargin * 2;
96
+ const width = availableWidth > 0 ? Math.min(panelWidth, availableWidth) : panelWidth;
97
+
98
+ const startLeft = anchor.x;
99
+ const endLeft = anchor.x + anchor.width - width;
100
+ const overflowsRight = startLeft + width > viewportWidth - screenMargin;
101
+
102
+ let desiredLeft = startLeft;
103
+ if (align === "end" || (align === "auto" && overflowsRight)) {
104
+ desiredLeft = endLeft;
105
+ }
106
+
107
+ const left = clampLeft({left: desiredLeft, panelWidth: width, screenMargin, viewportWidth});
108
+
109
+ const belowTop = anchor.y + anchor.height + gap;
110
+ const spaceBelow = viewportHeight - belowTop - screenMargin;
111
+ const spaceAbove = anchor.y - gap - screenMargin;
112
+ const flipAbove = spaceBelow < DROPDOWN_PANEL_MIN_HEIGHT && spaceAbove > spaceBelow;
113
+
114
+ const available = Math.max(
115
+ flipAbove ? spaceAbove : spaceBelow,
116
+ Math.min(DROPDOWN_PANEL_MIN_HEIGHT, viewportHeight)
117
+ );
118
+ const maxHeight = maxPanelHeight === undefined ? available : Math.min(maxPanelHeight, available);
119
+
120
+ if (flipAbove) {
121
+ return {
122
+ bottom: Math.max(screenMargin, viewportHeight - anchor.y + gap),
123
+ left,
124
+ maxHeight,
125
+ placement: "above",
126
+ width,
127
+ };
128
+ }
129
+
130
+ return {left, maxHeight, placement: "below", top: belowTop, width};
131
+ };
package/src/index.tsx CHANGED
@@ -38,14 +38,15 @@ export * from "./DateUtilities";
38
38
  export * from "./DecimalRangeActionSheet";
39
39
  export * from "./DismissButton";
40
40
  export type * from "./DonutChart";
41
+ export * from "./DropdownPanel";
41
42
  export * from "./dataTableListQuery";
43
+ export * from "./dropdownPanelLayout";
42
44
  export * from "./EditableCard";
43
45
  export * from "./EmailField";
44
46
  export * from "./ErrorBoundary";
45
47
  export * from "./ErrorPage";
46
48
  export * from "./Field";
47
49
  export * from "./FilePickerButton";
48
- export * from "./Filter";
49
50
  export * from "./FilterAccordion";
50
51
  export * from "./FilterBoolean";
51
52
  export * from "./FilterChangesBadge";
package/dist/Filter.d.ts DELETED
@@ -1,14 +0,0 @@
1
- import { type FC } from "react";
2
- import type { FilterProps } from "./Common";
3
- /**
4
- * Compositional filter dropdown. Renders a trigger button that opens a panel
5
- * containing composed filter controls (`FilterSelectMenu`, `FilterBoolean`,
6
- * `FilterAccordion`, or any custom content) plus an optional Apply / Clear /
7
- * Cancel footer. Clicking outside the panel closes it. Desktop web only.
8
- *
9
- * On web the panel is rendered in a portal on `document.body` and anchored to
10
- * the trigger, so it floats above all page content instead of being trapped in
11
- * a React Native Web stacking context (which would let content bleed through).
12
- */
13
- export declare const Filter: FC<FilterProps>;
14
- //# sourceMappingURL=Filter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Filter.d.ts","sourceRoot":"","sources":["../src/Filter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,EAAsC,MAAM,OAAO,CAAC;AAInE,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,UAAU,CAAC;AAc1C;;;;;;;;;GASG;AACH,eAAO,MAAM,MAAM,EAAE,EAAE,CAAC,WAAW,CA4QlC,CAAC"}
package/dist/Filter.js DELETED
@@ -1,145 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useEffect, useState } from "react";
3
- import { Platform, Pressable, View } from "react-native";
4
- import { Button } from "./Button";
5
- import { createWebPortal } from "./createWebPortal";
6
- import { Icon } from "./Icon";
7
- import { Text } from "./Text";
8
- import { useTheme } from "./Theme";
9
- import { resolveTestID } from "./testing/resolveTestId";
10
- import { createBoxShadow } from "./Utilities";
11
- import { useWebDropdownAnchor } from "./WebDropdownMenu";
12
- const DEFAULT_WIDTH = 320;
13
- const TRIGGER_OFFSET = 44;
14
- const PANEL_GAP = 4;
15
- const ICON_TRIGGER_SIZE = { default: 32, sm: 24 };
16
- /**
17
- * Compositional filter dropdown. Renders a trigger button that opens a panel
18
- * containing composed filter controls (`FilterSelectMenu`, `FilterBoolean`,
19
- * `FilterAccordion`, or any custom content) plus an optional Apply / Clear /
20
- * Cancel footer. Clicking outside the panel closes it. Desktop web only.
21
- *
22
- * On web the panel is rendered in a portal on `document.body` and anchored to
23
- * the trigger, so it floats above all page content instead of being trapped in
24
- * a React Native Web stacking context (which would let content bleed through).
25
- */
26
- export const Filter = ({ children, label = "Filter", triggerAccessibilityLabel, iconName = "bars-filter", iconOnly = false, triggerSize = "sm", isOpen, defaultOpen = false, onOpenChange, showActionButtons = true, showApplyButton = true, showClearButton = true, showCancelButton = true, applyButtonText = "Apply", clearButtonText = "Clear", cancelButtonText = "Cancel", onApply, onClear, onCancel, variant = "primary", width = DEFAULT_WIDTH, testID, }) => {
27
- const { theme } = useTheme();
28
- const [internalOpen, setInternalOpen] = useState(defaultOpen);
29
- const [anchorReady, setAnchorReady] = useState(false);
30
- const { anchor, cancelPendingMeasurement, measure, triggerRef } = useWebDropdownAnchor();
31
- const isControlled = isOpen !== undefined;
32
- const open = isControlled ? isOpen : internalOpen;
33
- // Measure-then-show: measure the trigger when the panel opens and only reveal
34
- // the portaled panel once the anchor is known, so it never flashes at the
35
- // default (0, 0) position before jumping into place.
36
- // biome-ignore lint/correctness/useExhaustiveDependencies: only re-measure on open transitions; `measure` is recreated each render.
37
- useEffect(() => {
38
- setAnchorReady(false);
39
- if (!open) {
40
- cancelPendingMeasurement();
41
- return;
42
- }
43
- measure(() => setAnchorReady(true));
44
- return cancelPendingMeasurement;
45
- }, [open]);
46
- // Return focus to the trigger after any in-panel dismissal so keyboard users
47
- // can continue from the control that opened the popup (web only).
48
- const restoreTriggerFocus = () => {
49
- if (Platform.OS !== "web" || !triggerRef.current) {
50
- return;
51
- }
52
- const node = triggerRef.current;
53
- node.querySelector?.('[role="button"]')?.focus?.();
54
- };
55
- const setOpen = (next) => {
56
- if (!isControlled) {
57
- setInternalOpen(next);
58
- }
59
- onOpenChange?.(next);
60
- };
61
- const handleApply = () => {
62
- onApply?.();
63
- setOpen(false);
64
- restoreTriggerFocus();
65
- };
66
- const handleClear = () => {
67
- // Clearing resets the filter values but keeps the panel open so the user can
68
- // immediately pick new filters without reopening it.
69
- onClear?.();
70
- };
71
- const handleCancel = () => {
72
- onCancel?.();
73
- setOpen(false);
74
- restoreTriggerFocus();
75
- };
76
- const showFooter = showActionButtons && (showApplyButton || showClearButton || showCancelButton);
77
- const panelSurfaceStyle = {
78
- backgroundColor: theme.surface.base,
79
- borderColor: theme.border.default,
80
- borderRadius: theme.radius.default,
81
- borderWidth: 1,
82
- boxShadow: createBoxShadow({
83
- blurRadius: 12,
84
- color: theme.primitives.neutral900,
85
- offsetY: 4,
86
- opacity: 0.15,
87
- }),
88
- width,
89
- };
90
- const panelBody = (_jsxs(_Fragment, { children: [_jsx(View, { style: { padding: theme.spacing.sm }, children: children }), showFooter && (_jsxs(View, { style: {
91
- alignItems: "center",
92
- borderTopColor: theme.border.default,
93
- borderTopWidth: 1,
94
- flexDirection: "row",
95
- justifyContent: "space-between",
96
- padding: theme.spacing.md,
97
- }, children: [showClearButton ? (_jsx(Pressable, { onPress: handleClear, testID: testID ? resolveTestID(testID, "clear") : undefined, children: _jsx(Text, { color: "link", underline: true, children: clearButtonText }) })) : (_jsx(View, {})), _jsxs(View, { style: {
98
- alignItems: "center",
99
- flexDirection: "row",
100
- gap: theme.spacing.sm,
101
- justifyContent: "flex-end",
102
- }, children: [showCancelButton && (_jsx(Button, { onClick: handleCancel, testID: testID ? resolveTestID(testID, "cancel") : undefined, text: cancelButtonText, variant: "outline" })), showApplyButton && (_jsx(Button, { onClick: handleApply, testID: testID ? resolveTestID(testID, "apply") : undefined, text: applyButtonText, variant: variant }))] })] }))] }));
103
- const renderOverlay = () => {
104
- // Web: portal to document.body with fixed positioning so the panel escapes
105
- // every ancestor stacking context and floats above all page content.
106
- if (Platform.OS === "web" && typeof document !== "undefined") {
107
- // Wait for the trigger measurement so the panel appears already anchored.
108
- if (!anchorReady) {
109
- return null;
110
- }
111
- const overlay = (_jsxs(View, { style: {
112
- inset: 0,
113
- // box-none lets clicks pass to the backdrop / panel but not the empty overlay.
114
- pointerEvents: "box-none",
115
- position: "fixed",
116
- zIndex: 9999,
117
- }, children: [_jsx(Pressable, { "aria-role": "button", onPress: handleCancel, style: { inset: 0, position: "fixed", zIndex: 1 }, testID: testID ? resolveTestID(testID, "backdrop") : undefined }), _jsx(View, { style: {
118
- ...panelSurfaceStyle,
119
- left: anchor.x,
120
- position: "fixed",
121
- top: anchor.y + anchor.height + PANEL_GAP,
122
- zIndex: 2,
123
- }, testID: testID ? resolveTestID(testID, "panel") : undefined, children: panelBody })] }));
124
- const target = document.body instanceof HTMLElement ? document.body : null;
125
- return target ? createWebPortal({ children: overlay, container: target }) : overlay;
126
- }
127
- // Native fallback: anchored inline beneath the trigger.
128
- return (_jsxs(_Fragment, { children: [_jsx(Pressable, { "aria-role": "button", onPress: handleCancel, style: { bottom: 0, left: 0, position: "absolute", right: 0, top: 0, zIndex: 10 }, testID: testID ? resolveTestID(testID, "backdrop") : undefined }), _jsx(View, { style: {
129
- ...panelSurfaceStyle,
130
- left: 0,
131
- position: "absolute",
132
- top: TRIGGER_OFFSET,
133
- zIndex: 11,
134
- }, testID: testID ? resolveTestID(testID, "panel") : undefined, children: panelBody })] }));
135
- };
136
- return (_jsxs(View, { style: { position: "relative" }, testID: testID, children: [_jsx(View, { ref: triggerRef, children: iconOnly ? (_jsx(Pressable, { accessibilityLabel: triggerAccessibilityLabel ?? label ?? "Filter", accessibilityRole: "button", "aria-label": triggerAccessibilityLabel ?? label ?? "Filter", hitSlop: 8, onPress: () => setOpen(!open), style: {
137
- alignItems: "center",
138
- backgroundColor: open ? theme.surface.neutralLight : theme.surface.base,
139
- borderRadius: theme.radius.rounded,
140
- height: ICON_TRIGGER_SIZE[triggerSize],
141
- justifyContent: "center",
142
- width: ICON_TRIGGER_SIZE[triggerSize],
143
- }, testID: testID ? resolveTestID(testID, "trigger") : undefined, children: _jsx(Icon, { color: "secondaryLight", iconName: iconName, size: triggerSize === "sm" ? "sm" : "md" }) })) : (_jsx(Button, { accessibilityLabel: triggerAccessibilityLabel, iconName: iconName, onClick: () => setOpen(!open), testID: testID ? resolveTestID(testID, "trigger") : undefined, text: label, variant: variant })) }), Boolean(open) && renderOverlay()] }));
144
- };
145
- //# sourceMappingURL=Filter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Filter.js","sourceRoot":"","sources":["../src/Filter.tsx"],"names":[],"mappings":";AAAA,OAAO,EAA0B,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACnE,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAiB,MAAM,cAAc,CAAC;AAEvE,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,IAAI,EAAC,M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