@geoffcox/sterling-svelte 0.0.1 → 0.0.3
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/buttons/Button.svelte +159 -0
- package/buttons/Button.svelte.d.ts +48 -0
- package/buttons/types.d.ts +2 -0
- package/buttons/types.js +1 -0
- package/index.d.ts +11 -1
- package/index.js +11 -1
- package/package.json +16 -3
- package/theme/index.d.ts +0 -8
- package/theme/index.js +0 -8
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
<script>export let variant = "regular";
|
|
2
|
+
export let shape = "rounded";
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<!--
|
|
6
|
+
@component
|
|
7
|
+
provides a styled HTML button element.
|
|
8
|
+
-->
|
|
9
|
+
<button
|
|
10
|
+
class="sterling-button"
|
|
11
|
+
class:square={shape === 'square'}
|
|
12
|
+
class:circular={shape === 'circular'}
|
|
13
|
+
class:outline={variant === 'outline'}
|
|
14
|
+
class:ghost={variant === 'ghost'}
|
|
15
|
+
on:blur
|
|
16
|
+
on:click
|
|
17
|
+
on:dblclick
|
|
18
|
+
on:focus
|
|
19
|
+
on:focusin
|
|
20
|
+
on:focusout
|
|
21
|
+
on:keydown
|
|
22
|
+
on:keypress
|
|
23
|
+
on:keyup
|
|
24
|
+
on:mousedown
|
|
25
|
+
on:mouseenter
|
|
26
|
+
on:mouseleave
|
|
27
|
+
on:mousemove
|
|
28
|
+
on:mouseover
|
|
29
|
+
on:mouseout
|
|
30
|
+
on:mouseup
|
|
31
|
+
on:pointercancel
|
|
32
|
+
on:pointerdown
|
|
33
|
+
on:pointerenter
|
|
34
|
+
on:pointerleave
|
|
35
|
+
on:pointermove
|
|
36
|
+
on:pointerover
|
|
37
|
+
on:pointerout
|
|
38
|
+
on:pointerup
|
|
39
|
+
on:wheel
|
|
40
|
+
{...$$restProps}
|
|
41
|
+
>
|
|
42
|
+
<slot />
|
|
43
|
+
</button>
|
|
44
|
+
|
|
45
|
+
<style>
|
|
46
|
+
button {
|
|
47
|
+
background-color: var(--Button__background-color);
|
|
48
|
+
border-color: var(--Button__border-color);
|
|
49
|
+
border-radius: var(--Button__border-radius);
|
|
50
|
+
border-style: var(--Button__border-style);
|
|
51
|
+
border-width: var(--Button__border-width);
|
|
52
|
+
box-sizing: border-box;
|
|
53
|
+
color: var(--Button__color);
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
display: inline-flex;
|
|
56
|
+
flex-direction: row;
|
|
57
|
+
font: inherit;
|
|
58
|
+
align-content: center;
|
|
59
|
+
align-items: center;
|
|
60
|
+
justify-content: center;
|
|
61
|
+
justify-items: center;
|
|
62
|
+
column-gap: 0.25em;
|
|
63
|
+
overflow: hidden;
|
|
64
|
+
padding: 0.5em 1em;
|
|
65
|
+
text-decoration: none;
|
|
66
|
+
text-overflow: ellipsis;
|
|
67
|
+
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
68
|
+
white-space: nowrap;
|
|
69
|
+
user-select: none;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
button.vertical {
|
|
73
|
+
flex-direction: column;
|
|
74
|
+
row-gap: 0.15em;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
button.circular {
|
|
78
|
+
border-radius: 10000px;
|
|
79
|
+
padding: 0.5em;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
button.square {
|
|
83
|
+
border-radius: 0;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
button:hover {
|
|
87
|
+
background-color: var(--Button__background-color--hover);
|
|
88
|
+
border-color: var(--Button__border-color--hover);
|
|
89
|
+
color: var(--Button__color--hover);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
button:active {
|
|
93
|
+
background-color: var(--Button__background-color--active);
|
|
94
|
+
border-color: var(--Button__border-color--active);
|
|
95
|
+
color: var(--Button__color--active);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
button:focus-visible {
|
|
99
|
+
border-color: var(--Button__border-color--focus);
|
|
100
|
+
outline-color: var(--Common__outline-color);
|
|
101
|
+
outline-offset: var(--Common__outline-offset);
|
|
102
|
+
outline-style: var(--Common__outline-style);
|
|
103
|
+
outline-width: var(--Common__outline-width);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
button:disabled {
|
|
107
|
+
background-color: var(--Button__background-color--disabled);
|
|
108
|
+
border-color: var(--Button__border-color--disabled);
|
|
109
|
+
color: var(--Button__color--disabled);
|
|
110
|
+
cursor: not-allowed;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
button.outline {
|
|
114
|
+
background-color: transparent;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
button.outline:hover {
|
|
118
|
+
background-color: var(--Button__background-color--hover);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
button.outline:active {
|
|
122
|
+
background-color: var(--Button__background-color--active);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
button.outline:disabled {
|
|
126
|
+
background-color: transparent;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
button.outline:disabled:hover {
|
|
130
|
+
border-color: var(--Button__border-color--disabled);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
button.ghost {
|
|
134
|
+
background-color: transparent;
|
|
135
|
+
border-color: transparent;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
button.ghost:hover {
|
|
139
|
+
background-color: var(--Button__background-color--hover);
|
|
140
|
+
border-color: transparent;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
button.ghost:active {
|
|
144
|
+
background-color: var(--Button__background-color--active);
|
|
145
|
+
border-color: transparent;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
button.ghost:focus-visible {
|
|
149
|
+
border-color: var(--Button__border-color--focus);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
button.ghost:disabled {
|
|
153
|
+
border-color: transparent;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
button.ghost:disabled:hover {
|
|
157
|
+
background-color: var(--Button__background-color--disabled);
|
|
158
|
+
}
|
|
159
|
+
</style>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { ButtonShape, ButtonVariant } from './types';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
variant?: ButtonVariant | undefined;
|
|
7
|
+
shape?: ButtonShape | undefined;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
blur: FocusEvent;
|
|
11
|
+
click: MouseEvent;
|
|
12
|
+
dblclick: MouseEvent;
|
|
13
|
+
focus: FocusEvent;
|
|
14
|
+
focusin: FocusEvent;
|
|
15
|
+
focusout: FocusEvent;
|
|
16
|
+
keydown: KeyboardEvent;
|
|
17
|
+
keypress: KeyboardEvent;
|
|
18
|
+
keyup: KeyboardEvent;
|
|
19
|
+
mousedown: MouseEvent;
|
|
20
|
+
mouseenter: MouseEvent;
|
|
21
|
+
mouseleave: MouseEvent;
|
|
22
|
+
mousemove: MouseEvent;
|
|
23
|
+
mouseover: MouseEvent;
|
|
24
|
+
mouseout: MouseEvent;
|
|
25
|
+
mouseup: MouseEvent;
|
|
26
|
+
pointercancel: PointerEvent;
|
|
27
|
+
pointerdown: PointerEvent;
|
|
28
|
+
pointerenter: PointerEvent;
|
|
29
|
+
pointerleave: PointerEvent;
|
|
30
|
+
pointermove: PointerEvent;
|
|
31
|
+
pointerover: PointerEvent;
|
|
32
|
+
pointerout: PointerEvent;
|
|
33
|
+
pointerup: PointerEvent;
|
|
34
|
+
wheel: WheelEvent;
|
|
35
|
+
} & {
|
|
36
|
+
[evt: string]: CustomEvent<any>;
|
|
37
|
+
};
|
|
38
|
+
slots: {
|
|
39
|
+
default: {};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export type ButtonProps = typeof __propDef.props;
|
|
43
|
+
export type ButtonEvents = typeof __propDef.events;
|
|
44
|
+
export type ButtonSlots = typeof __propDef.slots;
|
|
45
|
+
/** provides a styled HTML button element. */
|
|
46
|
+
export default class Button extends SvelteComponentTyped<ButtonProps, ButtonEvents, ButtonSlots> {
|
|
47
|
+
}
|
|
48
|
+
export {};
|
package/buttons/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/index.d.ts
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
|
-
export { type Theme, type ThemeActionParams
|
|
1
|
+
export { type Theme, type ThemeActionParams } from './theme/types';
|
|
2
|
+
export { applyDarkTheme } from './theme/applyDarkTheme';
|
|
3
|
+
export { applyLightTheme } from './theme/applyLightTheme';
|
|
4
|
+
export { applyTheme } from './theme/applyTheme';
|
|
5
|
+
export { darkTheme } from './theme/darkTheme';
|
|
6
|
+
export { lightTheme } from './theme/lightTheme';
|
|
7
|
+
export { neutrals } from './theme/colors';
|
|
8
|
+
export { toggleDarkTheme } from './theme/toggleDarkTheme';
|
|
9
|
+
export { type ButtonVariant, type ButtonShape } from './buttons/types';
|
|
10
|
+
import Button from './buttons/Button.svelte';
|
|
11
|
+
export { Button };
|
package/index.js
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {} from './theme/types';
|
|
2
|
+
export { applyDarkTheme } from './theme/applyDarkTheme';
|
|
3
|
+
export { applyLightTheme } from './theme/applyLightTheme';
|
|
4
|
+
export { applyTheme } from './theme/applyTheme';
|
|
5
|
+
export { darkTheme } from './theme/darkTheme';
|
|
6
|
+
export { lightTheme } from './theme/lightTheme';
|
|
7
|
+
export { neutrals } from './theme/colors';
|
|
8
|
+
export { toggleDarkTheme } from './theme/toggleDarkTheme';
|
|
9
|
+
export {} from './buttons/types';
|
|
10
|
+
import Button from './buttons/Button.svelte';
|
|
11
|
+
export { Button };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geoffcox/sterling-svelte",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"devDependencies": {
|
|
5
5
|
"@fontsource/fira-mono": "^4.5.10",
|
|
6
6
|
"@fontsource/overpass": "^4.5.10",
|
|
@@ -25,17 +25,30 @@
|
|
|
25
25
|
"vitest": "^0.25.3"
|
|
26
26
|
},
|
|
27
27
|
"type": "module",
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@floating-ui/dom": "^1.1.0",
|
|
30
|
+
"uuid": "^9.0.0"
|
|
31
|
+
},
|
|
28
32
|
"exports": {
|
|
29
33
|
"./package.json": "./package.json",
|
|
34
|
+
"./buttons/Button.svelte": "./buttons/Button.svelte",
|
|
35
|
+
"./buttons/types": "./buttons/types.js",
|
|
36
|
+
"./clickOutside": "./clickOutside.js",
|
|
30
37
|
".": "./index.js",
|
|
38
|
+
"./inputs/Checkbox.svelte": "./inputs/Checkbox.svelte",
|
|
39
|
+
"./inputs/Input.svelte": "./inputs/Input.svelte",
|
|
40
|
+
"./inputs/Radio.svelte": "./inputs/Radio.svelte",
|
|
41
|
+
"./inputs/Select.svelte": "./inputs/Select.svelte",
|
|
42
|
+
"./inputs/Slider.svelte": "./inputs/Slider.svelte",
|
|
43
|
+
"./lists/List.svelte": "./lists/List.svelte",
|
|
31
44
|
"./theme/applyDarkTheme": "./theme/applyDarkTheme.js",
|
|
32
45
|
"./theme/applyLightTheme": "./theme/applyLightTheme.js",
|
|
33
46
|
"./theme/applyTheme": "./theme/applyTheme.js",
|
|
34
47
|
"./theme/colors": "./theme/colors.js",
|
|
35
48
|
"./theme/darkTheme": "./theme/darkTheme.js",
|
|
36
|
-
"./theme": "./theme/index.js",
|
|
37
49
|
"./theme/lightTheme": "./theme/lightTheme.js",
|
|
38
50
|
"./theme/toggleDarkTheme": "./theme/toggleDarkTheme.js",
|
|
39
51
|
"./theme/types": "./theme/types.js"
|
|
40
|
-
}
|
|
52
|
+
},
|
|
53
|
+
"svelte": "./index.js"
|
|
41
54
|
}
|
package/theme/index.d.ts
DELETED
package/theme/index.js
DELETED