From 18dceb74455ccd6690069b973bcc9f563c78ebb3 Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Sun, 17 Jul 2022 12:37:16 +0200 Subject: [PATCH] feat(CommandPalette): implement component --- docs/app.vue | 2 +- docs/pages/components/[component].vue | 13 ++ docs/pages/migration.vue | 8 ++ .../components/navigation/CommandPalette.vue | 133 ++++++++++++++++++ .../navigation/CommandPaletteGroup.vue | 45 ++++++ src/runtime/types/command-palette.ts | 15 ++ 6 files changed, 215 insertions(+), 1 deletion(-) create mode 100644 src/runtime/components/navigation/CommandPalette.vue create mode 100644 src/runtime/components/navigation/CommandPaletteGroup.vue create mode 100644 src/runtime/types/command-palette.ts diff --git a/docs/app.vue b/docs/app.vue index f509acd1a2..856d789fa6 100644 --- a/docs/app.vue +++ b/docs/app.vue @@ -74,7 +74,7 @@ const sections = [ { label: 'Feedback', links: [{ label: 'Alert', to: '/components/Alert' }, { label: 'AlertDialog', to: '/components/AlertDialog' }] }, { label: 'Forms', links: [{ label: 'Checkbox', to: '/components/Checkbox' }, { label: 'Input', to: '/components/Input' }, { label: 'FormGroup', to: '/components/FormGroup' }, { label: 'Radio', to: '/components/Radio' }, { label: 'Select', to: '/components/Select' }, { label: 'SelectCustom', to: '/components/SelectCustom' }, { label: 'Textarea', to: '/components/Textarea' }, { label: 'Toggle', to: '/components/Toggle' }] }, { label: 'Layout', links: [{ label: 'Card', to: '/components/Card' }, { label: 'Container', to: '/components/Container' }] }, - { label: 'Navigation', links: [{ label: 'Pills', to: '/components/Pills' }, { label: 'Tabs', to: '/components/Tabs' }, { label: 'VerticalNavigation', to: '/components/VerticalNavigation' }] }, + { label: 'Navigation', links: [{ label: 'Pills', to: '/components/Pills' }, { label: 'Tabs', to: '/components/Tabs' }, { label: 'VerticalNavigation', to: '/components/VerticalNavigation' }, { label: 'CommandPalette', to: '/components/CommandPalette' }] }, { label: 'Overlays', links: [{ label: 'Modal', to: '/components/Modal' }, { label: 'Notification', to: '/components/Notification' }, { label: 'Popover', to: '/components/Popover' }, { label: 'Slideover', to: '/components/Slideover' }, { label: 'Tooltip', to: '/components/Tooltip' }] } ] diff --git a/docs/pages/components/[component].vue b/docs/pages/components/[component].vue index 111c93629a..2059d2979d 100644 --- a/docs/pages/components/[component].vue +++ b/docs/pages/components/[component].vue @@ -193,6 +193,19 @@ const defaultProps = { } ] }, + CommandPalette: { + groups: [{ + key: 'people', + label: 'People', + commands: [ + { id: 1, label: 'Durward Reynolds', disabled: false }, + { id: 2, label: 'Kenton Towne', disabled: false }, + { id: 3, label: 'Therese Wunsch', disabled: false }, + { id: 4, label: 'Benedict Kessler', disabled: true }, + { id: 5, label: 'Katelyn Rohan', disabled: false } + ] + }] + }, Icon: { name: 'heroicons-outline:bell' }, diff --git a/docs/pages/migration.vue b/docs/pages/migration.vue index 74bd2e781e..b46b81d728 100644 --- a/docs/pages/migration.vue +++ b/docs/pages/migration.vue @@ -212,6 +212,14 @@ const components = [ capi: true, typescript: true }, + { + label: 'CommandPalette', + to: '/components/CommandPalette', + nuxt3: true, + capi: true, + preset: false, + typescript: true + }, { label: 'Tabs', to: '/components/Tabs', diff --git a/src/runtime/components/navigation/CommandPalette.vue b/src/runtime/components/navigation/CommandPalette.vue new file mode 100644 index 0000000000..f94c645a55 --- /dev/null +++ b/src/runtime/components/navigation/CommandPalette.vue @@ -0,0 +1,133 @@ + + + + + diff --git a/src/runtime/components/navigation/CommandPaletteGroup.vue b/src/runtime/components/navigation/CommandPaletteGroup.vue new file mode 100644 index 0000000000..6c2d662433 --- /dev/null +++ b/src/runtime/components/navigation/CommandPaletteGroup.vue @@ -0,0 +1,45 @@ + + + + + diff --git a/src/runtime/types/command-palette.ts b/src/runtime/types/command-palette.ts new file mode 100644 index 0000000000..8bb671cbc1 --- /dev/null +++ b/src/runtime/types/command-palette.ts @@ -0,0 +1,15 @@ +export interface Command { + disabled?: boolean + icon?: string + iconColor?: string + iconClass?: string + avatar?: string + label: string + group?: string +} + +export interface Group { + key: string + label: string + commands: Command[] +}