kopia lustrzana https://github.com/shoelace-style/shoelace
fixes #855
rodzic
040e8ce5e1
commit
b669ab7b74
|
@ -5,7 +5,7 @@
|
||||||
Inputs collect data from the user.
|
Inputs collect data from the user.
|
||||||
|
|
||||||
```html preview
|
```html preview
|
||||||
<sl-input></sl-input>
|
<sl-input type="date" clearable></sl-input>
|
||||||
```
|
```
|
||||||
|
|
||||||
```jsx react
|
```jsx react
|
||||||
|
|
|
@ -18,6 +18,7 @@ _During the beta period, these restrictions may be relaxed in the event of a mis
|
||||||
- Fixed a bug in `<sl-popup>` that prevented the `arrow-padding` attribute from working as expected
|
- Fixed a bug in `<sl-popup>` that prevented the `arrow-padding` attribute from working as expected
|
||||||
- Improved accessibility of `<sl-rating>` so keyboard nav works better and screen readers announce it properly
|
- Improved accessibility of `<sl-rating>` so keyboard nav works better and screen readers announce it properly
|
||||||
- Improved accessibility of `<sl-spinner>` so screen readers no longer skip over it
|
- Improved accessibility of `<sl-spinner>` so screen readers no longer skip over it
|
||||||
|
- Removed a user agent sniffing notice that appeared in Chrome [#855](https://github.com/shoelace-style/shoelace/issues/855)
|
||||||
- Removed the default hover effect in `<sl-tree-items>` to make selections more obvious
|
- Removed the default hover effect in `<sl-tree-items>` to make selections more obvious
|
||||||
- Updated Floating UI to 1.0.1
|
- Updated Floating UI to 1.0.1
|
||||||
- Updated esbuild to 0.15.1
|
- Updated esbuild to 0.15.1
|
||||||
|
|
|
@ -63,7 +63,8 @@
|
||||||
"sinon": "^14.0.0",
|
"sinon": "^14.0.0",
|
||||||
"strip-css-comments": "^5.0.0",
|
"strip-css-comments": "^5.0.0",
|
||||||
"tslib": "^2.4.0",
|
"tslib": "^2.4.0",
|
||||||
"typescript": "4.7.4"
|
"typescript": "4.7.4",
|
||||||
|
"user-agent-data-types": "^0.3.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14.17.0"
|
"node": ">=14.17.0"
|
||||||
|
@ -14460,6 +14461,12 @@
|
||||||
"node": ">= 4"
|
"node": ">= 4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/user-agent-data-types": {
|
||||||
|
"version": "0.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/user-agent-data-types/-/user-agent-data-types-0.3.0.tgz",
|
||||||
|
"integrity": "sha512-AI3vPwmafXd4r/mSbubOu6S1ngO4vdvJFAJdP0MUc9Y4SwXm/Pqpno0R/O4Zt26vZYzWorV+4BgVcntxhJlMPw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/util-deprecate": {
|
"node_modules/util-deprecate": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||||
|
@ -25851,6 +25858,12 @@
|
||||||
"integrity": "sha1-FQWgOiiaSMvXpDTvuu7FBV9WM6k=",
|
"integrity": "sha1-FQWgOiiaSMvXpDTvuu7FBV9WM6k=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"user-agent-data-types": {
|
||||||
|
"version": "0.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/user-agent-data-types/-/user-agent-data-types-0.3.0.tgz",
|
||||||
|
"integrity": "sha512-AI3vPwmafXd4r/mSbubOu6S1ngO4vdvJFAJdP0MUc9Y4SwXm/Pqpno0R/O4Zt26vZYzWorV+4BgVcntxhJlMPw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"util-deprecate": {
|
"util-deprecate": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||||
|
|
|
@ -106,7 +106,8 @@
|
||||||
"sinon": "^14.0.0",
|
"sinon": "^14.0.0",
|
||||||
"strip-css-comments": "^5.0.0",
|
"strip-css-comments": "^5.0.0",
|
||||||
"tslib": "^2.4.0",
|
"tslib": "^2.4.0",
|
||||||
"typescript": "4.7.4"
|
"typescript": "4.7.4",
|
||||||
|
"user-agent-data-types": "^0.3.0"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.{ts,js}": [
|
"*.{ts,js}": [
|
||||||
|
|
|
@ -13,6 +13,17 @@ import '../icon/icon';
|
||||||
import styles from './input.styles';
|
import styles from './input.styles';
|
||||||
import type { CSSResultGroup } from 'lit';
|
import type { CSSResultGroup } from 'lit';
|
||||||
|
|
||||||
|
// It's currently impossible to hide Firefox's built-in clear icon when using <input type="date|time">, so we need this
|
||||||
|
// check to apply a clip-path to hide it. I know, I know...user agent sniffing is nasty but, if it fails, we only see a
|
||||||
|
// redundant clear icon so nothing important is breaking. The benefits outweigh the costs for this one. See the
|
||||||
|
// discussion at: https://github.com/shoelace-style/shoelace/pull/794
|
||||||
|
//
|
||||||
|
// Also note that we do the Chromium check first to prevent Chrome from logging a console notice as described here:
|
||||||
|
// https://github.com/shoelace-style/shoelace/issues/855
|
||||||
|
//
|
||||||
|
const isChromium = navigator.userAgentData?.brands.some(b => b.brand.includes('Chromium'));
|
||||||
|
const isFirefox = isChromium ? false : navigator.userAgent.includes('Firefox');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
* @status stable
|
* @status stable
|
||||||
|
@ -369,12 +380,7 @@ export default class SlInput extends LitElement {
|
||||||
'input--empty': !this.value,
|
'input--empty': !this.value,
|
||||||
'input--invalid': this.invalid,
|
'input--invalid': this.invalid,
|
||||||
'input--no-spin-buttons': this.noSpinButtons,
|
'input--no-spin-buttons': this.noSpinButtons,
|
||||||
|
'input--is-firefox': isFirefox
|
||||||
// It's currently impossible to hide Firefox's built-in clear icon when using <input type="date|time">, so
|
|
||||||
// we need this check to apply a clip-path to hide it. I know, I know...user agent sniffing is nasty but
|
|
||||||
// if it fails, we only see a redundant clear icon so nothing important is breaking. The benefits outweigh
|
|
||||||
// the costs for this one. See the discussion at: https://github.com/shoelace-style/shoelace/pull/794
|
|
||||||
'input--is-firefox': navigator.userAgent.includes('Firefox')
|
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<span part="prefix" class="input__prefix">
|
<span part="prefix" class="input__prefix">
|
||||||
|
|
|
@ -26,7 +26,10 @@
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"useUnknownInCatchVariables": true,
|
"useUnknownInCatchVariables": true,
|
||||||
"baseUrl": "."
|
"baseUrl": ".",
|
||||||
|
"types": [
|
||||||
|
"./node_modules/user-agent-data-types"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"src"
|
"src"
|
||||||
|
|
Ładowanie…
Reference in New Issue