Skip to content

Commit

Permalink
refactor(roving-focus): ts to sfc (#509)
Browse files Browse the repository at this point in the history
* refactor(roving-focus): ts to sfc

* Refactor focus handling and add tabindex attribute

* Add outline style to RovingFocusGroupImpl.vue

* Refactor focus and blur event handlers in RovingFocusGroupImpl.vue

* Remove unused import statement in Slot.vue
  • Loading branch information
productdevbook committed Jan 20, 2024
1 parent 4acaf32 commit 48276a6
Show file tree
Hide file tree
Showing 13 changed files with 380 additions and 476 deletions.
1 change: 0 additions & 1 deletion packages/vue/src/primitive/Primitive.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { OkuSlot } from '@oku-ui/slot'
defineOptions({
name: 'OkuPrimitive',
inheritAttrs: false,
})
withDefaults(
Expand Down
6 changes: 4 additions & 2 deletions packages/vue/src/primitive/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
export { default as Primitive } from './Primitive.vue'
export type * from './Primitive.vue'
export {
default as Primitive,
type PrimitiveProps,
} from './Primitive.vue'

export { renderSlotFragments } from './utils'

Expand Down
2 changes: 1 addition & 1 deletion packages/vue/src/primitive/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// same inspiration and resource https://github.com/chakra-ui/ark/blob/main/packages/vue/src/factory.tsx

import type { VNode } from 'vue'
import { Fragment, nextTick, watch, watchSyncEffect } from 'vue'
import { Fragment } from 'vue'

/**
* Checks whether a given VNode is a render-vialble element.
Expand Down
39 changes: 0 additions & 39 deletions packages/vue/src/roving-focus/RovingFocusGroup.ts

This file was deleted.

45 changes: 45 additions & 0 deletions packages/vue/src/roving-focus/RovingFocusGroup.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<script setup lang="ts">
import { useComponentRef } from '@oku-ui/use-composable'
import OkuRovingFocusGroupImpl from './RovingFocusGroupImpl.vue'
import type { RovingFocusGroupProps } from './props'
import { CollectionProvider, CollectionSlot } from './props'
defineOptions({
name: 'OkuRovingFocusGroup',
inheritAttrs: false,
})
const props = withDefaults(defineProps<RovingFocusGroupProps>(), {
orientation: undefined,
dir: undefined,
loop: false,
})
const { componentRef, currentElement } = useComponentRef<HTMLInputElement | null>()
defineExpose({
$el: currentElement,
})
</script>

<template>
<CollectionProvider
:scope="props.scopeOkuRovingFocusGroup"
>
<CollectionSlot
:scope="props.scopeOkuRovingFocusGroup"
>
<OkuRovingFocusGroupImpl
v-bind="$attrs"
:is="props.is"
ref="componentRef"
:orientation="props.orientation"
:dir="props.dir"
:loop="props.loop"
:as-child="props.asChild"
>
<slot />
</OkuRovingFocusGroupImpl>
</CollectionSlot>
</CollectionProvider>
</template>
140 changes: 0 additions & 140 deletions packages/vue/src/roving-focus/RovingFocusGroupImpl.ts

This file was deleted.

Loading

0 comments on commit 48276a6

Please sign in to comment.