Skip to content

Commit d3ff8df

Browse files
fix(floating-panel): delegate dir prop to all parts (#2874)
* Initial plan * fix(floating-panel): delegate dir prop to all parts Co-authored-by: segunadebayo <[email protected]> * chore: add changeset for floating-panel dir prop fix Co-authored-by: segunadebayo <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: segunadebayo <[email protected]>
1 parent fd6aaae commit d3ff8df

File tree

5 files changed

+79
-21
lines changed

5 files changed

+79
-21
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@zag-js/floating-panel": patch
3+
---
4+
5+
Fix issue where `dir` prop is ignored. The `dir` attribute is now properly delegated to all floating panel parts.

packages/docs/data/api.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,6 +1333,14 @@
13331333
"type": "boolean",
13341334
"description": "Whether the date picker is open"
13351335
},
1336+
"disabled": {
1337+
"type": "boolean",
1338+
"description": "Whether the date picker is disabled"
1339+
},
1340+
"invalid": {
1341+
"type": "boolean",
1342+
"description": "Whether the date picker is invalid"
1343+
},
13361344
"inline": {
13371345
"type": "boolean",
13381346
"description": "Whether the date picker is rendered inline"
@@ -1509,6 +1517,14 @@
15091517
"type": "boolean",
15101518
"description": "Whether the calendar is read-only."
15111519
},
1520+
"required": {
1521+
"type": "boolean",
1522+
"description": "Whether the date picker is required"
1523+
},
1524+
"invalid": {
1525+
"type": "boolean",
1526+
"description": "Whether the date picker is invalid"
1527+
},
15121528
"outsideDaySelectable": {
15131529
"type": "boolean",
15141530
"description": "Whether day outside the visible range can be selected.",
@@ -3027,6 +3043,10 @@
30273043
"orientation": {
30283044
"type": "Orientation",
30293045
"description": "The orientation of the menu"
3046+
},
3047+
"reposition": {
3048+
"type": "VoidFunction",
3049+
"description": "Function to reposition the viewport"
30303050
}
30313051
},
30323052
"context": {
@@ -4671,6 +4691,10 @@
46714691
"type": "boolean",
46724692
"description": "Whether the splitter is currently being resized."
46734693
},
4694+
"orientation": {
4695+
"type": "\"horizontal\" | \"vertical\"",
4696+
"description": "The orientation of the splitter."
4697+
},
46744698
"getSizes": {
46754699
"type": "() => number[]",
46764700
"description": "Returns the current sizes of the panels."
@@ -4683,6 +4707,14 @@
46834707
"type": "() => SplitterItem[]",
46844708
"description": "Returns the items of the splitter."
46854709
},
4710+
"getPanels": {
4711+
"type": "() => PanelData[]",
4712+
"description": "Returns the panels of the splitter."
4713+
},
4714+
"getPanelById": {
4715+
"type": "(id: string) => PanelData",
4716+
"description": "Returns the panel with the specified id."
4717+
},
46864718
"getPanelSize": {
46874719
"type": "(id: string) => number",
46884720
"description": "Returns the size of the specified panel."
@@ -4714,6 +4746,10 @@
47144746
"resetSizes": {
47154747
"type": "VoidFunction",
47164748
"description": "Resets the splitter to its initial state."
4749+
},
4750+
"getResizeTriggerState": {
4751+
"type": "(props: ResizeTriggerProps) => ResizeTriggerState",
4752+
"description": "Returns the state of the resize trigger."
47174753
}
47184754
},
47194755
"context": {

packages/docs/data/css-vars.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@
88
"--marker-value": "The marker value value for the Marker"
99
}
1010
},
11-
"carousel": {
12-
"Root": {
13-
"--slides-per-page": "The number of slides visible per page",
14-
"--slide-spacing": "The spacing between slides",
15-
"--slide-item-size": "The calculated size of each slide item"
16-
}
17-
},
1811
"bottom-sheet": {
1912
"Content": {
2013
"--bottom-sheet-translate": "The bottom sheet translate value for the Content",
@@ -25,6 +18,13 @@
2518
"--layer-index": "The index of the dismissable in the layer stack"
2619
}
2720
},
21+
"carousel": {
22+
"Root": {
23+
"--slides-per-page": "The number of slides visible per page",
24+
"--slide-spacing": "The spacing between slides",
25+
"--slide-item-size": "The calculated size of each slide item"
26+
}
27+
},
2828
"collapsible": {
2929
"Content": {
3030
"--height": "The height of the element",
@@ -144,13 +144,6 @@
144144
"--layer-index": "The index of the dismissable in the layer stack"
145145
}
146146
},
147-
"qr-code": {
148-
"Root": {
149-
"--qrcode-pixel-size": "The size of the Root",
150-
"--qrcode-width": "The width of the Root",
151-
"--qrcode-height": "The height of the Root"
152-
}
153-
},
154147
"progress": {
155148
"Root": {
156149
"--percent": "The percent value for the root",
@@ -159,6 +152,13 @@
159152
"--offset": "The offset position of the element"
160153
}
161154
},
155+
"qr-code": {
156+
"Root": {
157+
"--qrcode-pixel-size": "The size of the Root",
158+
"--qrcode-width": "The width of the Root",
159+
"--qrcode-height": "The height of the Root"
160+
}
161+
},
162162
"radio-group": {
163163
"Indicator": {
164164
"--transition-property": "The transition property value for the Indicator",

packages/docs/data/data-attr.json

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,8 @@
620620
"data-scope": "date-picker",
621621
"data-part": "input",
622622
"data-index": "The index of the item",
623-
"data-state": "\"open\" | \"closed\""
623+
"data-state": "\"open\" | \"closed\"",
624+
"data-invalid": "Present when invalid"
624625
}
625626
},
626627
"dialog": {
@@ -1035,11 +1036,6 @@
10351036
"data-orientation": "The orientation of the item",
10361037
"data-disabled": "Present when disabled"
10371038
},
1038-
"IndicatorTrack": {
1039-
"data-scope": "navigation-menu",
1040-
"data-part": "indicator-track",
1041-
"data-orientation": "The orientation of the indicatortrack"
1042-
},
10431039
"Indicator": {
10441040
"data-scope": "navigation-menu",
10451041
"data-part": "indicator",
@@ -1090,6 +1086,13 @@
10901086
"data-state": "\"open\" | \"closed\"",
10911087
"data-orientation": "The orientation of the viewport",
10921088
"data-align": ""
1089+
},
1090+
"ItemIndicator": {
1091+
"data-scope": "navigation-menu",
1092+
"data-part": "item-indicator",
1093+
"data-state": "\"open\" | \"closed\"",
1094+
"data-orientation": "The orientation of the item",
1095+
"data-value": "The value of the item"
10931096
}
10941097
},
10951098
"number-input": {
@@ -1600,12 +1603,14 @@
16001603
"Root": {
16011604
"data-scope": "splitter",
16021605
"data-part": "root",
1603-
"data-orientation": "The orientation of the splitter"
1606+
"data-orientation": "The orientation of the splitter",
1607+
"data-dragging": "Present when in the dragging state"
16041608
},
16051609
"Panel": {
16061610
"data-scope": "splitter",
16071611
"data-part": "panel",
16081612
"data-orientation": "The orientation of the panel",
1613+
"data-dragging": "Present when in the dragging state",
16091614
"data-id": "",
16101615
"data-index": "The index of the item"
16111616
},
@@ -1615,6 +1620,7 @@
16151620
"data-id": "",
16161621
"data-orientation": "The orientation of the resizetrigger",
16171622
"data-focus": "Present when focused",
1623+
"data-dragging": "Present when in the dragging state",
16181624
"data-disabled": "Present when disabled"
16191625
}
16201626
},

