@powered-by-array/ui 1.76.0 → 1.77.1

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.
@@ -17,11 +17,16 @@ export function DescriptionCard(props) {
17
17
  * component or the skeleton (two distinct component types), so toggling
18
18
  * `loading` mounts/unmounts rather than changing the hook count of one render.
19
19
  */
20
+ const COLLAPSED_CHARACTER_LIMIT = 400;
20
21
  function DescriptionCardContent({ label = "Description", description, expanded, defaultExpanded = false, onExpandedChange, onEdit, ref, ...rest }) {
21
22
  const [uncontrolledExpanded, setUncontrolledExpanded] = React.useState(defaultExpanded);
22
23
  const isControlled = expanded !== undefined;
23
24
  const isExpanded = isControlled ? expanded : uncontrolledExpanded;
24
25
  const characterCount = description.length;
26
+ const isTruncatable = characterCount > COLLAPSED_CHARACTER_LIMIT;
27
+ const visibleDescription = isTruncatable && !isExpanded
28
+ ? `${description.slice(0, COLLAPSED_CHARACTER_LIMIT)}…`
29
+ : description;
25
30
  const toggleExpanded = () => {
26
31
  const next = !isExpanded;
27
32
  if (!isControlled) {
@@ -29,6 +34,6 @@ function DescriptionCardContent({ label = "Description", description, expanded,
29
34
  }
30
35
  onExpandedChange?.(next);
31
36
  };
32
- return (_jsx(CardContainer, { variant: "outline", asChild: true, children: _jsxs("section", { ref: ref, "data-slot": "description-card", "data-state": isExpanded ? "expanded" : "collapsed", className: cn(descriptionCardVariants.root), ...rest, children: [_jsxs("div", { "data-slot": "description-card-header", className: cn(descriptionCardVariants.header), children: [_jsx("span", { "data-slot": "description-card-label", className: cn(descriptionCardVariants.label), children: label }), onEdit ? (_jsx("button", { type: "button", "data-slot": "description-card-edit", className: cn(descriptionCardVariants.edit), onClick: onEdit, children: "Edit" })) : null] }), _jsx("p", { "data-slot": "description-card-body", className: cn(descriptionCardVariants.body, !isExpanded && descriptionCardVariants.bodyCollapsed), children: description }), _jsxs("div", { "data-slot": "description-card-footer", className: cn(descriptionCardVariants.footer), children: [_jsx("button", { type: "button", "data-slot": "description-card-toggle", "aria-expanded": isExpanded, className: cn(descriptionCardVariants.toggle), onClick: toggleExpanded, children: isExpanded ? "View less" : "View more" }), _jsx("span", { "aria-hidden": "true", "data-slot": "description-card-separator", className: cn(descriptionCardVariants.separator), children: "\u00B7" }), _jsxs("span", { "data-slot": "description-card-count", className: cn(descriptionCardVariants.count), children: [characterCount, " characters"] })] })] }) }));
37
+ return (_jsx(CardContainer, { variant: "outline", asChild: true, children: _jsxs("section", { ref: ref, "data-slot": "description-card", "data-state": isExpanded ? "expanded" : "collapsed", className: cn(descriptionCardVariants.root), ...rest, children: [_jsxs("div", { "data-slot": "description-card-header", className: cn(descriptionCardVariants.header), children: [_jsx("span", { "data-slot": "description-card-label", className: cn(descriptionCardVariants.label), children: label }), onEdit ? (_jsx("button", { type: "button", "data-slot": "description-card-edit", className: cn(descriptionCardVariants.edit), onClick: onEdit, children: "Edit" })) : null] }), _jsx("p", { "data-slot": "description-card-body", className: cn(descriptionCardVariants.body), children: visibleDescription }), isTruncatable ? (_jsxs("div", { "data-slot": "description-card-footer", className: cn(descriptionCardVariants.footer), children: [_jsx("button", { type: "button", "data-slot": "description-card-toggle", "aria-expanded": isExpanded, className: cn(descriptionCardVariants.toggle), onClick: toggleExpanded, children: isExpanded ? "View less" : "View more" }), _jsx("span", { "aria-hidden": "true", "data-slot": "description-card-separator", className: cn(descriptionCardVariants.separator), children: "\u00B7" }), _jsxs("span", { "data-slot": "description-card-count", className: cn(descriptionCardVariants.count), children: [characterCount, " characters"] })] })) : null] }) }));
33
38
  }
34
39
  //# sourceMappingURL=DescriptionCard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DescriptionCard.js","sourceRoot":"","sources":["../../../src/components/DescriptionCard/DescriptionCard.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,2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C,CAAC,CAAC,WAAW,EACjD,SAAS,EAAE,EAAE,CAAC,uBAAuB,CAAC,IAAI,CAAC,KACvC,IAAI,aAER,4BACY,yBAAyB,EACnC,SAAS,EAAE,EAAE,CAAC,uBAAuB,CAAC,MAAM,CAAC,aAE7C,4BACY,wBAAwB,EAClC,SAAS,EAAE,EAAE,CAAC,uBAAuB,CAAC,KAAK,CAAC,YAE3C,KAAK,GACD,EACN,MAAM,CAAC,CAAC,CAAC,CACR,iBACE,IAAI,EAAC,QAAQ,eACH,uBAAuB,EACjC,SAAS,EAAE,EAAE,CAAC,uBAAuB,CAAC,IAAI,CAAC,EAC3C,OAAO,EAAE,MAAM,qBAGR,CACV,CAAC,CAAC,CAAC,IAAI,IACJ,EAEN,yBACY,uBAAuB,EACjC,SAAS,EAAE,EAAE,CACX,uBAAuB,CAAC,IAAI,EAC5B,CAAC,UAAU,IAAI,uBAAuB,CAAC,aAAa,CACrD,YAEA,WAAW,GACV,EAEJ,4BACY,yBAAyB,EACnC,SAAS,EAAE,EAAE,CAAC,uBAAuB,CAAC,MAAM,CAAC,aAE7C,iBACE,IAAI,EAAC,QAAQ,eACH,yBAAyB,mBACpB,UAAU,EACzB,SAAS,EAAE,EAAE,CAAC,uBAAuB,CAAC,MAAM,CAAC,EAC7C,OAAO,EAAE,cAAc,YAEtB,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,GAChC,EACT,8BACc,MAAM,eACR,4BAA4B,EACtC,SAAS,EAAE,EAAE,CAAC,uBAAuB,CAAC,SAAS,CAAC,uBAG3C,EACP,6BACY,wBAAwB,EAClC,SAAS,EAAE,EAAE,CAAC,uBAAuB,CAAC,KAAK,CAAC,aAE3C,cAAc,mBACV,IACH,IACE,GACI,CACjB,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"DescriptionCard.js","sourceRoot":"","sources":["../../../src/components/DescriptionCard/DescriptionCard.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAA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BACc,MAAM,eACR,4BAA4B,EACtC,SAAS,EAAE,EAAE,CAAC,uBAAuB,CAAC,SAAS,CAAC,uBAG3C,EACP,6BACY,wBAAwB,EAClC,SAAS,EAAE,EAAE,CAAC,uBAAuB,CAAC,KAAK,CAAC,aAE3C,cAAc,mBACV,IACH,CACP,CAAC,CAAC,CAAC,IAAI,IACA,GACI,CACjB,CAAC;AACJ,CAAC"}
@@ -3,8 +3,7 @@ export declare const descriptionCardVariants: {
3
3
  readonly header: "flex items-center justify-between gap-3";
4
4
  readonly label: readonly ["text-xs font-medium uppercase tracking-[0.0667em]", "text-[var(--color-semantic-description-card-label)]"];
5
5
  readonly edit: readonly ["shrink-0 cursor-pointer rounded-sm text-xs font-medium", "text-[var(--color-semantic-description-card-action)]", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-semantic-description-card-action)]"];
6
- readonly body: readonly ["text-base font-normal leading-normal", "text-[var(--color-semantic-description-card-body)]"];
7
- readonly bodyCollapsed: "line-clamp-4";
6
+ readonly body: readonly ["text-base font-normal leading-normal whitespace-pre-wrap break-words", "text-[var(--color-semantic-description-card-body)]"];
8
7
  readonly footer: readonly ["flex items-center gap-2 text-[13px]"];
9
8
  readonly toggle: readonly ["cursor-pointer rounded-sm font-medium", "text-[var(--color-semantic-description-card-action)]", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-semantic-description-card-action)]"];
10
9
  readonly separator: readonly ["font-medium", "text-[var(--color-semantic-description-card-meta)]"];
@@ -1 +1 @@
1
- {"version":3,"file":"DescriptionCard.variants.d.ts","sourceRoot":"","sources":["../../../src/components/DescriptionCard/DescriptionCard.variants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;CAoC1B,CAAC"}
1
+ {"version":3,"file":"DescriptionCard.variants.d.ts","sourceRoot":"","sources":["../../../src/components/DescriptionCard/DescriptionCard.variants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;CAmC1B,CAAC"}
@@ -13,10 +13,9 @@ export const descriptionCardVariants = {
13
13
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-semantic-description-card-action)]",
14
14
  ],
15
15
  body: [
16
- "text-base font-normal leading-normal",
16
+ "text-base font-normal leading-normal whitespace-pre-wrap break-words",
17
17
  "text-[var(--color-semantic-description-card-body)]",
18
18
  ],
19
- bodyCollapsed: "line-clamp-4",
20
19
  footer: ["flex items-center gap-2 text-[13px]"],
21
20
  toggle: [
22
21
  "cursor-pointer rounded-sm font-medium",
@@ -1 +1 @@
1
- {"version":3,"file":"DescriptionCard.variants.js","sourceRoot":"","sources":["../../../src/components/DescriptionCard/DescriptionCard.variants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,6EAA6E;IAC7E,gDAAgD;IAChD,IAAI,EAAE,CAAC,uBAAuB,CAAC;IAC/B,MAAM,EAAE,yCAAyC;IACjD,KAAK,EAAE;QACL,mDAAmD;QACnD,qDAAqD;KACtD;IACD,IAAI,EAAE;QACJ,wDAAwD;QACxD,sDAAsD;QACtD,oHAAoH;KACrH;IACD,IAAI,EAAE;QACJ,sCAAsC;QACtC,oDAAoD;KACrD;IACD,aAAa,EAAE,cAAc;IAC7B,MAAM,EAAE,CAAC,qCAAqC,CAAC;IAC/C,MAAM,EAAE;QACN,uCAAuC;QACvC,sDAAsD;QACtD,oHAAoH;KACrH;IACD,SAAS,EAAE,CAAC,aAAa,EAAE,oDAAoD,CAAC;IAChF,KAAK,EAAE,CAAC,aAAa,EAAE,oDAAoD,CAAC;IAC5E,QAAQ,EAAE;QACR,IAAI,EAAE,uBAAuB;QAC7B,KAAK,EAAE,UAAU;QACjB,IAAI,EAAE,qBAAqB;QAC3B,QAAQ,EAAE,YAAY;QACtB,YAAY,EAAE,WAAW;QACzB,MAAM,EAAE,UAAU;QAClB,KAAK,EAAE,UAAU;KAClB;CACO,CAAC"}
1
+ {"version":3,"file":"DescriptionCard.variants.js","sourceRoot":"","sources":["../../../src/components/DescriptionCard/DescriptionCard.variants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,6EAA6E;IAC7E,gDAAgD;IAChD,IAAI,EAAE,CAAC,uBAAuB,CAAC;IAC/B,MAAM,EAAE,yCAAyC;IACjD,KAAK,EAAE;QACL,mDAAmD;QACnD,qDAAqD;KACtD;IACD,IAAI,EAAE;QACJ,wDAAwD;QACxD,sDAAsD;QACtD,oHAAoH;KACrH;IACD,IAAI,EAAE;QACJ,sEAAsE;QACtE,oDAAoD;KACrD;IACD,MAAM,EAAE,CAAC,qCAAqC,CAAC;IAC/C,MAAM,EAAE;QACN,uCAAuC;QACvC,sDAAsD;QACtD,oHAAoH;KACrH;IACD,SAAS,EAAE,CAAC,aAAa,EAAE,oDAAoD,CAAC;IAChF,KAAK,EAAE,CAAC,aAAa,EAAE,oDAAoD,CAAC;IAC5E,QAAQ,EAAE;QACR,IAAI,EAAE,uBAAuB;QAC7B,KAAK,EAAE,UAAU;QACjB,IAAI,EAAE,qBAAqB;QAC3B,QAAQ,EAAE,YAAY;QACtB,YAAY,EAAE,WAAW;QACzB,MAAM,EAAE,UAAU;QAClB,KAAK,EAAE,UAAU;KAClB;CACO,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import type { DropdownButtonProps } from "./DropdownButton.types.js";
2
- declare function DropdownButton({ label, items, actionItems, onPrimaryAction, onItemSelect, minWidth, disabled, open: openProp, defaultOpen, onOpenChange, className, }: DropdownButtonProps): import("react/jsx-runtime").JSX.Element;
2
+ declare function DropdownButton({ label, items, actionItems, onPrimaryAction, onItemSelect, minWidth, disabled, open: openProp, defaultOpen, onOpenChange, avoidCollisions, container, className, }: DropdownButtonProps): import("react/jsx-runtime").JSX.Element;
3
3
  export { DropdownButton };
4
4
  //# sourceMappingURL=DropdownButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownButton.d.ts","sourceRoot":"","sources":["../../../src/components/DropdownButton/DropdownButton.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAEV,mBAAmB,EACpB,MAAM,2BAA2B,CAAC;AAenC,iBAAS,cAAc,CAAC,EACtB,KAAK,EACL,KAAK,EACL,WAAW,EACX,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,QAAgB,EAChB,IAAI,EAAE,QAAQ,EACd,WAAmB,EACnB,YAAY,EACZ,SAAS,GACV,EAAE,mBAAmB,2CAwIrB;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"DropdownButton.d.ts","sourceRoot":"","sources":["../../../src/components/DropdownButton/DropdownButton.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAEV,mBAAmB,EACpB,MAAM,2BAA2B,CAAC;AAenC,iBAAS,cAAc,CAAC,EACtB,KAAK,EACL,KAAK,EACL,WAAW,EACX,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,QAAgB,EAChB,IAAI,EAAE,QAAQ,EACd,WAAmB,EACnB,YAAY,EACZ,eAAsB,EACtB,SAAS,EACT,SAAS,GACV,EAAE,mBAAmB,2CA2JrB;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -4,12 +4,30 @@ import { ChevronDown, CircleCheck, CircleX } from "lucide-react";
4
4
  import * as React from "react";
5
5
  import { cn } from "../../lib/cn.js";
6
6
  import { dropdownButtonActionClasses, dropdownButtonActiveLabelClasses, dropdownButtonChevronClasses, dropdownButtonContainerClasses, dropdownButtonMenuContentClasses, dropdownButtonMenuItemClasses, dropdownButtonMenuSeparatorClasses, dropdownButtonNegativeIconClasses, dropdownButtonPositiveIconClasses, dropdownButtonTerminalIconClasses, dropdownButtonTriggerClasses, } from "./DropdownButton.variants.js";
7
- function DropdownButton({ label, items, actionItems, onPrimaryAction, onItemSelect, minWidth, disabled = false, open: openProp, defaultOpen = false, onOpenChange, className, }) {
7
+ function DropdownButton({ label, items, actionItems, onPrimaryAction, onItemSelect, minWidth, disabled = false, open: openProp, defaultOpen = false, onOpenChange, avoidCollisions = true, container, className, }) {
8
8
  // Track open state internally so we can drive the container border-radius and
9
9
  // chevron rotation regardless of controlled vs. uncontrolled usage.
10
10
  const isControlled = openProp !== undefined;
11
11
  const [internalOpen, setInternalOpen] = React.useState(defaultOpen);
12
12
  const isOpen = isControlled ? openProp : internalOpen;
13
+ // Track which side Radix actually places the menu on (may flip from "bottom" to
14
+ // "top" when avoidCollisions repositions it near the viewport edge).
15
+ const [openSide, setOpenSide] = React.useState("bottom");
16
+ const sideObserverRef = React.useRef(null);
17
+ const contentCallbackRef = React.useCallback((el) => {
18
+ sideObserverRef.current?.disconnect();
19
+ if (!el)
20
+ return;
21
+ const sync = () => {
22
+ const s = el.getAttribute("data-side");
23
+ if (s === "top" || s === "bottom")
24
+ setOpenSide(s);
25
+ };
26
+ sync();
27
+ const obs = new MutationObserver(sync);
28
+ obs.observe(el, { attributes: true, attributeFilter: ["data-side"] });
29
+ sideObserverRef.current = obs;
30
+ }, []);
13
31
  // Label updates to the selected item label when picked from the dropdown.
14
32
  // Resets if the parent changes the label prop.
15
33
  const [displayLabel, setDisplayLabel] = React.useState(label);
@@ -19,14 +37,14 @@ function DropdownButton({ label, items, actionItems, onPrimaryAction, onItemSele
19
37
  setInternalOpen(next);
20
38
  onOpenChange?.(next);
21
39
  }, [isControlled, onOpenChange]);
22
- return (_jsxs(DropdownMenuPrimitive.Root, { open: isControlled ? openProp : internalOpen, onOpenChange: handleOpenChange, modal: false, children: [_jsx(DropdownMenuPrimitive.Trigger, { asChild: true, disabled: disabled, children: _jsxs("div", { "data-slot": "dropdown-button", "data-state": isOpen ? "open" : "closed", "data-disabled": disabled || undefined, className: cn(dropdownButtonContainerClasses, className), style: minWidth !== undefined ? { minWidth } : undefined, children: [_jsx("button", { "data-slot": "dropdown-button-action", type: "button", onPointerDown: (e) => e.stopPropagation(), onClick: (e) => {
40
+ return (_jsxs(DropdownMenuPrimitive.Root, { open: isControlled ? openProp : internalOpen, onOpenChange: handleOpenChange, modal: false, children: [_jsx(DropdownMenuPrimitive.Trigger, { asChild: true, disabled: disabled, children: _jsxs("div", { "data-slot": "dropdown-button", "data-state": isOpen ? "open" : "closed", "data-open-side": isOpen ? openSide : undefined, "data-disabled": disabled || undefined, className: cn(dropdownButtonContainerClasses, className), style: minWidth !== undefined ? { minWidth } : undefined, children: [_jsx("button", { "data-slot": "dropdown-button-action", type: "button", onPointerDown: (e) => e.stopPropagation(), onClick: (e) => {
23
41
  e.stopPropagation();
24
42
  onPrimaryAction();
25
43
  }, onKeyDown: (e) => {
26
44
  if (e.key === "Enter" || e.key === " ")
27
45
  e.stopPropagation();
28
46
  }, disabled: disabled, className: cn(dropdownButtonActionClasses), children: _jsx("span", { children: displayLabel }) }), _jsx("div", { "data-slot": "dropdown-button-trigger", "aria-hidden": "true", className: cn(dropdownButtonTriggerClasses, isOpen &&
29
- "bg-[var(--color-semantic-dropdown-btn-trigger-open-bg)] hover:bg-[var(--color-semantic-dropdown-btn-trigger-open-bg)]"), children: _jsx(ChevronDown, { className: cn(dropdownButtonChevronClasses, isOpen && "rotate-180") }) })] }) }), _jsx(DropdownMenuPrimitive.Portal, { children: _jsxs(DropdownMenuPrimitive.Content, { "data-slot": "dropdown-button-content", side: "bottom", align: "start", sideOffset: 0, avoidCollisions: false, className: cn(dropdownButtonMenuContentClasses), children: [items.map((item) => (_jsxs(DropdownMenuPrimitive.Item, { "data-slot": "dropdown-button-item", disabled: item.isActive, onSelect: item.isActive ? undefined : () => {
47
+ "bg-[var(--color-semantic-dropdown-btn-trigger-open-bg)] hover:bg-[var(--color-semantic-dropdown-btn-trigger-open-bg)]"), children: _jsx(ChevronDown, { className: cn(dropdownButtonChevronClasses, isOpen && "rotate-180") }) })] }) }), _jsx(DropdownMenuPrimitive.Portal, { container: container, children: _jsxs(DropdownMenuPrimitive.Content, { ref: contentCallbackRef, "data-slot": "dropdown-button-content", side: "bottom", align: "start", sideOffset: 0, avoidCollisions: avoidCollisions, className: cn(dropdownButtonMenuContentClasses), children: [items.map((item) => (_jsxs(DropdownMenuPrimitive.Item, { "data-slot": "dropdown-button-item", disabled: item.isActive, onSelect: item.isActive ? undefined : () => {
30
48
  setDisplayLabel(item.label);
31
49
  onItemSelect?.(item);
32
50
  item.onSelect();
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownButton.js","sourceRoot":"","sources":["../../../src/components/DropdownButton/DropdownButton.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,qBAAqB,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAKrC,OAAO,EACL,2BAA2B,EAC3B,gCAAgC,EAChC,4BAA4B,EAC5B,8BAA8B,EAC9B,gCAAgC,EAChC,6BAA6B,EAC7B,kCAAkC,EAClC,iCAAiC,EACjC,iCAAiC,EACjC,iCAAiC,EACjC,4BAA4B,GAC7B,MAAM,8BAA8B,CAAC;AAEtC,SAAS,cAAc,CAAC,EACtB,KAAK,EACL,KAAK,EACL,WAAW,EACX,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,QAAQ,GAAG,KAAK,EAChB,IAAI,EAAE,QAAQ,EACd,WAAW,GAAG,KAAK,EACnB,YAAY,EACZ,SAAS,GACW;IACpB,8EAA8E;IAC9E,oEAAoE;IACpE,MAAM,YAAY,GAAG,QAAQ,KAAK,SAAS,CAAC;IAC5C,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IACpE,MAAM,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC;IAEtD,0EAA0E;IAC1E,+CAA+C;IAC/C,MAAM,CAAC,YAAY,EAAE,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AcY,CAC9B,CAAC,EAED,WAAW,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,IAAI,CACxC,8BACE,2BACY,2BAA2B,EACrC,SAAS,EAAE,EAAE,CAAC,kCAAkC,CAAC,GACjD,EACD,WAAW,CAAC,GAAG,CAAC,CAAC,MAAgC,EAAE,EAAE;oCACpD,MAAM,cAAc,GAClB,MAAM,CAAC,WAAW,KAAK,UAAU;wCAC/B,CAAC,CAAC,iCAAiC;wCACnC,CAAC,CAAC,iCAAiC,CAAC;oCACxC,MAAM,WAAW,GACf,MAAM,CAAC,WAAW,KAAK,UAAU,CAAC,CAAC,CAAC,KAAC,OAAO,KAAG,CAAC,CAAC,CAAC,KAAC,WAAW,KAAG,CAAC;oCACpE,OAAO,CACL,MAAC,qBAAqB,CAAC,IAAI,iBAEf,6BAA6B,EACvC,QAAQ,EAAE,MAAM,CAAC,QAAQ,EACzB,SAAS,EAAE,EAAE,CAAC,6BAA6B,CAAC,aAE5C,eACE,SAAS,EAAE,EAAE,CAAC,cAAc,EAAE,iCAAiC,CAAC,YAE/D,MAAM,CAAC,IAAI,IAAI,WAAW,GACtB,EACP,yBAAO,MAAM,CAAC,KAAK,GAAQ,KAVtB,MAAM,CAAC,KAAK,CAWU,CAC9B,CAAC;gCACJ,CAAC,CAAC,IACD,CACJ,IAC6B,GACH,IACJ,CAC9B,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"DropdownButton.js","sourceRoot":"","sources":["../../../src/components/DropdownButton/DropdownButton.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,qBAAqB,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAKrC,OAAO,EACL,2BAA2B,EAC3B,gCA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,CAAC,CAAC,IACD,CACJ,IAC6B,GACH,IACJ,CAC9B,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -49,6 +49,17 @@ export type DropdownButtonProps = {
49
49
  defaultOpen?: boolean;
50
50
  /** Called when the dropdown open state changes. */
51
51
  onOpenChange?: (open: boolean) => void;
52
+ /**
53
+ * Whether the dropdown content should avoid collisions with the viewport
54
+ * edges. Defaults to `true`. Set to `false` to disable repositioning.
55
+ */
56
+ avoidCollisions?: boolean;
57
+ /**
58
+ * DOM element to render the dropdown portal into. Defaults to `document.body`.
59
+ * Pass a scroll container element (e.g. `document.getElementById('my-list')`)
60
+ * so the menu stays anchored when the page scrolls.
61
+ */
62
+ container?: HTMLElement | null;
52
63
  className?: string;
53
64
  };
54
65
  //# sourceMappingURL=DropdownButton.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownButton.types.d.ts","sourceRoot":"","sources":["../../../src/components/DropdownButton/DropdownButton.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,oFAAoF;IACpF,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,+DAA+D;IAC/D,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB;;;;OAIG;IACH,WAAW,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IACtC,oFAAoF;IACpF,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,6EAA6E;IAC7E,KAAK,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,KAAK,EAAE,kBAAkB,EAAE,CAAC;IAC5B,6EAA6E;IAC7E,WAAW,CAAC,EAAE,wBAAwB,EAAE,CAAC;IACzC,6DAA6D;IAC7D,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B;;;;OAIG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAClD;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,gEAAgE;IAChE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8CAA8C;IAC9C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,uCAAuC;IACvC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,mDAAmD;IACnD,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
1
+ {"version":3,"file":"DropdownButton.types.d.ts","sourceRoot":"","sources":["../../../src/components/DropdownButton/DropdownButton.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,oFAAoF;IACpF,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,+DAA+D;IAC/D,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB;;;;OAIG;IACH,WAAW,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IACtC,oFAAoF;IACpF,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,6EAA6E;IAC7E,KAAK,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,KAAK,EAAE,kBAAkB,EAAE,CAAC;IAC5B,6EAA6E;IAC7E,WAAW,CAAC,EAAE,wBAAwB,EAAE,CAAC;IACzC,6DAA6D;IAC7D,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B;;;;OAIG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAClD;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,gEAAgE;IAChE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8CAA8C;IAC9C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,uCAAuC;IACvC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,mDAAmD;IACnD,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
@@ -1,5 +1,5 @@
1
- /** Outer unified pill container — shared border + bg; bottom radius removed when open */
2
- export declare const dropdownButtonContainerClasses: readonly ["inline-flex items-center", "h-9 pl-3 pr-[3px] py-[3px]", "rounded-[9px]", "bg-[var(--color-semantic-button-primary-bg)]", "border border-[var(--color-semantic-button-primary-bg)]", "[transition:border-radius_300ms_ease]", "data-[state=open]:rounded-b-none", "data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50"];
1
+ /** Outer unified pill container — shared border + bg; adjacent corners flatten to connect with the menu */
2
+ export declare const dropdownButtonContainerClasses: readonly ["inline-flex items-center", "h-9 pl-3 pr-[3px] py-[3px]", "rounded-[9px]", "bg-[var(--color-semantic-button-primary-bg)]", "border border-[var(--color-semantic-button-primary-bg)]", "[transition:border-radius_300ms_ease]", "data-[open-side=bottom]:rounded-b-none", "data-[open-side=top]:rounded-t-none", "data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50"];
3
3
  /** Left action button — fills remaining width inside the container */
4
4
  export declare const dropdownButtonActionClasses: readonly ["inline-flex flex-1 items-center gap-2 h-full pr-3", "text-[var(--color-semantic-button-primary-fg)]", "text-sm font-medium leading-5 whitespace-nowrap", "cursor-pointer rounded-[6px] transition-colors", "hover:bg-white/15", "active:bg-white/20", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-semantic-button-primary-focus)] focus-visible:ring-offset-1", "disabled:pointer-events-none disabled:opacity-50", "[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0"];
5
5
  /** Right chevron trigger — inset 30×30 blue button */
@@ -7,7 +7,7 @@ export declare const dropdownButtonTriggerClasses: readonly ["inline-flex items-
7
7
  /** Chevron icon — rotates when dropdown is open */
8
8
  export declare const dropdownButtonChevronClasses: readonly ["transition-transform duration-200"];
9
9
  /** Attached dropdown panel */
10
- export declare const dropdownButtonMenuContentClasses: readonly ["z-[80] overflow-hidden", "min-w-[var(--radix-popper-anchor-width)]", "p-3", "rounded-t-none rounded-b-[9px]", "bg-[var(--color-semantic-dropdown-btn-menu-bg)]", "data-[state=open]:animate-in data-[state=closed]:animate-out", "data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0", "data-[state=open]:slide-in-from-top-1 data-[state=closed]:slide-out-to-top-1", "duration-300"];
10
+ export declare const dropdownButtonMenuContentClasses: readonly ["z-[80] overflow-hidden", "min-w-[var(--radix-popper-anchor-width)]", "p-3", "data-[side=bottom]:rounded-t-none data-[side=bottom]:rounded-b-[9px]", "data-[side=top]:rounded-b-none data-[side=top]:rounded-t-[9px]", "bg-[var(--color-semantic-dropdown-btn-menu-bg)]", "data-[state=open]:animate-in data-[state=closed]:animate-out", "data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0", "data-[side=bottom]:data-[state=open]:slide-in-from-top-1 data-[side=bottom]:data-[state=closed]:slide-out-to-top-1", "data-[side=top]:data-[state=open]:slide-in-from-bottom-1 data-[side=top]:data-[state=closed]:slide-out-to-bottom-1", "duration-300"];
11
11
  /** Individual dropdown item */
12
12
  export declare const dropdownButtonMenuItemClasses: readonly ["relative flex cursor-default select-none items-center gap-2", "h-8 rounded-lg px-3 text-sm font-medium outline-hidden overflow-hidden", "text-[var(--color-semantic-dropdown-btn-menu-fg)]", "focus:bg-[var(--color-semantic-dropdown-btn-menu-item-hover-bg)]", "data-[highlighted]:bg-[var(--color-semantic-dropdown-btn-menu-item-hover-bg)]", "data-[disabled]:pointer-events-none data-[disabled]:opacity-40"];
13
13
  /** "Active" label badge on the current item */
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownButton.variants.d.ts","sourceRoot":"","sources":["../../../src/components/DropdownButton/DropdownButton.variants.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,eAAO,MAAM,8BAA8B,0VAajC,CAAC;AAEX,sEAAsE;AACtE,eAAO,MAAM,2BAA2B,0hBAe9B,CAAC;AAEX,sDAAsD;AACtD,eAAO,MAAM,4BAA4B,8hBAa/B,CAAC;AAEX,mDAAmD;AACnD,eAAO,MAAM,4BAA4B,gDAE/B,CAAC;AAEX,8BAA8B;AAC9B,eAAO,MAAM,gCAAgC,2YAcnC,CAAC;AAEX,+BAA+B;AAC/B,eAAO,MAAM,6BAA6B,gaAOhC,CAAC;AAEX,+CAA+C;AAC/C,eAAO,MAAM,gCAAgC,8CAEnC,CAAC;AAEX,+CAA+C;AAC/C,eAAO,MAAM,kCAAkC,iFAErC,CAAC;AAEX,eAAO,MAAM,iCAAiC,0EAEpC,CAAC;AAEX,eAAO,MAAM,iCAAiC,oEAEpC,CAAC;AAEX,eAAO,MAAM,iCAAiC,oEAEpC,CAAC"}
1
+ {"version":3,"file":"DropdownButton.variants.d.ts","sourceRoot":"","sources":["../../../src/components/DropdownButton/DropdownButton.variants.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAC3G,eAAO,MAAM,8BAA8B,uYAcjC,CAAC;AAEX,sEAAsE;AACtE,eAAO,MAAM,2BAA2B,0hBAe9B,CAAC;AAEX,sDAAsD;AACtD,eAAO,MAAM,4BAA4B,8hBAa/B,CAAC;AAEX,mDAAmD;AACnD,eAAO,MAAM,4BAA4B,gDAE/B,CAAC;AAEX,8BAA8B;AAC9B,eAAO,MAAM,gCAAgC,+oBAiBnC,CAAC;AAEX,+BAA+B;AAC/B,eAAO,MAAM,6BAA6B,gaAOhC,CAAC;AAEX,+CAA+C;AAC/C,eAAO,MAAM,gCAAgC,8CAEnC,CAAC;AAEX,+CAA+C;AAC/C,eAAO,MAAM,kCAAkC,iFAErC,CAAC;AAEX,eAAO,MAAM,iCAAiC,0EAEpC,CAAC;AAEX,eAAO,MAAM,iCAAiC,oEAEpC,CAAC;AAEX,eAAO,MAAM,iCAAiC,oEAEpC,CAAC"}
@@ -1,4 +1,4 @@
1
- /** Outer unified pill container — shared border + bg; bottom radius removed when open */
1
+ /** Outer unified pill container — shared border + bg; adjacent corners flatten to connect with the menu */
2
2
  export const dropdownButtonContainerClasses = [
3
3
  // Layout
4
4
  "inline-flex items-center",
@@ -7,9 +7,10 @@ export const dropdownButtonContainerClasses = [
7
7
  // Colors
8
8
  "bg-[var(--color-semantic-button-primary-bg)]",
9
9
  "border border-[var(--color-semantic-button-primary-bg)]",
10
- // Open state: flatten bottom corners, transition so it eases with the dropdown
10
+ // Open state: flatten the edge that connects to the menu (top or bottom depending on which way it opens)
11
11
  "[transition:border-radius_300ms_ease]",
12
- "data-[state=open]:rounded-b-none",
12
+ "data-[open-side=bottom]:rounded-b-none",
13
+ "data-[open-side=top]:rounded-t-none",
13
14
  // Disabled
14
15
  "data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50",
15
16
  ];
@@ -55,14 +56,17 @@ export const dropdownButtonMenuContentClasses = [
55
56
  "z-[80] overflow-hidden",
56
57
  "min-w-[var(--radix-popper-anchor-width)]",
57
58
  "p-3",
58
- // Shape: top is flat (connects to button), bottom has rounding
59
- "rounded-t-none rounded-b-[9px]",
59
+ // Shape: the edge that touches the button is flat; the far edge is rounded.
60
+ // Radix sets data-side="bottom" (opens down) or data-side="top" (opens up).
61
+ "data-[side=bottom]:rounded-t-none data-[side=bottom]:rounded-b-[9px]",
62
+ "data-[side=top]:rounded-b-none data-[side=top]:rounded-t-[9px]",
60
63
  // Colors
61
64
  "bg-[var(--color-semantic-dropdown-btn-menu-bg)]",
62
- // Animation — slides down from the button, rolls back up on close
65
+ // Animation — slides toward the button on close, away from it on open.
63
66
  "data-[state=open]:animate-in data-[state=closed]:animate-out",
64
67
  "data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0",
65
- "data-[state=open]:slide-in-from-top-1 data-[state=closed]:slide-out-to-top-1",
68
+ "data-[side=bottom]:data-[state=open]:slide-in-from-top-1 data-[side=bottom]:data-[state=closed]:slide-out-to-top-1",
69
+ "data-[side=top]:data-[state=open]:slide-in-from-bottom-1 data-[side=top]:data-[state=closed]:slide-out-to-bottom-1",
66
70
  "duration-300",
67
71
  ];
68
72
  /** Individual dropdown item */
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownButton.variants.js","sourceRoot":"","sources":["../../../src/components/DropdownButton/DropdownButton.variants.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,SAAS;IACT,0BAA0B;IAC1B,4BAA4B;IAC5B,eAAe;IACf,SAAS;IACT,8CAA8C;IAC9C,yDAAyD;IACzD,+EAA+E;IAC/E,uCAAuC;IACvC,kCAAkC;IAClC,WAAW;IACX,0EAA0E;CAClE,CAAC;AAEX,sEAAsE;AACtE,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,SAAS;IACT,mDAAmD;IACnD,SAAS;IACT,gDAAgD;IAChD,aAAa;IACb,iDAAiD;IACjD,6FAA6F;IAC7F,gDAAgD;IAChD,mBAAmB;IACnB,oBAAoB;IACpB,6IAA6I;IAC7I,kDAAkD;IAClD,cAAc;IACd,mFAAmF;CAC3E,CAAC;AAEX,sDAAsD;AACtD,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,SAAS;IACT,yCAAyC;IACzC,oCAAoC;IACpC,kEAAkE;IAClE,oDAAoD;IACpD,gDAAgD;IAChD,SAAS;IACT,gEAAgE;IAChE,6IAA6I;IAC7I,kDAAkD;IAClD,cAAc;IACd,mFAAmF;CAC3E,CAAC;AAEX,mDAAmD;AACnD,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,mCAAmC;CAC3B,CAAC;AAEX,8BAA8B;AAC9B,MAAM,CAAC,MAAM,gCAAgC,GAAG;IAC9C,uDAAuD;IACvD,wBAAwB;IACxB,0CAA0C;IAC1C,KAAK;IACL,+DAA+D;IAC/D,gCAAgC;IAChC,SAAS;IACT,iDAAiD;IACjD,kEAAkE;IAClE,8DAA8D;IAC9D,4DAA4D;IAC5D,8EAA8E;IAC9E,cAAc;CACN,CAAC;AAEX,+BAA+B;AAC/B,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,6DAA6D;IAC7D,wEAAwE;IACxE,mDAAmD;IACnD,kEAAkE;IAClE,+EAA+E;IAC/E,gEAAgE;CACxD,CAAC;AAEX,+CAA+C;AAC/C,MAAM,CAAC,MAAM,gCAAgC,GAAG;IAC9C,iCAAiC;CACzB,CAAC;AAEX,+CAA+C;AAC/C,MAAM,CAAC,MAAM,kCAAkC,GAAG;IAChD,oEAAoE;CAC5D,CAAC;AAEX,MAAM,CAAC,MAAM,iCAAiC,GAAG;IAC/C,6DAA6D;CACrD,CAAC;AAEX,MAAM,CAAC,MAAM,iCAAiC,GAAG;IAC/C,uDAAuD;CAC/C,CAAC;AAEX,MAAM,CAAC,MAAM,iCAAiC,GAAG;IAC/C,uDAAuD;CAC/C,CAAC"}
1
+ {"version":3,"file":"DropdownButton.variants.js","sourceRoot":"","sources":["../../../src/components/DropdownButton/DropdownButton.variants.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAC3G,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,SAAS;IAC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,gCAAgC,GAAG;IAC9C,iCAAiC;CACzB,CAAC;AAEX,+CAA+C;AAC/C,MAAM,CAAC,MAAM,kCAAkC,GAAG;IAChD,oEAAoE;CAC5D,CAAC;AAEX,MAAM,CAAC,MAAM,iCAAiC,GAAG;IAC/C,6DAA6D;CACrD,CAAC;AAEX,MAAM,CAAC,MAAM,iCAAiC,GAAG;IAC/C,uDAAuD;CAC/C,CAAC;AAEX,MAAM,CAAC,MAAM,iCAAiC,GAAG;IAC/C,uDAAuD;CAC/C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powered-by-array/ui",
3
- "version": "1.76.0",
3
+ "version": "1.77.1",
4
4
  "description": "ArrayHQ design system UI components",
5
5
  "type": "module",
6
6
  "repository": {