Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
935b500
feat: dismissable layer component
dammy001 Aug 4, 2023
6b1965a
fix: lint issues
autofix-ci[bot] Aug 4, 2023
7eb3281
chore: update package
dammy001 Aug 6, 2023
556e1b3
chore: update package
dammy001 Aug 6, 2023
d60e84a
chore: fix build
dammy001 Aug 6, 2023
d46c66c
chore: add tests and stories
dammy001 Aug 7, 2023
1123a7e
Merge branch 'main' into feat/dismissable-layer
dammy001 Aug 7, 2023
1e94e3d
fix: lint issues
autofix-ci[bot] Aug 7, 2023
24eee23
chore: update
dammy001 Aug 7, 2023
9e10000
Merge branch 'feat/dismissable-layer' of https://github.com/oku-ui/pr…
dammy001 Aug 7, 2023
efc9183
Merge branch 'main' into feat/dismissable-layer
productdevbook Aug 12, 2023
aa9567e
refactor: dismisslable layer (#281)
productdevbook Aug 14, 2023
06e59a7
Revert "refactor: dismisslable layer (#281)"
productdevbook Aug 14, 2023
9718205
Merge branch 'main' into feat/dismissable-layer
productdevbook Aug 14, 2023
703bdee
refaktor: struct
productdevbook Aug 14, 2023
1f2ee85
chore: add types
productdevbook Aug 14, 2023
58ac1f8
Merge branch 'main' into feat/dismissable-layer
dammy001 Aug 17, 2023
6880004
chore: fix conflict
dammy001 Aug 20, 2023
c5bf6ac
chore: update storybook examples
dammy001 Aug 20, 2023
e9ed3c0
feat: add focus guards component
dammy001 Aug 21, 2023
2136bc0
feat: add focus guards component
dammy001 Aug 21, 2023
beaa62a
chore: fix conflicts
dammy001 Aug 21, 2023
bd575dd
fix: lint issues
autofix-ci[bot] Aug 21, 2023
d26c26a
chore: update
dammy001 Aug 21, 2023
e4f636f
Merge branch 'feat/dismissable-layer' of https://github.com/oku-ui/pr…
dammy001 Aug 21, 2023
b3a31a2
fix: focus guards
productdevbook Aug 21, 2023
3d0e0e7
fix: new struct
productdevbook Aug 21, 2023
55ba6d3
fix: type
productdevbook Aug 21, 2023
070a5fd
chore: update
dammy001 Aug 23, 2023
29ca78c
Merge branch 'feat/dismissable-layer' of https://github.com/oku-ui/pr…
dammy001 Aug 23, 2023
1a7d029
chore: fix on dismiss event
dammy001 Aug 23, 2023
261df83
chore: update storybook
dammy001 Aug 23, 2023
e623f89
chore: update stories
dammy001 Aug 23, 2023
7552fc3
chore: complete stories
dammy001 Aug 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
"@oku-ui/collapsible": "workspace:^",
"@oku-ui/collection": "workspace:^",
"@oku-ui/direction": "workspace:^",
"@oku-ui/focus-group": "workspace:^",
"@oku-ui/dismissable-layer": "workspace:^",
"@oku-ui/focus-guards": "workspace:^",
"@oku-ui/focus-scope": "workspace:^",
"@oku-ui/label": "workspace:^",
"@oku-ui/popper": "workspace:^",
Expand Down
10 changes: 10 additions & 0 deletions packages/components/dismissable-layer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# `@oku-ui/dismissable-layer`

## Installation

```sh
$ pnpm add @oku-ui/dismissable-layer
```

## Usage
...
50 changes: 50 additions & 0 deletions packages/components/dismissable-layer/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "@oku-ui/dismissable-layer",
"type": "module",
"version": "0.0.0",
"license": "MIT",
"source": "src/index.ts",
"funding": "https://github.com/sponsors/productdevbook",
"homepage": "https://oku-ui.com/primitives",
"repository": {
"type": "git",
"url": "git+https://github.com/oku-ui/primitives.git",
"directory": "packages/components/dismissable-layer"
},
"bugs": {
"url": "https://github.com/oku-ui/primitives/issues"
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs"
}
},
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"engines": {
"node": ">=18"
},
"scripts": {
"build": "tsup",
"dev": "tsup --watch"
},
"peerDependencies": {
"vue": "^3.3.0"
},
"dependencies": {
"@oku-ui/primitive": "latest",
"@oku-ui/provide": "latest",
"@oku-ui/use-composable": "latest",
"@oku-ui/utils": "latest"
},
"devDependencies": {
"tsconfig": "workspace:^"
},
"publishConfig": {
"access": "public"
}
}
37 changes: 37 additions & 0 deletions packages/components/dismissable-layer/src/DismissableLayer.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { mount } from '@vue/test-utils'
import { describe, expect, it } from 'vitest'
import { OkuDismissableLayer } from './DismissableLayer'

// skipping this test for now. There's an error "TypeError: Cannot read properties of undefined (reading 'devtoolsRawSetupState')"
describe.skip('DismissableLayer', () => {
it('renders the component correctly', () => {
const wrapper = mount(OkuDismissableLayer)

// You can add more specific assertions based on your component's structure and props
expect(wrapper.exists()).toBe(true)
expect(wrapper.find('div').exists()).toBe(true)
})

it('emits events when interactions happen outside the layer', async () => {
const wrapper = mount(OkuDismissableLayer)

// Simulate a click outside the layer
await wrapper.trigger('pointerdown', { target: document.body })

// Check if the emitted events are correct
expect(wrapper.emitted('pointerDownOutside')).toHaveLength(1)
expect(wrapper.emitted('interactOutside')).toHaveLength(1)
expect(wrapper.emitted('dismiss')).toHaveLength(1)
})

it('emits events when Escape key is pressed', async () => {
const wrapper = mount(OkuDismissableLayer)

// Simulate pressing the Escape key
await wrapper.trigger('keydown', { key: 'Escape' })

// Check if the emitted events are correct
expect(wrapper.emitted('escapeKeyDown')).toHaveLength(1)
expect(wrapper.emitted('dismiss')).toHaveLength(1)
})
})
Loading