@faststore/ui 1.6.18 → 1.6.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/ui",
3
- "version": "1.6.18",
3
+ "version": "1.6.21",
4
4
  "description": "A lightweight, framework agnostic component library for React",
5
5
  "author": "emersonlaurentino",
6
6
  "license": "MIT",
@@ -76,7 +76,7 @@
76
76
  "@types/jest-axe": "^3.5.3",
77
77
  "@types/tabbable": "^3.1.1",
78
78
  "@types/testing-library__jest-dom": "^5.9.5",
79
- "@vtex/theme-b2c-tailwind": "^1.6.18",
79
+ "@vtex/theme-b2c-tailwind": "^1.6.21",
80
80
  "@vtex/tsconfig": "^0.5.0",
81
81
  "chalk": "^5.0.0",
82
82
  "jest-axe": "^5.0.1",
@@ -89,5 +89,5 @@
89
89
  "tsdx": "^0.14.1",
90
90
  "typescript": "^4.2.4"
91
91
  },
92
- "gitHead": "92a2ddacf6ae51bdeb43542cf0f7c36bba451d08"
92
+ "gitHead": "b1c9d5184b8bb57693b879950b6314bb74ead712"
93
93
  }
package/src/index.ts CHANGED
@@ -136,6 +136,19 @@ export type { AlertProps } from './molecules/Alert'
136
136
  export { default as QuantitySelector } from './molecules/QuantitySelector'
137
137
  export type { QuantitySelectorProps } from './molecules/QuantitySelector'
138
138
 
139
+ export {
140
+ default as Dropdown,
141
+ DropdownButton,
142
+ DropdownItem,
143
+ DropdownMenu,
144
+ } from './molecules/Dropdown'
145
+ export type {
146
+ DropdownProps,
147
+ DropdownButtonProps,
148
+ DropdownItemProps,
149
+ DropdownMenuProps,
150
+ } from './molecules/Dropdown'
151
+
139
152
  // Organisms
140
153
  export {
141
154
  default as Card,
@@ -12,11 +12,11 @@ type DropdownPosition = {
12
12
  */
13
13
  export const useDropdownPosition = (): DropdownPosition => {
14
14
  const { dropdownButtonRef } = useDropdown()
15
-
16
- const topLevel = dropdownButtonRef?.current?.offsetTop ?? 0
17
- const topOffset = dropdownButtonRef?.current?.offsetHeight ?? 0
15
+ const buttonRect = dropdownButtonRef?.current?.getBoundingClientRect()
16
+ const topLevel: number = buttonRect?.top ?? 0
17
+ const topOffset: number = buttonRect?.height ?? 0
18
18
  const topPosition = topLevel + topOffset
19
- const leftPosition = dropdownButtonRef?.current?.offsetLeft ?? 0
19
+ const leftPosition = buttonRect?.left ?? 0
20
20
 
21
21
  return {
22
22
  position: 'absolute',
@@ -5,12 +5,24 @@ import DropdownButton from '../DropdownButton'
5
5
  import DropdownItem from '../DropdownItem'
6
6
  import DropdownMenu from '../DropdownMenu'
7
7
 
8
- # Dropdown
8
+ # DropdownUncontrolled
9
9
 
10
10
  <Canvas>
11
11
  <Story id="molecules-dropdown--uncontrolled" />
12
12
  </Canvas>
13
13
 
14
+ # DropdownControlled
15
+
16
+ <Canvas>
17
+ <Story id="molecules-dropdown--controlled" />
18
+ </Canvas>
19
+
20
+ # DropdownSelectable
21
+
22
+ <Canvas>
23
+ <Story id="molecules-dropdown--selectable" />
24
+ </Canvas>
25
+
14
26
  ## Components
15
27
 
16
28
  The `Dropdown` uses the [Compound Component](https://kentcdodds.com/blog/compound-components-with-react-hooks) pattern, its components are: