diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 4adde4d7b2..9afa0370d4 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -70,7 +70,6 @@ export default defineConfig({ { text: 'External Link', link: '/components/external-link' }, { text: 'File Upload', link: '/components/file-upload' }, { text: 'Icon', link: '/components/icon' }, - { text: 'Inline Edit', link: '/components/inline-edit' }, { text: 'Input', link: '/components/input' }, { text: 'Input Switch', link: '/components/input-switch' }, { text: 'Label', link: '/components/label' }, diff --git a/docs/components/inline-edit.md b/docs/components/inline-edit.md deleted file mode 100644 index 47a1fed260..0000000000 --- a/docs/components/inline-edit.md +++ /dev/null @@ -1,143 +0,0 @@ -# Inline Edit - -**KInlineEdit** - A wrapper which adds inline edit capability. Currently only supports single text input. - - -

{{ data.inlineText }}

-
- -> The `KComponent` component is used in this example to create state. - -```html - - -

{{ data.inlineText }}

-
-
-``` - -## Props - -### ignoreValue - -If true, will not set the value of the input when enabled/clicked. This is useful to control placeholder style text - - -

{{ data.inlineText || 'cool placeholder' }}

-
- -> The `KComponent` component is used in this example to create state. - -```html - - -

{{ data.inlineText || 'cool placeholder' }}

-
-
-``` - -### styleOverrides - -Styles to set when the input is active. Useful when styling the default state differently. - - -

{{ data.inlineText || 'cool placeholder' }}

-
- -> The `KComponent` component is used in this example to create state. - -```html - - -

- {{ data.inlineText || 'cool placeholder' }} -

-
-
- - -``` - -## Events - -### `@changed` - -Emitted blurred away from the editing input or when enter is pressed. - -When clicking out of the input `@changed` will fire and emit the value. Can be used to reset the outside data. - -::: tip -While the component itself does not protect against returning empty an empty value, it is advised to do a check at the implementation layer to ensure empty & validation are accounted for. -::: - - - - - -> The `KComponent` component is used in this example to create state. - -```html - -
- Updated: {{ data.inlineText }} - -

{{ data.inlineText }}

-
-
-
-``` - -## Slots - -- `default` - Content to be edited - -::: warning -An HTML element must be passed in the slot. An error will be thrown if not passed. - -```html - - -

Some text

-
- - - - Some text - -``` - -::: - - - - diff --git a/docs/guide/migrating-to-version-9.md b/docs/guide/migrating-to-version-9.md index 09aee38ee2..162d57ef2a 100644 --- a/docs/guide/migrating-to-version-9.md +++ b/docs/guide/migrating-to-version-9.md @@ -332,6 +332,7 @@ No breaking changes. ### KInlineEdit +This component has been removed. ### KInput diff --git a/src/components/KInlineEdit/KInlineEdit.cy.ts b/src/components/KInlineEdit/KInlineEdit.cy.ts deleted file mode 100644 index 86a4cb8520..0000000000 --- a/src/components/KInlineEdit/KInlineEdit.cy.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { mount } from 'cypress/vue' -import { h } from 'vue' -import KInlineEdit from '@/components/KInlineEdit/KInlineEdit.vue' - -describe('KInlineEdit', () => { - it('copies element css to input on click', () => { - mount(KInlineEdit, { - slots: { - default: () => h('p', { style: { padding: '10px' } }, 'text'), - }, - }) - - cy.get('p').click() - cy.get('.k-input').should('have.css', 'padding').and('match', /10px/) - }) - - it('applies style overrides when prop passed', () => { - mount(KInlineEdit, { - props: { - styleOverrides: { color: 'red' }, - }, - slots: { - default: () => h('p', { style: { color: 'black' } }, 'text'), - }, - }) - - cy.get('p').click() - cy.get('.k-input').should('have.attr', 'style').and('match', /color: red/) - }) - - it('does not pass in initial value when prop passed', () => { - mount(KInlineEdit, { - props: { - ignoreValue: true, - }, - slots: { - default: () => h('p', {}, 'text'), - }, - }) - - cy.get('p').click() - cy.get('.k-input').should('have.value', '') - }) - - it('emits updated text on blur', () => { - const string1 = 'Hello' - const string2 = ' world!' - mount(KInlineEdit, { - slots: { - default: () => h('p', {}, string1), - }, - }) - - cy.get('p').click() - cy.get('.k-input').type(string2) - cy.get('.k-input').blur().then(() => { - cy.wrap(Cypress.vueWrapper.emitted()).should('have.property', 'changed') - cy.wrap(Cypress.vueWrapper.emitted('changed')[0][0]).should('eq', string1 + string2) - }) - }) -}) diff --git a/src/components/KInlineEdit/KInlineEdit.vue b/src/components/KInlineEdit/KInlineEdit.vue deleted file mode 100644 index 7c00039a65..0000000000 --- a/src/components/KInlineEdit/KInlineEdit.vue +++ /dev/null @@ -1,168 +0,0 @@ - - - - - diff --git a/src/components/index.ts b/src/components/index.ts index 1953f6c0f7..f7220faa3b 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -24,7 +24,6 @@ export { default as KDropdownMenu } from './KDropdown/KDropdown.vue' // KDropdow export { default as KEmptyState } from './KEmptyState/KEmptyState.vue' export { default as KFileUpload } from './KFileUpload/KFileUpload.vue' export { default as KIcon } from './KIcon/KIcon.vue' -export { default as KInlineEdit } from './KInlineEdit/KInlineEdit.vue' export { default as KInput } from './KInput/KInput.vue' export { default as KInputSwitch } from './KInputSwitch/KInputSwitch.vue' export { default as KLabel } from './KLabel/KLabel.vue' diff --git a/src/global-components.ts b/src/global-components.ts index 251f732d24..96dee12f50 100644 --- a/src/global-components.ts +++ b/src/global-components.ts @@ -23,7 +23,6 @@ declare module '@vue/runtime-core' { KExternalLink: typeof components.KExternalLink KFileUpload: typeof components.KFileUpload KIcon: typeof components.KIcon - KInlineEdit: typeof components.KInlineEdit KInput: typeof components.KInput KInputSwitch: typeof components.KInputSwitch KLabel: typeof components.KLabel diff --git a/src/types/index.ts b/src/types/index.ts index e8fbc98bf2..48eb81f60c 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -25,6 +25,5 @@ export * from './skeleton' export * from './select' export * from './swrv' export * from './toaster' -export * from './inline-edit' export * from './text-area' export * from './tree-list' diff --git a/src/types/inline-edit.ts b/src/types/inline-edit.ts deleted file mode 100644 index 3705ff6a88..0000000000 --- a/src/types/inline-edit.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Styles we want copied from the element -export enum Styles { - fontSize = 'font-size', - fontWeight = 'font-weight', - fontFamily = 'font-family', - color = 'color', - margin = 'margin', - padding = 'padding', -}