@crystallize/design-system 1.17.3 → 1.17.4

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @crystallize/design-system
2
2
 
3
+ ## 1.17.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 1e376d9: Since we added the `container` prop with a portal to the Dropdown and ActionMenu components all dropdowns are rendered in the `document.body` when container is not provided, a.k.a the container props is `undefined`. However sometimes we want to render the dropdown next to the trigger, which is possible if we provide a `ref` for a parent element. The problem is that sometimes the parent element ref is not set yet when the dropdown is rendered and thus the dropdown does not really show on the page. To fix this, the container prop now when set explicitly to `null` then we do not render the portal, which then render the dropdown next to the trigger (no need to custom ref to a parent element but render the dropdown in place).
8
+
3
9
  ## 1.17.3
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -29126,6 +29126,13 @@ function DropdownMenuRoot({
29126
29126
  container,
29127
29127
  ...delegated
29128
29128
  }) {
29129
+ const contentProps = {
29130
+ align: alignContent,
29131
+ sideOffset: 5,
29132
+ className: "c-dropdown-menu-content",
29133
+ children: content,
29134
+ ...delegated
29135
+ };
29129
29136
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(DropdownMenuPrimitive3.Root, {
29130
29137
  onOpenChange,
29131
29138
  children: [
@@ -29134,14 +29141,12 @@ function DropdownMenuRoot({
29134
29141
  asChild: true,
29135
29142
  children
29136
29143
  }),
29137
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuPrimitive3.Portal, {
29144
+ container === null ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuPrimitive3.Content, {
29145
+ ...contentProps
29146
+ }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuPrimitive3.Portal, {
29138
29147
  container,
29139
29148
  children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuPrimitive3.Content, {
29140
- align: alignContent,
29141
- sideOffset: 5,
29142
- className: "c-dropdown-menu-content",
29143
- ...delegated,
29144
- children: content
29149
+ ...contentProps
29145
29150
  })
29146
29151
  })
29147
29152
  ]
package/dist/index.mjs CHANGED
@@ -238,6 +238,13 @@ function DropdownMenuRoot({
238
238
  container,
239
239
  ...delegated
240
240
  }) {
241
+ const contentProps = {
242
+ align: alignContent,
243
+ sideOffset: 5,
244
+ className: "c-dropdown-menu-content",
245
+ children: content,
246
+ ...delegated
247
+ };
241
248
  return /* @__PURE__ */ jsxs3(DropdownMenuPrimitive3.Root, {
242
249
  onOpenChange,
243
250
  children: [
@@ -246,14 +253,12 @@ function DropdownMenuRoot({
246
253
  asChild: true,
247
254
  children
248
255
  }),
249
- /* @__PURE__ */ jsx6(DropdownMenuPrimitive3.Portal, {
256
+ container === null ? /* @__PURE__ */ jsx6(DropdownMenuPrimitive3.Content, {
257
+ ...contentProps
258
+ }) : /* @__PURE__ */ jsx6(DropdownMenuPrimitive3.Portal, {
250
259
  container,
251
260
  children: /* @__PURE__ */ jsx6(DropdownMenuPrimitive3.Content, {
252
- align: alignContent,
253
- sideOffset: 5,
254
- className: "c-dropdown-menu-content",
255
- ...delegated,
256
- children: content
261
+ ...contentProps
257
262
  })
258
263
  })
259
264
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crystallize/design-system",
3
- "version": "1.17.3",
3
+ "version": "1.17.4",
4
4
  "types": "./dist/index.d.ts",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -21,21 +21,26 @@ export function DropdownMenuRoot({
21
21
  container,
22
22
  ...delegated
23
23
  }: DropdownMenuRootProps) {
24
+ const contentProps = {
25
+ align: alignContent,
26
+ sideOffset: 5,
27
+ className: 'c-dropdown-menu-content',
28
+ children: content,
29
+ ...delegated,
30
+ };
31
+
24
32
  return (
25
33
  <DropdownMenuPrimitive.Root onOpenChange={onOpenChange}>
26
34
  <DropdownMenuPrimitive.Trigger disabled={disabled} asChild>
27
35
  {children}
28
36
  </DropdownMenuPrimitive.Trigger>
29
- <DropdownMenuPrimitive.Portal container={container}>
30
- <DropdownMenuPrimitive.Content
31
- align={alignContent}
32
- sideOffset={5}
33
- className="c-dropdown-menu-content"
34
- {...delegated}
35
- >
36
- {content}
37
- </DropdownMenuPrimitive.Content>
38
- </DropdownMenuPrimitive.Portal>
37
+ {container === null ? (
38
+ <DropdownMenuPrimitive.Content {...contentProps} />
39
+ ) : (
40
+ <DropdownMenuPrimitive.Portal container={container}>
41
+ <DropdownMenuPrimitive.Content {...contentProps} />
42
+ </DropdownMenuPrimitive.Portal>
43
+ )}
39
44
  </DropdownMenuPrimitive.Root>
40
45
  );
41
46
  }