Skip to content

Commit

Permalink
Merge branch 'v1/contrib' into pr/915
Browse files Browse the repository at this point in the history
  • Loading branch information
julczka committed Oct 11, 2024
2 parents 2442a2f + 8e7b851 commit 114326e
Show file tree
Hide file tree
Showing 133 changed files with 17,211 additions and 29,779 deletions.
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.

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [1.10.1](https://github.com/umbraco/Umbraco.UI/compare/v1.10.0...v1.10.1) (2024-10-09)

### Bug Fixes

- **uui-slider:** Focus handle in slider instead of slider track itself ([#918](https://github.com/umbraco/Umbraco.UI/issues/918)) ([b3438a0](https://github.com/umbraco/Umbraco.UI/commit/b3438a07d28e945a1f98ebfd976d4f661222ed51))

# [1.10.0](https://github.com/umbraco/Umbraco.UI/compare/v1.10.0-rc.0...v1.10.0) (2024-09-16)

**Note:** Version bump only for package uui-monorepo
Expand Down
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
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "node_modules/@lerna-lite/cli/schemas/lerna-schema.json",
"packages": ["packages/*"],
"version": "1.10.0",
"version": "1.10.1",
"preid": "rc",
"exact": true,
"noPush": true,
Expand Down
Loading

0 comments on commit 114326e

Please sign in to comment.