Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storybook 8 Upgrade #889

Merged
merged 195 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
195 commits
Select commit Hold shift + click to select a range
e93eb6c
remove storybook
JesmoDev Aug 12, 2024
ccfb7fe
install storybook 8
JesmoDev Aug 12, 2024
9ff519c
fix story paths
JesmoDev Aug 12, 2024
20e7ace
add umbraco text styling
JesmoDev Aug 12, 2024
c4ff958
Fix form control mixin
JesmoDev Aug 13, 2024
6c33eb6
add new web component analyzer
JesmoDev Aug 13, 2024
1b00940
add custom elements
JesmoDev Aug 13, 2024
13c5331
cleanup
JesmoDev Aug 13, 2024
b4ad6a0
add autodocs
JesmoDev Aug 13, 2024
1ccd3fe
cleanup button
JesmoDev Aug 13, 2024
06dc7e1
button stories
JesmoDev Aug 13, 2024
448a191
fix preview
JesmoDev Aug 13, 2024
cea25ca
work
JesmoDev Aug 19, 2024
cd6301d
css classes
JesmoDev Aug 19, 2024
2e44d3b
package lock
JesmoDev Aug 19, 2024
3cd82f9
remove test story
JesmoDev Aug 19, 2024
1a4923a
add spread directive
JesmoDev Aug 19, 2024
0093da4
fix import
JesmoDev Aug 19, 2024
033ceaf
more button stories
JesmoDev Aug 19, 2024
33df8b1
add size story
JesmoDev Aug 19, 2024
d63d5eb
update directive
JesmoDev Aug 19, 2024
615dc9f
update directive
JesmoDev Aug 19, 2024
0dc0424
more button stories
JesmoDev Aug 20, 2024
43dd373
cleanup
JesmoDev Aug 20, 2024
029e454
update directive
JesmoDev Aug 20, 2024
ed71686
fix directive
JesmoDev Aug 20, 2024
52fc4bc
button story
JesmoDev Aug 20, 2024
bc02955
cleanup
JesmoDev Aug 20, 2024
bacaf11
fix directive
JesmoDev Aug 20, 2024
b4c74b7
cleanup
JesmoDev Aug 20, 2024
c75996b
cleanup
JesmoDev Aug 20, 2024
db41668
action bar stories
JesmoDev Aug 20, 2024
7bf1910
add folder
JesmoDev Aug 20, 2024
6ef96be
avatar stories
JesmoDev Aug 20, 2024
cc73234
simple import
JesmoDev Aug 20, 2024
2a8ad17
avatar group
JesmoDev Aug 20, 2024
b9a9bdd
exclude decorators from source
JesmoDev Aug 20, 2024
8eac4ba
badge wip
JesmoDev Aug 20, 2024
03c3aca
fix icon registry setup
JesmoDev Aug 22, 2024
8484996
fix badge attention type
JesmoDev Aug 22, 2024
c067394
remove unused import
JesmoDev Aug 22, 2024
6a116f4
badge stories
JesmoDev Aug 22, 2024
3fcaf2f
formcontrolmixin mdx
JesmoDev Aug 22, 2024
f63df51
add id
JesmoDev Aug 22, 2024
d8ff451
uui box wip
JesmoDev Aug 22, 2024
b10bb88
package lock
JesmoDev Aug 22, 2024
7d91f6a
fix web component formatter
JesmoDev Aug 22, 2024
da7b71b
uui box
JesmoDev Aug 22, 2024
b2e9d97
breadcrumbs
JesmoDev Aug 23, 2024
8673813
button group
JesmoDev Aug 23, 2024
2eac21b
button group
JesmoDev Aug 23, 2024
b93722e
inline button create
JesmoDev Aug 23, 2024
d79fb08
inline button create
JesmoDev Aug 23, 2024
74dded7
uui card wip
JesmoDev Aug 23, 2024
44f6704
go back to old component analyzer
JesmoDev Aug 23, 2024
40a0df6
remove events from spread directive
JesmoDev Aug 23, 2024
bb9dad3
uui card
JesmoDev Aug 23, 2024
2d22a32
card block type
JesmoDev Aug 23, 2024
0a11d35
fix card
JesmoDev Aug 23, 2024
21bcefc
renderSlots helper
JesmoDev Aug 23, 2024
d0124a4
cleanup
JesmoDev Aug 23, 2024
17c3491
content node card
JesmoDev Aug 23, 2024
04b4635
card media
JesmoDev Aug 23, 2024
cac521b
card user
JesmoDev Aug 23, 2024
31abd54
caret
JesmoDev Aug 23, 2024
cd6b36b
filter out slots
JesmoDev Aug 29, 2024
8138750
js docs
JesmoDev Aug 29, 2024
30eb65e
add slot to slot names
JesmoDev Aug 29, 2024
f990b76
cleanup
JesmoDev Aug 29, 2024
dd4d40c
add rendering slots from args in renderSlots
JesmoDev Aug 29, 2024
cdaa18e
cleanup and update render slots to add newlines in the start and afte…
JesmoDev Aug 29, 2024
4bb7182
checkbox init
JesmoDev Aug 29, 2024
afff64e
checkbox
JesmoDev Aug 29, 2024
edf6213
Prevent false positives in renderSlots
JesmoDev Aug 29, 2024
271bb47
Prevent false positives in spread
JesmoDev Aug 29, 2024
a681378
color area
JesmoDev Aug 29, 2024
faeed23
cleanup
JesmoDev Aug 29, 2024
38b378b
color picker
JesmoDev Aug 29, 2024
df4282b
color slider
JesmoDev Aug 29, 2024
1084d5a
add event to all event names to prevent them from overriding properti…
JesmoDev Aug 29, 2024
a72e330
color swatch
JesmoDev Aug 29, 2024
78d1b99
color swatches
JesmoDev Aug 29, 2024
fa49b51
fix jsdocs types
JesmoDev Aug 29, 2024
5222154
fix jsdocs types
JesmoDev Aug 29, 2024
51f2957
fix ts configs
JesmoDev Aug 29, 2024
8e83476
combobox init
JesmoDev Aug 29, 2024
507771c
combobox wip
JesmoDev Aug 29, 2024
db8589f
auto format source
JesmoDev Aug 30, 2024
514b882
combobox
JesmoDev Aug 30, 2024
bf9e399
combobox list
JesmoDev Aug 30, 2024
eed5153
dialog and dialog layout
JesmoDev Sep 4, 2024
0b4168f
file dropzone
JesmoDev Sep 4, 2024
6adca49
file preview
JesmoDev Sep 4, 2024
f362511
revert pristine changes in formcontrolmixin
JesmoDev Sep 4, 2024
c3371b0
form
JesmoDev Sep 4, 2024
1c8304f
form layout
JesmoDev Sep 4, 2024
1032267
add missing import
JesmoDev Sep 4, 2024
ecded82
form validation message
JesmoDev Sep 4, 2024
5be0e6d
icon
JesmoDev Sep 4, 2024
05b8584
icon registry mdx
JesmoDev Sep 4, 2024
6ce2289
icon registry essential
JesmoDev Sep 4, 2024
8ff058a
icon registry essential
JesmoDev Sep 4, 2024
4df9e2a
input
JesmoDev Sep 4, 2024
4a91baf
input file
JesmoDev Sep 4, 2024
47f0b75
input lock
JesmoDev Sep 4, 2024
0d9bfe0
input password
JesmoDev Sep 4, 2024
e5c4488
render slots
JesmoDev Sep 4, 2024
0628daa
shortcuts
JesmoDev Sep 4, 2024
518440b
label
JesmoDev Sep 4, 2024
8495437
loaders
JesmoDev Sep 4, 2024
5fb5626
menu item
JesmoDev Sep 4, 2024
9d1b10e
modal
JesmoDev Sep 4, 2024
91bdbc0
pagination
JesmoDev Sep 4, 2024
7d0ea9a
popover
JesmoDev Sep 4, 2024
acbb59a
popover container
JesmoDev Sep 4, 2024
6f9bd13
progress bar
JesmoDev Sep 4, 2024
80a1ec2
radio
JesmoDev Sep 4, 2024
7cc879b
range slider
JesmoDev Sep 4, 2024
3d4d00c
ref
JesmoDev Sep 4, 2024
8faf7a7
ref
JesmoDev Sep 4, 2024
d5da15d
ref list
JesmoDev Sep 4, 2024
5d11ddb
ref node
JesmoDev Sep 4, 2024
548c2a9
ref node data type
JesmoDev Sep 4, 2024
5104b57
ref node document type
JesmoDev Sep 4, 2024
2016920
ref node form
JesmoDev Sep 4, 2024
2848292
ref node member
JesmoDev Sep 4, 2024
b03187a
ref node package
JesmoDev Sep 4, 2024
3e43ef1
ref node user
JesmoDev Sep 4, 2024
efa4180
scroll container
JesmoDev Sep 4, 2024
3eb2187
select
JesmoDev Sep 4, 2024
b628454
slider
JesmoDev Sep 5, 2024
5e29be0
symbol expand
JesmoDev Sep 5, 2024
34e8f90
symbol file dropzone
JesmoDev Sep 5, 2024
ab05077
symbol file thumbnail
JesmoDev Sep 5, 2024
8fe80df
symbol file
JesmoDev Sep 5, 2024
afa2f6a
symbol folder
JesmoDev Sep 5, 2024
75edd82
symbol lock
JesmoDev Sep 5, 2024
fdb3872
symbol more
JesmoDev Sep 5, 2024
3140533
symbol sort
JesmoDev Sep 5, 2024
c95b45b
table
JesmoDev Sep 5, 2024
fbcdfa9
table row
JesmoDev Sep 5, 2024
52787ab
table cell
JesmoDev Sep 5, 2024
947c579
clean
JesmoDev Sep 5, 2024
c0361af
tabs
JesmoDev Sep 5, 2024
1460c7e
tag
JesmoDev Sep 5, 2024
c567ab5
textarea
JesmoDev Sep 5, 2024
8d43f11
toast notification
JesmoDev Sep 5, 2024
c4a3668
toast notification container
JesmoDev Sep 5, 2024
ce2e74b
toast notification layout
JesmoDev Sep 5, 2024
aa8f4f3
toggle
JesmoDev Sep 5, 2024
15f11e9
visually hidden
JesmoDev Sep 5, 2024
9dc577a
css
JesmoDev Sep 6, 2024
ed8df3a
css stuff
JesmoDev Sep 6, 2024
4407bc4
add readme
JesmoDev Sep 6, 2024
a6a75b6
add readme
JesmoDev Sep 6, 2024
3cf729b
use old package lock
JesmoDev Sep 6, 2024
f558ad1
fix package.json
JesmoDev Sep 6, 2024
f628269
cleanup
JesmoDev Sep 6, 2024
c24a8ed
Merge branch 'v1/contrib' into v1/storybook8-upgrade
JesmoDev Sep 6, 2024
9ba0164
fix lint for storybook
JesmoDev Sep 6, 2024
15fb440
add theme
JesmoDev Sep 6, 2024
cbbc675
combine new and old mdx (remove new part of name)
JesmoDev Sep 6, 2024
56b0360
add stories from stories folder
JesmoDev Oct 8, 2024
f328cd8
include the stories
JesmoDev Oct 8, 2024
9fc5510
fix padding
JesmoDev Oct 8, 2024
dcf038b
update to storybook 8.3.5
JesmoDev Oct 8, 2024
0f71f50
Merge remote-tracking branch 'origin/v1/contrib' into v1/storybook8-u…
JesmoDev Oct 8, 2024
d7ef12d
add missing readonly story
JesmoDev Oct 8, 2024
08e810f
add missing import
JesmoDev Oct 8, 2024
3a27c8c
add a11y addon
JesmoDev Oct 9, 2024
df4f7bf
Merge remote-tracking branch 'origin/v1/contrib' into v1/storybook8-u…
JesmoDev Oct 9, 2024
407afc5
package lock
JesmoDev Oct 9, 2024
098cd80
package lock
JesmoDev Oct 9, 2024
2ddee58
fix: override lit version
iOvergaard Oct 9, 2024
39ff290
fix uui icon build
JesmoDev Oct 9, 2024
f3d7d88
Merge remote-tracking branch 'origin/v1/storybook8-upgrade' into v1/s…
JesmoDev Oct 9, 2024
0fc3295
chore: npm dedupe
iOvergaard Oct 9, 2024
06b6fcf
Merge remote-tracking branch 'origin/v1/storybook8-upgrade' into v1/s…
JesmoDev Oct 9, 2024
f240909
update button stories
JesmoDev Oct 9, 2024
ceadebf
Merge remote-tracking branch 'origin/v1/contrib' into v1/storybook8-u…
JesmoDev Oct 9, 2024
5118715
Merge branch 'v1/contrib' into v1/storybook8-upgrade
iOvergaard Oct 10, 2024
653139d
chore: mark property as readonly
iOvergaard Oct 10, 2024
eb135b7
build(deps-dev): update chromatic to 11.12.5
iOvergaard Oct 10, 2024
7705cfe
chore: remove old story files
iOvergaard Oct 10, 2024
f1a4951
chore: rename stories to .story
iOvergaard Oct 10, 2024
910fa52
chore: use .story.ts files
iOvergaard Oct 10, 2024
7b8dfaf
chore: correct imports to .story.ts
iOvergaard Oct 10, 2024
6b0bc2f
feat: update theme
iOvergaard Oct 10, 2024
0c04d79
restore images
iOvergaard Oct 10, 2024
5753cff
restore manager-head.html
iOvergaard Oct 10, 2024
c80fa5d
docs: include 'images' in storybook output
iOvergaard Oct 10, 2024
bdfd6d3
chore: remove uncommented code
iOvergaard Oct 10, 2024
ed8f50c
update packageManager field
iOvergaard Oct 10, 2024
b370514
chore: rename story
iOvergaard Oct 10, 2024
9197a8d
Merge remote-tracking branch 'origin/v1/contrib' into v1/storybook8-u…
iOvergaard Oct 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ out-css

