@faststore/ui 1.6.17 → 1.6.20
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 +33 -0
- package/dist/index.d.ts +2 -0
- package/dist/ui.cjs.development.js +285 -0
- package/dist/ui.cjs.development.js.map +1 -1
- package/dist/ui.cjs.production.min.js +1 -1
- package/dist/ui.cjs.production.min.js.map +1 -1
- package/dist/ui.esm.js +282 -1
- package/dist/ui.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +13 -0
- package/src/molecules/Dropdown/hooks/useDropdownPosition.ts +4 -4
- package/src/molecules/Dropdown/stories/Dropdown.mdx +13 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/ui",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.20",
|
|
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.
|
|
79
|
+
"@vtex/theme-b2c-tailwind": "^1.6.20",
|
|
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": "
|
|
92
|
+
"gitHead": "7e8b0399ddf4ffc6217fd14ca2a3b6e2cee78627"
|
|
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 =
|
|
17
|
-
const topOffset =
|
|
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 =
|
|
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
|
-
#
|
|
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:
|