Skip to content

Commit 821c43d

Browse files
committed
Merge remote-tracking branch 'origin/dev' into bugfix/replace-postcss-custom-properties-fallback-with-local-version
2 parents 3edfd9d + d88b12f commit 821c43d

File tree

7 files changed

+73
-19
lines changed

7 files changed

+73
-19
lines changed

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

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,42 @@ export class UUIInputElement extends FormControlMixin(LitElement) {
134134
`,
135135
];
136136

137+
/**
138+
* This is a minimum value of the input.
139+
* @type {number}
140+
* @attr
141+
* @default undefined
142+
*/
143+
@property({ type: Number })
144+
minlength?: number;
145+
146+
/**
147+
* Minlength validation message.
148+
* @type {boolean}
149+
* @attr
150+
* @default
151+
*/
152+
@property({ type: String, attribute: 'minlength-message' })
153+
minlengthMessage = 'This field need more characters';
154+
155+
/**
156+
* This is a maximum value of the input.
157+
* @type {number}
158+
* @attr
159+
* @default undefined
160+
*/
161+
@property({ type: Number })
162+
maxlength?: number;
163+
164+
/**
165+
* Maxlength validation message.
166+
* @type {boolean}
167+
* @attr
168+
* @default
169+
*/
170+
@property({ type: String, attribute: 'maxlength-message' })
171+
maxlengthMessage = 'This field exceeds the allowed amount of characters';
172+
137173
/**
138174
* Disables the input.
139175
* @type {boolean}
@@ -190,6 +226,17 @@ export class UUIInputElement extends FormControlMixin(LitElement) {
190226
this.addEventListener('blur', () => {
191227
this.style.setProperty('--uui-show-focus-outline', '');
192228
});
229+
230+
this.addValidator(
231+
'tooShort',
232+
() => this.minlengthMessage,
233+
() => !!this.minlength && (this._value as string).length < this.minlength
234+
);
235+
this.addValidator(
236+
'tooLong',
237+
() => this.maxlengthMessage,
238+
() => !!this.maxlength && (this._value as string).length > this.maxlength
239+
);
193240
}
194241

195242
/**

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ describe('UuiInputElement', () => {
3838
it('has a disabled property', () => {
3939
expect(element).to.have.property('disabled');
4040
});
41-
it('has a readOnly property', () => {
42-
expect(element).to.have.property('readOnly');
41+
it('has a readonly property', () => {
42+
expect(element).to.have.property('readonly');
4343
});
4444
it('has a error property', () => {
4545
expect(element).to.have.property('error');

packages/uui-menu-item/lib/uui-menu-item.element.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ export class UUIMenuItemElement extends SelectOnlyMixin(
116116
transition: opacity 120ms;
117117
grid-column-start: 3;
118118
}
119+
:host(:not([disabled])) #menu-item:hover #actions-container,
120+
:host(:not([disabled])) #menu-item:focus #actions-container,
121+
:host(:not([disabled])) #menu-item:focus-within #actions-container {
122+
opacity: 1;
123+
}
119124
120125
#loader {
121126
position: absolute;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { LitElement, html, css } from 'lit';
22
import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
33
import { property, query } from 'lit/decorators.js';
44
import { UUITextareaEvent } from './UUITextareaEvent';
5-
import { FormControlMixin } from 'packages/uui-base/lib/mixins';
5+
import { FormControlMixin } from '@umbraco-ui/uui-base/lib/mixins';
66

77
/**
88
* @element uui-textarea

packages/uui-toast-notification-layout/lib/uui-toast-notification-layout.element.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@ export class UUIToastNotificationLayoutElement extends LitElement {
1515
static styles = [
1616
UUITextStyles,
1717
css`
18-
#message > h5 {
18+
#message {
19+
margin-bottom: calc(var(--uui-size-space-1) * -1);
20+
}
21+
#message::after {
22+
content: '';
23+
display: block;
24+
clear: both;
1925
}
2026
#actions {
2127
/*
@@ -26,15 +32,9 @@ export class UUIToastNotificationLayoutElement extends LitElement {
2632
display: block;
2733
float: right;
2834
29-
margin-top: var(--uui-size-space-3);
35+
margin-top: var(--uui-size-space-4);
3036
margin-bottom: calc(var(--uui-size-space-2) * -1);
3137
}
32-
33-
#message::after {
34-
content: '';
35-
display: block;
36-
clear: both;
37-
}
3838
`,
3939
];
4040

@@ -59,7 +59,8 @@ export class UUIToastNotificationLayoutElement extends LitElement {
5959
return html`
6060
<div id="message" class="uui-text">
6161
<h5
62-
style=${this._headlineSlotHasContent || this.headline !== null
62+
style=${this._headlineSlotHasContent ||
63+
(this.headline && this.headline !== '')
6364
? ''
6465
: 'display: none'}>
6566
${this.headline}

packages/uui-toast-notification/lib/uui-toast-notification.element.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,9 @@ export class UUIToastNotificationElement extends LitElement {
8484
8585
#close {
8686
float: right;
87-
margin-top: -7px;
87+
margin-top: -6px;
8888
margin-left: var(--uui-size-space-1);
89-
margin-bottom: calc(var(--uui-size-space-2) * -1);
90-
margin-bottom: var(--uui-size-space-1);
89+
margin-bottom: -4px;
9190
}
9291
9392
#close > uui-button {

packages/uui-toast-notification/lib/uui-toast-notification.story.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,15 @@ AAAOverview.parameters = {
4242
export const ErrorStyle: Story = props => html`<uui-toast-notification
4343
.open=${props.open}
4444
.look=${props.look}>
45-
<uui-toast-notification-layout headline="Document could not be published!">
46-
An error occurred while attempting to contact the server. Please check your
47-
internet connection.
45+
<uui-toast-notification-layout .headline=${props.headline}>
46+
${props.message}
4847
<uui-button slot="actions" look="danger">Retry</uui-button>
4948
</uui-toast-notification-layout>
5049
</uui-toast-notification>`;
5150
ErrorStyle.args = {
5251
headline: 'Document could not be published!',
52+
message:
53+
'An error occurred while attempting to contact the server. Please check your internet connection.',
5354
look: 'danger',
5455
};
5556
ErrorStyle.parameters = {
@@ -70,12 +71,13 @@ export const PositiveStyle: Story = props => html`<uui-toast-notification
7071
.open=${props.open}
7172
.look=${props.look}>
7273
<uui-toast-notification-layout .headline=${props.headline}>
73-
<p>This document is now saved and published.</p>
74+
${props.message}
7475
<uui-button slot="actions" .look=${props.look}>View in browser</uui-button>
7576
</uui-toast-notification-layout>
7677
</uui-toast-notification>`;
7778
PositiveStyle.args = {
7879
headline: 'Document was published',
80+
message: 'This document is now saved and published.',
7981
look: 'positive',
8082
};
8183
PositiveStyle.parameters = {

0 commit comments

Comments
 (0)