Skip to content

Commit

Permalink
refactor(checkbox): update component and some corrections to other co…
Browse files Browse the repository at this point in the history
…mponents (#432)

* refactor: checkbox

* fix: useSize

* fix: vitest unexpected error

* fix: lint issues

* refactor: fix typo in tests

* refactor: aspect-ratio use slot function

* refactor: avatar use slot function

* fix: checkbox emits

* refactor: popover use slot function

* refactor: scroll-area use slot function

* refactor: arrow use slot function

* refactor: collection use slot function

* refactor: visually-hidden use slot function

* refactor: dismissable-layer use slot function

* refactor: focus-scope use slot function

* refactor: portal use slot function

* refactor: roving-focus use slot function

* refactor: slot use slot function

* refactor: popper use slot function

* refactor: menu use slot function

* refactor: primitive use only slots

* fix: slot component

* fix: update snapshot tests

* refactor: add OkuBubbleInput name

* refactor: add OkuBubbleInput name to props file

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
  • Loading branch information
Cr0zy07 and autofix-ci[bot] committed Nov 29, 2023
1 parent c579bd5 commit 545bb06
Show file tree
Hide file tree
Showing 95 changed files with 2,201 additions and 5,411 deletions.

Large diffs are not rendered by default.

31 changes: 14 additions & 17 deletions packages/components/aspect-ratio/src/aspect-ratio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,21 @@ const aspectRatio = defineComponent({
paddingBottom: `${100 / ratio.value}%`,
},
'data-oku-aspect-ratio-wrapper': '',
}, [
h(Primitive.div, {
...mergeProps(attrs, otherProps, emits),
ref: forwardedRef,
style: {
...attrs.style as any,
// ensures children expand in ratio
position: 'absolute',
top: '0px',
right: '0px',
left: '0px',
bottom: '0px',
},
}, slots),
])
}, h(Primitive.div, {
...mergeProps(attrs, otherProps, emits),
ref: forwardedRef,
style: {
...attrs.style as any,
// ensures children expand in ratio
position: 'absolute',
top: '0px',
right: '0px',
left: '0px',
bottom: '0px',
},
}, () => slots.default?.()))
},
})