packages/machines/floating-panel/src/floating-panel.connect.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export function connect<T extends PropTypes>(
6161
getTriggerProps() {
6262
return normalize.button({
6363
...parts.trigger.attrs,
64+
dir: prop("dir"),
6465
type: "button",
6566
disabled: prop("disabled"),
6667
id: dom.getTriggerId(scope),
@@ -79,6 +80,7 @@ export function connect<T extends PropTypes>(
7980
getPositionerProps() {
8081
return normalize.element({
8182
...parts.positioner.attrs,
83+
dir: prop("dir"),
8284
id: dom.getPositionerId(scope),
8385
style: {
8486
"--width": toPx(size?.width),
@@ -95,6 +97,7 @@ export function connect<T extends PropTypes>(
9597
getContentProps() {
9698
return normalize.element({
9799
...parts.content.attrs,
100+
dir: prop("dir"),
98101
role: "dialog",
99102
tabIndex: 0,
100103
hidden: !open,
@@ -152,6 +155,7 @@ export function connect<T extends PropTypes>(
152155
getCloseTriggerProps() {
153156
return normalize.button({
154157
...parts.closeTrigger.attrs,
158+
dir: prop("dir"),
155159
disabled: prop("disabled"),
156160
"aria-label": "Close Window",
157161
type: "button",
@@ -186,6 +190,7 @@ export function connect<T extends PropTypes>(
186190

187191
return normalize.button({
188192
...parts.stageTrigger.attrs,
193+
dir: prop("dir"),
189194
disabled: prop("disabled"),
190195
...actionProps,
191196
type: "button",
@@ -205,6 +210,7 @@ export function connect<T extends PropTypes>(
205210
getResizeTriggerProps(props: ResizeTriggerProps) {
206211
return normalize.element({
207212
...parts.resizeTrigger.attrs,
213+
dir: prop("dir"),
208214
"data-disabled": dataAttr(!canResize),
209215
"data-axis": props.axis,
210216
onPointerDown(event) {
@@ -238,6 +244,7 @@ export function connect<T extends PropTypes>(
238244
getDragTriggerProps() {
239245
return normalize.element({
240246
...parts.dragTrigger.attrs,
247+
dir: prop("dir"),
241248
"data-disabled": dataAttr(!canDrag),
242249
onPointerDown(event) {
243250
if (!canDrag) return
@@ -281,6 +288,7 @@ export function connect<T extends PropTypes>(
281288
getControlProps() {
282289
return normalize.element({
283290
...parts.control.attrs,
291+
dir: prop("dir"),
284292
"data-disabled": dataAttr(prop("disabled")),
285293
"data-stage": context.get("stage"),
286294
"data-minimized": dataAttr(isMinimized),
@@ -292,13 +300,15 @@ export function connect<T extends PropTypes>(
292300
getTitleProps() {
293301
return normalize.element({
294302
...parts.title.attrs,
303+
dir: prop("dir"),
295304
id: dom.getTitleId(scope),
296305
})
297306
},
298307

299308
getHeaderProps() {
300309
return normalize.element({
301310
...parts.header.attrs,
311+
dir: prop("dir"),
302312
id: dom.getHeaderId(scope),
303313
"data-dragging": dataAttr(dragging),
304314
"data-topmost": dataAttr(isTopmost),
@@ -312,6 +322,7 @@ export function connect<T extends PropTypes>(
312322
getBodyProps() {
313323
return normalize.element({
314324
...parts.body.attrs,
325+
dir: prop("dir"),
315326
"data-dragging": dataAttr(dragging),
316327
"data-minimized": dataAttr(isMinimized),
317328
"data-maximized": dataAttr(isMaximized),

0 commit comments

Comments
 (0)