@likable-hair/svelte 0.0.38 → 0.0.41

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 >export let type = 'default', active = false, loading = false, icon = undefined, iconSize = 15, clazz = '', maxWidth = undefined, maxHeight = undefined, minWidth = undefined, minHeight = undefined, width = undefined, height = undefined, textAlign = "center", cursor = "pointer", padding = "5px", fontSize = undefined, color = undefined, display = undefined, justifyContent = undefined, alignItems = undefined, backgroundColor = undefined, hoverBackgroundColor = '#88888847', activeBackgroundColor = hoverBackgroundColor, borderRadius = undefined, boxShadow = undefined;
1
+ <script >export let type = 'default', active = false, loading = false, icon = undefined, iconSize = 15, clazz = '', maxWidth = undefined, maxHeight = undefined, minWidth = undefined, minHeight = undefined, width = undefined, height = undefined, textAlign = "center", cursor = "pointer", padding = "5px", fontSize = undefined, color = undefined, display = undefined, justifyContent = undefined, alignItems = undefined, backgroundColor = undefined, hoverBackgroundColor = '#88888847', activeBackgroundColor = hoverBackgroundColor, borderRadius = undefined, border = undefined, boxShadow = undefined;
2
2
  export { clazz as class };
3
3
  import { createEventDispatcher } from 'svelte';
4
4
  const dispatch = createEventDispatcher();
@@ -29,6 +29,7 @@ import CircularLoader from '../loaders/CircularLoader.svelte';
29
29
  style:display={display}
30
30
  style:justify-content={justifyContent}
31
31
  style:align-items={alignItems}
32
+ style:--button-border={border}
32
33
  style:--button-border-radius={!!borderRadius ? borderRadius : defaultBorderRadius}
33
34
  style:--button-background-color={active ? activeBackgroundColor : backgroundColor}
34
35
  style:--button-hover-background-color={hoverBackgroundColor}
@@ -76,7 +77,8 @@ import CircularLoader from '../loaders/CircularLoader.svelte';
76
77
  transition: background-color 200ms;
77
78
  background-color: var(--button-background-color);
78
79
  outline: 0;
79
- border: 0;
80
+ border: var(--button-border);
81
+ border-color: var(--button-border-color);
80
82
  border-radius: var(--button-border-radius, 0.25rem);
81
83
  box-shadow: var(--button-box-shadow, 0 0 0.5rem rgba(0, 0, 0, 0.3));
82
84
  }
@@ -90,7 +92,7 @@ import CircularLoader from '../loaders/CircularLoader.svelte';
90
92
  text-transform: uppercase;
91
93
  font-weight: 600;
92
94
  outline: 0;
93
- border: 0;
95
+ border: var(--button-border);
94
96
  border-radius: var(--button-border-radius, 0.25rem);
95
97
  }
96
98
 
