-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
48feccd
commit d5d193b
Showing
14 changed files
with
212 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
# CHANGELOG | ||
|
||
## v2.0.72 | ||
|
||
- Add `Panel` component | ||
|
||
## v2.0.71 | ||
|
||
- Add `KeyValueInput` component | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Canvas, ArgTypes, PRIMARY_STORY } from '@storybook/addon-docs'; | ||
import { Primary } from './Panel.stories'; | ||
|
||
# Panel | ||
|
||
<Canvas of={Primary} /> | ||
|
||
## Props | ||
|
||
<ArgTypes story={PRIMARY_STORY} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Meta, StoryFn } from '@storybook/vue3'; | ||
import mdx from './Panel.mdx'; | ||
// @ts-ignore No types from Vue file | ||
import Panel from './Panel.vue'; | ||
|
||
const meta: Meta<typeof Panel> = { | ||
title: 'Components/Panel', | ||
component: Panel, | ||
parameters: { | ||
docs: { | ||
page: mdx | ||
} | ||
} | ||
}; | ||
|
||
export default meta; | ||
|
||
const Template: StoryFn = (args, { argTypes }) => ({ | ||
components: { Panel }, | ||
setup: () => ({ args }), | ||
template: ` | ||
<div style="width: 500px;"> | ||
<Panel v-bind="args"> | ||
<template #header>Metadata</template> | ||
<template #default> | ||
<ul> | ||
<li>City: Chicago</li> | ||
<li>State: Illinois</li> | ||
<li>Country: United States</li> | ||
</ul> | ||
</template> | ||
</Panel> | ||
</div> | ||
` | ||
}); | ||
|
||
export const Primary = Template.bind({}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<template> | ||
<Panel | ||
class="uic-panel-container" | ||
:collapsed | ||
data-testid="uic-panel" | ||
:pt="{ | ||
transition: { | ||
enterFromClass: 'max-h-0', | ||
enterActiveClass: | ||
'overflow-hidden transition-[max-height] duration-1000 ease-[cubic-bezier(0.42,0,0.58,1)]', | ||
enterToClass: 'max-h-[1000px]', | ||
leaveFromClass: 'max-h-[1000px]', | ||
leaveActiveClass: | ||
'overflow-hidden transition-[max-height] duration-[450ms] ease-[cubic-bezier(0,1,0,1)]', | ||
leaveToClass: 'max-h-0' | ||
} | ||
}" | ||
:toggleable="collapsible" | ||
@update:collapsed="$emit('update:collapsed', $event)" | ||
> | ||
<template #header> | ||
<component | ||
:is="headerComponent" | ||
class="type-base-600 flex flex-row gap-2 items-center" | ||
> | ||
<slot name="header"> | ||
{{ header }} | ||
</slot> | ||
<LoadingSpinnerIcon v-if="loading" /> | ||
</component> | ||
</template> | ||
|
||
<template #togglericon="{ collapsed: iconCollapsed }"> | ||
<Icon | ||
:class="['toggle-icon', { collapsed: iconCollapsed }]" | ||
data-testid="uic-panel-toggle-icon" | ||
icon="Collapse" | ||
size="lg" | ||
/> | ||
</template> | ||
|
||
<template #default> | ||
<slot /> | ||
</template> | ||
</Panel> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { Icon } from '@/components/Icon'; | ||
import Panel from 'primevue/panel'; | ||
import { LoadingSpinnerIcon } from '../LoadingSpinnerIcon'; | ||
withDefaults( | ||
defineProps<{ | ||
collapsed?: boolean; | ||
collapsible?: boolean; | ||
header?: string; | ||
headerComponent?: string; | ||
loading?: boolean; | ||
}>(), | ||
{ | ||
collapsed: false, | ||
collapsible: false, | ||
header: undefined, | ||
headerComponent: 'h2', | ||
loading: false | ||
} | ||
); | ||
defineEmits<{ | ||
(e: 'update:collapsed', collapsed: boolean): void; // eslint-disable-line no-unused-vars | ||
}>(); | ||
</script> | ||
|
||
<style scoped="scss"> | ||
.uic-panel-container { | ||
:deep([data-pc-section='header']) { | ||
@apply flex flex-row gap-2 items-center justify-between; | ||
} | ||
:deep([data-pc-section='icons']) { | ||
@apply flex flex-row items-center justify-center; | ||
.toggle-icon { | ||
transition: transform 0.3s; | ||
&:not(.collapsed) { | ||
transform: rotate(180deg); | ||
} | ||
} | ||
} | ||
:deep([data-pc-section='content']) { | ||
@apply pt-2; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import '@testing-library/jest-dom'; | ||
import userEvent from '@testing-library/user-event'; | ||
import { render, waitFor } from '@testing-library/vue'; | ||
|
||
import Panel from '../Panel.vue'; | ||
|
||
describe('Panel', () => { | ||
it('renders', () => { | ||
const { getByTestId, getByText } = render(Panel, { | ||
slots: { | ||
header: { | ||
template: 'Test header slot' | ||
}, | ||
default: { | ||
template: 'Test default slot' | ||
} | ||
} | ||
}); | ||
|
||
expect(getByTestId('uic-panel')).toBeVisible(); | ||
expect(getByText('Test header slot')).toBeVisible(); | ||
expect(getByText('Test default slot')).toBeVisible(); | ||
}); | ||
|
||
it('emits update:collapsed', async () => { | ||
const { findByTestId, emitted } = render(Panel, { | ||
props: { | ||
collapsible: true | ||
} | ||
}); | ||
|
||
userEvent.click(await findByTestId('uic-panel-toggle-icon')); | ||
await waitFor(() => { | ||
expect(emitted()).toHaveProperty('update:collapsed'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as Panel } from './Panel.vue'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters