@umbraco-ui/uui-visually-hidden 1.5.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 uui-app
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # uui-visually-hidden
2
+
3
+ ![npm](https://img.shields.io/npm/v/@umbraco-ui/uui-visually-hidden?logoColor=%231B264F)
4
+
5
+ Umbraco style visually-hidden component.
6
+
7
+ The visually hidden utility makes content accessible to assistive devices without displaying it on the screen.
8
+
9
+ According to [The A11Y Project](https://www.a11yproject.com/posts/how-to-hide-content/):
10
+
11
+ > There are real world situations where visually hiding content may be appropriate, while the content should remain available to assistive technologies, such as screen readers. For instance, hiding a search field's label as a common magnifying glass icon is used in its stead.
12
+
13
+ Since visually hidden content can receive focus when tabbing, the element will become visible when something inside receives focus. This behavior is intentional, as sighted keyboard user won’t be able to determine where the focus indicator is without it.
14
+
15
+ ## Installation
16
+
17
+ ### ES imports
18
+
19
+ ```zsh
20
+ npm i @umbraco-ui/uui-visually-hidden
21
+ ```
22
+
23
+ Import the registration of `<uui-visually-hidden>` via:
24
+
25
+ ```javascript
26
+ import '@umbraco-ui/uui-visually-hidden';
27
+ ```
28
+
29
+ When looking to leverage the `UUIVisuallyHiddenElement` base class as a type and/or for extension purposes, do so via:
30
+
31
+ ```javascript
32
+ import { UUIVisuallyHiddenElement } from '@umbraco-ui/uui-visually-hidden';
33
+ ```
34
+
35
+ ## Usage
36
+
37
+ ```html
38
+ <uui-visually-hidden></uui-visually-hidden>
39
+ ```
@@ -0,0 +1,16 @@
1
+ {
2
+ "version": "experimental",
3
+ "tags": [
4
+ {
5
+ "name": "uui-visually-hidden",
6
+ "path": "./lib/uui-visually-hidden.element.ts",
7
+ "properties": [
8
+ {
9
+ "name": "styles",
10
+ "type": "CSSResult[]",
11
+ "default": "[null]"
12
+ }
13
+ ]
14
+ }
15
+ ]
16
+ }
package/lib/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './uui-visually-hidden.element';
package/lib/index.js ADDED
@@ -0,0 +1,39 @@
1
+ import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
2
+ import { css, LitElement, html } from 'lit';
3
+
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __decorateClass = (decorators, target, key, kind) => {
7
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
8
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
9
+ if (decorator = decorators[i])
10
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11
+ if (kind && result)
12
+ __defProp(target, key, result);
13
+ return result;
14
+ };
15
+ let UUIVisuallyHiddenElement = class extends LitElement {
16
+ render() {
17
+ return html`<slot></slot>`;
18
+ }
19
+ };
20
+ UUIVisuallyHiddenElement.styles = [
21
+ css`
22
+ :host(:not(:focus-within)) {
23
+ position: absolute !important;
24
+ width: 1px !important;
25
+ height: 1px !important;
26
+ clip: rect(0 0 0 0) !important;
27
+ clip-path: inset(50%) !important;
28
+ border: none !important;
29
+ overflow: hidden !important;
30
+ white-space: nowrap !important;
31
+ padding: 0 !important;
32
+ }
33
+ `
34
+ ];
35
+ UUIVisuallyHiddenElement = __decorateClass([
36
+ defineElement("uui-visually-hidden")
37
+ ], UUIVisuallyHiddenElement);
38
+
39
+ export { UUIVisuallyHiddenElement };
@@ -0,0 +1,13 @@
1
+ import { LitElement } from 'lit';
2
+ /**
3
+ * @element uui-visually-hidden
4
+ */
5
+ export declare class UUIVisuallyHiddenElement extends LitElement {
6
+ render(): import("lit-html").TemplateResult<1>;
7
+ static styles: import("lit").CSSResult[];
8
+ }
9
+ declare global {
10
+ interface HTMLElementTagNameMap {
11
+ 'uui-visually-hidden': UUIVisuallyHiddenElement;
12
+ }
13
+ }
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@umbraco-ui/uui-visually-hidden",
3
+ "version": "1.5.0-rc.1",
4
+ "license": "MIT",
5
+ "keywords": [
6
+ "Umbraco",
7
+ "Custom elements",
8
+ "Web components",
9
+ "UI",
10
+ "Lit",
11
+ "Visually Hidden"
12
+ ],
13
+ "description": "Umbraco UI visually-hidden component",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/umbraco/Umbraco.UI.git",
17
+ "directory": "packages/uui-visually-hidden"
18
+ },
19
+ "bugs": {
20
+ "url": "https://github.com/umbraco/Umbraco.UI/issues"
21
+ },
22
+ "main": "./lib/index.js",
23
+ "module": "./lib/index.js",
24
+ "types": "./lib/index.d.ts",
25
+ "type": "module",
26
+ "customElements": "custom-elements.json",
27
+ "files": [
28
+ "lib/**/*.d.ts",
29
+ "lib/**/*.js",
30
+ "custom-elements.json"
31
+ ],
32
+ "dependencies": {
33
+ "@umbraco-ui/uui-base": "1.5.0-rc.1"
34
+ },
35
+ "scripts": {
36
+ "build": "npm run analyze && tsc --build --force && rollup -c rollup.config.js",
37
+ "clean": "tsc --build --clean && rimraf -g dist lib/*.js lib/**/*.js *.tgz lib/**/*.d.ts custom-elements.json",
38
+ "analyze": "web-component-analyzer **/*.element.ts --outFile custom-elements.json"
39
+ },
40
+ "publishConfig": {
41
+ "access": "public"
42
+ },
43
+ "homepage": "https://uui.umbraco.com/?path=/story/uui-visually-hidden",
44
+ "gitHead": "2ff35a098ed8a3feb8ebed1bf43b4fbb75950d65"
45
+ }