# old source
/src

*storybook.log
72 changes: 0 additions & 72 deletions .storybook/main.js

This file was deleted.

32 changes: 32 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import type { StorybookConfig } from '@storybook/web-components-vite';
import { html } from 'lit';
import { join, dirname } from 'path';

/**
* This function is used to resolve the absolute path of a package.
* It is needed in projects that use Yarn PnP or are set up within a monorepo.
*/
function getAbsolutePath(value: string): any {
return dirname(require.resolve(join(value, 'package.json')));
}

const config: StorybookConfig = {
stories: [
'../packages/**/*.mdx',
'../packages/**/*.story.@(js|jsx|mjs|ts|tsx)',
'../stories/**/*.story.@(js|jsx|mjs|ts|tsx)',
],
staticDirs: ['./images'],
addons: [
getAbsolutePath('@storybook/addon-links'),
getAbsolutePath('@storybook/addon-essentials'),
getAbsolutePath('@chromatic-com/storybook'),
getAbsolutePath('@storybook/addon-a11y'),
'../storyhelpers/storybook-readme',
],
framework: {
name: getAbsolutePath('@storybook/web-components-vite'),
options: {},
},
};
export default config;
2 changes: 1 addition & 1 deletion .storybook/manager.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { addons } from '@storybook/addons';
import { addons } from '@storybook/manager-api';
import umbracoTheme from './umbraco-theme';

