Skip to content

Commit

Permalink
Merge branch 'main' into feat/new-monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgoud committed Jan 23, 2024
2 parents 9593734 + e5aa555 commit e3d93a2
Show file tree
Hide file tree
Showing 54 changed files with 3,128 additions and 796 deletions.
7 changes: 4 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"cSpell.words": ["Puik", "puik"],
"typescript.tsdk": "node_modules/typescript/lib",
"editor.codeActionsOnSave": {
"source.fixAll": false,
"source.fixAll.eslint": false
"source.fixAll": "never",
"source.fixAll.eslint": "explicit"
},
"npm.packageManager": "pnpm",
"eslint.probe": [
Expand All @@ -29,5 +29,6 @@
"i18n-ally.localesPaths": "packages/locale/lang",
"i18n-ally.enabledParsers": ["ts"],
"i18n-ally.enabledFrameworks": ["vue", "vue-sfc"],
"i18n-ally.keystyle": "nested"
"i18n-ally.keystyle": "nested",
"eslint.format.enable": true
}
18 changes: 9 additions & 9 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@
"build": "storybook build"
},
"devDependencies": {
"@storybook/addon-a11y": "^7.6.4",
"@storybook/addon-actions": "^7.6.4",
"@storybook/addon-essentials": "^7.6.4",
"@storybook/addon-links": "^7.6.4",
"@storybook/blocks": "^7.6.4",
"@storybook/vue3": "^7.6.4",
"@storybook/vue3-vite": "^7.6.4",
"@storybook/addon-a11y": "^7.6.10",
"@storybook/addon-actions": "^7.6.10",
"@storybook/addon-essentials": "^7.6.10",
"@storybook/addon-links": "^7.6.10",
"@storybook/blocks": "^7.6.10",
"@storybook/vue3": "^7.6.10",
"@storybook/vue3-vite": "^7.6.10",
"@vitejs/plugin-vue": "^4.5.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"storybook": "^7.6.4",
"storybook": "^7.6.10",
"vite": "^5.0.8"
},
"dependencies": {
"@storybook/client-api": "^7.6.4",
"@storybook/client-api": "^7.6.10",
"typescript": "^5.3.3",
"vue": "3.3.10"
}
Expand Down
1 change: 1 addition & 0 deletions packages/components/accordion/src/accordion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export interface AccordionProps {
subTitle?: string
icon?: string
disabled?: boolean
borderNone?: boolean
dataTest?: string
}

Expand Down
1 change: 1 addition & 0 deletions packages/components/accordion/src/accordion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
:class="{
'puik-accordion--expanded': isExpanded,
'puik-accordion--disabled': disabled,
'puik-accordion--border-none': borderNone,
}"
>
<button
Expand Down
52 changes: 52 additions & 0 deletions packages/components/accordion/stories/accordion.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ export default {
control: 'none',
description: 'Accordion content'
},
borderNone: {
control: 'boolean',
description: 'remove borders',
table: {
defaultValue: {
summary: false
}
}
},
dataTest: {
control: 'text',
description:
Expand Down Expand Up @@ -157,3 +166,46 @@ export const Disabled = {
}
}
};

export const NoBorders = {
render: Template,

args: {
name: 'accordion-1',
title: 'Accordion title',
subTitle: 'Accordion subtitle',
icon: 'home',
borderNone: true
},

parameters: {
docs: {
source: {
code: `
<!--VueJS Snippet-->
<puik-accordion-group>
<puik-accordion name="accordion-1" border-none>
Content 1
</puik-accordion>
</puik-accordion-group>
<!--HTML/CSS Snippet-->
<div class="puik-accordion-group">
<div class="puik-accordion puik-accordion--border-none">
<button aria-expanded="true" aria-controls="accordion-id" class="puik-accordion__header">
<div class="puik-icon material-icons-round puik-accordion__header__icon" style="font-size: 24px;">home</div>
<div class="puik-accordion__header__content">
<div class="puik-accordion__header__content__title">Accordion title</div>
<div class="puik-accordion__header__content__sub-title">Accordion subtitle</div>
</div>
<div class="puik-icon material-icons-round puik-accordion__header__expand__icon" style="font-size: 24px;">keyboard_arrow_up</div>
</button>
<div id="accordion-id" class="puik-accordion__content"> Content 1 </div>
</div>
</div>
`,
language: 'html'
}
}
}
};
15 changes: 15 additions & 0 deletions packages/components/accordion/test/accordion.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,19 @@ describe('Accordion tests', () => {
'icon-accordion'
);
});

it('should not contain borders', () => {
const template = `
<puik-accordion-group>
<puik-accordion name="accordion-1" title="title-1" border-none>
Content 1
</puik-accordion>
</puik-accordion-group>
`;
factory(template);
const accordion = getAccordion(wrapper);
expect(getAccordionContainer(accordion).classes()).toContain(
'puik-accordion--border-none'
);
});
});
1 change: 1 addition & 0 deletions packages/components/link/src/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface LinkProps {
to?: RouteLocationRaw
target?: `${PuikLinkTargetVariants}`
title?: string
highContrast?: boolean
dataTest?: string
}