@@ -101,7 +103,7 @@ import CircularLoader from '../loaders/CircularLoader.svelte';
101
103
  .button-icon {
102
104
  transition: background-color 200ms;
103
105
  outline: 0;
104
- border: 0;
106
+ border: var(--button-border);
105
107
  border-radius: var(--button-border-radius, 50%);
106
108
  height: var(--button-icon-height) !important;
107
109
  width: var(--button-icon-width) !important;
@@ -25,6 +25,7 @@ declare const __propDef: {
25
25
  hoverBackgroundColor?: string;
26
26
  activeBackgroundColor?: string;
27
27
  borderRadius?: string;
28
+ border?: string;
28
29
  boxShadow?: string;
29
30
  };
30
31
  events: {
@@ -0,0 +1,101 @@
1
+ <script >export let value = false, id = undefined, disabled = false, activeColor = "#275efe", activeInnerColor = "#fff", focusShadow = "2px rgba(39, 94, 254, 0.3)", borderColor = "#bbc1e1", borderHoverColor = "#275efe", backgroundColor = "#fff", disabledColor = "#f6f8ff", disabledInnerColor = "#e1e6f9";
2
+ </script>
3
+
4
+ <input
5
+ style:--checkbox-active-color={activeColor}
6
+ style:--checkbox-active-inner-color={activeInnerColor}
7
+ style:--checkbox-focus-shadow={focusShadow}
8
+ style:--checkbox-border-color={borderColor}
9
+ style:--checkbox-border-hover-color={borderHoverColor}
10
+ style:--checkbox-background-color={backgroundColor}
11
+ style:--checkbox-disabled-color={disabledColor}
12
+ style:--checkbox-disabled-inner-color={disabledInnerColor}
13
+ id={id}
14
+ type="checkbox"
15
+ checked={value}
16
+ disabled={disabled}
17
+ >
18
+
19
+ <style>
20
+ @supports (-webkit-appearance: none) or (-moz-appearance: none) {
21
+ input[type="checkbox"] {
22
+ -webkit-appearance: none;
23
+ -moz-appearance: none;
24
+ height: 21px;
25
+ outline: none;
26
+ display: inline-block;
27
+ vertical-align: top;
28
+ position: relative;
29
+ margin: 0;
30
+ cursor: pointer;
31
+ border: 1px solid var(--bc, var(--checkbox-border-color));
32
+ background: var(--b, var(--checkbox-background-color));
33
+ transition: background 0.3s, border-color 0.3s, box-shadow 0.2s;
34
+ width: 21px;
35
+ border-radius: 7px;
36
+ }
37
+
38
+ input[type="checkbox"]:after {
39
+ content: "";
40
+ display: block;
41
+ position: absolute;
42
+ opacity: var(--o, 0);
43
+ transition: transform var(--d-t, 0.3s) var(--d-t-e, ease),
44
+ opacity var(--d-o, 0.2s);
45
+ width: 5px;
46
+ height: 9px;
47
+ border: 2px solid var(--checkbox-active-inner-color);
48
+ border-top: 0;
49
+ border-left: 0;
50
+ left: 7px;
51
+ top: 4px;
52
+ transform: rotate(var(--r, 20deg));
53
+ box-sizing: border-box;
54
+ }
55
+
56
+ input[type="checkbox"]:checked {
57
+ --b: var(--checkbox-active-color);
58
+ --bc: var(--checkbox-active-color);
59
+ --d-o: 0.3s;
60
+ --d-t: 0.6s;
61
+ --d-t-e: cubic-bezier(0.2, 0.85, 0.32, 1.2);
62
+ --o: 1;
63
+ --r: 43deg;
64
+ }
65
+
66
+ input[type="checkbox"]:disabled {
67
+ --b: var(--checkbox-disabled-color);
68
+ cursor: not-allowed;
69
+ opacity: 0.9;
70
+ }
71
+
72
+ input[type="checkbox"]:disabled:checked {
73
+ --b: var(--checkbox-disabled-inner-color);
74
+ --bc: var(--checkbox-border-color);
75
+ --r: 43deg;
76
+ }
77
+
78
+ input[type="checkbox"]:disabled + label {
79
+ cursor: not-allowed;
80
+ }
81
+
82
+ input[type="checkbox"]:hover:not(:checked):not(:disabled) {
83
+ --bc: var(--checkbox-border-hover-color);
84
+ }
85
+ input[type="checkbox"]:focus {
86
+ box-shadow: 0 0 0 var(--checkbox-focus-shadow);
87
+ }
88
+
89
+ input[type="checkbox"]:not(.switch):after {
90
+ width: 5px;
91
+ height: 9px;
92
+ border: 2px solid var(--checkbox-active-inner-color);
93
+ border-top: 0;
94
+ border-left: 0;
95
+ left: 7px;
96
+ top: 4px;
97
+ transform: rotate(var(--r, 20deg));
98
+ }
99
+
100
+ }
101
+ </style>
@@ -0,0 +1,26 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ value?: boolean;
5
+ id?: string;
6
+ disabled?: boolean;
7
+ activeColor?: string;
8
+ activeInnerColor?: string;
9
+ focusShadow?: string;
10
+ borderColor?: string;
11
+ borderHoverColor?: string;
12
+ backgroundColor?: string;
13
+ disabledColor?: string;
14
+ disabledInnerColor?: string;
15
+ };
16
+ events: {
17
+ [evt: string]: CustomEvent<any>;
18
+ };
19
+ slots: {};
20
+ };
21
+ export declare type CheckboxProps = typeof __propDef.props;
22
+ export declare type CheckboxEvents = typeof __propDef.events;
23
+ export declare type CheckboxSlots = typeof __propDef.slots;
24
+ export default class Checkbox extends SvelteComponentTyped<CheckboxProps, CheckboxEvents, CheckboxSlots> {
25
+ }
26
+ export {};
@@ -1,7 +1,7 @@
1
1
  <script >export let value = false, height = "20px", width = "40px", padding = "6px", borderRadius = "10px", toggleActiveColor = "#5c5c5c", toggleDeactiveColor = "#5c5c5c", backgroundActiveColor = "#e6e6e6", backgroundDeactiveColor = "#e6e6e6", animationDuration = "0.1s";