addons.setConfig({
Expand Down
4 changes: 0 additions & 4 deletions .storybook/preview-body.html

This file was deleted.

51 changes: 0 additions & 51 deletions .storybook/preview-head.html

This file was deleted.

73 changes: 38 additions & 35 deletions .storybook/preview.js → .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,40 +1,41 @@
import {
setCustomElementsManifest,
type Preview,
} from '@storybook/web-components';
import '../packages/uui-css/lib/uui-css.css';
import 'element-internals-polyfill';

import { setCustomElements } from '@storybook/web-components';

import customElements from '../custom-elements.json';
import { html } from 'lit';

export const parameters = {
layout: 'padded',
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)/i,
date: /Date$/,
import '@umbraco-ui/uui-icon-registry-essential/lib';

const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
docs: {
source: { state: 'open' },
},
options: {
method: 'alphabetical',
storySort: (a, b) => {
//NOTE: This has to be an inline function for some reason
if (a.title === 'Overview') {
return 0;
}
if (b.title === 'Overview') {
return 1;
}
return a.title > b.title;
docs: {
source: {
excludeDecorators: true,
format: 'html', // see storybook docs for more info on this format https://storybook.js.org/docs/api/doc-blocks/doc-block-source#format
},
},
},
tags: ['autodocs'],

decorators: [
story => {
return html`<uui-icon-registry-essential class="uui-font uui-text"
>${story()}</uui-icon-registry-essential
>`;
},
],
};

WebComponentFormatter(customElements);

setCustomElements(customElements);
setCustomElementsManifest(customElements);

function WebComponentFormatter(customElements) {
for (let tag of customElements.tags || []) {
Expand All @@ -59,19 +60,19 @@ function WebComponentFormatter(customElements) {
}
}

// Find all names of properties
const propertyNames = (tag.properties || []).map(p => p.name);
// add 'Event' to the name of all events
for (let event of tag.events || []) {
event.name = `${event.name} event`;
}

// Run through all slots to clean them up a bit
for (let slot of tag.slots || []) {
// Replace the name of the default slot so Storybook will show it
if (typeof slot.name === 'string' && slot.name.length === 0) {
slot.name = 'slot';
}

// If the slot has the same name as a property, then add the word 'slot' to the name
// Bug reported to Storybook here: https://github.com/storybookjs/storybook/issues/17733
if (propertyNames.includes(slot.name)) {
} else {
// Add slot to the name. This will allow us to filter out slots in various situations. Example the spread directive.
// Bug reported to Storybook here: https://github.com/storybookjs/storybook/issues/17733
slot.name = `${slot.name} slot`;
}

Expand All @@ -84,3 +85,5 @@ function WebComponentFormatter(customElements) {

return customElements;
}

export default preview;
29 changes: 2 additions & 27 deletions .storybook/umbraco-theme.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ export default [
// Global ignores
includeIgnoreFile(gitignorePath),
{
ignores: ['**/*.{cjs,mjs,js}', 'vite.config.ts', 'stories/'],
ignores: [
'**/*.{cjs,mjs,js}',
'vite.config.ts',
'stories/',
'**/.storybook/**',
],
},

// Global config
Expand Down
Loading
Loading