Skip to content

Commit

Permalink
Adds scaffolding files for uui-copy
Browse files Browse the repository at this point in the history
npm run new-package
  • Loading branch information
warrenbuckley committed Dec 16, 2024
1 parent 207119e commit 380f454
Show file tree
Hide file tree
Showing 10 changed files with 184 additions and 0 deletions.
12 changes: 12 additions & 0 deletions package-lock.json

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

31 changes: 31 additions & 0 deletions packages/uui-copy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# uui-copy

![npm](https://img.shields.io/npm/v/@umbraco-ui/uui-copy?logoColor=%231B264F)

Umbraco style copy component.

## Installation

### ES imports

```zsh
npm i @umbraco-ui/uui-copy
```

Import the registration of `<uui-copy>` via:

```javascript
import '@umbraco-ui/uui-copy';
```

When looking to leverage the `UUICopyElement` base class as a type and/or for extension purposes, do so via:

```javascript
import { UUICopyElement } from '@umbraco-ui/uui-copy';
```

## Usage

```html
<uui-copy></uui-copy>
```
1 change: 1 addition & 0 deletions packages/uui-copy/lib/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './uui-copy.element';
28 changes: 28 additions & 0 deletions packages/uui-copy/lib/uui-copy.element.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
import { css, html, LitElement } from 'lit';

/**
* @element uui-copy
*/
@defineElement('uui-copy')
export class UUICopyElement extends LitElement {
static styles = [
css`
:host {
/* Styles goes here */
}
`,
];

render(){
return html`
Markup goes here
`;
}
}

declare global {
interface HTMLElementTagNameMap {
'uui-copy': UUICopyElement;
}
}
24 changes: 24 additions & 0 deletions packages/uui-copy/lib/uui-copy.story.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { Meta, StoryObj } from '@storybook/web-components';

import './uui-copy.element';
import type { UUICopyElement } from './uui-copy.element';
import readme from '../README.md?raw';

const meta: Meta<UUICopyElement> = {
id: 'uui-copy',
title: 'Copy',
component: 'uui-copy',
parameters: {
readme: { markdown: readme },
docs: {
source: {
code: `<uui-copy></uui-copy>`,
},
},
},
};

export default meta;
type Story = StoryObj<UUICopyElement>;

export const Overview: Story = {};
20 changes: 20 additions & 0 deletions packages/uui-copy/lib/uui-copy.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { html, fixture, expect } from '@open-wc/testing';
import { UUICopyElement } from './uui-copy.element';

describe('UUICopyElement', () => {
let element: UUICopyElement;

beforeEach(async () => {
element = await fixture(
html` <uui-copy></uui-copy> `
);
});

it('is defined with its own instance', () => {
expect(element).to.be.instanceOf(UUICopyElement);
});

it('passes the a11y audit', async () => {
await expect(element).shadowDom.to.be.accessible();
});
});
44 changes: 44 additions & 0 deletions packages/uui-copy/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "@umbraco-ui/uui-copy",
"version": "0.0.0",
"license": "MIT",
"keywords": [
"Umbraco",
"Custom elements",
"Web components",
"UI",
"Lit",
"Copy"
],
"description": "Umbraco UI copy component",
"repository": {
"type": "git",
"url": "https://github.com/umbraco/Umbraco.UI.git",
"directory": "packages/uui-copy"
},
"bugs": {
"url": "https://github.com/umbraco/Umbraco.UI/issues"
},
"main": "./lib/index.js",
"module": "./lib/index.js",
"types": "./lib/index.d.ts",
"type": "module",
"customElements": "custom-elements.json",
"files": [
"lib/**/*.d.ts",
"lib/**/*.js",
"custom-elements.json"
],
"dependencies": {
"@umbraco-ui/uui-base": "1.12.2"
},
"scripts": {
"build": "npm run analyze && tsc --build --force && rollup -c rollup.config.js",
"clean": "tsc --build --clean && rimraf -g dist lib/*.js lib/**/*.js *.tgz lib/**/*.d.ts custom-elements.json",
"analyze": "web-component-analyzer **/*.element.ts --outFile custom-elements.json"
},
"publishConfig": {
"access": "public"
},
"homepage": "https://uui.umbraco.com/?path=/story/uui-copy"
}
5 changes: 5 additions & 0 deletions packages/uui-copy/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { UUIProdConfig } from '../rollup-package.config.mjs';

export default UUIProdConfig({
entryPoints: ['index']
});
17 changes: 17 additions & 0 deletions packages/uui-copy/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Don't edit this file directly. It is generated by /scripts/generate-ts-config.js

{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./lib",
"rootDir": "./lib",
"composite": true
},
"include": ["./**/*.ts"],
"exclude": ["./**/*.test.ts", "./**/*.story.ts"],
"references": [
{
"path": "../uui-base"
}
]
}
2 changes: 2 additions & 0 deletions packages/uui/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,5 @@ export * from '@umbraco-ui/uui-toast-notification-layout/lib';
export * from '@umbraco-ui/uui-toast-notification/lib';
export * from '@umbraco-ui/uui-toggle/lib';
export * from '@umbraco-ui/uui-visually-hidden/lib';

export * from '@umbraco-ui/uui-copy/lib/index.js';

0 comments on commit 380f454

Please sign in to comment.