1.0.0 • Published 8 months ago

@spectrum-web-components/thumbnail v1.0.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
8 months ago

Description

An sp-thumbnail can be used in a variety of locations as a way to display a preview of an image, layer, or effect. sp-thumbnail elements are not keyboard-focusable since they're intended to be used inside of a component that a user sets focus to (such as select lists or tree items).

Usage

See it on NPM! How big is this package in your project? Try it on webcomponents.dev

yarn add @spectrum-web-components/thumbnail

Import the side effectful registration of <sp-thumbnail> via:

import '@spectrum-web-components/thumbnail/sp-thumbnail.js';

When looking to leverage the Thumbnail base class as a type and/or for extension purposes, do so via:

import { Thumbnail } from '@spectrum-web-components/thumbnail';

Sizes

<sp-thumbnail size="50">
    <img src="https://picsum.photos/100/100" alt="Demo Image" />
</sp-thumbnail>
<sp-thumbnail size="75">
    <img src="https://picsum.photos/100/100" alt="Demo Image" />
</sp-thumbnail>
<sp-thumbnail size="100">
    <img src="https://picsum.photos/100/100" alt="Demo Image" />
</sp-thumbnail>
<sp-thumbnail size="200">
    <img src="https://picsum.photos/100/100" alt="Demo Image" />
</sp-thumbnail>
<sp-thumbnail size="300">
    <img src="https://picsum.photos/100/100" alt="Demo Image" />
</sp-thumbnail>
<sp-thumbnail size="400">
    <img src="https://picsum.photos/100/100" alt="Demo Image" />
</sp-thumbnail>
<sp-thumbnail size="500">
    <img src="https://picsum.photos/100/100" alt="Demo Image" />
</sp-thumbnail>
<sp-thumbnail size="600">
    <img src="https://picsum.photos/100/100" alt="Demo Image" />
</sp-thumbnail>
<sp-thumbnail size="700">
    <img src="https://picsum.photos/100/100" alt="Demo Image" />
</sp-thumbnail>
<sp-thumbnail size="800">
    <img src="https://picsum.photos/100/100" alt="Demo Image" />
</sp-thumbnail>
<sp-thumbnail size="900">
    <img src="https://picsum.photos/100/100" alt="Demo Image" />
</sp-thumbnail>
<sp-thumbnail size="1000">
    <img src="https://picsum.photos/100/100" alt="Demo Image" />
</sp-thumbnail>

Focused

When focused the sp-thumbnail element will be displayed as follows:

<sp-thumbnail focused>
    <img src="https://picsum.photos/100/100" alt="Demo Image" />
</sp-thumbnail>

Disabled

Thumbnail should only be displayed as disabled if the entire componet is also disabled. When disabled the sp-thumbnail element will be displayed as follows:

<sp-thumbnail disabled>
    <img src="https://picsum.photos/100/100" alt="Demo Image" />
</sp-thumbnail>

Representing non-square content

By default, an sp-thumbnail will ensure that the entirety of the content that it respresents is visible by letterboxing that content with a checkerboard background when its aspect ratio is not square.

<div style="display: flex; gap: var(--spectrum-spacing-100);">
    <sp-thumbnail>
        <img src="https://picsum.photos/300/400" alt="Demo Image" />
    </sp-thumbnail>

    <sp-thumbnail>
        <img src="https://picsum.photos/500/100" alt="Demo Image" />
    </sp-thumbnail>
</div>

The background attribute takes a string value of the CSS "background" property in order to customize the letterboxing.

<div style="display: flex; gap: var(--spectrum-spacing-100);">
    <sp-thumbnail background="red">
        <img src="https://picsum.photos/300/400" alt="Demo Image" />
    </sp-thumbnail>

    <sp-thumbnail background="#00ff00">
        <img src="https://picsum.photos/500/100" alt="Demo Image" />
    </sp-thumbnail>
</div>

The cover attribute will cause the content to fill the space provided by the sp-thumbnail element:

<div style="display: flex; gap: var(--spectrum-spacing-100);">
    <sp-thumbnail cover>
        <img src="https://picsum.photos/300/400" alt="Demo Image" />
    </sp-thumbnail>

    <sp-thumbnail cover>
        <img src="https://picsum.photos/500/100" alt="Demo Image" />
    </sp-thumbnail>
</div>

Layer and Layer Selected

For when sp-thumbail is used in layer management (such as the Compact or Detail Layers panels). The thumbnail is given a thick blue border to indicate its selection when used in layer management.

<div style="display: flex; gap: var(--spectrum-spacing-100);">
    <sp-thumbnail layer>
        <img src="https://picsum.photos/400/400" alt="Demo Image" />
    </sp-thumbnail>

    <sp-thumbnail layer selected>
        <img src="https://picsum.photos/500/100" alt="Demo Image" />
    </sp-thumbnail>
</div>
1.0.0-rc.9

8 months ago

1.0.0-rc.7

8 months ago

1.0.0-rc.8

8 months ago

1.0.0-rc.5

8 months ago

1.0.0-rc.6

8 months ago

1.0.0-rc.10

8 months ago

1.0.0-rc.3

8 months ago

1.0.0-rc.4

8 months ago

1.0.0-rc.1

8 months ago

1.0.0-rc.2

8 months ago

0.50.0-beta.11

8 months ago

0.50.0-beta.12

8 months ago

0.50.0-beta.10

8 months ago

1.1.0-beta.1

8 months ago

1.1.0-beta.0

8 months ago

0.50.0-beta.9

