Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(toolbar): update component #454

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion packages/components/aspect-ratio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ Displays content within a desired ratio.
$ pnpm add @oku-ui/aspect-ratio
```

[Documentation](https://oku-ui.com/primitives/components/aspect-ratio)
[Documentation](https://oku-ui.com/primitives/components/aspect-ratio)
8 changes: 2 additions & 6 deletions packages/components/aspect-ratio/src/aspect-ratio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@ import type { AspectRatioNativeElement } from './props'
const aspectRatio = defineComponent({
name: ASPECT_RATIO_NAME,
inheritAttrs: false,
props: {
...aspectRatioProps.props,
},
emit: {
...aspectRatioProps.emits,
},
props: aspectRatioProps.props,
emit: aspectRatioProps.emits,
setup(props, { attrs, slots }) {
const {
ratio,
Expand Down
2 changes: 1 addition & 1 deletion packages/components/avatar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ An image element with a fallback for representing the user.
$ pnpm add @oku-ui/avatar
```

[Documentation](https://oku-ui.com/primitives/components/avatar)
[Documentation](https://oku-ui.com/primitives/components/avatar)
4 changes: 1 addition & 3 deletions packages/components/avatar/src/avatar-fallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ const avatarFallback = defineComponent({
...avatarFallbackProps.props,
...scopeAvatarProps,
},
emit: {
...avatarFallbackProps.emits,
},
emit: avatarFallbackProps.emits,
setup(props, { attrs, slots }) {
const {
scopeOkuAvatar,
Expand Down
4 changes: 1 addition & 3 deletions packages/components/avatar/src/avatar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ const avatar = defineComponent({
...avatarProps.props,
...scopeAvatarProps,
},
emit: {
...avatarProps.emits,
},
emit: avatarProps.emits,
setup(props, { attrs, slots }) {
const {
scopeOkuAvatar,
Expand Down
2 changes: 1 addition & 1 deletion packages/components/avatar/src/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const [createAvatarProvide, createAvatarScope] = createProvideScope(AVATA

export type ImageLoadingStatus = 'idle' | 'loading' | 'loaded' | 'error'

export type AvatarProvideValue = {
type AvatarProvideValue = {
imageLoadingStatus: Ref<ImageLoadingStatus>
onImageLoadingStatusChange(status: ImageLoadingStatus): void
}
Expand Down
3 changes: 1 addition & 2 deletions packages/components/checkbox/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Checkbox
A control that allows the user to toggle between checked and not checked.


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

[![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)
Expand All @@ -12,4 +11,4 @@ A control that allows the user to toggle between checked and not checked.
$ pnpm add @oku-ui/checkbox
```

[Documentation](https://oku-ui.com/primitives/components/checkbox)
[Documentation](https://oku-ui.com/primitives/components/checkbox)
8 changes: 2 additions & 6 deletions packages/components/checkbox/src/bubble-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@ import type { BubbleInputNativeElement } from './props'
const bubbleInput = defineComponent({
name: CHECKBOX_BUBBLE_INPUT_NAME,
inheritAttrs: false,
props: {
...bubbleInputProps.props,
},
emits: {
...bubbleInputProps.emits,
},
props: bubbleInputProps.props,
emits: bubbleInputProps.emits,
setup(props, { attrs }) {
const {
checked,
Expand Down
4 changes: 1 addition & 3 deletions packages/components/checkbox/src/checkbox-indicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ const checkboxIndicator = defineComponent({
...checkboxIndicatorProps.props,
...scopeCheckboxProps,
},
emits: {
...checkboxIndicatorProps.emits,
},
emits: checkboxIndicatorProps.emits,
setup(props, { attrs, slots }) {
const {
scopeOkuCheckbox,
Expand Down
4 changes: 2 additions & 2 deletions packages/components/checkbox/src/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ export type CheckboxElement = HTMLButtonElement
export const [createCheckboxProvider, createCheckboxScope] = createProvideScope(CHECKBOX_NAME)

export const [checkboxProvider, useCheckboxInject]
= createCheckboxProvider<CheckboxInjectValue>(CHECKBOX_NAME)
= createCheckboxProvider<CheckboxProvideValue>(CHECKBOX_NAME)

export type CheckedState = boolean | 'indeterminate'

export type CheckboxInjectValue = {
type CheckboxProvideValue = {
state: Ref<CheckedState>
disabled?: Ref<boolean | undefined>
}
Expand Down
2 changes: 1 addition & 1 deletion packages/components/label/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ Renders an accessible label associated with controls.
$ pnpm add @oku-ui/label
```

[Documentation](https://oku-ui.com/primitives/components/label)
[Documentation](https://oku-ui.com/primitives/components/label)
10 changes: 3 additions & 7 deletions packages/components/label/src/label.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,11 @@ import type { LabelEmits, LabelNativeElement } from './props'
const label = defineComponent({
name: LABEL_NAME,
inheritAttrs: false,
props: {
...labelProps.props,
},
emits: {
...labelProps.emits,
},
props: labelProps.props,
emits: labelProps.emits,
setup(props, { attrs, slots, emit }) {
const forwardedRef = useForwardRef()
const emits = useListeners(['onMousedown'])
const emits = useListeners()

return () => h(Primitive.label, {
...mergeProps(attrs, emits),
Expand Down
2 changes: 1 addition & 1 deletion packages/components/separator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ Visually or semantically separates content.
$ pnpm add @oku-ui/separator
```

[Documentation](https://oku-ui.com/primitives/components/separator)
[Documentation](https://oku-ui.com/primitives/components/separator)
8 changes: 3 additions & 5 deletions packages/components/separator/src/separator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ import type { SeparatorNativeElement } from './props'
const separator = defineComponent({
name: SEPARATOR_NAME,
inheritAttrs: false,
props: {
...separatorProps.props,
},
props: separatorProps.props,
emits: separatorProps.emits,
setup(props, { attrs, slots }) {
setup(props, { attrs }) {
const {
decorative,
orientation: orientationProp,
Expand All @@ -37,7 +35,7 @@ const separator = defineComponent({
...semanticProps.value,
...mergeProps(attrs, otherProps, emits),
'ref': forwardedRef,
}, () => slots.default?.())
})
},
})

Expand Down
2 changes: 1 addition & 1 deletion packages/components/toggle-group/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ A set of two-state buttons that can be toggled on or off.
$ pnpm add @oku-ui/toggle-group
```

[Documentation](https://oku-ui.com/primitives/components/toggle-group)
[Documentation](https://oku-ui.com/primitives/components/toggle-group)
4 changes: 2 additions & 2 deletions packages/components/toggle-group/src/stories/Chromatic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ import { OkuDirectionProvider } from '@oku-ui/direction'
<OkuToggleGroup
type="multiple"
class="toggle-group"
default-value="['1', '2']"
:default-value="['1', '2']"
:disabled="false"
>
<OkuToggleGroupItem value="1" class="toggle-group-attr-styles">
Expand All @@ -168,7 +168,7 @@ import { OkuDirectionProvider } from '@oku-ui/direction'
<OkuToggleGroup
type="multiple"
class="toggle-group"
default-value="['1', '2']"
:default-value="['1', '2']"
:disabled="true"
>
<OkuToggleGroupItem value="1" class="toggle-group-attr-styles">
Expand Down
2 changes: 1 addition & 1 deletion packages/components/toggle-group/src/toggle-group-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const toggleGroupImpl = defineComponent({
disabled,
})

return () => [rovingFocus
return () => [rovingFocus.value
? h(OkuRovingFocusGroup, {
asChild: true,
...rovingFocusGroupScope,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ const toggleGroupItemImpl = defineComponent({
...typeProps.value,
...mergeProps(attrs, otherProps, emits),
ref: forwardedRef,
onPressedChange: (pressed) => {
if (pressed)
onPressedChange: (_pressed) => {
if (_pressed)
valueInject.onItemActivate(value.value!)
else
valueInject.onItemDeactivate(value.value!)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ exports[`okuToggleGroup Stories > chromatic > should render correctly 1`] = `
<h2>Group disabled</h2>
<oku-toggle-group-stub type=\\"multiple\\" class=\\"toggle-group\\" default-value=\\"1,2\\" disabled=\\"\\"></oku-toggle-group-stub>
<h2>Group enabled with button override</h2>
<oku-toggle-group-stub type=\\"multiple\\" class=\\"toggle-group\\" default-value=\\"['1', '2']\\" disabled=\\"false\\"></oku-toggle-group-stub>
<oku-toggle-group-stub type=\\"multiple\\" class=\\"toggle-group\\" default-value=\\"1,2\\" disabled=\\"false\\"></oku-toggle-group-stub>
<h2>Group disabled with button override</h2>
<oku-toggle-group-stub type=\\"multiple\\" class=\\"toggle-group\\" default-value=\\"['1', '2']\\" disabled=\\"true\\"></oku-toggle-group-stub>"
<oku-toggle-group-stub type=\\"multiple\\" class=\\"toggle-group\\" default-value=\\"1,2\\" disabled=\\"true\\"></oku-toggle-group-stub>"
`;

exports[`okuToggleGroup Stories > multiple > should render correctly 1`] = `
Expand Down
2 changes: 1 addition & 1 deletion packages/components/toggle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ A two-state button that can be either on or off.
$ pnpm add @oku-ui/toggle
```

[Documentation](https://oku-ui.com/primitives/components/toggle)
[Documentation](https://oku-ui.com/primitives/components/toggle)
2 changes: 1 addition & 1 deletion packages/components/toolbar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ A container for grouping a set of controls, such as buttons, toggle groups or dr

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

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

## Installation

Expand Down
71 changes: 28 additions & 43 deletions packages/components/toolbar/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,60 +1,45 @@
export {
OkuToolbar,
} from './toolbar'
export { OkuToolbar } from './toolbar'
export { OkuToolbarSeparator } from './toolbar-separator'
export { OkuToolbarButton } from './toolbar-button'
export { OkuToolbarLink } from './toolbar-link'
export { OkuToolbarToggleGroup } from './toolbar-toggle-group'
export { OkuToolbarToggleItem } from './toolbar-toggleI-item'

export type {
ToolbarProps,
ToolbarElement,
ToolbarNaviteElement,
} from './toolbar'
ToolbarNativeElement,
} from './props'

export {
OkuToolbarButton,
toolbarButtonProps,
} from './toolbarButton'
export type {
ToolbarSeparatorProps,
ToolbarSeparatorElement,
ToolbarSeparatorNativeElement,
} from './props'

export type {
ToolbarButtonElement,
ToolbarButtonNaviteElement,
ToolbarButtonProps,
} from './toolbarButton'

export {
OkuToolbarLink,
toolbarLinkProps,
} from './toolbarLink'
ToolbarButtonElement,
ToolbarButtonNativeElement,
} from './props'

export type {
ToolbarLinkElement,
ToolbarLinkProps,
ToolbarLinkEmits,
} from './toolbarLink'

export {
OkuToolbarSeparator,
} from './toolbarSeparator'

export type {
ToolbarSeparatorNaviteElement,
ToolbarSeparatorElement,
ToolbarSeparatorProps,
} from './toolbarSeparator'

export {
OkuToolbarToggleGroup,
toolbarToggleGroupProps,
} from './toolbarToggleGroup'
ToolbarLinkElement,
ToolbarLinkNativeElement,
} from './props'

export type {
ToolbarToggleGroupProps,
} from './toolbarToggleGroup'

export {
OkuToolbarToggleItem,
toolbarToggleItemProps,
} from './toolbarToggleItem'
ToolbarToggleGroupSingleProps,
ToolbarToggleGroupMultipleProps,
ToolbarToggleGroupElement,
ToolbarToggleGroupNativeElement,
} from './props'

export type {
ToolbarToggleItemNaviteElement,
ToolbarToggleItemProps,
} from './toolbarToggleItem'
ToolbarToggleItemEmits,
ToolbarToggleItemElement,
ToolbarToggleItemNativeElement,
} from './props'
Loading
Loading