// TODO: https://github.com/vuejs/core/pull/7444 after delete
export const OkuAspectRatio = aspectRatio as typeof aspectRatio &
(new () => { $props: AspectRatioNativeElement })
export const OkuAspectRatio = aspectRatio as typeof aspectRatio & (new () => { $props: AspectRatioNativeElement })
8 changes: 4 additions & 4 deletions packages/components/aspect-ratio/tests/aspect-ratio.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('okuAspectRatio', () => {
/**
* @vitest-environment jsdom
*/
it('should pass accessibility tests', async () => {
it('should have no accessibility violations', async () => {
expect(await axe(wrapper.element)).toHaveNoViolations()
})
})
Expand All @@ -65,7 +65,7 @@ describe('okuAspectRatio Stories', () => {
/**
* @vitest-environment jsdom
*/
it('should pass accessibility tests', async () => {
it('should have no accessibility violations', async () => {
expect(await axe(wrapper.element)).toHaveNoViolations()
})

Expand All @@ -86,7 +86,7 @@ describe('okuAspectRatio Stories', () => {
/**
* @vitest-environment jsdom
*/
it('should pass accessibility tests', async () => {
it('should have no accessibility violations', async () => {
expect(await axe(wrapper.element)).toHaveNoViolations()
})

Expand All @@ -107,7 +107,7 @@ describe('okuAspectRatio Stories', () => {
/**
* @vitest-environment jsdom
*/
it('should pass accessibility tests', async () => {
it('should have no accessibility violations', async () => {
expect(await axe(wrapper.element)).toHaveNoViolations()
})

Expand Down
10 changes: 5 additions & 5 deletions packages/components/avatar/src/avatar-fallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ const avatarFallback = defineComponent({

onBeforeUnmount(() => window.clearTimeout(timerId))

return () => canRender.value && inject.imageLoadingStatus.value !== 'loaded'
return () => [canRender.value && inject.imageLoadingStatus.value !== 'loaded'
? h(Primitive.span, {
...mergeProps(attrs, otherProps, listeners),
ref: forwardedRef,
}, slots)
: null
}, () => slots.default?.())
: null,
]
},
})

// TODO: https://github.com/vuejs/core/pull/7444 after delete
export const OkuAvatarFallback = avatarFallback as typeof avatarFallback &
(new () => { $props: AvatarFallbackNativeElement })
export const OkuAvatarFallback = avatarFallback as typeof avatarFallback & (new () => { $props: AvatarFallbackNativeElement })
10 changes: 5 additions & 5 deletions packages/components/avatar/src/avatar-image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ const avatarImage = defineComponent({
handleLoadingStatusChange(imageLoadingStatus.value)
})

return () => imageLoadingStatus.value === 'loaded'
return () => [imageLoadingStatus.value === 'loaded'
? h(Primitive.img, {
...mergeProps(attrs, otherProps, emits),
src: src.value,
ref: forwardedRef,
}, slots)
: null
}, () => slots.default?.())
: null,
]
},
})

// TODO: https://github.com/vuejs/core/pull/7444 after delete
export const OkuAvatarImage = avatarImage as typeof avatarImage &
(new () => { $props: AvatarImageNativeElement })
export const OkuAvatarImage = avatarImage as typeof avatarImage & (new () => { $props: AvatarImageNativeElement })
9 changes: 4 additions & 5 deletions packages/components/avatar/src/avatar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const avatar = defineComponent({
const otherProps = reactiveOmit(_reactive, (key, _value) => key === undefined)

const forwardedRef = useForwardRef()
const listeners = useListeners()
const emits = useListeners()

const imageLoadingStatus = ref<ImageLoadingStatus>('idle')

Expand All @@ -35,12 +35,11 @@ const avatar = defineComponent({
})

return () => h(Primitive.span, {
...mergeProps(attrs, otherProps, listeners),
...mergeProps(attrs, otherProps, emits),
ref: forwardedRef,
}, slots)
}, () => slots.default?.())
},
})

// TODO: https://github.com/vuejs/core/pull/7444 after delete
export const OkuAvatar = avatar as typeof avatar &
(new () => { $props: AvatarNativeElement })
export const OkuAvatar = avatar as typeof avatar & (new () => { $props: AvatarNativeElement })
6 changes: 3 additions & 3 deletions packages/components/avatar/tests/avatar.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe('okuAvatar', () => {
/**
* @vitest-environment jsdom
*/
it('should pass accessibility tests', async () => {
it('should have no accessibility violations', async () => {
expect(await axe(wrapper.element)).toHaveNoViolations()
})

Expand Down Expand Up @@ -195,7 +195,7 @@ describe('okuAvatar Stories', () => {
/**
* @vitest-environment jsdom
*/
it('should pass accessibility tests', async () => {
it('should have no accessibility violations', async () => {
expect(await axe(wrapper.element)).toHaveNoViolations()
})

Expand All @@ -216,7 +216,7 @@ describe('okuAvatar Stories', () => {
/**
* @vitest-environment jsdom
*/
it('should pass accessibility tests', async () => {
it('should have no accessibility violations', async () => {
expect(await axe(wrapper.element)).toHaveNoViolations()
})

Expand Down
4 changes: 2 additions & 2 deletions packages/components/checkbox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ A control that allows the user to toggle between checked and not checked.

![@oku-ui/checkbox](./../../../.github/assets/og/oku-checkbox.jpg)

<span><a href="https://www.npmjs.com/package/@oku-ui/checkbox "><img src="https://img.shields.io/npm/v/@oku-ui/checkbox?style=flat&colorA=18181B&colorB=28CF8D" alt="Version"></a> </span> | <span> <a href="https://www.npmjs.com/package/@oku-ui/checkbox"> <img src="https://img.shields.io/npm/dm/@oku-ui/checkbox?style=flat&colorA=18181B&colorB=28CF8D" alt="Downloads"> </a> </span> | <span> <a href="https://oku-ui.com/primitives/components/checkbox"><img src="https://img.shields.io/badge/Open%20Documentation-18181B" alt="Website"></a> </span>
[![Version](https://img.shields.io/npm/v/@oku-ui/checkbox?style=flat&colorA=18181B&colorB=28CF8D)](https://www.npmjs.com/package/@oku-ui/checkbox) [![Downloads](https://img.shields.io/npm/dm/@oku-ui/checkbox?style=flat&colorA=18181B&colorB=28CF8D)](https://www.npmjs.com/package/@oku-ui/checkbox)

## Installation

```sh
$ pnpm add @oku-ui/checkbox
```

[Documentation](https://oku-ui.com/primitives/components/checkbox)
[Documentation](https://oku-ui.com/primitives/components/checkbox)
Loading

0 comments on commit 545bb06

Please sign in to comment.