@streamscloud/kit 0.0.1-1770364570820 → 0.0.1-1770761450561
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/dist/core/continuation-token.d.ts +1 -0
- package/dist/core/continuation-token.js +4 -1
- package/dist/styles/_colors.scss +126 -0
- package/dist/styles/_form-group.scss +37 -0
- package/dist/styles/_functions.scss +37 -0
- package/dist/styles/_index.scss +6 -0
- package/dist/styles/_mixins.scss +128 -0
- package/dist/styles/_normalize.scss +257 -0
- package/dist/styles/_reset.scss +194 -0
- package/dist/styles/_responsive.scss +70 -0
- package/dist/styles/_row.scss +81 -0
- package/dist/styles/_theme.scss +68 -0
- package/dist/ui/button/cmp.button.svelte +10 -0
- package/dist/ui/button/cmp.button.svelte.d.ts +16 -0
- package/dist/ui/button/cmp.options-button.svelte +202 -0
- package/dist/ui/button/cmp.options-button.svelte.d.ts +21 -0
- package/dist/ui/button/index.d.ts +3 -0
- package/dist/ui/button/index.js +2 -0
- package/dist/ui/button/resources/button-base.svelte +81 -0
- package/dist/ui/button/resources/button-base.svelte.d.ts +13 -0
- package/dist/ui/button/resources/button-theme.svelte +233 -0
- package/dist/ui/button/resources/button-theme.svelte.d.ts +10 -0
- package/dist/ui/button/resources/types.d.ts +2 -0
- package/dist/ui/button/resources/types.js +1 -0
- package/dist/ui/dialog/cmp.dialog-button.svelte +13 -0
- package/dist/ui/dialog/cmp.dialog-button.svelte.d.ts +15 -0
- package/dist/ui/dialog/cmp.dialog-cancel-button.svelte +13 -0
- package/dist/ui/dialog/cmp.dialog-cancel-button.svelte.d.ts +11 -0
- package/dist/ui/dialog/cmp.dialog-close-button.svelte +17 -0
- package/dist/ui/dialog/cmp.dialog-close-button.svelte.d.ts +27 -0
- package/dist/ui/dialog/cmp.dialog-container.svelte +183 -0
- package/dist/ui/dialog/cmp.dialog-container.svelte.d.ts +27 -0
- package/dist/ui/dialog/cmp.dialog.svelte +113 -0
- package/dist/ui/dialog/cmp.dialog.svelte.d.ts +35 -0
- package/dist/ui/dialog/dialog-controller.d.ts +22 -0
- package/dist/ui/dialog/dialog-controller.js +45 -0
- package/dist/ui/dialog/dialog-data.d.ts +27 -0
- package/dist/ui/dialog/dialog-data.js +1 -0
- package/dist/ui/dialog/dialog-mount.d.ts +3 -0
- package/dist/ui/dialog/dialog-mount.js +19 -0
- package/dist/ui/dialog/dialogs.svelte.d.ts +13 -0
- package/dist/ui/dialog/dialogs.svelte.js +67 -0
- package/dist/ui/dialog/index.d.ts +8 -0
- package/dist/ui/dialog/index.js +7 -0
- package/dist/ui/dialog/types.svelte.d.ts +30 -0
- package/dist/ui/dialog/types.svelte.js +25 -0
- package/dist/ui/icon/cmp.icon.svelte +76 -0
- package/dist/ui/icon/cmp.icon.svelte.d.ts +8 -0
- package/dist/ui/icon/index.d.ts +2 -0
- package/dist/ui/icon/index.js +1 -0
- package/dist/ui/icon/types.d.ts +1 -0
- package/dist/ui/icon/types.js +1 -0
- package/package.json +42 -7
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
@use 'mixins';
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Modern CSS Reset
|
|
5
|
+
* Based on Josh W. Comeau's reset with custom additions
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
$input-placeholder-color: var(--input--placeholder--color, #c1c1c1);
|
|
9
|
+
|
|
10
|
+
/* 1. Use a more-intuitive box-sizing model */
|
|
11
|
+
html {
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
*,
|
|
16
|
+
*::before,
|
|
17
|
+
*::after {
|
|
18
|
+
box-sizing: inherit;
|
|
19
|
+
border-width: 0;
|
|
20
|
+
border-style: solid;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* 2. Remove default margin */
|
|
24
|
+
*:not(dialog) {
|
|
25
|
+
margin: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* 3. Enable keyword animations */
|
|
29
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
30
|
+
html {
|
|
31
|
+
interpolate-size: allow-keywords;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* 4. Add accessible line-height and improve text rendering */
|
|
36
|
+
body {
|
|
37
|
+
line-height: 1.5;
|
|
38
|
+
-webkit-font-smoothing: antialiased;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* 5. Improve media defaults */
|
|
42
|
+
img,
|
|
43
|
+
picture,
|
|
44
|
+
video,
|
|
45
|
+
canvas,
|
|
46
|
+
svg {
|
|
47
|
+
display: block;
|
|
48
|
+
vertical-align: middle;
|
|
49
|
+
max-width: 100%;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
img {
|
|
53
|
+
border: none;
|
|
54
|
+
height: auto;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
video {
|
|
58
|
+
outline: none;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* 6. Inherit fonts for form controls */
|
|
62
|
+
input,
|
|
63
|
+
button,
|
|
64
|
+
textarea,
|
|
65
|
+
select {
|
|
66
|
+
font: inherit;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* 7. Avoid text overflows */
|
|
70
|
+
p,
|
|
71
|
+
h1,
|
|
72
|
+
h2,
|
|
73
|
+
h3,
|
|
74
|
+
h4,
|
|
75
|
+
h5,
|
|
76
|
+
h6 {
|
|
77
|
+
overflow-wrap: break-word;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* 8. Improve line wrapping */
|
|
81
|
+
p {
|
|
82
|
+
text-wrap: pretty;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
h1,
|
|
86
|
+
h2,
|
|
87
|
+
h3,
|
|
88
|
+
h4,
|
|
89
|
+
h5,
|
|
90
|
+
h6 {
|
|
91
|
+
text-wrap: balance;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* ========================================
|
|
95
|
+
* Custom additions
|
|
96
|
+
* ======================================== */
|
|
97
|
+
|
|
98
|
+
/* Lists */
|
|
99
|
+
ul,
|
|
100
|
+
ol {
|
|
101
|
+
list-style: none;
|
|
102
|
+
padding: 0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
li {
|
|
106
|
+
list-style: inherit;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/* Input & Textarea */
|
|
110
|
+
input {
|
|
111
|
+
vertical-align: middle;
|
|
112
|
+
min-width: 0;
|
|
113
|
+
|
|
114
|
+
&::placeholder {
|
|
115
|
+
color: $input-placeholder-color !important;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&:-webkit-autofill,
|
|
119
|
+
&:-webkit-autofill:hover,
|
|
120
|
+
&:-webkit-autofill:focus {
|
|
121
|
+
-webkit-background-clip: text;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&::-webkit-outer-spin-button,
|
|
125
|
+
&::-webkit-inner-spin-button {
|
|
126
|
+
-webkit-appearance: none;
|
|
127
|
+
margin: 0;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
&[type='number'] {
|
|
131
|
+
-moz-appearance: textfield;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
textarea {
|
|
136
|
+
vertical-align: top;
|
|
137
|
+
resize: vertical;
|
|
138
|
+
@include mixins.scrollbar;
|
|
139
|
+
|
|
140
|
+
&::placeholder {
|
|
141
|
+
color: $input-placeholder-color !important;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
input:focus,
|
|
146
|
+
textarea:focus {
|
|
147
|
+
outline: none;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/* Button */
|
|
151
|
+
button,
|
|
152
|
+
input[type='submit'] {
|
|
153
|
+
cursor: pointer;
|
|
154
|
+
-webkit-appearance: none;
|
|
155
|
+
background-color: transparent;
|
|
156
|
+
padding: 0;
|
|
157
|
+
text-align: left;
|
|
158
|
+
color: inherit;
|
|
159
|
+
|
|
160
|
+
&:focus {
|
|
161
|
+
outline: none;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&:disabled {
|
|
165
|
+
cursor: default;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/* Details/Summary */
|
|
170
|
+
details {
|
|
171
|
+
summary {
|
|
172
|
+
list-style: none;
|
|
173
|
+
|
|
174
|
+
&::-webkit-details-marker {
|
|
175
|
+
display: none;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
> * {
|
|
180
|
+
box-sizing: border-box;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/* Links */
|
|
185
|
+
a {
|
|
186
|
+
color: inherit;
|
|
187
|
+
text-decoration: none;
|
|
188
|
+
transition: color linear 0.2s;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/* Table */
|
|
192
|
+
table {
|
|
193
|
+
border-collapse: collapse;
|
|
194
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
|
|
3
|
+
$layout-breakpoints: (
|
|
4
|
+
xs: 480px,
|
|
5
|
+
sm: 576px,
|
|
6
|
+
md: 768px,
|
|
7
|
+
lg: 992px,
|
|
8
|
+
xl: 1200px,
|
|
9
|
+
xxl: 1400px,
|
|
10
|
+
fhd: 1920px,
|
|
11
|
+
fhd-p: 2200px
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
@mixin container($breakpoint) {
|
|
15
|
+
/* Set 'container-type: inline-size;' to reference container*/
|
|
16
|
+
|
|
17
|
+
$val: map.get($layout-breakpoints, $breakpoint);
|
|
18
|
+
@container (width < #{$val}) {
|
|
19
|
+
@content;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@mixin container-custom($width) {
|
|
24
|
+
/* Set 'container-type: inline-size;' to reference container*/
|
|
25
|
+
@container (width < #{$width}) {
|
|
26
|
+
@content;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@mixin container-mobile() {
|
|
31
|
+
@include container(sm) {
|
|
32
|
+
@content;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@mixin container-tablet() {
|
|
37
|
+
@include container(md) {
|
|
38
|
+
@content;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@mixin container-laptop() {
|
|
43
|
+
@include container(lg) {
|
|
44
|
+
@content;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@mixin container-narrow-desktop() {
|
|
49
|
+
@include container(xl) {
|
|
50
|
+
@content;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@mixin container-desktop() {
|
|
55
|
+
@include container(xxl) {
|
|
56
|
+
@content;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@mixin container-fhd() {
|
|
61
|
+
@include container(fhd) {
|
|
62
|
+
@content;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@mixin container-fhd-p() {
|
|
67
|
+
@include container(fhd-p) {
|
|
68
|
+
@content;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
$_desktop: 960px;
|
|
2
|
+
$_tablet: 768px;
|
|
3
|
+
$_grid-cols: 12;
|
|
4
|
+
|
|
5
|
+
.g-row {
|
|
6
|
+
display: flex !important;
|
|
7
|
+
flex-wrap: wrap;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.g-row-center {
|
|
11
|
+
margin-left: auto;
|
|
12
|
+
margin-right: auto;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
[class*='g-col-'] {
|
|
16
|
+
flex: 0 1 auto;
|
|
17
|
+
max-width: 100%;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@for $i from 1 through $_grid-cols {
|
|
21
|
+
.g-col-#{$i} {
|
|
22
|
+
flex-basis: calc((100 / (#{$_grid-cols} / #{$i})) * 1%);
|
|
23
|
+
max-width: calc((100 / (#{$_grid-cols} / #{$i})) * 1%);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@for $i from 0 through ($_grid-cols - 1) {
|
|
28
|
+
.g-col-offset-#{$i} {
|
|
29
|
+
margin-left: calc((100 / (#{$_grid-cols} / #{$i})) * 1%);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* Tablets */
|
|
34
|
+
@media only screen and (min-width: $_tablet) and (max-width: $_desktop - 1) {
|
|
35
|
+
[class*='g-col-'] {
|
|
36
|
+
flex-basis: 100%;
|
|
37
|
+
max-width: 100%;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
[class*='g-col-offset-'] {
|
|
41
|
+
margin-left: 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@for $i from 1 through $_grid-cols {
|
|
45
|
+
.g-tablet-col-#{$i} {
|
|
46
|
+
flex-basis: calc((100 / (#{$_grid-cols} / #{$i})) * 1%);
|
|
47
|
+
max-width: calc((100 / (#{$_grid-cols} / #{$i})) * 1%);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@for $i from 0 through ($_grid-cols - 1) {
|
|
52
|
+
.g-tablet-col-offset-#{$i} {
|
|
53
|
+
margin-left: calc((100 / (#{$_grid-cols} / #{$i})) * 1%);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* Mobile portrait and landscape modes */
|
|
59
|
+
@media only screen and (max-width: $_tablet - 1) {
|
|
60
|
+
[class*='g-tablet-col-'] {
|
|
61
|
+
flex-basis: 100%;
|
|
62
|
+
max-width: 100%;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
[class*='g-tablet-col-offset-'] {
|
|
66
|
+
margin-left: 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@for $i from 1 through $_grid-cols {
|
|
70
|
+
.g-mobile-col-#{$i} {
|
|
71
|
+
flex-basis: calc((100 / (#{$_grid-cols} / #{$i})) * 1%);
|
|
72
|
+
max-width: calc((100 / (#{$_grid-cols} / #{$i})) * 1%);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@for $i from 0 through ($_grid-cols - 1) {
|
|
77
|
+
.g-mobile-col-offset-#{$i} {
|
|
78
|
+
margin-left: calc((100 / (#{$_grid-cols} / #{$i})) * 1%);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
@use 'colors';
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
/* Backgrounds */
|
|
5
|
+
--sc-color--bg-brand: light-dark(#{colors.$color-primary-500}, #{colors.$color-primary-400});
|
|
6
|
+
--sc-color--bg-button: light-dark(#{colors.$color-white}, #{colors.$color-dark-800});
|
|
7
|
+
--sc-color--bg-element: light-dark(#{colors.$color-neutral-50}, #{colors.$color-dark-800});
|
|
8
|
+
--sc-color--bg-header: light-dark(#{colors.$color-neutral-50}, #{colors.$color-black});
|
|
9
|
+
--sc-color--bg-images: #{colors.$color-neutral-300};
|
|
10
|
+
--sc-color--bg-images-secondary: #{colors.$color-neutral-400};
|
|
11
|
+
--sc-color--bg-inactive: light-dark(#{colors.$color-neutral-100}, #{colors.$color-dark-100});
|
|
12
|
+
--sc-color--bg-menu-active: light-dark(#{colors.$color-primary-50}, #{colors.$color-primary-800});
|
|
13
|
+
--sc-color--bg-menu-hover: light-dark(#{colors.$color-neutral-50}, #{colors.$color-neutral-800});
|
|
14
|
+
--sc-color--bg-page: light-dark(#{colors.$color-white}, #{colors.$color-black});
|
|
15
|
+
--sc-color--bg-primary: light-dark(#{colors.$color-white}, #{colors.$color-dark-900});
|
|
16
|
+
--sc-color--bg-screen: light-dark(#{colors.$color-neutral-50}, #{colors.$color-black});
|
|
17
|
+
--sc-color--bg-secondary: light-dark(#{colors.$color-neutral-50}, #{colors.$color-dark-800});
|
|
18
|
+
--sc-color--bg-section: #f3f4f6;
|
|
19
|
+
|
|
20
|
+
/* Borders */
|
|
21
|
+
--sc-color--border-active: #{colors.$color-primary-400};
|
|
22
|
+
--sc-color--border-brand: light-dark(#{colors.$color-primary-500}, #{colors.$color-primary-400});
|
|
23
|
+
--sc-color--border-error: light-dark(#{colors.$color-destructive-500}, #{colors.$color-destructive-600});
|
|
24
|
+
--sc-color--border-gray: light-dark(#{colors.$color-neutral-200}, #{colors.$color-dark-200});
|
|
25
|
+
--sc-color--border-green: light-dark(#{colors.$color-success-500}, #{colors.$color-success-700});
|
|
26
|
+
--sc-color--border-input: light-dark(#{colors.$color-neutral-300}, #{colors.$color-dark-800});
|
|
27
|
+
--sc-color--border-input-dark: light-dark(#{colors.$color-neutral-300}, #{colors.$color-neutral-500});
|
|
28
|
+
--sc-color--border-light: light-dark(#{colors.$color-neutral-100}, #{colors.$color-neutral-300});
|
|
29
|
+
--sc-color--border-primary: light-dark(#{colors.$color-neutral-100}, #{colors.$color-dark-800});
|
|
30
|
+
--sc-color--border-secondary: light-dark(#{colors.$color-neutral-100}, #{colors.$color-dark-100});
|
|
31
|
+
--sc-color--border-white: light-dark(#{colors.$color-white}, #{colors.$color-dark-900});
|
|
32
|
+
|
|
33
|
+
/* Buttons */
|
|
34
|
+
--sc-color--button-blue: light-dark(#{colors.$color-primary-500}, #{colors.$color-primary-800});
|
|
35
|
+
--sc-color--button-blue-bg: light-dark(#{colors.$color-primary-50}, #{colors.$color-dark-300});
|
|
36
|
+
--sc-color--button-green: light-dark(#{colors.$color-success-500}, #{colors.$color-success-700});
|
|
37
|
+
--sc-color--button-green-bg: light-dark(#{colors.$color-success-50}, #{colors.$color-success-900});
|
|
38
|
+
--sc-color--button-red: light-dark(#{colors.$color-destructive-500}, #{colors.$color-destructive-700});
|
|
39
|
+
|
|
40
|
+
/* Badges */
|
|
41
|
+
--sc-color--badge-blue: light-dark(#{colors.$color-primary-500}, #{colors.$color-primary-400});
|
|
42
|
+
--sc-color--badge-blue-bg: light-dark(#{colors.$color-primary-50}, #{colors.$color-primary-900});
|
|
43
|
+
--sc-color--badge-green: light-dark(#{colors.$color-success-500}, #{colors.$color-success-400});
|
|
44
|
+
--sc-color--badge-green-bg: light-dark(#{colors.$color-success-50}, #{colors.$color-success-900});
|
|
45
|
+
--sc-color--badge-red: light-dark(#{colors.$color-destructive-500}, #{colors.$color-destructive-400});
|
|
46
|
+
--sc-color--badge-red-bg: light-dark(#{colors.$color-destructive-50}, #{colors.$color-destructive-900});
|
|
47
|
+
--sc-color--badge-gray: light-dark(#{colors.$color-neutral-500}, #{colors.$color-neutral-400});
|
|
48
|
+
--sc-color--badge-gray-bg: light-dark(#{colors.$color-neutral-50}, #{colors.$color-neutral-900});
|
|
49
|
+
|
|
50
|
+
/* Icons */
|
|
51
|
+
--sc-color--icon-brand: light-dark(#{colors.$color-primary-500}, #{colors.$color-white});
|
|
52
|
+
--sc-color--icon-menu: light-dark(#{colors.$color-neutral-800}, #{colors.$color-white});
|
|
53
|
+
--sc-color--icon-overlay: #{colors.$color-white};
|
|
54
|
+
--sc-color--icon-primary: light-dark(#{colors.$color-black}, #{colors.$color-white});
|
|
55
|
+
--sc-color--icon-secondary: #{colors.$color-neutral-400};
|
|
56
|
+
--sc-color--icon-warning: light-dark(#{colors.$color-destructive-500}, #{colors.$color-destructive-600});
|
|
57
|
+
|
|
58
|
+
/* Text */
|
|
59
|
+
--sc-color--text-brand: light-dark(#{colors.$color-primary-500}, #{colors.$color-primary-400});
|
|
60
|
+
--sc-color--text-error: light-dark(#{colors.$color-destructive-500}, #{colors.$color-destructive-600});
|
|
61
|
+
--sc-color--text-inverted: #{colors.$color-white};
|
|
62
|
+
--sc-color--text-paragraph: #{colors.$color-neutral-400};
|
|
63
|
+
--sc-color--text-primary: light-dark(#{colors.$color-black}, #{colors.$color-white});
|
|
64
|
+
--sc-color--text-secondary: #{colors.$color-neutral-400};
|
|
65
|
+
|
|
66
|
+
/* Shadows */
|
|
67
|
+
--sc-color--box-shadow: light-dark(#2f2b431a, #ffffff1a);
|
|
68
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<script lang="ts">import { default as ButtonBase } from './resources/button-base.svelte';
|
|
2
|
+
import { default as ButtonTheme } from './resources/button-theme.svelte';
|
|
3
|
+
let { type = 'button', disabled = false, autofocus = false, variant = null, size = null, on, children } = $props();
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<ButtonTheme variant={variant} size={size}>
|
|
7
|
+
<ButtonBase disabled={disabled} type={type} autofocus={autofocus} on={on}>
|
|
8
|
+
{@render children()}
|
|
9
|
+
</ButtonBase>
|
|
10
|
+
</ButtonTheme>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ButtonSize, ButtonVariant } from './resources/types';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
type Props = {
|
|
4
|
+
type?: 'button' | 'submit' | 'reset';
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
autofocus?: boolean;
|
|
7
|
+
variant?: ButtonVariant | null;
|
|
8
|
+
size?: ButtonSize | null;
|
|
9
|
+
on?: {
|
|
10
|
+
click?: (e: MouseEvent) => void;
|
|
11
|
+
};
|
|
12
|
+
children: Snippet;
|
|
13
|
+
};
|
|
14
|
+
declare const Cmp: import("svelte").Component<Props, {}, "">;
|
|
15
|
+
type Cmp = ReturnType<typeof Cmp>;
|
|
16
|
+
export default Cmp;
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
<script lang="ts">import { Icon } from '../icon';
|
|
2
|
+
import { default as ButtonBase } from './resources/button-base.svelte';
|
|
3
|
+
import { default as ButtonTheme } from './resources/button-theme.svelte';
|
|
4
|
+
import IconChevronDown from '@fluentui/svg-icons/icons/chevron_down_20_regular.svg?raw';
|
|
5
|
+
import { createPopper } from '@popperjs/core';
|
|
6
|
+
let { type = 'button', disabled = false, autofocus = false, variant = null, size = null, optionsPosition = 'bottom-start', optionsOffset = 4, on, children, options, rightOptions } = $props();
|
|
7
|
+
let leftOpened = $state(false);
|
|
8
|
+
let rightOpened = $state(false);
|
|
9
|
+
let leftTriggerRef = $state(null);
|
|
10
|
+
let rightTriggerRef = $state(null);
|
|
11
|
+
const initPopper = (node, triggerEl) => {
|
|
12
|
+
const popper = createPopper(triggerEl, node, {
|
|
13
|
+
placement: optionsPosition,
|
|
14
|
+
modifiers: [
|
|
15
|
+
{
|
|
16
|
+
name: 'offset',
|
|
17
|
+
options: { offset: [0, optionsOffset] }
|
|
18
|
+
},
|
|
19
|
+
{ name: 'flip' },
|
|
20
|
+
{
|
|
21
|
+
name: 'preventOverflow',
|
|
22
|
+
options: { boundary: document.body, padding: 8 }
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
});
|
|
26
|
+
return {
|
|
27
|
+
destroy() {
|
|
28
|
+
popper.destroy();
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
const close = () => {
|
|
33
|
+
leftOpened = false;
|
|
34
|
+
rightOpened = false;
|
|
35
|
+
};
|
|
36
|
+
$effect(() => {
|
|
37
|
+
if (leftOpened || rightOpened) {
|
|
38
|
+
window.addEventListener(/*@wc-ignore*/ 'click', close);
|
|
39
|
+
return () => {
|
|
40
|
+
window.removeEventListener(/*@wc-ignore*/ 'click', close);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
const toggleLeft = (e) => {
|
|
45
|
+
e.stopPropagation();
|
|
46
|
+
if (disabled) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
rightOpened = false;
|
|
50
|
+
leftOpened = !leftOpened;
|
|
51
|
+
};
|
|
52
|
+
const toggleRight = (e) => {
|
|
53
|
+
e.stopPropagation();
|
|
54
|
+
if (disabled) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
leftOpened = false;
|
|
58
|
+
rightOpened = !rightOpened;
|
|
59
|
+
};
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<ButtonTheme variant={variant} size={size}>
|
|
63
|
+
<div class="options-button" class:options-button--disabled={disabled}>
|
|
64
|
+
{#if options}
|
|
65
|
+
<div class="options-button__options">
|
|
66
|
+
<button
|
|
67
|
+
class="options-button__options-trigger"
|
|
68
|
+
type="button"
|
|
69
|
+
disabled={disabled}
|
|
70
|
+
aria-label="Options"
|
|
71
|
+
aria-expanded={leftOpened}
|
|
72
|
+
bind:this={leftTriggerRef}
|
|
73
|
+
onclick={toggleLeft}>
|
|
74
|
+
<span class="options-button__options-trigger-icon"><Icon src={IconChevronDown} /></span>
|
|
75
|
+
</button>
|
|
76
|
+
{#if leftOpened && leftTriggerRef}
|
|
77
|
+
<div class="options-button__dropdown" use:initPopper={leftTriggerRef} role="menu" tabindex="-1">
|
|
78
|
+
{@render options()}
|
|
79
|
+
</div>
|
|
80
|
+
{/if}
|
|
81
|
+
</div>
|
|
82
|
+
<span class="options-button__options-separator">‍</span>
|
|
83
|
+
{/if}
|
|
84
|
+
|
|
85
|
+
<div class="options-button__trigger">
|
|
86
|
+
<ButtonBase type={type} disabled={disabled} autofocus={autofocus} on={on}>
|
|
87
|
+
{@render children()}
|
|
88
|
+
</ButtonBase>
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
{#if rightOptions}
|
|
92
|
+
<span class="options-button__options-separator">‍</span>
|
|
93
|
+
<div class="options-button__options">
|
|
94
|
+
<button
|
|
95
|
+
class="options-button__options-trigger"
|
|
96
|
+
type="button"
|
|
97
|
+
disabled={disabled}
|
|
98
|
+
aria-label="Options"
|
|
99
|
+
aria-expanded={rightOpened}
|
|
100
|
+
bind:this={rightTriggerRef}
|
|
101
|
+
onclick={toggleRight}>
|
|
102
|
+
<span class="options-button__options-trigger-icon"><Icon src={IconChevronDown} /></span>
|
|
103
|
+
</button>
|
|
104
|
+
{#if rightOpened && rightTriggerRef}
|
|
105
|
+
<div class="options-button__dropdown" use:initPopper={rightTriggerRef} role="menu" tabindex="-1">
|
|
106
|
+
{@render rightOptions()}
|
|
107
|
+
</div>
|
|
108
|
+
{/if}
|
|
109
|
+
</div>
|
|
110
|
+
{/if}
|
|
111
|
+
</div>
|
|
112
|
+
</ButtonTheme>
|
|
113
|
+
|
|
114
|
+
<style>.options-button {
|
|
115
|
+
--_options-button--font--color: var(--button--font--color, black);
|
|
116
|
+
--_options-button--font-weight: var(--button--font-weight, 400);
|
|
117
|
+
--_options-button--text--font-size: var(--button--text--font-size, 0.875em);
|
|
118
|
+
--_options-button--background: var(--button--background, white);
|
|
119
|
+
--_options-button--background--hover: var(--button--background--hover, var(--_options-button--background));
|
|
120
|
+
--_options-button--background--active: var(--button--background--active, var(--_options-button--background));
|
|
121
|
+
--_options-button--background--disabled: var(--button--background--disabled, var(--_options-button--background));
|
|
122
|
+
--_options-button--border: var(--button--border, none);
|
|
123
|
+
--_options-button--border-radius: var(--button--border-radius, 0.25em);
|
|
124
|
+
--_options-button--box-shadow: var(--button--box-shadow, none);
|
|
125
|
+
--_options-button--padding--vertical: var(--button--padding--vertical, 0);
|
|
126
|
+
--_options-button--min-width: var(--button--min-width, 0);
|
|
127
|
+
--_options-button--height: var(--button--height, 2em);
|
|
128
|
+
--_options-button--separator--border: 1px solid var(--_options-button--font--color);
|
|
129
|
+
--_options-button--dropdown--min-width: var(--options-button--dropdown--min-width, 10em);
|
|
130
|
+
font-weight: var(--_options-button--font-weight);
|
|
131
|
+
color: var(--_options-button--font--color);
|
|
132
|
+
background: var(--_options-button--background);
|
|
133
|
+
border: var(--_options-button--border);
|
|
134
|
+
border-radius: var(--_options-button--border-radius);
|
|
135
|
+
min-width: var(--_options-button--min-width);
|
|
136
|
+
height: var(--_options-button--height);
|
|
137
|
+
display: inline-flex;
|
|
138
|
+
align-items: center;
|
|
139
|
+
vertical-align: middle;
|
|
140
|
+
white-space: nowrap;
|
|
141
|
+
box-shadow: var(--_options-button--box-shadow);
|
|
142
|
+
}
|
|
143
|
+
.options-button--disabled {
|
|
144
|
+
background: var(--_options-button--background--disabled);
|
|
145
|
+
}
|
|
146
|
+
.options-button:not(.options-button--disabled):hover {
|
|
147
|
+
background: var(--_options-button--background--hover);
|
|
148
|
+
}
|
|
149
|
+
.options-button:not(.options-button--disabled):active {
|
|
150
|
+
background: var(--_options-button--background--active);
|
|
151
|
+
}
|
|
152
|
+
.options-button__trigger {
|
|
153
|
+
display: inline-flex;
|
|
154
|
+
height: 100%;
|
|
155
|
+
flex: 1;
|
|
156
|
+
--button--min-width: 100%;
|
|
157
|
+
--button--box-shadow: none;
|
|
158
|
+
--button--border: none;
|
|
159
|
+
--button--border--disabled: none;
|
|
160
|
+
--button--height: 100%;
|
|
161
|
+
--button--background: transparent;
|
|
162
|
+
--button--background--hover: transparent;
|
|
163
|
+
--button--background--active: transparent;
|
|
164
|
+
--button--background--disabled: transparent;
|
|
165
|
+
}
|
|
166
|
+
.options-button__options {
|
|
167
|
+
position: relative;
|
|
168
|
+
height: 100%;
|
|
169
|
+
--dropdown-item--min-width: var(--_options-button--dropdown--min-width);
|
|
170
|
+
--button--min-width: 100%;
|
|
171
|
+
--button--justify-content: flex-start;
|
|
172
|
+
}
|
|
173
|
+
.options-button__options-trigger {
|
|
174
|
+
height: 100%;
|
|
175
|
+
font-size: var(--_options-button--text--font-size);
|
|
176
|
+
border-radius: var(--_options-button--border-radius);
|
|
177
|
+
padding: var(--_options-button--padding--vertical) 0.5em;
|
|
178
|
+
color: inherit;
|
|
179
|
+
background: transparent;
|
|
180
|
+
border: none;
|
|
181
|
+
cursor: pointer;
|
|
182
|
+
}
|
|
183
|
+
.options-button__options-trigger:disabled {
|
|
184
|
+
cursor: default;
|
|
185
|
+
}
|
|
186
|
+
.options-button__options-trigger-icon {
|
|
187
|
+
display: inline-flex;
|
|
188
|
+
align-items: center;
|
|
189
|
+
--icon--size: var(--_options-button--text--font-size);
|
|
190
|
+
}
|
|
191
|
+
.options-button__options-separator {
|
|
192
|
+
border-right: var(--_options-button--separator--border);
|
|
193
|
+
height: var(--_options-button--text--font-size);
|
|
194
|
+
}
|
|
195
|
+
.options-button__dropdown {
|
|
196
|
+
position: absolute;
|
|
197
|
+
z-index: 999;
|
|
198
|
+
min-width: var(--_options-button--dropdown--min-width);
|
|
199
|
+
background: light-dark(#ffffff, #000000);
|
|
200
|
+
box-shadow: 0 2px 10px light-dark(#d9d9d9, hsl(0, 0%, 50%));
|
|
201
|
+
border-radius: 0.25em;
|
|
202
|
+
}</style>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ButtonSize, ButtonVariant } from './resources/types';
|
|
2
|
+
import { type Placement } from '@popperjs/core';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
type Props = {
|
|
5
|
+
type?: 'button' | 'submit' | 'reset';
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
autofocus?: boolean;
|
|
8
|
+
variant?: ButtonVariant | null;
|
|
9
|
+
size?: ButtonSize | null;
|
|
10
|
+
optionsPosition?: Placement;
|
|
11
|
+
optionsOffset?: number;
|
|
12
|
+
on?: {
|
|
13
|
+
click?: (e: MouseEvent) => void;
|
|
14
|
+
};
|
|
15
|
+
children: Snippet;
|
|
16
|
+
options?: Snippet;
|
|
17
|
+
rightOptions?: Snippet;
|
|
18
|
+
};
|
|
19
|
+
declare const Cmp: import("svelte").Component<Props, {}, "">;
|
|
20
|
+
type Cmp = ReturnType<typeof Cmp>;
|
|
21
|
+
export default Cmp;
|