Skip to content

Commit

Permalink
docs(*): component api docs touchups [KHCP-9012] (#2175)
Browse files Browse the repository at this point in the history
* docs(button): add events section [KHCP-9012]

* docs(kmodalfullscreen): remove component docs [KHCP-9012]

* fix(kmodalfullscreen): minor tweak [KHCP-9012]

* docs(label): default slot docs [KHCP-9012]

* test(kmodalfullscreen): fix component tests [KHCP-9012]

* docs: minor fix [KHCP-9012]
  • Loading branch information
portikM authored and adamdehaven committed Jun 3, 2024
1 parent b0406bb commit 8505728
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 468 deletions.
1 change: 0 additions & 1 deletion docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ export default defineConfig({
{ text: 'Input Switch', link: '/components/input-switch' },
{ text: 'Label', link: '/components/label' },
{ text: 'Modal', link: '/components/modal' },
{ text: 'Modal Fullscreen', link: '/components/modal-fullscreen' },
{ text: 'Multiselect', link: '/components/multiselect' },
{ text: 'Pagination', link: '/components/pagination' },
{ text: 'Popover', link: '/components/popover' },
Expand Down
34 changes: 34 additions & 0 deletions docs/components/button.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,42 @@ This slot is deprecated and will be removed in the `9.0.0-beta.0` release. Pleas
</KButton>
```

## Events

KButton supports all events a native `button` and `a` elements do. Simply bind your event handler function to event with any modifiers.

<form>
<KButton
type="submit"
@click.prevent="onButtonClick"
@keydown.enter.prevent="onButtonEnter"
>
Simple button
</KButton>
</form>

```html
<form>
<KButton
type="submit"
@click.prevent="onButtonClick"
@keydown.enter.prevent="onButtonEnter"
>
Simple button
</KButton>
</form>
```

<script setup lang="ts">
import { WorldIcon, ChevronDownIcon } from '@kong/icons'

const onButtonClick = () => {
alert('Button was clicked')
}

const onButtonEnter = () => {
alert('Enter was pressed')
}
</script>

<style scoped lang="scss">
Expand Down
10 changes: 10 additions & 0 deletions docs/components/label.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ Use the `for` attribute to bind a label to an input element for accessibility.

## Slots

### default

Label content.

<KLabel>Label Text</KLabel>

```html
<KLabel>Label Text</KLabel>
```

### tooltip

Should you need to utilize HTML in the tooltip, you may use the `tooltip` slot.
Expand Down
461 changes: 0 additions & 461 deletions docs/components/modal-fullscreen.md

This file was deleted.

1 change: 1 addition & 0 deletions docs/guide/migrating-to-version-9.md
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ This component has been removed. Please refer to KBadge component which has been

### KModalFullscreen

This component is deprecated and will be removed in the next major release.

### KMultiselect

Expand Down
2 changes: 0 additions & 2 deletions src/components/KModalFullscreen/KModalFullscreen.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,9 @@ describe('KModalFullscreen', () => {
cancelButtonText,
bodyHeader,
bodyHeaderDescription,
iconString: 'immunity',
},
})

cy.get('.k-modal-fullscreen-title .header-icon .kong-icon-immunity').should('be.visible')
cy.get('.proceed-button').should('contain', actionButtonText)
cy.get('.cancel-button').should('contain', cancelButtonText)
cy.get('.k-modal-fullscreen-header').should('contain', title)
Expand Down
10 changes: 6 additions & 4 deletions src/components/KModalFullscreen/KModalFullscreen.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<div class="k-modal-fullscreen-title">
<span class="header-icon">
<slot name="header-icon">
<KIcon :icon="iconString" />
<KongIcon :color="KUI_COLOR_TEXT_DECORATIVE_AQUA" />
</slot>
</span>
<span class="header-content">
Expand Down Expand Up @@ -104,8 +104,9 @@
import type { PropType } from 'vue'
import { watch, ref, computed, onMounted, onUnmounted, onBeforeUnmount, nextTick } from 'vue'
import KButton from '@/components/KButton/KButton.vue'
import KIcon from '@/components/KIcon/KIcon.vue'
import type { ButtonAppearance } from '@/types'
import { KongIcon } from '@kong/icons'
import { KUI_COLOR_TEXT_DECORATIVE_AQUA } from '@kong/design-tokens'
const props = defineProps({
/**
Expand Down Expand Up @@ -165,7 +166,8 @@ const props = defineProps({
default: 'secondary',
},
/**
* Pass the type of icon for the header on the left
* @deprecated
* Pass the type of icon for the header on the left
*/
iconString: {
type: String,
Expand Down Expand Up @@ -217,7 +219,7 @@ const proceed = () => {
onMounted(() => {
document.addEventListener('keydown', handleKeydown)
console.warn("The Kongponents 'KFullScreenModal' component is deprecated and will be removed in the 9.0.0-beta.0 release.\nWe suggest using 'KModal' component instead.\nDocs: https://alpha--kongponents.netlify.app/components/modal.html#fullscreen")
console.warn("The Kongponents 'KFullScreenModal' component is deprecated and will be removed in the next major release.\nWe suggest using 'KModal' component instead.\nDocs: https://alpha--kongponents.netlify.app/components/modal.html#fullscreen")
})
onBeforeUnmount(() => {
Expand Down

0 comments on commit 8505728

Please sign in to comment.