@hyvor/design 0.0.64 → 0.0.67

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.
@@ -18,21 +18,13 @@ if (error) {
18
18
  iconColor = iconColor || "var(--gray-dark)";
19
19
  </script>
20
20
 
21
- <div
22
- class="icon-message"
23
- style:padding={padding + 'px'}
24
- >
25
-
26
- <div
27
- class="icon"
28
- style:color={iconColor}
29
- {...$$restProps}
30
- >
31
- {#if $$slots.icon}
32
- <slot name="icon" />
33
- {:else if icon}
34
- <svelte:component this={icon} size={iconSize + 'px' } />
35
- {/if}
21
+ <div class="icon-message" style:padding={padding + "px"}>
22
+ <div class="icon" style:color={iconColor} {...$$restProps}>
23
+ {#if $$slots.icon}
24
+ <slot name="icon" />
25
+ {:else if icon}
26
+ <svelte:component this={icon} size={iconSize + "px"} />
27
+ {/if}
36
28
  </div>
37
29
 
38
30
  <div class="message">
@@ -42,11 +34,9 @@ iconColor = iconColor || "var(--gray-dark)";
42
34
  {message}
43
35
  {/if}
44
36
  </div>
45
-
46
37
  </div>
47
38
 
48
39
  <style>
49
-
50
40
  .icon-message {
51
41
  width: 100%;
52
42
  height: 100%;
@@ -64,8 +54,4 @@ iconColor = iconColor || "var(--gray-dark)";
64
54
  color: var(--text-light);
65
55
  margin-top: 15px;
66
56
  }
67
-
68
- .icon {
69
- }
70
-
71
- </style>
57
+ </style>
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponent } from "svelte";
2
- import type { ComponentType } from 'svelte';
2
+ import type { ComponentType } from "svelte";
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  [x: string]: any;
@@ -0,0 +1,127 @@
1
+ <script>import { createEventDispatcher } from "svelte";
2
+ export let min;
3
+ export let max;
4
+ export let value;
5
+ export let step = 1;
6
+ export let dots = false;
7
+ const dispatch = createEventDispatcher();
8
+ function toStep(value2) {
9
+ return Math.max(min, Math.min(max, Math.round(value2 / step) * step));
10
+ }
11
+ $:
12
+ progress = (value - min) / (max - min) * 100;
13
+ let dragging = false;
14
+ let trackEl;
15
+ function handleMousedown(event) {
16
+ dragging = true;
17
+ handleMousemove(event);
18
+ window.addEventListener("mousemove", handleMousemove);
19
+ window.addEventListener("mouseup", handleMouseup);
20
+ }
21
+ function handleMouseup() {
22
+ dragging = false;
23
+ window.removeEventListener("mousemove", handleMousemove);
24
+ }
25
+ function handleMousemove(event) {
26
+ if (dragging) {
27
+ const rect = trackEl.getBoundingClientRect();
28
+ const x = event.clientX - rect.left;
29
+ const width = rect.width;
30
+ const newValue = min + x / width * (max - min);
31
+ value = toStep(newValue);
32
+ dispatch("change", value);
33
+ }
34
+ }
35
+ </script>
36
+
37
+ <div class="slider">
38
+ <!-- svelte-ignore a11y-no-static-element-interactions -->
39
+ <div
40
+ class="track"
41
+ bind:this={trackEl}
42
+ class:dragging
43
+ on:mousedown={handleMousedown}
44
+ >
45
+ <div class="progress" style="width: {progress}%"></div>
46
+ <button class="handle" style="left: {progress}%">
47
+ <span class="tip">
48
+ {value}
49
+ </span>
50
+ </button>
51
+
52
+ {#if dots}
53
+ {#each Array.from({ length: (max - min) / step + 1 }, (_, i) => i) as i}
54
+ <div
55
+ class="dot"
56
+ style="left: {(i * 100) / ((max - min) / step)}%"
57
+ ></div>
58
+ {/each}
59
+ {/if}
60
+ </div>
61
+ </div>
62
+
63
+ <style>
64
+ .track {
65
+ background-color: var(--input);
66
+ height: 10px;
67
+ border-radius: 20px;
68
+ position: relative;
69
+ }
70
+ .handle {
71
+ background-color: var(--accent);
72
+ width: 20px;
73
+ height: 20px;
74
+ border-radius: 50%;
75
+ position: absolute;
76
+ top: 50%;
77
+ transform: translate(-50%, -50%);
78
+ cursor: grab;
79
+ z-index: 1;
80
+ transition: 0.2s box-shadow;
81
+ }
82
+ .handle:hover {
83
+ box-shadow: 0 0 0 2px var(--accent-light);
84
+ }
85
+ .tip {
86
+ position: absolute;
87
+ bottom: 100%;
88
+ margin-bottom: 3px;
89
+ left: 50%;
90
+ transform: translateX(-50%);
91
+ padding: 3px 6px;
92
+ border-radius: 5px;
93
+
94
+ /* from Tooltip */
95
+ --local-bg: #24292f;
96
+ --local-color: #fff;
97
+
98
+ background-color: var(--local-bg);
99
+ color: var(--local-color);
100
+ display: none;
101
+ }
102
+
103
+ .dot {
104
+ background-color: var(--accent-light);
105
+ z-index: 0;
106
+ width: 8px;
107
+ height: 8px;
108
+ border-radius: 50%;
109
+ position: absolute;
110
+ top: 50%;
111
+ transform: translate(-50%, -50%);
112
+ }
113
+
114
+ .handle:hover .tip,
115
+ .track.dragging .tip {
116
+ display: block;
117
+ }
118
+
119
+ .track.dragging,
120
+ .track.dragging .handle {
121
+ cursor: grabbing;
122
+ }
123
+
124
+ .track.dragging .handle {
125
+ box-shadow: 0 0 0 3px var(--accent-light);
126
+ }
127
+ </style>
@@ -0,0 +1,22 @@
1
+ import { SvelteComponent } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ min: number;
5
+ max: number;
6
+ value: number;
7
+ step?: number | undefined;
8
+ dots?: boolean | undefined;
9
+ };
10
+ events: {
11
+ change: CustomEvent<number>;
12
+ } & {
13
+ [evt: string]: CustomEvent<any>;
14
+ };
15
+ slots: {};
16
+ };
17
+ export type SliderProps = typeof __propDef.props;
18
+ export type SliderEvents = typeof __propDef.events;
19
+ export type SliderSlots = typeof __propDef.slots;
20
+ export default class Slider extends SvelteComponent<SliderProps, SliderEvents, SliderSlots> {
21
+ }
22
+ export {};
@@ -6,32 +6,27 @@ export let state = "default";
6
6
  export let textarea = {};
7
7
  </script>
8
8
 
9
-
10
- <span class="input-wrap state-{state}"
9
+ <span
10
+ class="input-wrap state-{state}"
11
11
  class:block
12
12
  on:click={() => textarea.focus()}
13
13
  on:keydown={(e) => {
14
- if (e.key === 'Enter') {
14
+ if (e.key === "Enter") {
15
15
  textarea.focus();
16
16
  }
17
17
  }}
18
18
  role="textbox"
19
- tabindex="0"
19
+ tabindex="0"
20
20
  >
21
-
22
21
  {#if $$slots.start}
23
- <span class="slot start"
24
-
25
- >
22
+ <span class="slot start">
26
23
  <slot name="start" />
27
24
  </span>
28
25
  {/if}
29
26
 
30
- <textarea
31
- bind:value={value}
27
+ <textarea
28
+ bind:value
32
29
  bind:this={textarea}
33
-
34
-
35
30
  on:keyup
36
31
  on:keydown
37
32
  on:keypress
@@ -43,12 +38,9 @@ export let textarea = {};
43
38
  on:mouseleave
44
39
  on:change
45
40
  on:input
46
-
47
41
  {rows}
48
42
  {cols}
49
-
50
43
  {...$$restProps}
51
-
52
44
  ></textarea>
53
45
 
54
46
  {#if $$slots.end}
@@ -137,4 +129,4 @@ export let textarea = {};
137
129
  }
138
130
  .input-wrap textarea:focus {
139
131
  outline: none;
140
- }</style>
132
+ }</style>
@@ -2,7 +2,7 @@ import { SvelteComponent } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  [x: string]: any;
5
- value?: string | undefined;
5
+ value?: any;
6
6
  block?: boolean | undefined;
7
7
  rows?: number | undefined;
8
8
  cols?: number | undefined;
@@ -27,6 +27,7 @@ export { default as Modal } from './Modal/Modal.svelte';
27
27
  export { confirm } from './Modal/confirm.js';
28
28
  export { default as NavLink } from './NavLink/NavLink.svelte';
29
29
  export { default as Radio } from './Radio/Radio.svelte';
30
+ export { default as Slider } from './Slider/Slider.svelte';
30
31
  export { default as SplitControl } from './SplitControl/SplitControl.svelte';
31
32
  export { default as Switch } from './Switch/Switch.svelte';
32
33
  export { default as Table } from './Table/Table.svelte';
@@ -27,6 +27,7 @@ export { default as Modal } from './Modal/Modal.svelte';
27
27
  export { confirm } from './Modal/confirm.js';
28
28
  export { default as NavLink } from './NavLink/NavLink.svelte';
29
29
  export { default as Radio } from './Radio/Radio.svelte';
30
+ export { default as Slider } from './Slider/Slider.svelte';
30
31
  export { default as SplitControl } from './SplitControl/SplitControl.svelte';
31
32
  export { default as Switch } from './Switch/Switch.svelte';
32
33
  export { default as Table } from './Table/Table.svelte';
@@ -0,0 +1,59 @@
1
+ <script>import FeatureSectionTitle from "./DocumentTitle.svelte";
2
+ export let title;
3
+ export let subtitle;
4
+ </script>
5
+
6
+ <section>
7
+ <div class="hds-container container">
8
+ <FeatureSectionTitle {title} />
9
+ <div class="date">{subtitle}</div>
10
+ <content><slot /></content>
11
+ </div>
12
+ </section>
13
+
14
+ <style>* {
15
+ line-height: 30px;
16
+ }
17
+
18
+ .container {
19
+ margin: 0 auto 20px auto;
20
+ padding: 30px 15px 20px 15px;
21
+ }
22
+ .container :global(.wrap) {
23
+ margin-top: 0 !important;
24
+ }
25
+ .container .date {
26
+ text-align: center;
27
+ margin: 15px 0 60px 0;
28
+ color: var(--text-light);
29
+ }
30
+ .container content :global(h2) {
31
+ font-size: 32px !important;
32
+ font-weight: 600;
33
+ margin-top: 40px;
34
+ position: relative;
35
+ }
36
+ .container content :global(h3) {
37
+ font-size: 24px;
38
+ font-weight: 600;
39
+ margin-top: 40px;
40
+ }
41
+ .container content :global(p) {
42
+ margin-top: 20px;
43
+ }
44
+ .container content :global(ul) {
45
+ margin-top: 20px;
46
+ }
47
+ .container content :global(ol) {
48
+ margin-top: 20px;
49
+ }
50
+ .container content :global(hr) {
51
+ margin: 40px 0;
52
+ border: none;
53
+ height: 1px;
54
+ background-color: var(--border);
55
+ }
56
+ .container content :global(a) {
57
+ color: var(--link);
58
+ text-decoration: underline;
59
+ }</style>
@@ -0,0 +1,19 @@
1
+ import { SvelteComponent } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ title: string;
5
+ subtitle: string;
6
+ };
7
+ events: {
8
+ [evt: string]: CustomEvent<any>;
9
+ };
10
+ slots: {
11
+ default: {};
12
+ };
13
+ };
14
+ export type DocumentProps = typeof __propDef.props;
15
+ export type DocumentEvents = typeof __propDef.events;
16
+ export type DocumentSlots = typeof __propDef.slots;
17
+ export default class Document extends SvelteComponent<DocumentProps, DocumentEvents, DocumentSlots> {
18
+ }
19
+ export {};
@@ -0,0 +1,63 @@
1
+ <script>export let title;
2
+ export let subtitle = void 0;
3
+ export let icon = null;
4
+ export let h2Style = void 0;
5
+ export let wrapStyle = void 0;
6
+ </script>
7
+
8
+ <div class="wrap document-title" style={wrapStyle}>
9
+ <h2 style={h2Style}>
10
+ {title}
11
+ {#if icon}
12
+ <div class="img-wrap">
13
+ <img src={icon} alt={title} />
14
+ </div>
15
+ {/if}
16
+ </h2>
17
+
18
+ {#if subtitle}
19
+ <h3>{@html subtitle}</h3>
20
+ {/if}
21
+ </div>
22
+
23
+ <style>
24
+ .wrap {
25
+ margin-top: 100px;
26
+ }
27
+ h2 {
28
+ font-size: 38px;
29
+ font-weight: 700;
30
+ margin-bottom: 10px;
31
+ margin-top: 20px;
32
+ text-align: center;
33
+ display: flex;
34
+ align-items: center;
35
+ justify-content: center;
36
+ }
37
+ h3 {
38
+ font-size: 20px;
39
+ width: 650px;
40
+ max-width: 100%;
41
+ margin: 0 auto;
42
+ font-weight: normal;
43
+ line-height: 1.4;
44
+ text-align: center;
45
+ }
46
+ .img-wrap {
47
+ text-align: center;
48
+ margin-left: 20px;
49
+ display: inline-flex;
50
+ align-items: center;
51
+ }
52
+ img {
53
+ width: 85px;
54
+ height: 85px;
55
+ }
56
+
57
+ @media (max-width: 992px) {
58
+ h2 {
59
+ flex-direction: column-reverse;
60
+ gap: 15px;
61
+ }
62
+ }
63
+ </style>
@@ -0,0 +1,20 @@
1
+ import { SvelteComponent } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ title: string;
5
+ subtitle?: string | undefined;
6
+ icon?: string | null | undefined;
7
+ h2Style?: string | undefined;
8
+ wrapStyle?: string | undefined;
9
+ };
10
+ events: {
11
+ [evt: string]: CustomEvent<any>;
12
+ };
13
+ slots: {};
14
+ };
15
+ export type DocumentTitleProps = typeof __propDef.props;
16
+ export type DocumentTitleEvents = typeof __propDef.events;
17
+ export type DocumentTitleSlots = typeof __propDef.slots;
18
+ export default class DocumentTitle extends SvelteComponent<DocumentTitleProps, DocumentTitleEvents, DocumentTitleSlots> {
19
+ }
20
+ export {};
@@ -8,3 +8,4 @@ export { default as DocsContent } from './Docs/Content/Content.svelte';
8
8
  export { default as DocsImage } from './Docs/Content/DocsImage.svelte';
9
9
  export { default as Footer } from './Footer/Footer.svelte';
10
10
  export { default as FooterLinkList } from './Footer/FooterLinkList.svelte';
11
+ export { default as Document } from './Document/Document.svelte';
@@ -8,3 +8,4 @@ export { default as DocsContent } from './Docs/Content/Content.svelte';
8
8
  export { default as DocsImage } from './Docs/Content/DocsImage.svelte';
9
9
  export { default as Footer } from './Footer/Footer.svelte';
10
10
  export { default as FooterLinkList } from './Footer/FooterLinkList.svelte';
11
+ export { default as Document } from './Document/Document.svelte';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyvor/design",
3
- "version": "0.0.64",
3
+ "version": "0.0.67",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "scripts": {