зеркало из https://github.com/microsoft/sonder-ui.git
handle inert polyfill separately, fix multiselect input styling, readonly combo focus handling
This commit is contained in:
Родитель
d7b2e3a0fd
Коммит
aed89f04d9
|
@ -775,7 +775,8 @@
|
||||||
"ansi-regex": {
|
"ansi-regex": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"aproba": {
|
"aproba": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
|
@ -1190,7 +1191,8 @@
|
||||||
"safe-buffer": {
|
"safe-buffer": {
|
||||||
"version": "5.1.2",
|
"version": "5.1.2",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"safer-buffer": {
|
"safer-buffer": {
|
||||||
"version": "2.1.2",
|
"version": "2.1.2",
|
||||||
|
@ -1246,6 +1248,7 @@
|
||||||
"version": "3.0.1",
|
"version": "3.0.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"ansi-regex": "^2.0.0"
|
"ansi-regex": "^2.0.0"
|
||||||
}
|
}
|
||||||
|
@ -1289,12 +1292,14 @@
|
||||||
"wrappy": {
|
"wrappy": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"yallist": {
|
"yallist": {
|
||||||
"version": "3.0.3",
|
"version": "3.0.3",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -2557,11 +2562,6 @@
|
||||||
"webidl-conversions": "^4.0.2"
|
"webidl-conversions": "^4.0.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"wicg-inert": {
|
|
||||||
"version": "2.2.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/wicg-inert/-/wicg-inert-2.2.1.tgz",
|
|
||||||
"integrity": "sha512-xaI3ig1hhEcec2+5uUs9i2BrVXzJ83dOn2ij3ze2RAKUQ4X03Cm99SLny1Vh1KL4Rc1SPZnQOs0mdtVkQ0Tclw=="
|
|
||||||
},
|
|
||||||
"wordwrap": {
|
"wordwrap": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
|
||||||
|
|
|
@ -16,9 +16,6 @@
|
||||||
"test": "stencil test --spec --e2e",
|
"test": "stencil test --spec --e2e",
|
||||||
"test.watch": "stencil test --spec --e2e --watchAll"
|
"test.watch": "stencil test --spec --e2e --watchAll"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
|
||||||
"wicg-inert": "^2.1.2"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@stencil/core": "~0.16.2"
|
"@stencil/core": "~0.16.2"
|
||||||
},
|
},
|
||||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -45,6 +45,9 @@ export class ComboNoInput {
|
||||||
// Unique ID that should really use a UUID library instead
|
// Unique ID that should really use a UUID library instead
|
||||||
private htmlId = uniqueId();
|
private htmlId = uniqueId();
|
||||||
|
|
||||||
|
// Prevent menu closing before click completed
|
||||||
|
private ignoreBlur = false;
|
||||||
|
|
||||||
// save reference to input element
|
// save reference to input element
|
||||||
private inputRef: HTMLElement;
|
private inputRef: HTMLElement;
|
||||||
|
|
||||||
|
@ -92,6 +95,7 @@ export class ComboNoInput {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
this.onOptionClick(i);
|
this.onOptionClick(i);
|
||||||
}}
|
}}
|
||||||
|
onMouseDown={this.onOptionMouseDown.bind(this)}
|
||||||
>{option.name}</div>
|
>{option.name}</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
@ -126,6 +130,11 @@ export class ComboNoInput {
|
||||||
}
|
}
|
||||||
|
|
||||||
private onComboBlur() {
|
private onComboBlur() {
|
||||||
|
if (this.ignoreBlur) {
|
||||||
|
this.ignoreBlur = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.updateMenuState(false, false);
|
this.updateMenuState(false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,6 +148,10 @@ export class ComboNoInput {
|
||||||
this.updateMenuState(false);
|
this.updateMenuState(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private onOptionMouseDown() {
|
||||||
|
this.ignoreBlur = true;
|
||||||
|
}
|
||||||
|
|
||||||
private selectOption(index: number) {
|
private selectOption(index: number) {
|
||||||
const selected = this.options[index];
|
const selected = this.options[index];
|
||||||
this.value = selected.name;
|
this.value = selected.name;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { Component, Event, EventEmitter, Prop, Watch } from '@stencil/core';
|
import { Component, Event, EventEmitter, Prop, Watch } from '@stencil/core';
|
||||||
import 'wicg-inert';
|
// import 'wicg-inert';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
tag: 'sui-modal',
|
tag: 'sui-modal',
|
||||||
|
|
|
@ -111,7 +111,7 @@ export class MultiselectInline {
|
||||||
{selectedOptions.map((option, i) => {
|
{selectedOptions.map((option, i) => {
|
||||||
return (
|
return (
|
||||||
<li>
|
<li>
|
||||||
<button class="remove-option" aria-describedby={`${htmlId}-remove`} onClick={() => { this.removeOption(i); }}>
|
<button type="button" class="remove-option" aria-describedby={`${htmlId}-remove`} onClick={() => { this.removeOption(i); }}>
|
||||||
{option.name}
|
{option.name}
|
||||||
<span class="remove-icon" aria-hidden="true">x</span>
|
<span class="remove-icon" aria-hidden="true">x</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0">
|
||||||
<title>Stencil Component Starter</title>
|
<title>Stencil Component Starter</title>
|
||||||
<script src="/build/caiacc.js"></script>
|
<script src="/build/caiacc.js"></script>
|
||||||
|
<script src="./assets/inert.min.js"></script>
|
||||||
<style type="text/css" src="/build/style.css"></style>
|
<style type="text/css" src="/build/style.css"></style>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.fruit-select,
|
.fruit-select,
|
||||||
|
|
|
@ -160,12 +160,13 @@ select.combo-input {
|
||||||
border: 2px solid rgba(0,0,0,.42);
|
border: 2px solid rgba(0,0,0,.42);
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
min-height: calc(1.4em + 26px);
|
min-height: calc(1.4em + 26px);
|
||||||
padding: 12px 16px 14px;
|
padding: 12px 16px 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.multiselect-inline .selected-options {
|
.multiselect-inline .selected-options {
|
||||||
flex: 0 0 auto;
|
flex: 0 1 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.multiselect-inline .selected-options li {
|
.multiselect-inline .selected-options li {
|
||||||
|
@ -174,7 +175,7 @@ select.combo-input {
|
||||||
|
|
||||||
.multiselect-inline .combo-input {
|
.multiselect-inline .combo-input {
|
||||||
border: none;
|
border: none;
|
||||||
flex: 1 1 auto;
|
flex: 1 1 35%;
|
||||||
min-height: calc(1.4em - 2px);
|
min-height: calc(1.4em - 2px);
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<title>Grid Usability Study</title>
|
<title>Grid Usability Study</title>
|
||||||
<link rel="stylesheet" href="../../style.css"></style>
|
<link rel="stylesheet" href="../../style.css"></style>
|
||||||
<script src="/build/caiacc.js"></script>
|
<script src="/build/caiacc.js"></script>
|
||||||
|
<script src="./assets/inert.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div role="main" class="main">
|
<div role="main" class="main">
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<title>Grid Usability Study</title>
|
<title>Grid Usability Study</title>
|
||||||
<link rel="stylesheet" href="../../style.css"></style>
|
<link rel="stylesheet" href="../../style.css"></style>
|
||||||
<script src="/build/caiacc.js"></script>
|
<script src="/build/caiacc.js"></script>
|
||||||
|
<script src="./assets/inert.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div role="main" class="main">
|
<div role="main" class="main">
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<title>Grid Usability Study</title>
|
<title>Grid Usability Study</title>
|
||||||
<link rel="stylesheet" href="../../style.css"></style>
|
<link rel="stylesheet" href="../../style.css"></style>
|
||||||
<script src="/build/caiacc.js"></script>
|
<script src="/build/caiacc.js"></script>
|
||||||
|
<script src="./assets/inert.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div role="main" class="main">
|
<div role="main" class="main">
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<title>Grid Usability Study</title>
|
<title>Grid Usability Study</title>
|
||||||
<link rel="stylesheet" href="../../style.css"></style>
|
<link rel="stylesheet" href="../../style.css"></style>
|
||||||
<script src="/build/caiacc.js"></script>
|
<script src="/build/caiacc.js"></script>
|
||||||
|
<script src="./assets/inert.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div role="main" class="main">
|
<div role="main" class="main">
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<title>Grid Usability Study</title>
|
<title>Grid Usability Study</title>
|
||||||
<link rel="stylesheet" href="../../style.css"></style>
|
<link rel="stylesheet" href="../../style.css"></style>
|
||||||
<script src="/build/caiacc.js"></script>
|
<script src="/build/caiacc.js"></script>
|
||||||
|
<script src="./assets/inert.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div role="main" class="main">
|
<div role="main" class="main">
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<title>Grid Usability Study</title>
|
<title>Grid Usability Study</title>
|
||||||
<link rel="stylesheet" href="../../style.css"></style>
|
<link rel="stylesheet" href="../../style.css"></style>
|
||||||
<script src="/build/caiacc.js"></script>
|
<script src="/build/caiacc.js"></script>
|
||||||
|
<script src="./assets/inert.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div role="main" class="main">
|
<div role="main" class="main">
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
<title>Modal Dialog Usability Study</title>
|
<title>Modal Dialog Usability Study</title>
|
||||||
<link rel="stylesheet" href="../../style.css"></style>
|
<link rel="stylesheet" href="../../style.css"></style>
|
||||||
<link rel="stylesheet" href="./forms.css"></style>
|
<link rel="stylesheet" href="./forms.css"></style>
|
||||||
<script src="/build/caiacc.js"></script>
|
<script src="/build/caiacc.js"></script>
|
||||||
|
<script src="./assets/inert.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div role="main" class="main example-form">
|
<div role="main" class="main example-form">
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
<title>Modal Dialog Usability Study</title>
|
<title>Modal Dialog Usability Study</title>
|
||||||
<link rel="stylesheet" href="../../style.css"></style>
|
<link rel="stylesheet" href="../../style.css"></style>
|
||||||
<link rel="stylesheet" href="./forms.css"></style>
|
<link rel="stylesheet" href="./forms.css"></style>
|
||||||
<script src="/build/caiacc.js"></script>
|
<script src="/build/caiacc.js"></script>
|
||||||
|
<script src="./assets/inert.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div role="main" class="main example-form">
|
<div role="main" class="main example-form">
|
||||||
|
|
Загрузка…
Ссылка в новой задаче