@agility/plenum-ui 2.1.3 → 2.1.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/dist/index.d.ts +229 -228
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/tailwind.css +8 -0
- package/dist/types/stories/organisms/DropdownComponent/DropdownComponent.d.ts +1 -0
- package/package.json +1 -1
- package/stories/organisms/DropdownComponent/Dropdown.stories.tsx +8 -0
- package/stories/organisms/DropdownComponent/DropdownComponent.tsx +14 -2
package/dist/tailwind.css
CHANGED
|
@@ -59222,4 +59222,12 @@ select {
|
|
|
59222
59222
|
font-size: 0.875rem;
|
|
59223
59223
|
line-height: 1.25rem;
|
|
59224
59224
|
}
|
|
59225
|
+
}
|
|
59226
|
+
|
|
59227
|
+
.\[\&\>path\:first-of-type\]\:stroke-gray-300>path:first-of-type {
|
|
59228
|
+
stroke: #D1D5DB;
|
|
59229
|
+
}
|
|
59230
|
+
|
|
59231
|
+
.\[\&\>path\:last-of-type\]\:stroke-white>path:last-of-type {
|
|
59232
|
+
stroke: #fff;
|
|
59225
59233
|
}
|
package/package.json
CHANGED
|
@@ -15,7 +15,9 @@ import {
|
|
|
15
15
|
FloatingList,
|
|
16
16
|
useTransitionStyles,
|
|
17
17
|
Placement,
|
|
18
|
-
useListNavigation
|
|
18
|
+
useListNavigation,
|
|
19
|
+
FloatingArrow,
|
|
20
|
+
arrow
|
|
19
21
|
} from "@floating-ui/react"
|
|
20
22
|
|
|
21
23
|
import { ClassNameWithAutocomplete } from "utils/types"
|
|
@@ -54,6 +56,7 @@ export interface IDropdownProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
54
56
|
disabled?: boolean
|
|
55
57
|
onFocus?: () => void
|
|
56
58
|
onBlur?: () => void
|
|
59
|
+
showFloatingArrow?: boolean
|
|
57
60
|
}
|
|
58
61
|
export const defaultClassNames = {
|
|
59
62
|
groupClassname: "flex inline-block text-left",
|
|
@@ -85,6 +88,7 @@ const Dropdown: React.FC<IDropdownProps> = ({
|
|
|
85
88
|
disabled,
|
|
86
89
|
onFocus,
|
|
87
90
|
onBlur,
|
|
91
|
+
showFloatingArrow = false,
|
|
88
92
|
...props
|
|
89
93
|
}: IDropdownProps): JSX.Element | null => {
|
|
90
94
|
const [isOpen, setIsOpen] = useState(false)
|
|
@@ -92,6 +96,7 @@ const Dropdown: React.FC<IDropdownProps> = ({
|
|
|
92
96
|
const [activeIndex, setActiveIndex] = useState<number | null>(null)
|
|
93
97
|
|
|
94
98
|
const listRef = useRef<(HTMLButtonElement | null)[]>([])
|
|
99
|
+
const arrowRef = React.useRef(null)
|
|
95
100
|
|
|
96
101
|
// Floating UI logic
|
|
97
102
|
const { refs, floatingStyles, context } = useFloating({
|
|
@@ -113,7 +118,11 @@ const Dropdown: React.FC<IDropdownProps> = ({
|
|
|
113
118
|
autoPlacement({
|
|
114
119
|
allowedPlacements: [placement, "bottom-start", "bottom-end", "bottom"]
|
|
115
120
|
}),
|
|
116
|
-
shift({ rootBoundary: "document" })
|
|
121
|
+
shift({ rootBoundary: "document" }),
|
|
122
|
+
arrow({
|
|
123
|
+
element: arrowRef,
|
|
124
|
+
padding: 4
|
|
125
|
+
})
|
|
117
126
|
],
|
|
118
127
|
whileElementsMounted: autoUpdate
|
|
119
128
|
})
|
|
@@ -351,6 +360,9 @@ const Dropdown: React.FC<IDropdownProps> = ({
|
|
|
351
360
|
}}
|
|
352
361
|
>
|
|
353
362
|
{ItemComponents}
|
|
363
|
+
{showFloatingArrow &&
|
|
364
|
+
<FloatingArrow ref={arrowRef} context={context} strokeWidth={1}
|
|
365
|
+
className={cn(defaultClassNames.itemsClassname, itemsClassname, "fill-white [&>path:first-of-type]:stroke-gray-300 [&>path:last-of-type]:stroke-white")}/>}
|
|
354
366
|
</div>
|
|
355
367
|
</FloatingFocusManager>
|
|
356
368
|
</FloatingPortal>
|