Skip to content

Commit

Permalink
Merge branch 'feat/cwc-storybook-7-vite' into chore/content-switcher-…
Browse files Browse the repository at this point in the history
…sb-v7
  • Loading branch information
m4olivei committed Jan 8, 2024
2 parents 3308b8d + 8a98504 commit 895c24b
Show file tree
Hide file tree
Showing 23 changed files with 190 additions and 131 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
9 changes: 9 additions & 0 deletions packages/carbon-web-components/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/**
* @license
*
* Copyright IBM Corp. 2023, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

import type { StorybookConfig } from '@storybook/web-components-vite';
import { mergeConfig } from 'vite';
import { litStyleLoader, litTemplateLoader } from '@mordech/vite-lit-loader';
Expand Down
3 changes: 2 additions & 1 deletion packages/carbon-web-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"@babel/runtime": "^7.16.3",
"@carbon/styles": "^1.45.0",
"flatpickr": "4.6.1",
"lit": "^2.7.6",
"lit": "^3.1.0",
"lodash-es": "^4.17.21"
},
"devDependencies": {
Expand All @@ -100,6 +100,7 @@
"@percy/cli": "^1.27.4",
"@percy/cypress": "^3.1.2",
"@percy/dom": "^1.27.5",
"@rollup/plugin-alias": "^5.1.0",
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-commonjs": "^21.0.3",
"@rollup/plugin-node-resolve": "^8.4.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @license
*
* Copyright IBM Corp. 2019, 2023
* Copyright IBM Corp. 2019, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
Expand All @@ -14,7 +14,7 @@ import { prefix } from '../../globals/settings';
import WarningFilled16 from '@carbon/icons/lib/warning--filled/16';
import WarningAltFilled16 from '@carbon/icons/lib/warning--alt--filled/16';
import CDSCheckbox from './checkbox';
import styles from './checkbox.scss';
import styles from './checkbox.scss?lit';
import { carbonElement as customElement } from '../../globals/decorators/carbon-element';

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @license
*
* Copyright IBM Corp. 2019, 2023
* Copyright IBM Corp. 2019, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
Expand Down Expand Up @@ -53,7 +53,6 @@ const meta: Meta = {
};

export const Default = {
name: 'Default',
parameters: {
controls: { exclude: /(.*?)/ },
},
Expand All @@ -63,4 +62,4 @@ export const Playground = {
argTypes: controls,
};

export default meta;
export default meta;
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/**
* @license
*
* Copyright IBM Corp. 2019, 2023
* Copyright IBM Corp. 2019, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

import { LitElement, html } from 'lit';
import { customElement } from 'lit/decorators.js';
import { carbonElement as customElement } from '../../globals/decorators/carbon-element';
import { prefix } from '../../globals/settings';
import styles from './data-table.scss?lit';

Expand Down
82 changes: 40 additions & 42 deletions packages/carbon-web-components/src/components/icon/icon.stories.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @license
*
* Copyright IBM Corp. 2019, 2023
* Copyright IBM Corp. 2019, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
Expand All @@ -22,58 +22,56 @@ import Add32 from '@carbon/web-components/es/icons/add/32';

import storyDocs from './icon.mdx';


export const Default = {
render: () => html` ${Add16()} ${Add20()} ${Add24()} ${Add32()} `
}

render: () => html` ${Add16()} ${Add20()} ${Add24()} ${Add32()} `,
};

export const withCustomClass = {
name: 'With custom class',
render: () => html`
<style>
.test-class {
fill: #0062ff;
}
</style>
${Add16({ class: 'test-class' })} ${Add20({ class: 'test-class' })}
${Add24({ class: 'test-class' })} ${Add32({ class: 'test-class' })}
`
}
<style>
.test-class {
fill: #0062ff;
}
</style>
${Add16({ class: 'test-class' })} ${Add20({ class: 'test-class' })}
${Add24({ class: 'test-class' })} ${Add32({ class: 'test-class' })}
`,
};

export const withAriaLabel = {
name: 'With aria label',
render: () => html`
${Add16({ 'aria-label': 'add' })} ${Add20({ 'aria-label': 'add' })}
${Add24({ 'aria-label': 'add' })} ${Add32({ 'aria-label': 'add' })}
`
}
${Add16({ 'aria-label': 'add' })} ${Add20({ 'aria-label': 'add' })}
${Add24({ 'aria-label': 'add' })} ${Add32({ 'aria-label': 'add' })}
`,
};

export const withTitle = {
export const withTitle = {
name: 'With title',
render: () => html`
${Add16({
'aria-describedby': 'id-title-1',
// @ts-ignore
children: svg`<title id="id-title-1">add</title>`,
})}
${Add20({
'aria-describedby': 'id-title-2',
// @ts-ignore
children: svg`<title id="id-title-2">add</title>`,
})}
${Add24({
'aria-describedby': 'id-title-3',
// @ts-ignore
children: svg`<title id="id-title-3">add</title>`,
})}
${Add32({
'aria-describedby': 'id-title-4',
// @ts-ignore
children: svg`<title id="id-title-4">add</title>`,
})}
`
}
${Add16({
'aria-describedby': 'id-title-1',
// @ts-ignore
children: svg`<title id="id-title-1">add</title>`,
})}
${Add20({
'aria-describedby': 'id-title-2',
// @ts-ignore
children: svg`<title id="id-title-2">add</title>`,
})}
${Add24({
'aria-describedby': 'id-title-3',
// @ts-ignore
children: svg`<title id="id-title-3">add</title>`,
})}
${Add32({
'aria-describedby': 'id-title-4',
// @ts-ignore
children: svg`<title id="id-title-4">add</title>`,
})}
`,
};

const meta = {
title: 'Components/Icon',
Expand All @@ -84,4 +82,4 @@ const meta = {
},
};

export default meta;
export default meta;
34 changes: 11 additions & 23 deletions packages/carbon-web-components/src/components/link/link.stories.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @license
*
* Copyright IBM Corp. 2019, 2023
* Copyright IBM Corp. 2019, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
Expand All @@ -19,7 +19,7 @@ const defaultArgs = {
inline: false,
size: LINK_SIZE.MEDIUM,
visited: false,
}
};

const controls = {
disabled: {
Expand All @@ -31,20 +31,20 @@ const controls = {
description: `Provide the href attribute for the <a> node`,
},
size: {
control: 'radio', options: [LINK_SIZE.SMALL, LINK_SIZE.MEDIUM, LINK_SIZE.LARGE],
description: `Specify the size of the Link. Currently supports either sm, 'md' (default) or 'lg' as an option.`
control: 'radio',
options: [LINK_SIZE.SMALL, LINK_SIZE.MEDIUM, LINK_SIZE.LARGE],
description: `Specify the size of the Link. Currently supports either sm, 'md' (default) or 'lg' as an option.`,
},
visited: {
control: 'boolean',
description: `Specify whether you want the link to receive visited styles after the link has been clicked`,
},
}
};

export const Default = {
render: () => html` <cds-link href="#"> Link </cds-link> `
render: () => html` <cds-link href="#"> Link </cds-link> `,
};


export const Inline = {
render: () => html`
<cds-link inline href="#"
Expand All @@ -64,20 +64,15 @@ export const Inline = {
Duis at tincidunt orci. Ut velit ipsum, lacinia at ex quis, aliquet
rhoncus purus. Praesent et scelerisque ligula.
</p>
`
`,
};

export const PairedWithIcon = {
args: defaultArgs,
parameters: {
controls: { exclude: /(.*?)/ },
},
render: ({
disabled,
href,
size,
onClick
}) => html`
render: ({ disabled, href, size, onClick }) => html`
<cds-link
?disabled="${disabled}"
href="${ifDefined(href)}"
Expand All @@ -91,14 +86,7 @@ export const PairedWithIcon = {
export const Playground = {
argTypes: controls,
args: defaultArgs,
render: ({
disabled,
href,
inline,
size,
visited,
onClick
}) => html`
render: ({ disabled, href, inline, size, visited, onClick }) => html`
<cds-link
?disabled="${disabled}"
href="${ifDefined(href)}"
Expand All @@ -120,4 +108,4 @@ const meta = {
},
};

export default meta;
export default meta;
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/**
* @license
*
* Copyright IBM Corp. 2021, 2023
* Copyright IBM Corp. 2021, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

import { prefix } from '../../globals/settings';
import CDSButton from '../button/button';
import buttonStyles from '../button/button.scss';
import buttonStyles from '../button/button.scss?lit';
import styles from './modal.scss?lit';
import { carbonElement as customElement } from '../../globals/decorators/carbon-element';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @license
*
* Copyright IBM Corp. 2019, 2023
* Copyright IBM Corp. 2019, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
Expand All @@ -15,7 +15,7 @@ import Fade16 from '@carbon/web-components/es/icons/fade/16';
import Search20 from '@carbon/web-components/es/icons/search/20';
import Notification20 from '@carbon/web-components/es/icons/notification/20';
import SwitcherIcon20 from '@carbon/web-components/es/icons/switcher/20';
import contentStyles from '@carbon/styles/scss/components/ui-shell/content/_content.scss';
import contentStyles from '@carbon/styles/scss/components/ui-shell/content/_content.scss?lit';
import { SIDE_NAV_COLLAPSE_MODE, SIDE_NAV_USAGE_MODE } from './side-nav';
import { classMap } from 'lit/directives/class-map.js';
import './index';
Expand Down
Loading

0 comments on commit 895c24b

Please sign in to comment.