diff --git a/packages/design-system/src/components/N8nActionDropdown/ActionDropdown.stories.ts b/packages/design-system/src/components/N8nActionDropdown/ActionDropdown.stories.ts new file mode 100644 index 0000000000..149d255ba0 --- /dev/null +++ b/packages/design-system/src/components/N8nActionDropdown/ActionDropdown.stories.ts @@ -0,0 +1,72 @@ +import N8nActionDropdown from "./ActionDropdown.vue"; +import { StoryFn } from '@storybook/vue'; + +export default { + title: 'Atoms/ActionDropdown', + component: N8nActionDropdown, + argTypes: { + placement: { + control: { + type: 'select', + options: ['top', 'top-end', 'top-start', 'bottom', 'bottom-end', 'bottom-start'], + }, + }, + activatorIcon: { + control: { + type: 'text', + }, + }, + trigger: { + control: { + type: 'select', + options: ['click', 'hover'], + }, + }, + }, +}; + +const template: StoryFn = (args, { argTypes }) => ({ + props: Object.keys(argTypes), + components: { + N8nActionDropdown, + }, + template: ``, +}); + +export const defaultActionDropdown = template.bind({}); +defaultActionDropdown.args = { + items: [ + { + id: 'item1', + label: 'Action 1', + }, + { + id: 'item2', + label: 'Action 2', + }, + ], +}; + +export const customStyling = template.bind({}); +customStyling.args = { + activatorIcon: 'bars', + items: [ + { + id: 'item1', + label: 'Action 1', + icon: 'thumbs-up', + }, + { + id: 'item2', + label: 'Action 2', + icon: 'thumbs-down', + disabled: true, + }, + { + id: 'item3', + label: 'Action 3', + icon: 'heart', + divided: true, + }, + ], +}; diff --git a/packages/design-system/src/components/N8nActionDropdown/ActionDropdown.vue b/packages/design-system/src/components/N8nActionDropdown/ActionDropdown.vue new file mode 100644 index 0000000000..0ae8705fed --- /dev/null +++ b/packages/design-system/src/components/N8nActionDropdown/ActionDropdown.vue @@ -0,0 +1,130 @@ + + + + + diff --git a/packages/design-system/src/components/N8nActionDropdown/__tests__/ActionDropdown.spec.ts b/packages/design-system/src/components/N8nActionDropdown/__tests__/ActionDropdown.spec.ts new file mode 100644 index 0000000000..8af723b476 --- /dev/null +++ b/packages/design-system/src/components/N8nActionDropdown/__tests__/ActionDropdown.spec.ts @@ -0,0 +1,52 @@ +import { render } from '@testing-library/vue'; +import N8nActionDropdown from '../ActionDropdown.vue'; + +describe('components', () => { + describe('N8nActionDropdown', () => { + it('should render default styling correctly', () => { + const wrapper = render(N8nActionDropdown, { + props: { + items: [ + { + id: 'item1', + label: 'Action 1', + }, + { + id: 'item2', + label: 'Action 2', + }, + ], + }, + stubs: ['n8n-icon', 'el-dropdown', 'el-dropdown-menu', 'el-dropdown-item'], + }); + expect(wrapper.html()).toMatchSnapshot(); + }); + it('should render custom styling correctly', () => { + const wrapper = render(N8nActionDropdown, { + props: { + items: [ + { + id: 'item1', + label: 'Action 1', + icon: 'thumbs-up', + }, + { + id: 'item2', + label: 'Action 2', + icon: 'thumbs-down', + disabled: true, + }, + { + id: 'item3', + label: 'Action 3', + icon: 'heart', + divided: true, + }, + ], + }, + stubs: ['n8n-icon', 'el-dropdown', 'el-dropdown-menu', 'el-dropdown-item'], + }); + expect(wrapper.html()).toMatchSnapshot(); + }); + }); +}); diff --git a/packages/design-system/src/components/N8nActionDropdown/__tests__/__snapshots__/ActionDropdown.spec.ts.snap b/packages/design-system/src/components/N8nActionDropdown/__tests__/__snapshots__/ActionDropdown.spec.ts.snap new file mode 100644 index 0000000000..cfeb3fa9ee --- /dev/null +++ b/packages/design-system/src/components/N8nActionDropdown/__tests__/__snapshots__/ActionDropdown.spec.ts.snap @@ -0,0 +1,42 @@ +// Vitest Snapshot v1 + +exports[`components > N8nActionDropdown > should render custom styling correctly 1`] = ` +"
+ +
+ +
+ + +
Action 1
+
+ +
Action 2
+
+ +
Action 3
+
+
+
+
" +`; + +exports[`components > N8nActionDropdown > should render default styling correctly 1`] = ` +"
+ +
+ +
+ + +
+ Action 1
+
+ +
+ Action 2
+
+
+
+
" +`; diff --git a/packages/design-system/src/components/N8nActionDropdown/index.ts b/packages/design-system/src/components/N8nActionDropdown/index.ts new file mode 100644 index 0000000000..e0b58950d4 --- /dev/null +++ b/packages/design-system/src/components/N8nActionDropdown/index.ts @@ -0,0 +1,2 @@ +import N8nActionDropdown from './ActionDropdown.vue'; +export default N8nActionDropdown; diff --git a/packages/design-system/src/css/reset.scss b/packages/design-system/src/css/reset.scss index 6688cb9621..546de883be 100644 --- a/packages/design-system/src/css/reset.scss +++ b/packages/design-system/src/css/reset.scss @@ -15,7 +15,7 @@ html { body { height: 100%; width: 100%; - overscroll-behavior-x: none; + overscroll-behavior: none; line-height: 1; font-size: var(--font-size-m); font-weight: var(--font-weight-regular); diff --git a/packages/design-system/src/plugins/n8nComponents.ts b/packages/design-system/src/plugins/n8nComponents.ts index 15816855de..990b7311d9 100644 --- a/packages/design-system/src/plugins/n8nComponents.ts +++ b/packages/design-system/src/plugins/n8nComponents.ts @@ -1,5 +1,6 @@ import Vue from 'vue'; import N8nActionBox from '../components/N8nActionBox'; +import N8nActionDropdown from '../components/N8nActionDropdown'; import N8nActionToggle from '../components/N8nActionToggle'; import N8nAvatar from '../components/N8nAvatar'; import N8nBadge from "../components/N8nBadge"; @@ -46,6 +47,7 @@ export default { install: (app: typeof Vue, options?: {}) => { app.component('n8n-info-accordion', N8nInfoAccordion); app.component('n8n-action-box', N8nActionBox); + app.component('n8n-action-dropdown', N8nActionDropdown); app.component('n8n-action-toggle', N8nActionToggle); app.component('n8n-avatar', N8nAvatar); app.component('n8n-badge', N8nBadge); diff --git a/packages/editor-ui/public/favicon.ico b/packages/editor-ui/public/favicon.ico index 0b4949e8fd..e5f92d7f5e 100644 Binary files a/packages/editor-ui/public/favicon.ico and b/packages/editor-ui/public/favicon.ico differ diff --git a/packages/editor-ui/public/n8n-logo-collapsed.svg b/packages/editor-ui/public/n8n-logo-collapsed.svg new file mode 100644 index 0000000000..62e0c21bb7 --- /dev/null +++ b/packages/editor-ui/public/n8n-logo-collapsed.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/editor-ui/public/n8n-logo-expanded.svg b/packages/editor-ui/public/n8n-logo-expanded.svg new file mode 100644 index 0000000000..29dbf38f91 --- /dev/null +++ b/packages/editor-ui/public/n8n-logo-expanded.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/editor-ui/src/App.vue b/packages/editor-ui/src/App.vue index f48dcfb217..a03bbf4d37 100644 --- a/packages/editor-ui/src/App.vue +++ b/packages/editor-ui/src/App.vue @@ -1,14 +1,21 @@