Expand Down
6 changes: 5 additions & 1 deletion packages/components/link/src/link.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
v-bind="pathProp"
:target="target"
:title="title"
:class="['puik-link', `puik-link--${size}`]"
:class="[
'puik-link',
`puik-link--${size}`,
{ 'puik-link--high-contrast': highContrast },
]"
:data-test="dataTest"
>
<slot />
Expand Down
13 changes: 12 additions & 1 deletion packages/components/link/stories/link.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ export default {
}
}
},
highContrast: {
description:
'Sets the link in high contrast mode by disabling the purple color for the visited stated',
table: {
defaultValue: {
summary: false
}
}
},
default: {
control: 'text',
description: 'Label of the link'
Expand All @@ -62,6 +71,7 @@ export default {
href: '#',
to: undefined,
target: '_self',
highContrast: false,
default: "I'm a cool link",
title: "I'm a tooltip for your link",
size: 'md',
Expand Down Expand Up @@ -100,8 +110,9 @@ export const Default = {
<!--
$sizes: ${linkSizesSummary}
$targets: ${targetVariantsSummary}
$variants: high-contrast (optional)
-->
<a class="puik-link puik-link--{$sizes}" href="#" target="$targets" title="I'm a tooltip for your link">
<a class="puik-link puik-link--{$sizes} puik-link--{$variants}" href="#" target="$targets" title="I'm a tooltip for your link">
I'm a cool link
</a>
`,
Expand Down
5 changes: 5 additions & 0 deletions packages/components/link/test/link.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,9 @@ describe('Link tests', () => {
factory({ href: '/test', dataTest: 'test' });
expect(findLink().attributes('data-test')).toBe('test');
});

it('should set the link in high-contrast mode', () => {
factory({ highContrast: true });
expect(findLink().classes()).toContain('puik-link--high-contrast');
});
});
6 changes: 3 additions & 3 deletions packages/components/modal/src/modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
v-if="titleIcon || PuikModalVariants.Destructive === variant"
class="puik-modal__dialogPanelContainer__dialogPanel__header__icon"
:icon="getTitleIconName ?? ''"
:font-size="24"
:font-size="ICON_SIZE"
/>

<puik-tooltip
Expand Down Expand Up @@ -48,7 +48,7 @@
>
<puik-icon
icon="close"
:font-size="CLOSE_ICON_SIZE"
:font-size="ICON_SIZE"
/>
</puik-button>
</header>
Expand Down Expand Up @@ -122,7 +122,7 @@ defineOptions({
name: 'PuikModal'
});
const CLOSE_ICON_SIZE = 24;
const ICON_SIZE = 24;
const props = withDefaults(defineProps<ModalProps>(), {
variant: PuikModalVariants.Feedback,
Expand Down
54 changes: 27 additions & 27 deletions packages/components/select/test/select.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,33 +306,33 @@ describe('Select tests', () => {
expect(findSelected().classes('puik-select__selected--full-width')).toBe(false);
});

it('should display the custom label', async () => {
const items = [
{
label: 'Test',
value: 'test'
},
{
label: 'Test2',
value: 'test2'
},
{
label: 'Test3',
value: 'test3'
}
];
factory(
`<puik-select :options="items" v-model="value" custom-label="Custom Label">
<puik-option value="test" label="test" />
</puik-select>`,
() => ({
items,
value: ''
})
);
await findAllOptions().at(0)?.trigger('click');
expect(findSelected().element.value).toBe('Custom Label');
});
// it('should display the custom label', async () => {
// const items = [
// {
// label: 'Test',
// value: 'test',
// },
// {
// label: 'Test2',
// value: 'test2',
// },
// {
// label: 'Test3',
// value: 'test3',
// },
// ]
// factory(
// `<puik-select :options="items" v-model="value" custom-label="Custom Label">
// <puik-option value="test" label="test" />
// </puik-select>`,
// () => ({
// items,
// value: '',
// })
// )
// await findAllOptions().at(0)?.trigger('click')
// expect(findSelected().element.value).toBe('Custom Label')
// })

it('should have a data-test attribute on select, searchInput noResults and options', async () => {
const items = [
Expand Down
2 changes: 1 addition & 1 deletion packages/components/snackbar/src/snackbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<button
v-if="action"
class="puik-snackbar__action"
@click="action?.callback"
@click="action?.callback(), close()"
>
{{ action.label }}
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

<script setup lang="ts">
import { type TabNavigationGroupTitlesProps } from './tab-navigation-group-titles';
defineOptions({
name: 'PuikTabNavigationGroupTitles'
});
Expand Down
3 changes: 3 additions & 0 deletions packages/components/table-search-input/style/css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import '@prestashopcorp/puik-components/base/style/css';
import '@prestashopcorp/puik-theme/puik-table-search-input.css';
import '@prestashopcorp/puik-theme/puik-input.css';
3 changes: 3 additions & 0 deletions packages/components/table-search-input/style/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import '@prestashopcorp/puik-components/base/style';
import '@prestashopcorp/puik-theme/src/puik-table-search-input.scss';
import '@prestashopcorp/puik-theme/src/puik-input.scss';
3 changes: 3 additions & 0 deletions packages/components/table/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import Table from './src/table.vue';
import TableSearchInput from './src/table-search-input.vue';

export const PuikTable = Table;
export const PuikTableSearchInput = TableSearchInput;
export default PuikTable;

export * from './src/table';
export * from './src/table-search-input';
26 changes: 26 additions & 0 deletions packages/components/table/src/table-search-input.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import type TableSearchInput from './table-search-input.vue';

export enum PuikTableSearchInputTypes {
Text = 'text',
Range = 'range',
}

export type inputRange = {
min?: number
max?: number
};

export type searchOption = {
searchBy: string
inputText?: string
inputRange?: inputRange
};
export interface TableSearchInputProps {
name?: string
column?: string
searchSubmit?: boolean
searchReset?: boolean
searchType?: `${PuikTableSearchInputTypes}`
}

export type TableSearchInputInstance = InstanceType<typeof TableSearchInput>;
Loading

0 comments on commit e3d93a2

Please sign in to comment.