braid-design-system 33.13.1-component-types-20251210033001 → 33.14.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/CHANGELOG.md +18 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/lib/components/MenuRenderer/MenuRenderer.cjs +1 -1
- package/dist/lib/components/MenuRenderer/MenuRenderer.mjs +1 -1
- package/dist/lib/components/TooltipRenderer/TooltipRenderer.cjs +11 -4
- package/dist/lib/components/TooltipRenderer/TooltipRenderer.css.cjs +6 -0
- package/dist/lib/components/TooltipRenderer/TooltipRenderer.css.mjs +6 -0
- package/dist/lib/components/TooltipRenderer/TooltipRenderer.mjs +11 -4
- package/dist/lib/components/private/Popover/Popover.cjs +16 -6
- package/dist/lib/components/private/Popover/Popover.mjs +16 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
# braid-design-system
|
|
2
2
|
|
|
3
|
-
## 33.
|
|
3
|
+
## 33.14.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- **TooltipRenderer:** Add support for `left` and `right` placement, in addition to existing `top` and `bottom`. ([#1942](https://github.com/seek-oss/braid-design-system/pull/1942))
|
|
8
|
+
|
|
9
|
+
**EXAMPLE USAGE:**
|
|
10
|
+
|
|
11
|
+
```jsx
|
|
12
|
+
<TooltipRenderer
|
|
13
|
+
placement="left"
|
|
14
|
+
...props
|
|
15
|
+
>
|
|
16
|
+
...
|
|
17
|
+
</TooltipRenderer>
|
|
18
|
+
|
|
19
|
+
```
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
6
22
|
|
|
7
|
-
- Improve components type definitions in support of Playroom props (
|
|
23
|
+
- Improve components type definitions in support of Playroom props ([#1941](https://github.com/seek-oss/braid-design-system/pull/1941))
|
|
8
24
|
|
|
9
25
|
## 33.13.0
|
|
10
26
|
|
package/dist/index.d.mts
CHANGED
|
@@ -3421,7 +3421,7 @@ interface LoaderProps {
|
|
|
3421
3421
|
}
|
|
3422
3422
|
declare const Loader: FC<LoaderProps>;
|
|
3423
3423
|
|
|
3424
|
-
type Placement = 'top' | 'bottom';
|
|
3424
|
+
type Placement = 'top' | 'bottom' | 'left' | 'right';
|
|
3425
3425
|
interface PopoverPlacementData {
|
|
3426
3426
|
placement: Placement;
|
|
3427
3427
|
arrow?: {
|
|
@@ -3432,7 +3432,7 @@ interface PopoverPlacementData {
|
|
|
3432
3432
|
interface PopoverProps {
|
|
3433
3433
|
id?: string;
|
|
3434
3434
|
role: NonNullable<AllHTMLAttributes<HTMLElement>['role'] | false>;
|
|
3435
|
-
align?: '
|
|
3435
|
+
align?: 'start' | 'end' | 'center';
|
|
3436
3436
|
width?: 'content' | 'full';
|
|
3437
3437
|
placement?: Placement;
|
|
3438
3438
|
lockPlacement?: boolean;
|
|
@@ -3476,7 +3476,7 @@ interface MenuRendererProps {
|
|
|
3476
3476
|
offsetSpace?: ResponsiveSpace;
|
|
3477
3477
|
size?: MenuSize;
|
|
3478
3478
|
width?: keyof typeof width | 'content';
|
|
3479
|
-
placement?: PopoverProps['placement']
|
|
3479
|
+
placement?: Extract<PopoverProps['placement'], 'top' | 'bottom'>;
|
|
3480
3480
|
onOpen?: () => void;
|
|
3481
3481
|
onClose?: (closeReason: CloseReason) => void;
|
|
3482
3482
|
data?: DataAttributeMap;
|
package/dist/index.d.ts
CHANGED
|
@@ -3421,7 +3421,7 @@ interface LoaderProps {
|
|
|
3421
3421
|
}
|
|
3422
3422
|
declare const Loader: FC<LoaderProps>;
|
|
3423
3423
|
|
|
3424
|
-
type Placement = 'top' | 'bottom';
|
|
3424
|
+
type Placement = 'top' | 'bottom' | 'left' | 'right';
|
|
3425
3425
|
interface PopoverPlacementData {
|
|
3426
3426
|
placement: Placement;
|
|
3427
3427
|
arrow?: {
|
|
@@ -3432,7 +3432,7 @@ interface PopoverPlacementData {
|
|
|
3432
3432
|
interface PopoverProps {
|
|
3433
3433
|
id?: string;
|
|
3434
3434
|
role: NonNullable<AllHTMLAttributes<HTMLElement>['role'] | false>;
|
|
3435
|
-
align?: '
|
|
3435
|
+
align?: 'start' | 'end' | 'center';
|
|
3436
3436
|
width?: 'content' | 'full';
|
|
3437
3437
|
placement?: Placement;
|
|
3438
3438
|
lockPlacement?: boolean;
|
|
@@ -3476,7 +3476,7 @@ interface MenuRendererProps {
|
|
|
3476
3476
|
offsetSpace?: ResponsiveSpace;
|
|
3477
3477
|
size?: MenuSize;
|
|
3478
3478
|
width?: keyof typeof width | 'content';
|
|
3479
|
-
placement?: PopoverProps['placement']
|
|
3479
|
+
placement?: Extract<PopoverProps['placement'], 'top' | 'bottom'>;
|
|
3480
3480
|
onOpen?: () => void;
|
|
3481
3481
|
onClose?: (closeReason: CloseReason) => void;
|
|
3482
3482
|
data?: DataAttributeMap;
|
|
@@ -39,21 +39,28 @@ const TooltipContent = ({
|
|
|
39
39
|
const arrowY = arrowPosition?.y;
|
|
40
40
|
const { space, grid } = lib_components_useSpace_useSpace_cjs.useSpace();
|
|
41
41
|
const edgeOffsetInPx = grid * space.xsmall;
|
|
42
|
-
const
|
|
42
|
+
const arrowSizeOffset = parseFloat(lib_components_TooltipRenderer_TooltipRenderer_css_cjs.constants.arrowSize) * 2;
|
|
43
43
|
const [tooltipWidth, setTooltipWidth] = react.useState(0);
|
|
44
|
+
const [tooltipHeight, setTooltipHeight] = react.useState(0);
|
|
44
45
|
const tooltipContainerRef = react.useRef(null);
|
|
45
46
|
lib_hooks_useIsomorphicLayoutEffect_cjs.useIsomorphicLayoutEffect(() => {
|
|
46
47
|
if (!tooltipContainerRef.current) {
|
|
47
48
|
return;
|
|
48
49
|
}
|
|
49
|
-
const { width } = tooltipContainerRef.current.getBoundingClientRect();
|
|
50
|
+
const { width, height } = tooltipContainerRef.current.getBoundingClientRect();
|
|
50
51
|
setTooltipWidth(width);
|
|
52
|
+
setTooltipHeight(height);
|
|
51
53
|
}, [children]);
|
|
52
54
|
const clampedArrowX = arrowX !== void 0 && tooltipWidth > 0 ? clamp(
|
|
53
55
|
edgeOffsetInPx,
|
|
54
56
|
arrowX,
|
|
55
|
-
tooltipWidth - edgeOffsetInPx -
|
|
57
|
+
tooltipWidth - edgeOffsetInPx - arrowSizeOffset
|
|
56
58
|
) : arrowX;
|
|
59
|
+
const clampedArrowY = arrowY !== void 0 && tooltipHeight > 0 ? clamp(
|
|
60
|
+
edgeOffsetInPx,
|
|
61
|
+
arrowY,
|
|
62
|
+
tooltipHeight - edgeOffsetInPx - arrowSizeOffset
|
|
63
|
+
) : arrowY;
|
|
57
64
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
58
65
|
lib_components_Box_Box_cjs.Box,
|
|
59
66
|
{
|
|
@@ -75,7 +82,7 @@ const TooltipContent = ({
|
|
|
75
82
|
className: lib_components_TooltipRenderer_TooltipRenderer_css_cjs.arrow[placement ?? "top"],
|
|
76
83
|
style: dynamic.assignInlineVars({
|
|
77
84
|
[lib_components_TooltipRenderer_TooltipRenderer_css_cjs.arrowX]: clampedArrowX !== void 0 ? `${clampedArrowX}px` : void 0,
|
|
78
|
-
[lib_components_TooltipRenderer_TooltipRenderer_css_cjs.arrowY]:
|
|
85
|
+
[lib_components_TooltipRenderer_TooltipRenderer_css_cjs.arrowY]: clampedArrowY !== void 0 ? `${clampedArrowY}px` : void 0
|
|
79
86
|
})
|
|
80
87
|
}
|
|
81
88
|
)
|
|
@@ -36,21 +36,28 @@ const TooltipContent = ({
|
|
|
36
36
|
const arrowY$1 = arrowPosition?.y;
|
|
37
37
|
const { space, grid } = useSpace();
|
|
38
38
|
const edgeOffsetInPx = grid * space.xsmall;
|
|
39
|
-
const
|
|
39
|
+
const arrowSizeOffset = parseFloat(constants.arrowSize) * 2;
|
|
40
40
|
const [tooltipWidth, setTooltipWidth] = useState(0);
|
|
41
|
+
const [tooltipHeight, setTooltipHeight] = useState(0);
|
|
41
42
|
const tooltipContainerRef = useRef(null);
|
|
42
43
|
useIsomorphicLayoutEffect(() => {
|
|
43
44
|
if (!tooltipContainerRef.current) {
|
|
44
45
|
return;
|
|
45
46
|
}
|
|
46
|
-
const { width } = tooltipContainerRef.current.getBoundingClientRect();
|
|
47
|
+
const { width, height } = tooltipContainerRef.current.getBoundingClientRect();
|
|
47
48
|
setTooltipWidth(width);
|
|
49
|
+
setTooltipHeight(height);
|
|
48
50
|
}, [children]);
|
|
49
51
|
const clampedArrowX = arrowX$1 !== void 0 && tooltipWidth > 0 ? clamp(
|
|
50
52
|
edgeOffsetInPx,
|
|
51
53
|
arrowX$1,
|
|
52
|
-
tooltipWidth - edgeOffsetInPx -
|
|
54
|
+
tooltipWidth - edgeOffsetInPx - arrowSizeOffset
|
|
53
55
|
) : arrowX$1;
|
|
56
|
+
const clampedArrowY = arrowY$1 !== void 0 && tooltipHeight > 0 ? clamp(
|
|
57
|
+
edgeOffsetInPx,
|
|
58
|
+
arrowY$1,
|
|
59
|
+
tooltipHeight - edgeOffsetInPx - arrowSizeOffset
|
|
60
|
+
) : arrowY$1;
|
|
54
61
|
return /* @__PURE__ */ jsx(
|
|
55
62
|
Box,
|
|
56
63
|
{
|
|
@@ -72,7 +79,7 @@ const TooltipContent = ({
|
|
|
72
79
|
className: arrow[placement ?? "top"],
|
|
73
80
|
style: assignInlineVars({
|
|
74
81
|
[arrowX]: clampedArrowX !== void 0 ? `${clampedArrowX}px` : void 0,
|
|
75
|
-
[arrowY]:
|
|
82
|
+
[arrowY]: clampedArrowY !== void 0 ? `${clampedArrowY}px` : void 0
|
|
76
83
|
})
|
|
77
84
|
}
|
|
78
85
|
)
|
|
@@ -14,14 +14,24 @@ const _interopDefaultCompat = (e) => e && typeof e === "object" && "default" in
|
|
|
14
14
|
const dedent__default = /* @__PURE__ */ _interopDefaultCompat(dedent);
|
|
15
15
|
const positionMap = {
|
|
16
16
|
top: {
|
|
17
|
-
|
|
17
|
+
start: "top-start",
|
|
18
18
|
center: "top",
|
|
19
|
-
|
|
19
|
+
end: "top-end"
|
|
20
20
|
},
|
|
21
21
|
bottom: {
|
|
22
|
-
|
|
22
|
+
start: "bottom-start",
|
|
23
23
|
center: "bottom",
|
|
24
|
-
|
|
24
|
+
end: "bottom-end"
|
|
25
|
+
},
|
|
26
|
+
left: {
|
|
27
|
+
start: "left-start",
|
|
28
|
+
center: "left",
|
|
29
|
+
end: "left-end"
|
|
30
|
+
},
|
|
31
|
+
right: {
|
|
32
|
+
start: "right-start",
|
|
33
|
+
center: "right",
|
|
34
|
+
end: "right-end"
|
|
25
35
|
}
|
|
26
36
|
};
|
|
27
37
|
function getFloatingUiPosition(placement, align) {
|
|
@@ -33,7 +43,7 @@ const PopoverContent = react.forwardRef(
|
|
|
33
43
|
({
|
|
34
44
|
id,
|
|
35
45
|
role,
|
|
36
|
-
align = "
|
|
46
|
+
align = "start",
|
|
37
47
|
width = "content",
|
|
38
48
|
placement = "bottom",
|
|
39
49
|
lockPlacement = false,
|
|
@@ -137,7 +147,7 @@ const PopoverContent = react.forwardRef(
|
|
|
137
147
|
}
|
|
138
148
|
}, lib_components_private_animationTimeout_cjs.animationTimeout);
|
|
139
149
|
}, [open, enterFocusRef]);
|
|
140
|
-
const resolvedPlacement = floatingUiEvaluatedPosition?.
|
|
150
|
+
const resolvedPlacement = floatingUiEvaluatedPosition?.split("-")[0] ?? "bottom";
|
|
141
151
|
react.useEffect(() => {
|
|
142
152
|
if (onPlacementChange) {
|
|
143
153
|
onPlacementChange({
|
|
@@ -11,14 +11,24 @@ import { backdrop, delayVisibility, invertPlacement, animation } from "./Popover
|
|
|
11
11
|
import { normalizeResponsiveValue } from "../../../css/atoms/sprinkles.css.mjs";
|
|
12
12
|
const positionMap = {
|
|
13
13
|
top: {
|
|
14
|
-
|
|
14
|
+
start: "top-start",
|
|
15
15
|
center: "top",
|
|
16
|
-
|
|
16
|
+
end: "top-end"
|
|
17
17
|
},
|
|
18
18
|
bottom: {
|
|
19
|
-
|
|
19
|
+
start: "bottom-start",
|
|
20
20
|
center: "bottom",
|
|
21
|
-
|
|
21
|
+
end: "bottom-end"
|
|
22
|
+
},
|
|
23
|
+
left: {
|
|
24
|
+
start: "left-start",
|
|
25
|
+
center: "left",
|
|
26
|
+
end: "left-end"
|
|
27
|
+
},
|
|
28
|
+
right: {
|
|
29
|
+
start: "right-start",
|
|
30
|
+
center: "right",
|
|
31
|
+
end: "right-end"
|
|
22
32
|
}
|
|
23
33
|
};
|
|
24
34
|
function getFloatingUiPosition(placement, align) {
|
|
@@ -30,7 +40,7 @@ const PopoverContent = forwardRef(
|
|
|
30
40
|
({
|
|
31
41
|
id,
|
|
32
42
|
role,
|
|
33
|
-
align = "
|
|
43
|
+
align = "start",
|
|
34
44
|
width = "content",
|
|
35
45
|
placement = "bottom",
|
|
36
46
|
lockPlacement = false,
|
|
@@ -134,7 +144,7 @@ const PopoverContent = forwardRef(
|
|
|
134
144
|
}
|
|
135
145
|
}, animationTimeout);
|
|
136
146
|
}, [open, enterFocusRef]);
|
|
137
|
-
const resolvedPlacement = floatingUiEvaluatedPosition?.
|
|
147
|
+
const resolvedPlacement = floatingUiEvaluatedPosition?.split("-")[0] ?? "bottom";
|
|
138
148
|
useEffect(() => {
|
|
139
149
|
if (onPlacementChange) {
|
|
140
150
|
onPlacementChange({
|
package/package.json
CHANGED