8 months ago

0.50.0-beta.8

8 months ago

0.50.0-beta.7

8 months ago

0.50.0-beta.6

8 months ago

0.50.0-beta.5

8 months ago

0.50.0-beta.4

8 months ago

1.0.0

8 months ago

0.50.0-beta.3

8 months ago

0.50.0-beta.2

8 months ago

1.0.0-rc.0

8 months ago

0.50.0-beta.1

8 months ago

0.50.0-beta.0

8 months ago

0.49.0

8 months ago

0.49.0-beta.2

8 months ago

0.49.0-beta.1

8 months ago

0.48.1

9 months ago

0.48.0-beta.0

9 months ago

0.48.0-beta.1

9 months ago

0.48.0-beta.2

9 months ago

0.49.0-beta.0

9 months ago

0.43.0

1 year ago

0.48.0

9 months ago

0.44.0

11 months ago

0.45.0

11 months ago

0.46.0

10 months ago

0.42.5

1 year ago

0.47.1

10 months ago

0.47.2

10 months ago

0.47.0

10 months ago

0.42.4

1 year ago

0.42.3

1 year ago

0.42.2

1 year ago

0.42.1

1 year ago

0.42.0

1 year ago

0.41.2

1 year ago

0.41.1

1 year ago

0.41.0

1 year ago

0.40.5

1 year ago

0.40.4

1 year ago

0.40.3

1 year ago

0.40.2

1 year ago

0.40.1

2 years ago

0.36.0

2 years ago

0.40.0

2 years ago

0.35.1-rc.15

2 years ago

0.37.0

2 years ago

0.34.1-rc.0

2 years ago

0.35.1-rc.25

2 years ago

0.35.1-rc.26

2 years ago

0.35.1-rc.24

2 years ago

0.38.0

2 years ago

0.35.1-rc.34

2 years ago

0.34.0

2 years ago

0.35.1-rc.43

2 years ago

0.35.1-rc.41

2 years ago

0.39.1

2 years ago

0.39.0

2 years ago

0.35.0

2 years ago

0.39.4

2 years ago

0.39.3

2 years ago

0.39.2

2 years ago

0.31.1-react.21

2 years ago

0.32.0

2 years ago

0.31.1-react.3

2 years ago

0.31.1-react.1

2 years ago

0.31.1-react.2

2 years ago

0.33.2

2 years ago

0.33.0

2 years ago

0.30.0

2 years ago

0.31.0

2 years ago

0.6.8-overlay.8

2 years ago

0.6.8-overlay.9

2 years ago

0.6.7

2 years ago

0.6.9

2 years ago

0.6.8

2 years ago

0.6.8-overlay.22

2 years ago

0.6.6-react.75

2 years ago

0.6.6

2 years ago

0.6.6-react.50

2 years ago

0.6.6-react.48

2 years ago

0.6.6-react.49

2 years ago

0.6.3-react.54

3 years ago

0.6.6-react.32

2 years ago

0.6.3

3 years ago

0.6.5

2 years ago

0.6.4

2 years ago

0.6.2

3 years ago

0.6.1

3 years ago

0.5.7-devmode.0

3 years ago

0.6.0-devmode.0

3 years ago

0.5.8-devmode2.0

3 years ago

0.5.7-devmode.7

3 years ago

0.5.8-devmode.0

3 years ago

0.5.6

3 years ago

0.5.5

3 years ago

0.5.7

3 years ago

0.6.0

3 years ago

0.5.4

3 years ago

0.5.3

3 years ago

0.5.2

3 years ago

0.5.0

3 years ago

0.5.1

3 years ago

0.4.5-express.9

3 years ago

0.4.3-express.0

3 years ago

0.4.4-express.12

3 years ago

0.4.4

3 years ago

0.4.3

3 years ago

0.4.2

3 years ago

0.3.1

4 years ago

0.4.1

4 years ago

0.4.0

4 years ago

0.3.1-lit-next.0

4 years ago

0.3.0

4 years ago

0.2.6-lit-next.0

4 years ago

0.2.5

4 years ago

0.2.5-lit-next.0

4 years ago

0.2.4

4 years ago

0.2.4-lit-next.0

4 years ago

0.2.3

4 years ago

0.2.3-alpha.69

4 years ago

0.2.3-alpha.40

4 years ago

0.2.3-alpha.1

4 years ago

0.2.2

4 years ago

0.2.2-alpha.59

4 years ago

0.2.2-alpha.1

4 years ago

0.2.1

4 years ago

0.2.1-alpha.14

4 years ago

0.2.1-alpha.13

4 years ago

0.2.1-alpha.12

4 years ago

0.2.1-alpha.1

4 years ago

0.2.0

4 years ago

0.1.6-alpha.27

4 years ago

0.1.6-alpha.0

4 years ago

0.1.5

4 years ago

0.1.4-alpha.26

4 years ago

0.1.4

4 years ago

0.1.4-alpha.23

4 years ago

0.1.4-alpha.21

4 years ago

0.1.4-beta.12

4 years ago

0.1.4-beta.11

4 years ago

0.1.4-beta.10

4 years ago

0.1.4-beta.16

4 years ago

0.1.4-beta.15

4 years ago

0.1.4-beta.14

4 years ago

0.1.4-beta.13

4 years ago

0.1.4-alpha.17

4 years ago

0.1.4-beta.17

4 years ago

0.1.4-alpha.12

4 years ago

0.1.4-alpha.11

4 years ago

0.1.4-alpha.9

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago