Skip to content

Prefix interface types with UUI #716

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

Merged
merged 6 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions packages/uui-badge/lib/uui-badge.element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
import { css, html, LitElement } from 'lit';
import { property } from 'lit/decorators.js';
import type {
InterfaceColor,
InterfaceLook,
UUIInterfaceColor,
UUIInterfaceLook,
} from '@umbraco-ui/uui-base/lib/types';

/**
Expand All @@ -21,7 +21,7 @@ export class UUIBadgeElement extends LitElement {
* @default "default"
*/
@property({ reflect: true })
color: InterfaceColor = 'default';
color: UUIInterfaceColor = 'default';

/**
* 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.
Expand All @@ -30,7 +30,7 @@ export class UUIBadgeElement extends LitElement {
* @default "default"
*/
@property({ reflect: true })
look: InterfaceLook = 'primary';
look: UUIInterfaceLook = 'primary';

/**
* Bring attention to this badge by applying a bounce animation.
Expand Down
9 changes: 7 additions & 2 deletions packages/uui-base/lib/types/InterfaceColor.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
export const InterfaceColorValues: Readonly<InterfaceColor[]> = [
export const UUIInterfaceColorValues: Readonly<UUIInterfaceColor[]> = [
'default',
'positive',
'warning',
'danger',
] as const;

export type InterfaceColor = '' | 'default' | 'positive' | 'warning' | 'danger';
export type UUIInterfaceColor =
| ''
| 'default'
| 'positive'
| 'warning'
| 'danger';
4 changes: 2 additions & 2 deletions packages/uui-base/lib/types/InterfaceHeading.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const InterfaceHeadingValues: Readonly<InterfaceHeading[]> = [
export const UUIInterfaceHeadingValues: Readonly<UUIInterfaceHeading[]> = [
'h1',
'h2',
'h3',
Expand All @@ -7,4 +7,4 @@ export const InterfaceHeadingValues: Readonly<InterfaceHeading[]> = [
'h6',
] as const;

export type InterfaceHeading = '' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
export type UUIInterfaceHeading = '' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
4 changes: 2 additions & 2 deletions packages/uui-base/lib/types/InterfaceLook.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
export const InterfaceLookValues: Readonly<InterfaceLook[]> = [
export const UUIInterfaceLookValues: Readonly<UUIInterfaceLook[]> = [
'default',
'primary',
'secondary',
'outline',
'placeholder',
] as const;

export type InterfaceLook =
export type UUIInterfaceLook =
| ''
| 'default'
| 'primary'
Expand Down
4 changes: 2 additions & 2 deletions packages/uui-box/lib/uui-box.element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { LitElement, css } from 'lit';
import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
import { property, state } from 'lit/decorators.js';
import { UUITextStyles } from '@umbraco-ui/uui-css/lib';
import type { InterfaceHeading } from '@umbraco-ui/uui-base/lib';
import type { UUIInterfaceHeading } from '@umbraco-ui/uui-base/lib';
import { StaticValue, html, literal, unsafeStatic } from 'lit/static-html.js';

function slotHasContent(target: EventTarget | null): boolean {
Expand Down Expand Up @@ -41,7 +41,7 @@ export class UUIBoxElement extends LitElement {
* @default "h5"
*/
@property({ attribute: 'headline-variant' })
set headlineVariant(value: InterfaceHeading) {
set headlineVariant(value: UUIInterfaceHeading) {
if (!value) {
this._headlineVariantTag = literal`h5`;
} else {
Expand Down
4 changes: 2 additions & 2 deletions packages/uui-box/lib/uui-box.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect, fixture, html } from '@open-wc/testing';

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

describe('UUIBox', () => {
let element: UUIBoxElement;
Expand All @@ -16,7 +16,7 @@ describe('UUIBox', () => {
});

it('passes the a11y audit', async () => {
for (const headlineVariant of InterfaceHeadingValues) {
for (const headlineVariant of UUIInterfaceHeadingValues) {
element = await fixture(
html` <uui-box
headline="headline"
Expand Down
9 changes: 6 additions & 3 deletions packages/uui-button/lib/uui-button.element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ import {
import { css, html, LitElement, nothing, TemplateResult } from 'lit';
import { property, query } from 'lit/decorators.js';
import { ifDefined } from 'lit/directives/if-defined.js';
import { InterfaceColor, InterfaceLook } from '@umbraco-ui/uui-base/lib/types';
import {
UUIInterfaceColor,
UUIInterfaceLook,
} from '@umbraco-ui/uui-base/lib/types';

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

Expand Down Expand Up @@ -74,7 +77,7 @@ export class UUIButtonElement extends FormControlMixin(
* @default "default"
*/
@property({ reflect: true })
look: InterfaceLook = 'default';
look: UUIInterfaceLook = 'default';

/**
* 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.
Expand All @@ -83,7 +86,7 @@ export class UUIButtonElement extends FormControlMixin(
* @default "default"
*/
@property({ reflect: true })
color: InterfaceColor = 'default';
color: UUIInterfaceColor = 'default';

/**
* Makes the left and right padding of the button narrower.
Expand Down
8 changes: 4 additions & 4 deletions packages/uui-button/lib/uui-button.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {
oneEvent,
} from '@open-wc/testing';
import {
InterfaceColorValues,
InterfaceLookValues,
UUIInterfaceColorValues,
UUIInterfaceLookValues,
} from '@umbraco-ui/uui-base/lib/types';

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

it('passes the a11y audit', async () => {
for (const color of InterfaceColorValues) {
for (const look of InterfaceLookValues) {
for (const color of UUIInterfaceColorValues) {
for (const look of UUIInterfaceLookValues) {
for (const disabled of [true, false]) {
element = await fixture(
html` <uui-button
Expand Down
9 changes: 6 additions & 3 deletions packages/uui-tag/lib/uui-tag.element.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
import { css, html, LitElement } from 'lit';
import { property } from 'lit/decorators.js';
import { InterfaceColor, InterfaceLook } from '@umbraco-ui/uui-base/lib/types';
import {
UUIInterfaceColor,
UUIInterfaceLook,
} from '@umbraco-ui/uui-base/lib/types';

/**
*
Expand All @@ -20,7 +23,7 @@ export class UUITagElement extends LitElement {
* @default "default"
*/
@property({ reflect: true })
color: InterfaceColor = 'default';
color: UUIInterfaceColor = 'default';

/**
* 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.
Expand All @@ -29,7 +32,7 @@ export class UUITagElement extends LitElement {
* @default "default"
*/
@property({ reflect: true })
look: InterfaceLook = 'primary';
look: UUIInterfaceLook = 'primary';

render() {
return html`<slot></slot>`;
Expand Down