@scalewing/react 0.7.0 → 1.1.0
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/CHANGELOG.md +33 -0
- package/README.md +12 -2
- package/dist/components/Badge.d.ts +2 -1
- package/dist/components/Badge.js +2 -1
- package/dist/components/Box.d.ts +3 -2
- package/dist/components/Box.js +3 -2
- package/dist/components/Button.js +1 -1
- package/dist/components/DenominationGrid.d.ts +3 -0
- package/dist/components/DenominationGrid.js +12 -0
- package/dist/components/FilterChips.d.ts +1 -0
- package/dist/components/FilterChips.js +9 -3
- package/dist/components/Grid.d.ts +11 -0
- package/dist/components/Grid.js +21 -0
- package/dist/components/Inline.js +1 -1
- package/dist/components/Stack.js +1 -1
- package/dist/components/Text.d.ts +3 -0
- package/dist/components/Text.js +2 -2
- package/dist/components/denomination-grid/DenominationStrip.d.ts +4 -0
- package/dist/components/denomination-grid/DenominationStrip.js +10 -0
- package/dist/components/denomination-grid/DenominationTiles.d.ts +4 -0
- package/dist/components/denomination-grid/DenominationTiles.js +13 -0
- package/dist/components/denomination-grid/types.d.ts +25 -0
- package/dist/components/denomination-grid/types.js +1 -0
- package/dist/components/denomination-grid/validate.d.ts +2 -0
- package/dist/components/denomination-grid/validate.js +18 -0
- package/dist/css/breakpoints.d.ts +8 -0
- package/dist/css/breakpoints.js +11 -0
- package/dist/css/css-accordion.d.ts +2 -0
- package/dist/css/css-accordion.js +33 -0
- package/dist/css/css-action-menu.d.ts +2 -0
- package/dist/css/css-action-menu.js +95 -0
- package/dist/css/css-button.d.ts +7 -0
- package/dist/css/css-button.js +68 -0
- package/dist/css/css-chart.d.ts +2 -0
- package/dist/css/css-chart.js +98 -0
- package/dist/css/css-checkbox.d.ts +2 -0
- package/dist/css/css-checkbox.js +127 -0
- package/dist/css/css-chrome.d.ts +2 -0
- package/dist/css/css-chrome.js +59 -0
- package/dist/css/css-components.d.ts +1 -0
- package/dist/css/css-components.js +148 -0
- package/dist/css/css-data.d.ts +7 -0
- package/dist/css/css-data.js +189 -0
- package/dist/css/css-date-field.d.ts +2 -0
- package/dist/css/css-date-field.js +77 -0
- package/dist/css/css-denomination-grid.d.ts +2 -0
- package/dist/css/css-denomination-grid.js +213 -0
- package/dist/css/css-dialog.d.ts +2 -0
- package/dist/css/css-dialog.js +29 -0
- package/dist/css/css-document.d.ts +1 -0
- package/dist/css/css-document.js +102 -0
- package/dist/css/css-field.d.ts +2 -0
- package/dist/css/css-field.js +33 -0
- package/dist/css/css-filter-chips.d.ts +2 -0
- package/dist/css/css-filter-chips.js +116 -0
- package/dist/css/css-grid.d.ts +7 -0
- package/dist/css/css-grid.js +31 -0
- package/dist/css/css-palettes.d.ts +4 -0
- package/dist/css/css-palettes.js +52 -0
- package/dist/css/css-progress.d.ts +2 -0
- package/dist/css/css-progress.js +77 -0
- package/dist/css/css-radio-group.d.ts +2 -0
- package/dist/css/css-radio-group.js +148 -0
- package/dist/css/css-responsive.d.ts +2 -0
- package/dist/css/css-responsive.js +12 -0
- package/dist/css/css-select.d.ts +2 -0
- package/dist/css/css-select.js +134 -0
- package/dist/css/css-separator.d.ts +2 -0
- package/dist/css/css-separator.js +26 -0
- package/dist/css/css-spinner.d.ts +2 -0
- package/dist/css/css-spinner.js +45 -0
- package/dist/css/css-split.d.ts +2 -0
- package/dist/css/css-split.js +67 -0
- package/dist/css/css-switch.d.ts +2 -0
- package/dist/css/css-switch.js +115 -0
- package/dist/css/css-toast.d.ts +2 -0
- package/dist/css/css-toast.js +92 -0
- package/dist/css/css-tooltip.d.ts +2 -0
- package/dist/css/css-tooltip.js +35 -0
- package/dist/css/css-utilities.d.ts +1 -0
- package/dist/css/css-utilities.js +57 -0
- package/dist/css/css-variables.d.ts +2 -0
- package/dist/css/css-variables.js +61 -0
- package/dist/css/spacing-classes.d.ts +10 -0
- package/dist/css/spacing-classes.js +40 -0
- package/dist/css/stylesheet.d.ts +3 -0
- package/dist/css/stylesheet.js +82 -0
- package/dist/denomination-cells.d.ts +12 -0
- package/dist/denomination-cells.js +15 -0
- package/dist/index.d.ts +8 -2
- package/dist/index.js +5 -2
- package/dist/spacing-classes.js +1 -1
- package/dist/styles.css +231 -0
- package/dist/visibility-classes.d.ts +6 -0
- package/dist/visibility-classes.js +7 -0
- package/package.json +3 -3
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { typographyVariants } from '@scalewing/tokens';
|
|
2
|
+
const body = typographyVariants.body;
|
|
3
|
+
const label = typographyVariants.label;
|
|
4
|
+
const caption = typographyVariants.caption;
|
|
5
|
+
export function cssDateFieldClasses() {
|
|
6
|
+
return `.sw-date-field {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
gap: var(--sw-space-1);
|
|
10
|
+
max-width: 100%;
|
|
11
|
+
min-width: 0;
|
|
12
|
+
width: max-content;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.sw-date-field-label {
|
|
16
|
+
color: var(--sw-color-text);
|
|
17
|
+
font-family: var(--sw-font-sans);
|
|
18
|
+
font-size: ${label.fontSize}px;
|
|
19
|
+
font-weight: ${label.fontWeight};
|
|
20
|
+
line-height: ${label.lineHeight}px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.sw-date-field-input {
|
|
24
|
+
background: var(--sw-glass-fill);
|
|
25
|
+
border: 1px solid var(--sw-color-border);
|
|
26
|
+
border-radius: var(--sw-radius-sm);
|
|
27
|
+
box-sizing: border-box;
|
|
28
|
+
color: var(--sw-color-text);
|
|
29
|
+
font-family: var(--sw-font-sans);
|
|
30
|
+
font-size: ${body.fontSize}px;
|
|
31
|
+
min-height: var(--sw-control-md-min-height);
|
|
32
|
+
min-width: 0;
|
|
33
|
+
padding-inline: var(--sw-control-md-padding-inline);
|
|
34
|
+
width: 100%;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.sw-date-field-input:focus-visible {
|
|
38
|
+
outline: var(--sw-focus-ring-width) solid var(--sw-color-accent);
|
|
39
|
+
outline-offset: var(--sw-focus-ring-offset);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.sw-date-field-input[aria-invalid='true'] {
|
|
43
|
+
border-color: var(--sw-color-danger);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.sw-date-field-input:disabled {
|
|
47
|
+
cursor: not-allowed;
|
|
48
|
+
opacity: var(--sw-disabled-opacity);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.sw-date-field-description,
|
|
52
|
+
.sw-date-field-error {
|
|
53
|
+
font-family: var(--sw-font-sans);
|
|
54
|
+
font-size: ${caption.fontSize}px;
|
|
55
|
+
line-height: ${caption.lineHeight}px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.sw-date-field-description { color: var(--sw-color-muted); }
|
|
59
|
+
.sw-date-field-error { color: var(--sw-color-danger); }
|
|
60
|
+
|
|
61
|
+
@media (prefers-reduced-transparency: reduce) {
|
|
62
|
+
.sw-date-field-input { background: var(--sw-color-surface); }
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@media (forced-colors: active) {
|
|
66
|
+
.sw-date-field-input[aria-invalid='true'] { border-color: CanvasText; }
|
|
67
|
+
}`;
|
|
68
|
+
}
|
|
69
|
+
export function dateFieldClassCatalog() {
|
|
70
|
+
return [
|
|
71
|
+
'sw-date-field',
|
|
72
|
+
'sw-date-field-label',
|
|
73
|
+
'sw-date-field-input',
|
|
74
|
+
'sw-date-field-description',
|
|
75
|
+
'sw-date-field-error',
|
|
76
|
+
];
|
|
77
|
+
}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { typographyVariants } from '@scalewing/tokens';
|
|
2
|
+
import { breakpointQuery } from './breakpoints.js';
|
|
3
|
+
import { badgeTones } from './css-data.js';
|
|
4
|
+
const caption = typographyVariants.caption;
|
|
5
|
+
const data = typographyVariants.data;
|
|
6
|
+
const label = typographyVariants.label;
|
|
7
|
+
const title = typographyVariants.title;
|
|
8
|
+
function toneRules() {
|
|
9
|
+
return badgeTones
|
|
10
|
+
.map((tone) => `.sw-denomination-row-${tone} { --sw-denomination-tone: var(--sw-color-${tone === 'neutral' ? 'muted' : tone}); }`)
|
|
11
|
+
.join('\n');
|
|
12
|
+
}
|
|
13
|
+
export function cssDenominationGridClasses() {
|
|
14
|
+
return `.sw-denomination-grid {
|
|
15
|
+
color: var(--sw-color-text);
|
|
16
|
+
font-family: var(--sw-font-sans);
|
|
17
|
+
max-width: 100%;
|
|
18
|
+
min-width: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
${toneRules()}
|
|
22
|
+
|
|
23
|
+
.sw-denomination-strip {
|
|
24
|
+
border-collapse: collapse;
|
|
25
|
+
width: 100%;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.sw-denomination-strip th,
|
|
29
|
+
.sw-denomination-strip td {
|
|
30
|
+
padding: var(--sw-space-1) var(--sw-space-2);
|
|
31
|
+
vertical-align: middle;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.sw-denomination-strip tbody tr {
|
|
35
|
+
border-top: 1px solid var(--sw-color-border);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.sw-denomination-head {
|
|
39
|
+
color: var(--sw-color-muted);
|
|
40
|
+
font-size: ${caption.fontSize}px;
|
|
41
|
+
font-weight: 600;
|
|
42
|
+
letter-spacing: ${caption.letterSpacing}px;
|
|
43
|
+
line-height: ${caption.lineHeight}px;
|
|
44
|
+
text-align: end;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.sw-denomination-corner {
|
|
48
|
+
padding: 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.sw-denomination-label {
|
|
52
|
+
align-items: center;
|
|
53
|
+
border-inline-start: var(--sw-space-1) solid var(--sw-denomination-tone);
|
|
54
|
+
color: var(--sw-denomination-tone);
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-wrap: wrap;
|
|
57
|
+
font-size: ${label.fontSize}px;
|
|
58
|
+
font-weight: ${label.fontWeight};
|
|
59
|
+
gap: var(--sw-space-2);
|
|
60
|
+
letter-spacing: ${label.letterSpacing}px;
|
|
61
|
+
line-height: ${label.lineHeight}px;
|
|
62
|
+
min-width: 0;
|
|
63
|
+
text-align: start;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.sw-denomination-icon {
|
|
67
|
+
display: inline-flex;
|
|
68
|
+
flex: none;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.sw-denomination-cell {
|
|
72
|
+
color: var(--sw-color-text);
|
|
73
|
+
font-size: ${data.fontSize}px;
|
|
74
|
+
font-variant-numeric: tabular-nums;
|
|
75
|
+
font-weight: 600;
|
|
76
|
+
letter-spacing: ${data.letterSpacing}px;
|
|
77
|
+
line-height: ${data.lineHeight}px;
|
|
78
|
+
text-align: end;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.sw-denomination-cell-zero {
|
|
82
|
+
color: var(--sw-color-muted);
|
|
83
|
+
font-weight: ${data.fontWeight};
|
|
84
|
+
opacity: var(--sw-quiet-opacity);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.sw-denomination-row-signed .sw-denomination-cell-positive {
|
|
88
|
+
color: var(--sw-color-success);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.sw-denomination-cell-negative {
|
|
92
|
+
color: var(--sw-color-danger);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.sw-denomination-total {
|
|
96
|
+
color: var(--sw-denomination-tone);
|
|
97
|
+
font-size: ${data.fontSize}px;
|
|
98
|
+
font-variant-numeric: tabular-nums;
|
|
99
|
+
font-weight: 600;
|
|
100
|
+
letter-spacing: ${data.letterSpacing}px;
|
|
101
|
+
line-height: ${data.lineHeight}px;
|
|
102
|
+
text-align: end;
|
|
103
|
+
white-space: nowrap;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.sw-denomination-total-inline {
|
|
107
|
+
display: none;
|
|
108
|
+
flex-basis: 100%;
|
|
109
|
+
font-size: ${caption.fontSize}px;
|
|
110
|
+
font-variant-numeric: tabular-nums;
|
|
111
|
+
font-weight: 600;
|
|
112
|
+
line-height: ${caption.lineHeight}px;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.sw-denomination-tiles {
|
|
116
|
+
display: flex;
|
|
117
|
+
flex-direction: column;
|
|
118
|
+
gap: var(--sw-space-3);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.sw-denomination-tiles .sw-denomination-label {
|
|
122
|
+
border-inline-start: 0;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.sw-denomination-tiles .sw-denomination-row {
|
|
126
|
+
display: flex;
|
|
127
|
+
flex-direction: column;
|
|
128
|
+
gap: var(--sw-space-2);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.sw-denomination-tile-list {
|
|
132
|
+
display: grid;
|
|
133
|
+
gap: var(--sw-space-2);
|
|
134
|
+
grid-template-columns: repeat(auto-fit, minmax(var(--sw-space-8), 1fr));
|
|
135
|
+
list-style: none;
|
|
136
|
+
margin: 0;
|
|
137
|
+
padding: 0;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.sw-denomination-tile {
|
|
141
|
+
align-items: center;
|
|
142
|
+
background: var(--sw-color-surface);
|
|
143
|
+
border: 1px solid var(--sw-color-border);
|
|
144
|
+
border-radius: var(--sw-radius-md);
|
|
145
|
+
display: flex;
|
|
146
|
+
flex-direction: column;
|
|
147
|
+
gap: var(--sw-space-1);
|
|
148
|
+
min-width: 0;
|
|
149
|
+
padding: var(--sw-space-3) var(--sw-space-2);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.sw-denomination-tile .sw-denomination-head,
|
|
153
|
+
.sw-denomination-tile .sw-denomination-cell {
|
|
154
|
+
text-align: center;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.sw-denomination-tile .sw-denomination-cell {
|
|
158
|
+
font-size: ${title.fontSize}px;
|
|
159
|
+
letter-spacing: ${title.letterSpacing}px;
|
|
160
|
+
line-height: ${title.lineHeight}px;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.sw-denomination-subtotal {
|
|
164
|
+
color: var(--sw-color-muted);
|
|
165
|
+
font-size: ${caption.fontSize}px;
|
|
166
|
+
font-variant-numeric: tabular-nums;
|
|
167
|
+
letter-spacing: ${caption.letterSpacing}px;
|
|
168
|
+
line-height: ${caption.lineHeight}px;
|
|
169
|
+
text-align: center;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
@media ${breakpointQuery('below', 'md')} {
|
|
173
|
+
.sw-denomination-strip .sw-denomination-total { display: none; }
|
|
174
|
+
.sw-denomination-total-inline { display: block; }
|
|
175
|
+
.sw-denomination-strip .sw-denomination-label { flex-direction: column; align-items: flex-start; gap: var(--sw-space-1); }
|
|
176
|
+
.sw-denomination-strip th,
|
|
177
|
+
.sw-denomination-strip td { padding: var(--sw-space-1); }
|
|
178
|
+
.sw-denomination-tile-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
@media (forced-colors: active) {
|
|
182
|
+
.sw-denomination-label { border-inline-start-color: CanvasText; color: CanvasText; }
|
|
183
|
+
.sw-denomination-cell-zero { color: GrayText; opacity: 1; }
|
|
184
|
+
.sw-denomination-cell-negative,
|
|
185
|
+
.sw-denomination-row-signed .sw-denomination-cell-positive,
|
|
186
|
+
.sw-denomination-total { color: CanvasText; }
|
|
187
|
+
.sw-denomination-tile { border-color: CanvasText; }
|
|
188
|
+
}`;
|
|
189
|
+
}
|
|
190
|
+
export function denominationGridClassCatalog() {
|
|
191
|
+
return [
|
|
192
|
+
'sw-denomination-grid',
|
|
193
|
+
...badgeTones.map((tone) => `sw-denomination-row-${tone}`),
|
|
194
|
+
'sw-denomination-strip',
|
|
195
|
+
'sw-denomination-head',
|
|
196
|
+
'sw-denomination-corner',
|
|
197
|
+
'sw-denomination-row',
|
|
198
|
+
'sw-denomination-row-signed',
|
|
199
|
+
'sw-denomination-label',
|
|
200
|
+
'sw-denomination-label-text',
|
|
201
|
+
'sw-denomination-icon',
|
|
202
|
+
'sw-denomination-cell',
|
|
203
|
+
'sw-denomination-cell-zero',
|
|
204
|
+
'sw-denomination-cell-positive',
|
|
205
|
+
'sw-denomination-cell-negative',
|
|
206
|
+
'sw-denomination-total',
|
|
207
|
+
'sw-denomination-total-inline',
|
|
208
|
+
'sw-denomination-tiles',
|
|
209
|
+
'sw-denomination-tile-list',
|
|
210
|
+
'sw-denomination-tile',
|
|
211
|
+
'sw-denomination-subtotal',
|
|
212
|
+
];
|
|
213
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export function cssDialogClasses() {
|
|
2
|
+
return `.sw-dialog {
|
|
3
|
+
background: var(--sw-glass-fill);
|
|
4
|
+
border: 1px solid var(--sw-glass-border);
|
|
5
|
+
border-radius: var(--sw-radius-lg);
|
|
6
|
+
box-shadow: inset 0 1px 0 var(--sw-glass-specular);
|
|
7
|
+
backdrop-filter: blur(var(--sw-glass-blur)) saturate(var(--sw-glass-saturate));
|
|
8
|
+
-webkit-backdrop-filter: blur(var(--sw-glass-blur)) saturate(var(--sw-glass-saturate));
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
color: var(--sw-color-text);
|
|
11
|
+
margin: auto;
|
|
12
|
+
max-height: min(100vh - var(--sw-space-8), 100dvh - var(--sw-space-8));
|
|
13
|
+
max-width: min(var(--sw-dialog-max), calc(100vw - var(--sw-space-8)));
|
|
14
|
+
overflow: auto;
|
|
15
|
+
width: calc(100% - var(--sw-space-8));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.sw-dialog::backdrop {
|
|
19
|
+
background: color-mix(in srgb, var(--sw-color-text) 28%, transparent);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.sw-dialog:focus-visible {
|
|
23
|
+
outline: var(--sw-focus-ring-width) solid var(--sw-color-accent);
|
|
24
|
+
outline-offset: var(--sw-focus-ring-offset);
|
|
25
|
+
}`;
|
|
26
|
+
}
|
|
27
|
+
export function dialogClassCatalog() {
|
|
28
|
+
return ['sw-dialog'];
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function cssDocumentCanvas(): string;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { typographyVariants } from '@scalewing/tokens';
|
|
2
|
+
const body = typographyVariants.body;
|
|
3
|
+
const typedInputs = [
|
|
4
|
+
"input[type='text']",
|
|
5
|
+
"input[type='email']",
|
|
6
|
+
"input[type='number']",
|
|
7
|
+
"input[type='search']",
|
|
8
|
+
"input[type='url']",
|
|
9
|
+
"input[type='password']",
|
|
10
|
+
'input:not([type])',
|
|
11
|
+
'textarea',
|
|
12
|
+
].join(', ');
|
|
13
|
+
const controlSurface = `background-color: var(--sw-glass-fill);
|
|
14
|
+
border: 1px solid var(--sw-color-border);
|
|
15
|
+
border-radius: var(--sw-radius-sm);
|
|
16
|
+
color: inherit;
|
|
17
|
+
font-family: inherit;
|
|
18
|
+
font-size: inherit;
|
|
19
|
+
padding-inline: var(--sw-control-md-padding-inline);`;
|
|
20
|
+
export function cssDocumentCanvas() {
|
|
21
|
+
return `html,
|
|
22
|
+
body {
|
|
23
|
+
margin: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
[data-theme] {
|
|
27
|
+
background-color: var(--sw-color-background);
|
|
28
|
+
color: var(--sw-color-text);
|
|
29
|
+
font-family: var(--sw-font-sans);
|
|
30
|
+
font-size: ${body.fontSize}px;
|
|
31
|
+
letter-spacing: ${body.letterSpacing}px;
|
|
32
|
+
line-height: ${body.lineHeight}px;
|
|
33
|
+
min-height: 100vh;
|
|
34
|
+
min-height: 100dvh;
|
|
35
|
+
-webkit-font-smoothing: antialiased;
|
|
36
|
+
-moz-osx-font-smoothing: grayscale;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
[data-theme] [data-theme] {
|
|
40
|
+
min-height: 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
[data-theme='light'] {
|
|
44
|
+
color-scheme: light;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
[data-theme='dark'] {
|
|
48
|
+
color-scheme: dark;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
[data-theme] a {
|
|
52
|
+
color: var(--sw-color-accent);
|
|
53
|
+
text-decoration: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
[data-theme] a:hover {
|
|
57
|
+
color: var(--sw-color-text);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
[data-theme] a:focus-visible {
|
|
61
|
+
outline: var(--sw-focus-ring-width) solid var(--sw-color-accent);
|
|
62
|
+
outline-offset: var(--sw-focus-ring-offset);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
[data-theme] :is(${typedInputs}) {
|
|
66
|
+
${controlSurface}
|
|
67
|
+
box-sizing: border-box;
|
|
68
|
+
min-height: var(--sw-control-md-min-height);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
[data-theme] select {
|
|
72
|
+
${controlSurface}
|
|
73
|
+
appearance: none;
|
|
74
|
+
background-image:
|
|
75
|
+
linear-gradient(45deg, transparent 50%, var(--sw-color-muted) 50%),
|
|
76
|
+
linear-gradient(135deg, var(--sw-color-muted) 50%, transparent 50%);
|
|
77
|
+
background-position:
|
|
78
|
+
calc(100% - var(--sw-space-4)) calc(50% - 1px),
|
|
79
|
+
calc(100% - calc(var(--sw-space-4) - var(--sw-space-1))) calc(50% - 1px);
|
|
80
|
+
background-repeat: no-repeat;
|
|
81
|
+
background-size: var(--sw-space-1) var(--sw-space-1),
|
|
82
|
+
var(--sw-space-1) var(--sw-space-1);
|
|
83
|
+
box-sizing: content-box;
|
|
84
|
+
height: calc(var(--sw-control-md-min-height) - 1px - 1px);
|
|
85
|
+
min-height: 0;
|
|
86
|
+
padding-inline-end: calc(
|
|
87
|
+
var(--sw-control-md-padding-inline) + var(--sw-space-5)
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
[data-theme] :is(${typedInputs}):focus,
|
|
92
|
+
[data-theme] select:focus {
|
|
93
|
+
box-shadow: none;
|
|
94
|
+
outline: none;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
[data-theme] :is(${typedInputs}):focus-visible,
|
|
98
|
+
[data-theme] select:focus-visible {
|
|
99
|
+
outline: var(--sw-focus-ring-width) solid var(--sw-color-accent);
|
|
100
|
+
outline-offset: var(--sw-focus-ring-offset);
|
|
101
|
+
}`;
|
|
102
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { typographyVariants } from '@scalewing/tokens';
|
|
2
|
+
const caption = typographyVariants.caption;
|
|
3
|
+
export function cssFieldClasses() {
|
|
4
|
+
return `.sw-field-required { color: var(--sw-color-danger); }
|
|
5
|
+
|
|
6
|
+
.sw-field-description,
|
|
7
|
+
.sw-field-error {
|
|
8
|
+
font-family: var(--sw-font-sans);
|
|
9
|
+
font-size: ${caption.fontSize}px;
|
|
10
|
+
line-height: ${caption.lineHeight}px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.sw-field-description { color: var(--sw-color-muted); }
|
|
14
|
+
.sw-field-error { color: var(--sw-color-danger); }
|
|
15
|
+
|
|
16
|
+
[data-theme] .sw-field-invalid :is(input, select, textarea) {
|
|
17
|
+
border-color: var(--sw-color-danger);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@media (forced-colors: active) {
|
|
21
|
+
[data-theme] .sw-field-invalid :is(input, select, textarea) { border-color: Mark; }
|
|
22
|
+
.sw-field-error, .sw-field-required { color: Mark; }
|
|
23
|
+
}`;
|
|
24
|
+
}
|
|
25
|
+
export function fieldClassCatalog() {
|
|
26
|
+
return [
|
|
27
|
+
'sw-field',
|
|
28
|
+
'sw-field-required',
|
|
29
|
+
'sw-field-description',
|
|
30
|
+
'sw-field-error',
|
|
31
|
+
'sw-field-invalid',
|
|
32
|
+
];
|
|
33
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { typographyVariants } from '@scalewing/tokens';
|
|
2
|
+
const label = typographyVariants.label;
|
|
3
|
+
const data = typographyVariants.data;
|
|
4
|
+
export function cssFilterChipsClasses() {
|
|
5
|
+
return `.sw-filter-chips {
|
|
6
|
+
border: 0;
|
|
7
|
+
margin: 0;
|
|
8
|
+
max-width: 100%;
|
|
9
|
+
min-width: 0;
|
|
10
|
+
padding: 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.sw-filter-chips-legend {
|
|
14
|
+
color: var(--sw-color-text);
|
|
15
|
+
font-family: var(--sw-font-sans);
|
|
16
|
+
font-size: ${label.fontSize}px;
|
|
17
|
+
font-weight: ${label.fontWeight};
|
|
18
|
+
line-height: ${label.lineHeight}px;
|
|
19
|
+
padding: 0 0 var(--sw-space-2);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.sw-filter-chips-options {
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-wrap: wrap;
|
|
25
|
+
gap: var(--sw-space-2);
|
|
26
|
+
min-width: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.sw-filter-chip {
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
display: inline-flex;
|
|
32
|
+
max-width: 100%;
|
|
33
|
+
position: relative;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.sw-filter-chip-input {
|
|
37
|
+
cursor: inherit;
|
|
38
|
+
height: 100%;
|
|
39
|
+
inset: 0;
|
|
40
|
+
margin: 0;
|
|
41
|
+
opacity: 0;
|
|
42
|
+
position: absolute;
|
|
43
|
+
width: 100%;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.sw-filter-chip-face {
|
|
47
|
+
align-items: center;
|
|
48
|
+
background: var(--sw-glass-fill);
|
|
49
|
+
border: 1px solid var(--sw-color-border);
|
|
50
|
+
border-radius: var(--sw-radius-pill);
|
|
51
|
+
color: var(--sw-color-text);
|
|
52
|
+
display: inline-flex;
|
|
53
|
+
font-family: var(--sw-font-sans);
|
|
54
|
+
font-size: ${label.fontSize}px;
|
|
55
|
+
gap: var(--sw-space-2);
|
|
56
|
+
line-height: ${label.lineHeight}px;
|
|
57
|
+
min-height: var(--sw-control-md-min-height);
|
|
58
|
+
min-width: 0;
|
|
59
|
+
overflow-wrap: anywhere;
|
|
60
|
+
padding: var(--sw-space-1) var(--sw-space-3);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.sw-filter-chip-count {
|
|
64
|
+
color: var(--sw-color-muted);
|
|
65
|
+
flex: none;
|
|
66
|
+
font-size: ${data.fontSize}px;
|
|
67
|
+
font-variant-numeric: tabular-nums;
|
|
68
|
+
font-weight: ${data.fontWeight};
|
|
69
|
+
letter-spacing: ${data.letterSpacing}px;
|
|
70
|
+
line-height: ${data.lineHeight}px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.sw-filter-chip-quiet:not(:has(.sw-filter-chip-input:checked)) .sw-filter-chip-face {
|
|
74
|
+
opacity: var(--sw-quiet-opacity);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.sw-filter-chip-input:checked + .sw-filter-chip-face {
|
|
78
|
+
background: var(--sw-color-accent);
|
|
79
|
+
border-color: var(--sw-color-accent);
|
|
80
|
+
color: var(--sw-color-onAccent);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.sw-filter-chip-input:checked + .sw-filter-chip-face .sw-filter-chip-count {
|
|
84
|
+
color: inherit;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.sw-filter-chip-input:focus-visible + .sw-filter-chip-face {
|
|
88
|
+
outline: var(--sw-focus-ring-width) solid var(--sw-color-accent);
|
|
89
|
+
outline-offset: var(--sw-focus-ring-offset);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.sw-filter-chip:has(.sw-filter-chip-input:disabled) {
|
|
93
|
+
cursor: not-allowed;
|
|
94
|
+
opacity: var(--sw-disabled-opacity);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@media (forced-colors: active) {
|
|
98
|
+
.sw-filter-chip-face { background: Canvas; border-color: CanvasText; color: CanvasText; }
|
|
99
|
+
.sw-filter-chip-input:checked + .sw-filter-chip-face { background: Highlight; border-color: Highlight; color: HighlightText; }
|
|
100
|
+
.sw-filter-chip-input:focus-visible + .sw-filter-chip-face { outline-color: Highlight; }
|
|
101
|
+
.sw-filter-chip-count { color: inherit; }
|
|
102
|
+
.sw-filter-chip-quiet:not(:has(.sw-filter-chip-input:checked)) .sw-filter-chip-face { opacity: 1; color: GrayText; border-color: GrayText; }
|
|
103
|
+
}`;
|
|
104
|
+
}
|
|
105
|
+
export function filterChipsClassCatalog() {
|
|
106
|
+
return [
|
|
107
|
+
'sw-filter-chips',
|
|
108
|
+
'sw-filter-chips-legend',
|
|
109
|
+
'sw-filter-chips-options',
|
|
110
|
+
'sw-filter-chip',
|
|
111
|
+
'sw-filter-chip-input',
|
|
112
|
+
'sw-filter-chip-face',
|
|
113
|
+
'sw-filter-chip-count',
|
|
114
|
+
'sw-filter-chip-quiet',
|
|
115
|
+
];
|
|
116
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Breakpoint } from './breakpoints.js';
|
|
2
|
+
export declare const gridColumnCounts: readonly [1, 2, 3, 4];
|
|
3
|
+
export type GridColumns = (typeof gridColumnCounts)[number];
|
|
4
|
+
export declare function gridColumnsClass(columns: GridColumns): string;
|
|
5
|
+
export declare function gridColumnsBelowClass(breakpoint: Breakpoint, columns: GridColumns): string;
|
|
6
|
+
export declare function cssGridClasses(): string;
|
|
7
|
+
export declare function gridClassCatalog(): string[];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { breakpointQuery, breakpoints, } from './breakpoints.js';
|
|
2
|
+
export const gridColumnCounts = [1, 2, 3, 4];
|
|
3
|
+
export function gridColumnsClass(columns) {
|
|
4
|
+
return `sw-grid-cols-${columns}`;
|
|
5
|
+
}
|
|
6
|
+
export function gridColumnsBelowClass(breakpoint, columns) {
|
|
7
|
+
return `sw-grid-cols-below-${breakpoint}-${columns}`;
|
|
8
|
+
}
|
|
9
|
+
function columnsRule(className, columns) {
|
|
10
|
+
return `.${className} { grid-template-columns: repeat(${columns}, minmax(0, 1fr)); }`;
|
|
11
|
+
}
|
|
12
|
+
export function cssGridClasses() {
|
|
13
|
+
const base = `.sw-grid {
|
|
14
|
+
display: grid;
|
|
15
|
+
min-width: 0;
|
|
16
|
+
}`;
|
|
17
|
+
const columns = gridColumnCounts.map((count) => columnsRule(gridColumnsClass(count), count));
|
|
18
|
+
const below = breakpoints.map((breakpoint) => `@media ${breakpointQuery('below', breakpoint)} {
|
|
19
|
+
${gridColumnCounts
|
|
20
|
+
.map((count) => columnsRule(gridColumnsBelowClass(breakpoint, count), count))
|
|
21
|
+
.join('\n')}
|
|
22
|
+
}`);
|
|
23
|
+
return [base, ...columns, ...below].join('\n');
|
|
24
|
+
}
|
|
25
|
+
export function gridClassCatalog() {
|
|
26
|
+
return [
|
|
27
|
+
'sw-grid',
|
|
28
|
+
...gridColumnCounts.map((count) => gridColumnsClass(count)),
|
|
29
|
+
...breakpoints.flatMap((breakpoint) => gridColumnCounts.map((count) => gridColumnsBelowClass(breakpoint, count))),
|
|
30
|
+
];
|
|
31
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { colorsForPalette, createTheme, paletteHasStylesheet, palettesWithStylesheets, semanticColorKeys, } from '@scalewing/tokens';
|
|
2
|
+
function paletteCustomProperties(id, scheme) {
|
|
3
|
+
const overlay = colorsForPalette(id, scheme);
|
|
4
|
+
const theme = createTheme({ colorScheme: scheme, palette: id });
|
|
5
|
+
const lines = [];
|
|
6
|
+
for (const key of semanticColorKeys) {
|
|
7
|
+
if (overlay[key]) {
|
|
8
|
+
lines.push(` --sw-color-${key}: ${theme.colors[key]};`);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
lines.push(` --sw-glass-blur: ${theme.glass.blur}px;`);
|
|
12
|
+
lines.push(` --sw-glass-saturate: ${theme.glass.saturate};`);
|
|
13
|
+
lines.push(` --sw-glass-fill: ${theme.glass.fill};`);
|
|
14
|
+
lines.push(` --sw-glass-border: ${theme.glass.border};`);
|
|
15
|
+
lines.push(` --sw-glass-specular: ${theme.glass.specular};`);
|
|
16
|
+
return lines.join('\n');
|
|
17
|
+
}
|
|
18
|
+
export function cssPaletteAttributes() {
|
|
19
|
+
return palettesWithStylesheets()
|
|
20
|
+
.map((palette) => {
|
|
21
|
+
const light = paletteCustomProperties(palette.id, 'light');
|
|
22
|
+
const dark = paletteCustomProperties(palette.id, 'dark');
|
|
23
|
+
return `[data-theme='light'][data-palette='${palette.id}'] {
|
|
24
|
+
${light}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
[data-theme='dark'][data-palette='${palette.id}'] {
|
|
28
|
+
${dark}
|
|
29
|
+
}`;
|
|
30
|
+
})
|
|
31
|
+
.join('\n\n');
|
|
32
|
+
}
|
|
33
|
+
export function generatePaletteStylesheet(id) {
|
|
34
|
+
if (!paletteHasStylesheet(id)) {
|
|
35
|
+
throw new Error(`Palette ${id} is the default and has no overlay stylesheet`);
|
|
36
|
+
}
|
|
37
|
+
const light = paletteCustomProperties(id, 'light');
|
|
38
|
+
const dark = paletteCustomProperties(id, 'dark');
|
|
39
|
+
return `/* Generated by @scalewing/tokens. Do not edit by hand. */
|
|
40
|
+
:root,
|
|
41
|
+
[data-theme='light'] {
|
|
42
|
+
${light}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
[data-theme='dark'] {
|
|
46
|
+
${dark}
|
|
47
|
+
}
|
|
48
|
+
`;
|
|
49
|
+
}
|
|
50
|
+
export function paletteStylesheetIds() {
|
|
51
|
+
return palettesWithStylesheets().map((palette) => palette.id);
|
|
52
|
+
}
|