@hyvor/design 0.0.46 → 0.0.47

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.
@@ -1,4 +1,4 @@
1
- <script>import { clickOutside } from "../../directives/clickOutside.js";
1
+ <script>import { clickOutside } from "../directives/clickOutside.js";
2
2
  import Box from "./../Box/Box.svelte";
3
3
  export let show = false;
4
4
  export let width = 225;
@@ -1,5 +1,5 @@
1
1
  <script>import ModalFooter from "./ModalFooter.svelte";
2
- import { clickOutside } from "../../directives/clickOutside.js";
2
+ import { clickOutside } from "../directives/clickOutside.js";
3
3
  import { IconX } from "@hyvor/icons";
4
4
  import IconButton from "./../IconButton/IconButton.svelte";
5
5
  import { fade, scale } from "svelte/transition";
@@ -40,3 +40,4 @@ export { default as TextInput } from './TextInput/TextInput.svelte';
40
40
  export { default as toast } from './Toast/toast.js';
41
41
  export { default as Tooltip } from './Tooltip/Tooltip.svelte';
42
42
  export { default as IconMessage } from './IconMessage/IconMessage.svelte';
43
+ export { clickOutside } from './directives/clickOutside.js';
@@ -40,3 +40,5 @@ export { default as TextInput } from './TextInput/TextInput.svelte';
40
40
  export { default as toast } from './Toast/toast.js';
41
41
  export { default as Tooltip } from './Tooltip/Tooltip.svelte';
42
42
  export { default as IconMessage } from './IconMessage/IconMessage.svelte';
43
+ // directives
44
+ export { clickOutside } from './directives/clickOutside.js';
@@ -0,0 +1,78 @@
1
+ <script>import { scale } from "svelte/transition";
2
+ import { clickOutside } from "../../../components/index.js";
3
+ export let src;
4
+ export let alt;
5
+ export let width = void 0;
6
+ let open = false;
7
+ </script>
8
+
9
+ <div class="wrap">
10
+ <img
11
+ {src}
12
+ {alt}
13
+ {...$$restProps}
14
+ {width}
15
+ on:click={() => open = true}
16
+ class="preview"
17
+ />
18
+ </div>
19
+
20
+ {#if open}
21
+ <div
22
+ class="modal"
23
+ >
24
+ <img
25
+ {src}
26
+ {alt}
27
+ {...$$restProps}
28
+ {width}
29
+ use:clickOutside={{
30
+ callback: () => open = false
31
+ }}
32
+ transition:scale={{ duration: 100, opacity: 0.5, start: 0.95 }}
33
+ />
34
+ </div>
35
+ {/if}
36
+
37
+ <style>
38
+ img.preview {
39
+ display: block;
40
+ max-width: 100%;
41
+ max-height: 100%;
42
+ margin: 0 auto;
43
+ border-radius: 5px;
44
+ box-shadow: 0 0 10px rgba(0,0,0,0.2);
45
+ cursor: pointer;
46
+ transition: .1s box-shadow;
47
+ }
48
+ img.preview:hover {
49
+ box-shadow: 0 0 15px rgba(0,0,0,0.3);
50
+ }
51
+
52
+ .modal {
53
+ position: fixed;
54
+ z-index: 1000000;
55
+ left: 0;
56
+ top: 0;
57
+ width: 100%;
58
+ height: 100%;
59
+ background-color: rgba(0,0,0,0.5);
60
+ display: flex;
61
+ align-items: center;
62
+ justify-content: center;
63
+ padding: 40px;
64
+ overflow: hidden;
65
+ }
66
+ .modal-content {
67
+ min-height: 0;
68
+ }
69
+ .modal img {
70
+ max-width: 100%;
71
+ max-height: 100%;
72
+ border-radius: 5px;
73
+ }
74
+ .wrap {
75
+ padding: 25px 0;
76
+ }
77
+
78
+ </style>
@@ -0,0 +1,19 @@
1
+ import { SvelteComponent } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ [x: string]: any;
5
+ src: string;
6
+ alt: string;
7
+ width?: undefined | number;
8
+ };
9
+ events: {
10
+ [evt: string]: CustomEvent<any>;
11
+ };
12
+ slots: {};
13
+ };
14
+ export type DocsImageProps = typeof __propDef.props;
15
+ export type DocsImageEvents = typeof __propDef.events;
16
+ export type DocsImageSlots = typeof __propDef.slots;
17
+ export default class DocsImage extends SvelteComponent<DocsImageProps, DocsImageEvents, DocsImageSlots> {
18
+ }
19
+ export {};
@@ -5,5 +5,6 @@ export { default as DocsNav } from './Docs/Nav/Nav.svelte';
5
5
  export { default as DocsNavItem } from './Docs/Nav/NavItem.svelte';
6
6
  export { default as DocsNavCategory } from './Docs/Nav/NavCategory.svelte';
7
7
  export { default as DocsContent } from './Docs/Content/Content.svelte';
8
+ export { default as DocsImage } from './Docs/Content/DocsImage.svelte';
8
9
  export { default as Footer } from './Footer/Footer.svelte';
9
10
  export { default as FooterLinkList } from './Footer/FooterLinkList.svelte';
@@ -5,5 +5,6 @@ export { default as DocsNav } from './Docs/Nav/Nav.svelte';
5
5
  export { default as DocsNavItem } from './Docs/Nav/NavItem.svelte';
6
6
  export { default as DocsNavCategory } from './Docs/Nav/NavCategory.svelte';
7
7
  export { default as DocsContent } from './Docs/Content/Content.svelte';
8
+ export { default as DocsImage } from './Docs/Content/DocsImage.svelte';
8
9
  export { default as Footer } from './Footer/Footer.svelte';
9
10
  export { default as FooterLinkList } from './Footer/FooterLinkList.svelte';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyvor/design",
3
- "version": "0.0.46",
3
+ "version": "0.0.47",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "scripts": {