2
2
  </script>
3
3
 
4
- <span
4
+ <div
5
5
  style:--switch-toggle-active-color={toggleActiveColor}
6
6
  style:--switch-toggle-deactive-color={toggleDeactiveColor}
7
7
  style:--switch-animation-duration={animationDuration}
@@ -19,12 +19,13 @@
19
19
  <input
20
20
  bind:checked={value}
21
21
  type="checkbox"
22
+ on:change
22
23
  >
23
24
  <span
24
25
  class="slider"
25
26
  ></span>
26
27
  </div>
27
- </span>
28
+ </div>
28
29
 
29
30
  <style>
30
31
  .container {
@@ -13,6 +13,8 @@ declare const __propDef: {
13
13
  animationDuration?: string;
14
14
  };
15
15
  events: {
16
+ change: Event;
17
+ } & {
16
18
  [evt: string]: CustomEvent<any>;
17
19
  };
18
20
  slots: {};
package/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export { default as MediaQuery } from './common/MediaQuery.svelte';
6
6
  export { default as Dialog } from './dialogs/Dialog.svelte';
7
7
  export { default as TextField } from './forms/Textfield.svelte';
8
8
  export { default as Switch } from './forms/Switch.svelte';
9
+ export { default as Checkbox } from './forms/Checkbox.svelte';
9
10
  export { default as Skeleton } from './loaders/Skeleton.svelte';
10
11
  export { default as CircularLoader } from './loaders/CircularLoader.svelte';
11
12
  export { default as AttachmentDownloader } from './media/AttachmentDownloader.svelte';
package/index.js CHANGED
@@ -10,6 +10,7 @@ export { default as Dialog } from './dialogs/Dialog.svelte';
10
10
  // forms
11
11
  export { default as TextField } from './forms/Textfield.svelte';
12
12
  export { default as Switch } from './forms/Switch.svelte';
13
+ export { default as Checkbox } from './forms/Checkbox.svelte';
13
14
  // loaders
14
15
  export { default as Skeleton } from './loaders/Skeleton.svelte';
15
16
  export { default as CircularLoader } from './loaders/CircularLoader.svelte';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@likable-hair/svelte",
3
3
  "description": "A Svelte component for likablehair",
4
- "version": "0.0.38",
4
+ "version": "0.0.41",
5
5
  "devDependencies": {
6
6
  "@sveltejs/adapter-auto": "next",
7
7
  "@sveltejs/kit": "next",
@@ -37,6 +37,7 @@
37
37
  "./dates/YearSelector.svelte": "./dates/YearSelector.svelte",
38
38
  "./dates/utils": "./dates/utils.js",
39
39
  "./dialogs/Dialog.svelte": "./dialogs/Dialog.svelte",
40
+ "./forms/Checkbox.svelte": "./forms/Checkbox.svelte",
40
41
  "./forms/Switch.svelte": "./forms/Switch.svelte",
41
42
  "./forms/Textfield.svelte": "./forms/Textfield.svelte",
42
43
  ".": "./index.js",