Skip to content

Commit 7cd20db

Browse files
JesmoDeviOvergaard
andauthored
feat: Prefix interface types with UUI (#716)
* prefix interface types with UUI * Update packages/uui-badge/lib/uui-badge.element.ts --------- Co-authored-by: Jacob Overgaard <[email protected]>
1 parent 2f07793 commit 7cd20db

File tree

9 files changed

+35
-24
lines changed

9 files changed

+35
-24
lines changed

packages/uui-badge/lib/uui-badge.element.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
22
import { css, html, LitElement } from 'lit';
33
import { property } from 'lit/decorators.js';
44
import type {
5-
InterfaceColor,
6-
InterfaceLook,
5+
UUIInterfaceColor,
6+
UUIInterfaceLook,
77
} from '@umbraco-ui/uui-base/lib/types';
88

99
/**
@@ -21,7 +21,7 @@ export class UUIBadgeElement extends LitElement {
2121
* @default "default"
2222
*/
2323
@property({ reflect: true })
24-
color: InterfaceColor = 'default';
24+
color: UUIInterfaceColor = 'default';
2525

2626
/**
2727
* Changes the look of the button to one of the predefined, symbolic looks. For example - set this to positive if you want nice, green "confirm" button.
@@ -30,7 +30,7 @@ export class UUIBadgeElement extends LitElement {
3030
* @default "default"
3131
*/
3232
@property({ reflect: true })
33-
look: InterfaceLook = 'primary';
33+
look: UUIInterfaceLook = 'primary';
3434

3535
/**
3636
* Bring attention to this badge by applying a bounce animation.
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
export const InterfaceColorValues: Readonly<InterfaceColor[]> = [
1+
export const UUIInterfaceColorValues: Readonly<UUIInterfaceColor[]> = [
22
'default',
33
'positive',
44
'warning',
55
'danger',
66
] as const;
77

8-
export type InterfaceColor = '' | 'default' | 'positive' | 'warning' | 'danger';
8+
export type UUIInterfaceColor =
9+
| ''
10+
| 'default'
11+
| 'positive'
12+
| 'warning'
13+
| 'danger';
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const InterfaceHeadingValues: Readonly<InterfaceHeading[]> = [
1+
export const UUIInterfaceHeadingValues: Readonly<UUIInterfaceHeading[]> = [
22
'h1',
33
'h2',
44
'h3',
@@ -7,4 +7,4 @@ export const InterfaceHeadingValues: Readonly<InterfaceHeading[]> = [
77
'h6',
88
] as const;
99

10-
export type InterfaceHeading = '' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
10+
export type UUIInterfaceHeading = '' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';

packages/uui-base/lib/types/InterfaceLook.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
export const InterfaceLookValues: Readonly<InterfaceLook[]> = [
1+
export const UUIInterfaceLookValues: Readonly<UUIInterfaceLook[]> = [
22
'default',
33
'primary',
44
'secondary',
55
'outline',
66
'placeholder',
77
] as const;
88

9-
export type InterfaceLook =
9+
export type UUIInterfaceLook =
1010
| ''
1111
| 'default'
1212
| 'primary'

packages/uui-box/lib/uui-box.element.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { LitElement, css } from 'lit';
22
import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
33
import { property, state } from 'lit/decorators.js';
44
import { UUITextStyles } from '@umbraco-ui/uui-css/lib';
5-
import type { InterfaceHeading } from '@umbraco-ui/uui-base/lib';
5+
import type { UUIInterfaceHeading } from '@umbraco-ui/uui-base/lib';
66
import { StaticValue, html, literal, unsafeStatic } from 'lit/static-html.js';
77

88
function slotHasContent(target: EventTarget | null): boolean {
@@ -41,7 +41,7 @@ export class UUIBoxElement extends LitElement {
4141
* @default "h5"
4242
*/
4343
@property({ attribute: 'headline-variant' })
44-
set headlineVariant(value: InterfaceHeading) {
44+
set headlineVariant(value: UUIInterfaceHeading) {
4545
if (!value) {
4646
this._headlineVariantTag = literal`h5`;
4747
} else {

packages/uui-box/lib/uui-box.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { expect, fixture, html } from '@open-wc/testing';
22

33
import { UUIBoxElement } from './uui-box.element';
4-
import { InterfaceHeadingValues } from '@umbraco-ui/uui-base/lib/types';
4+
import { UUIInterfaceHeadingValues } from '@umbraco-ui/uui-base/lib/types';
55

66
describe('UUIBox', () => {
77
let element: UUIBoxElement;
@@ -16,7 +16,7 @@ describe('UUIBox', () => {
1616
});
1717

1818
it('passes the a11y audit', async () => {
19-
for (const headlineVariant of InterfaceHeadingValues) {
19+
for (const headlineVariant of UUIInterfaceHeadingValues) {
2020
element = await fixture(
2121
html` <uui-box
2222
headline="headline"

packages/uui-button/lib/uui-button.element.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ import {
1616
import { css, html, LitElement, nothing, TemplateResult } from 'lit';
1717
import { property, query } from 'lit/decorators.js';
1818
import { ifDefined } from 'lit/directives/if-defined.js';
19-
import { InterfaceColor, InterfaceLook } from '@umbraco-ui/uui-base/lib/types';
19+
import {
20+
UUIInterfaceColor,
21+
UUIInterfaceLook,
22+
} from '@umbraco-ui/uui-base/lib/types';
2023

2124
export type UUIButtonState = undefined | 'waiting' | 'success' | 'failed';
2225

@@ -74,7 +77,7 @@ export class UUIButtonElement extends FormControlMixin(
7477
* @default "default"
7578
*/
7679
@property({ reflect: true })
77-
look: InterfaceLook = 'default';
80+
look: UUIInterfaceLook = 'default';
7881

7982
/**
8083
* Changes the look of the button to one of the predefined, symbolic looks. For example - set this to positive if you want nice, green "confirm" button.
@@ -83,7 +86,7 @@ export class UUIButtonElement extends FormControlMixin(
8386
* @default "default"
8487
*/
8588
@property({ reflect: true })
86-
color: InterfaceColor = 'default';
89+
color: UUIInterfaceColor = 'default';
8790

8891
/**
8992
* Makes the left and right padding of the button narrower.

packages/uui-button/lib/uui-button.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import {
66
oneEvent,
77
} from '@open-wc/testing';
88
import {
9-
InterfaceColorValues,
10-
InterfaceLookValues,
9+
UUIInterfaceColorValues,
10+
UUIInterfaceLookValues,
1111
} from '@umbraco-ui/uui-base/lib/types';
1212

1313
import { UUIButtonElement } from './uui-button.element';
@@ -41,8 +41,8 @@ describe('UuiButton', () => {
4141
});
4242

4343
it('passes the a11y audit', async () => {
44-
for (const color of InterfaceColorValues) {
45-
for (const look of InterfaceLookValues) {
44+
for (const color of UUIInterfaceColorValues) {
45+
for (const look of UUIInterfaceLookValues) {
4646
for (const disabled of [true, false]) {
4747
element = await fixture(
4848
html` <uui-button

packages/uui-tag/lib/uui-tag.element.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
22
import { css, html, LitElement } from 'lit';
33
import { property } from 'lit/decorators.js';
4-
import { InterfaceColor, InterfaceLook } from '@umbraco-ui/uui-base/lib/types';
4+
import {
5+
UUIInterfaceColor,
6+
UUIInterfaceLook,
7+
} from '@umbraco-ui/uui-base/lib/types';
58

69
/**
710
*
@@ -20,7 +23,7 @@ export class UUITagElement extends LitElement {
2023
* @default "default"
2124
*/
2225
@property({ reflect: true })
23-
color: InterfaceColor = 'default';
26+
color: UUIInterfaceColor = 'default';
2427

2528
/**
2629
* Changes the look of the button to one of the predefined, symbolic looks. For example - set this to positive if you want nice, green "confirm" button.
@@ -29,7 +32,7 @@ export class UUITagElement extends LitElement {
2932
* @default "default"
3033
*/
3134
@property({ reflect: true })
32-
look: InterfaceLook = 'primary';
35+
look: UUIInterfaceLook = 'primary';
3336

3437
render() {
3538
return html`<slot></slot>`;

0 commit comments

Comments
 (0)