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

Remove explicit class prop #608

Merged
merged 1 commit into from
Jun 10, 2021
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Improve `aria-expanded` logic ([#592](https://github.com/tailwindlabs/headlessui/pull/592))
- Remove undocumented `:className` prop ([#607](https://github.com/tailwindlabs/headlessui/pull/607))
- Improve types for `Listbox` component ([#576](https://github.com/tailwindlabs/headlessui/pull/576))
- Remove explicit `:class` prop ([#608](https://github.com/tailwindlabs/headlessui/pull/608))

## [Unreleased - Vue]

Expand Down
4 changes: 1 addition & 3 deletions packages/@headlessui-vue/src/components/listbox/listbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,6 @@ export let ListboxOption = defineComponent({
as: { type: [Object, String], default: 'li' },
value: { type: [Object, String, Number, Boolean] },
disabled: { type: Boolean, default: false },
class: { type: [String, Function], required: false },
},
setup(props, { slots, attrs }) {
let api = useListboxContext('ListboxOption')
Expand Down Expand Up @@ -546,13 +545,12 @@ export let ListboxOption = defineComponent({
}

return () => {
let { disabled, class: defaultClass } = props
let { disabled } = props
let slot = { active: active.value, selected: selected.value, disabled }
let propsWeControl = {
id,
role: 'option',
tabIndex: disabled === true ? undefined : -1,
class: defaultClass,
'aria-disabled': disabled === true ? true : undefined,
'aria-selected': selected.value === true ? selected.value : undefined,
disabled: undefined, // Never forward the `disabled` prop
Expand Down
4 changes: 1 addition & 3 deletions packages/@headlessui-vue/src/components/menu/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,6 @@ export let MenuItem = defineComponent({
props: {
as: { type: [Object, String], default: 'template' },
disabled: { type: Boolean, default: false },
class: { type: [String, Function], required: false },
},
setup(props, { slots, attrs }) {
let api = useMenuContext('MenuItem')
Expand Down Expand Up @@ -465,13 +464,12 @@ export let MenuItem = defineComponent({
}

return () => {
let { disabled, class: defaultClass } = props
let { disabled } = props
let slot = { active: active.value, disabled }
let propsWeControl = {
id,
role: 'menuitem',
tabIndex: disabled === true ? undefined : -1,
class: defaultClass,
'aria-disabled': disabled === true ? true : undefined,
onClick: handleClick,
onFocus: handleFocus,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,9 @@ export let RadioGroupOption = defineComponent({
as: { type: [Object, String], default: 'div' },
value: { type: [Object, String, Number, Boolean] },
disabled: { type: Boolean, default: false },
class: { type: [String, Function], required: false },
},
render() {
let { value, disabled, class: defaultClass, ...passThroughProps } = this.$props
let { value, disabled, ...passThroughProps } = this.$props

let slot = {
checked: this.checked,
Expand All @@ -247,7 +246,6 @@ export let RadioGroupOption = defineComponent({
id: this.id,
ref: 'el',
role: 'radio',
class: defaultClass,
'aria-checked': this.checked ? 'true' : 'false',
'aria-labelledby': this.labelledby,
'aria-describedby': this.describedby,
Expand Down
3 changes: 0 additions & 3 deletions packages/@headlessui-vue/src/components/switch/switch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,16 @@ export let Switch = defineComponent({
props: {
as: { type: [Object, String], default: 'button' },
modelValue: { type: Boolean, default: false },
class: { type: [String, Function], required: false },
},
render() {
let api = inject(GroupContext, null)
let { class: defaultClass } = this.$props

let slot = { checked: this.$props.modelValue }
let propsWeControl = {
id: this.id,
ref: api === null ? undefined : api.switchRef,
role: 'switch',
tabIndex: 0,
class: defaultClass,
'aria-checked': this.$props.modelValue,
'aria-labelledby': this.labelledby,
'aria-describedby': this.describedby,
Expand Down