@stacksjs/components 0.2.865 → 0.2.868
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/AppearancePicker-61r20jpp.stx +351 -0
- package/dist/{Button-sebyqeva.stx → Button-pg8mzsq3.stx} +249 -0
- package/dist/Checkbox-52mhrzkz.stx +417 -0
- package/dist/ColorSwatches-ecfxphjy.stx +287 -0
- package/dist/{NumberInput-axcfj9y8.stx → NumberInput-e2afxyh3.stx} +303 -0
- package/dist/{PasswordInput-8m3109tp.stx → PasswordInput-n2ven456.stx} +315 -0
- package/dist/RadioGroup-ps9kn22f.stx +329 -0
- package/dist/RadioGroupOption-6hyy1bvb.stx +246 -0
- package/dist/{SegmentedControl-fr69q4gb.stx → SegmentedControl-7q0t8c9s.stx} +170 -1
- package/dist/{Select-1cnqbcmg.stx → Select-ygzchedx.stx} +266 -0
- package/dist/SettingsGroup-dkae46k5.stx +200 -0
- package/dist/SettingsPane-jbd1gbdt.stx +50 -0
- package/dist/SettingsPaneHeader-f0cvkqs7.stx +188 -0
- package/dist/SettingsRow-4cxbsf1q.stx +424 -0
- package/dist/SettingsSidebarGroup-p2ygv5yy.stx +108 -0
- package/dist/SettingsSidebarItem-x8fsn3w5.stx +228 -0
- package/dist/SettingsWindow-mm490ymt.stx +537 -0
- package/dist/Slider-j59dgw1c.stx +377 -0
- package/dist/Switch-ga9ap8n8.stx +374 -0
- package/dist/{TextInput-tsvfwxmg.stx → TextInput-tyqzz3jy.stx} +325 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +35 -24
- package/dist/preview-frame/preview-frame.js +58 -2
- package/dist/settings/settings.js +757 -0
- package/dist/ui/appearance-picker/AppearancePicker.d.ts +12 -0
- package/dist/ui/appearance-picker/index.d.ts +16 -0
- package/dist/ui/button/Button.d.ts +24 -1
- package/dist/ui/button/index.d.ts +1 -0
- package/dist/ui/checkbox/Checkbox.d.ts +9 -1
- package/dist/ui/checkbox/index.d.ts +1 -0
- package/dist/ui/color-swatches/ColorSwatches.d.ts +26 -0
- package/dist/ui/color-swatches/index.d.ts +18 -0
- package/dist/ui/input/NumberInput.d.ts +11 -1
- package/dist/ui/input/PasswordInput.d.ts +9 -1
- package/dist/ui/input/TextInput.d.ts +12 -1
- package/dist/ui/input/index.d.ts +7 -3
- package/dist/ui/preview-frame/core.d.ts +22 -0
- package/dist/ui/preview-frame/view.d.ts +9 -0
- package/dist/ui/radio-group/RadioGroup.d.ts +14 -2
- package/dist/ui/radio-group/RadioGroupOption.d.ts +6 -1
- package/dist/ui/radio-group/index.d.ts +2 -0
- package/dist/ui/segmented-control/SegmentedControl.d.ts +9 -1
- package/dist/ui/segmented-control/index.d.ts +1 -0
- package/dist/ui/select/Select.d.ts +10 -1
- package/dist/ui/select/index.d.ts +1 -0
- package/dist/ui/settings/SettingsGroup.d.ts +30 -0
- package/dist/ui/settings/SettingsPane.d.ts +19 -0
- package/dist/ui/settings/SettingsPaneHeader.d.ts +20 -0
- package/dist/ui/settings/SettingsRow.d.ts +53 -0
- package/dist/ui/settings/SettingsSidebarGroup.d.ts +11 -0
- package/dist/ui/settings/SettingsSidebarItem.d.ts +22 -0
- package/dist/ui/settings/SettingsWindow.d.ts +22 -0
- package/dist/ui/settings/core.d.ts +146 -0
- package/dist/ui/settings/index.d.ts +73 -0
- package/dist/ui/settings/settings.d.ts +8 -0
- package/dist/ui/settings/view.d.ts +36 -0
- package/dist/ui/slider/Slider.d.ts +24 -0
- package/dist/ui/slider/core.d.ts +33 -0
- package/dist/ui/slider/index.d.ts +20 -0
- package/dist/ui/switch/Switch.d.ts +10 -1
- package/dist/ui/switch/index.d.ts +2 -1
- package/dist/utils/mac-theme.d.ts +24 -0
- package/package.json +8 -3
- package/src/index.ts +6 -0
- package/src/ui/appearance-picker/AppearancePicker.stx +351 -0
- package/src/ui/appearance-picker/README.md +61 -0
- package/src/ui/appearance-picker/index.ts +22 -0
- package/src/ui/button/Button.stx +249 -0
- package/src/ui/button/README.md +21 -0
- package/src/ui/button/index.ts +8 -0
- package/src/ui/checkbox/Checkbox.stx +275 -0
- package/src/ui/checkbox/index.ts +2 -0
- package/src/ui/color-swatches/ColorSwatches.stx +287 -0
- package/src/ui/color-swatches/README.md +66 -0
- package/src/ui/color-swatches/index.ts +25 -0
- package/src/ui/input/NumberInput.stx +303 -0
- package/src/ui/input/PasswordInput.stx +315 -0
- package/src/ui/input/TextInput.stx +325 -0
- package/src/ui/input/index.ts +9 -3
- package/src/ui/preview-frame/README.md +16 -14
- package/src/ui/preview-frame/core.ts +50 -0
- package/src/ui/preview-frame/index.ts +4 -4
- package/src/ui/preview-frame/view.ts +61 -4
- package/src/ui/radio-group/README.md +17 -0
- package/src/ui/radio-group/RadioGroup.stx +184 -6
- package/src/ui/radio-group/RadioGroupOption.stx +178 -2
- package/src/ui/radio-group/index.ts +4 -0
- package/src/ui/segmented-control/SegmentedControl.stx +170 -1
- package/src/ui/segmented-control/index.ts +2 -0
- package/src/ui/select/README.md +12 -0
- package/src/ui/select/Select.stx +266 -0
- package/src/ui/select/index.ts +2 -0
- package/src/ui/settings/README.md +221 -0
- package/src/ui/settings/SettingsGroup.stx +200 -0
- package/src/ui/settings/SettingsPane.stx +50 -0
- package/src/ui/settings/SettingsPaneHeader.stx +188 -0
- package/src/ui/settings/SettingsRow.stx +424 -0
- package/src/ui/settings/SettingsSidebarGroup.stx +108 -0
- package/src/ui/settings/SettingsSidebarItem.stx +228 -0
- package/src/ui/settings/SettingsWindow.stx +537 -0
- package/src/ui/settings/core.ts +359 -0
- package/src/ui/settings/index.ts +111 -0
- package/src/ui/settings/settings.ts +8 -0
- package/src/ui/settings/view.ts +740 -0
- package/src/ui/slider/README.md +91 -0
- package/src/ui/slider/Slider.stx +377 -0
- package/src/ui/slider/core.ts +120 -0
- package/src/ui/slider/index.ts +34 -0
- package/src/ui/switch/README.md +11 -0
- package/src/ui/switch/Switch.stx +217 -0
- package/src/ui/switch/index.ts +4 -1
- package/src/utils/mac-theme.ts +95 -0
- package/dist/Checkbox-80myyzzm.stx +0 -142
- package/dist/RadioGroup-smqcqgds.stx +0 -151
- package/dist/RadioGroupOption-twcw1b2a.stx +0 -70
- package/dist/Switch-s8yf2rvm.stx +0 -157
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
<script server>
|
|
2
|
+
/*
|
|
3
|
+
* <AppearancePicker>: light, dark, or whatever the system is, picked from
|
|
4
|
+
* three small pictures of a desktop, as System Settings offers it.
|
|
5
|
+
*
|
|
6
|
+
* <AppearancePicker v-model:value="appearance" label="Appearance" />
|
|
7
|
+
*
|
|
8
|
+
* It reports the choice (`light`, `dark` or `auto`) and does nothing else:
|
|
9
|
+
* putting the choice into effect is the page's business, usually stx's
|
|
10
|
+
* `useColorMode()`. `options` renames a choice or leaves one out:
|
|
11
|
+
*
|
|
12
|
+
* :options="[{ value: 'light', label: 'Hell' }, { value: 'dark', label: 'Dunkel' }]"
|
|
13
|
+
*
|
|
14
|
+
* A radio group: one tab stop, arrow keys move the choice. The pictures are
|
|
15
|
+
* drawn in CSS and say nothing to a screen reader; the captions do.
|
|
16
|
+
*/
|
|
17
|
+
const MODES = ['light', 'dark', 'auto']
|
|
18
|
+
export const value = MODES.includes($props.value) ? $props.value : 'auto'
|
|
19
|
+
export const options = Array.isArray($props.options) && $props.options.length > 0 ? $props.options : MODES
|
|
20
|
+
export const label = $props.label || ''
|
|
21
|
+
export const disabled = $bool($props.disabled)
|
|
22
|
+
export const pickerId = $props.id || `appearance-picker-${$uid}`
|
|
23
|
+
export const className = $props.className || ''
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<script client>
|
|
27
|
+
const emit = defineEmits(['change'])
|
|
28
|
+
const MODES = ['light', 'dark', 'auto']
|
|
29
|
+
const NAMES = { light: 'Light', dark: 'Dark', auto: 'Auto' }
|
|
30
|
+
const asMode = value => (MODES.includes(value) ? value : 'auto')
|
|
31
|
+
|
|
32
|
+
const chosen = useModel('value', { default: {{ value }}, parse: asMode })
|
|
33
|
+
const choices = useReactiveProp('options', {{ options }})
|
|
34
|
+
const groupLabel = useReactiveProp('label', {{ label }})
|
|
35
|
+
const isDisabled = useReactiveProp('disabled', {{ disabled }})
|
|
36
|
+
|
|
37
|
+
/** The choices as `{ value, label }`, in the order given, without anything that is not a mode. */
|
|
38
|
+
function modes() {
|
|
39
|
+
const list = Array.isArray(choices()) && choices().length > 0 ? choices() : MODES
|
|
40
|
+
const seen = []
|
|
41
|
+
for (const choice of list) {
|
|
42
|
+
const value = choice !== null && typeof choice === 'object' ? choice.value : choice
|
|
43
|
+
if (!MODES.includes(value) || seen.some(mode => mode.value === value)) continue
|
|
44
|
+
const label = choice !== null && typeof choice === 'object' && choice.label != null ? String(choice.label) : NAMES[value]
|
|
45
|
+
seen.push({ value, label })
|
|
46
|
+
}
|
|
47
|
+
return seen
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const isOn = mode => mode.value === chosen()
|
|
51
|
+
|
|
52
|
+
/** The one picture Tab lands on: the chosen one, or the first when the choice is not offered. */
|
|
53
|
+
function isTabStop(mode) {
|
|
54
|
+
const list = modes()
|
|
55
|
+
const current = list.find(isOn) || list[0]
|
|
56
|
+
return Boolean(current) && current.value === mode.value
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function choose(mode) {
|
|
60
|
+
if (isDisabled() || isOn(mode)) return
|
|
61
|
+
chosen.set(mode.value)
|
|
62
|
+
emit('change', mode.value)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function onKey(event, mode) {
|
|
66
|
+
if (isDisabled() || event.metaKey || event.ctrlKey || event.altKey) return
|
|
67
|
+
if (event.key === ' ' || event.key === 'Enter') {
|
|
68
|
+
event.preventDefault()
|
|
69
|
+
choose(mode)
|
|
70
|
+
return
|
|
71
|
+
}
|
|
72
|
+
const list = modes()
|
|
73
|
+
const at = list.findIndex(item => item.value === mode.value)
|
|
74
|
+
if (at === -1) return
|
|
75
|
+
|
|
76
|
+
let next = -1
|
|
77
|
+
if (event.key === 'ArrowRight' || event.key === 'ArrowDown') next = (at + 1) % list.length
|
|
78
|
+
else if (event.key === 'ArrowLeft' || event.key === 'ArrowUp') next = (at - 1 + list.length) % list.length
|
|
79
|
+
else if (event.key === 'Home') next = 0
|
|
80
|
+
else if (event.key === 'End') next = list.length - 1
|
|
81
|
+
if (next === -1) return
|
|
82
|
+
|
|
83
|
+
event.preventDefault()
|
|
84
|
+
const target = list[next]
|
|
85
|
+
choose(target)
|
|
86
|
+
const group = event.currentTarget.parentElement
|
|
87
|
+
const pictures = group ? Array.from(group.querySelectorAll('[role="radio"]')) : []
|
|
88
|
+
const picture = pictures.find(item => item.getAttribute('data-mode') === target.value)
|
|
89
|
+
if (picture) picture.focus()
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
defineExpose({ value: chosen })
|
|
93
|
+
</script>
|
|
94
|
+
|
|
95
|
+
<div
|
|
96
|
+
id="{{ pickerId }}"
|
|
97
|
+
role="radiogroup"
|
|
98
|
+
data-stx-appearance-picker
|
|
99
|
+
@if(label)aria-label="{{ label }}"@endif
|
|
100
|
+
:aria-label="groupLabel() || null"
|
|
101
|
+
@if(disabled)aria-disabled="true"@endif
|
|
102
|
+
:aria-disabled="isDisabled() ? 'true' : null"
|
|
103
|
+
class="stx-appearance-picker {{ className }}"
|
|
104
|
+
>
|
|
105
|
+
<button
|
|
106
|
+
:for="mode in modes()"
|
|
107
|
+
:key="mode.value"
|
|
108
|
+
type="button"
|
|
109
|
+
role="radio"
|
|
110
|
+
class="stx-appearance-option"
|
|
111
|
+
:data-mode="mode.value"
|
|
112
|
+
:aria-checked="isOn(mode) ? 'true' : 'false'"
|
|
113
|
+
:tabindex="isTabStop(mode) ? 0 : -1"
|
|
114
|
+
:disabled="isDisabled()"
|
|
115
|
+
@click="choose(mode)"
|
|
116
|
+
@keydown="onKey($event, mode)"
|
|
117
|
+
><span class="stx-appearance-frame" aria-hidden="true"><span class="stx-appearance-thumb"><span class="stx-appearance-scene" data-scheme="light"></span><span class="stx-appearance-scene" data-scheme="dark"></span></span></span><span class="stx-appearance-caption" :text="mode.label"></span></button>
|
|
118
|
+
</div>
|
|
119
|
+
|
|
120
|
+
<style data-native-exclude>
|
|
121
|
+
:where(:root) {
|
|
122
|
+
--stx-mac-font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI Variable Text', 'Segoe UI', system-ui, Roboto, 'Helvetica Neue', sans-serif;
|
|
123
|
+
--stx-mac-font-size: 13px;
|
|
124
|
+
--stx-mac-font-size-small: 11px;
|
|
125
|
+
--stx-mac-hairline: 0.5px;
|
|
126
|
+
--stx-mac-focus-ring: 0 0 0 3px color-mix(in srgb, var(--stx-mac-accent) 35%, transparent);
|
|
127
|
+
--stx-mac-card-radius: 12px;
|
|
128
|
+
--stx-mac-control-radius: 6px;
|
|
129
|
+
--stx-mac-row-height: 38px;
|
|
130
|
+
--stx-mac-row-inset: 10px;
|
|
131
|
+
--stx-mac-sidebar-width: 226px;
|
|
132
|
+
--stx-mac-accent: var(--stx-accent, rgb(0, 122, 255));
|
|
133
|
+
--stx-mac-accent-ink: #ffffff;
|
|
134
|
+
--stx-mac-ink: rgba(0, 0, 0, 0.85);
|
|
135
|
+
--stx-mac-ink-secondary: rgba(0, 0, 0, 0.5);
|
|
136
|
+
--stx-mac-ink-tertiary: rgba(0, 0, 0, 0.26);
|
|
137
|
+
--stx-mac-window: #ffffff;
|
|
138
|
+
--stx-mac-sidebar: #f2f1f0;
|
|
139
|
+
--stx-mac-card: rgba(0, 0, 0, 0.04);
|
|
140
|
+
--stx-mac-separator: rgba(0, 0, 0, 0.1);
|
|
141
|
+
--stx-mac-hover: rgba(0, 0, 0, 0.05);
|
|
142
|
+
--stx-mac-selection-inactive: rgba(0, 0, 0, 0.08);
|
|
143
|
+
--stx-mac-well: rgba(0, 0, 0, 0.07);
|
|
144
|
+
--stx-mac-control: #ffffff;
|
|
145
|
+
--stx-mac-control-line: rgba(0, 0, 0, 0.12);
|
|
146
|
+
--stx-mac-control-shadow: 0 0.5px 1.5px rgba(0, 0, 0, 0.14), 0 0 0 0.5px rgba(0, 0, 0, 0.08);
|
|
147
|
+
--stx-mac-switch-on: #34c759;
|
|
148
|
+
--stx-mac-knob: #ffffff;
|
|
149
|
+
--stx-mac-danger: #ff3b30;
|
|
150
|
+
}
|
|
151
|
+
:where(.dark) {
|
|
152
|
+
--stx-mac-accent: var(--stx-accent, #0a84ff);
|
|
153
|
+
--stx-mac-accent-ink: #ffffff;
|
|
154
|
+
--stx-mac-ink: rgba(255, 255, 255, 0.85);
|
|
155
|
+
--stx-mac-ink-secondary: rgba(255, 255, 255, 0.55);
|
|
156
|
+
--stx-mac-ink-tertiary: rgba(255, 255, 255, 0.25);
|
|
157
|
+
--stx-mac-window: #1e1e1e;
|
|
158
|
+
--stx-mac-sidebar: #2a2a2a;
|
|
159
|
+
--stx-mac-card: rgba(255, 255, 255, 0.05);
|
|
160
|
+
--stx-mac-separator: rgba(255, 255, 255, 0.1);
|
|
161
|
+
--stx-mac-hover: rgba(255, 255, 255, 0.06);
|
|
162
|
+
--stx-mac-selection-inactive: rgba(255, 255, 255, 0.1);
|
|
163
|
+
--stx-mac-well: rgba(255, 255, 255, 0.1);
|
|
164
|
+
--stx-mac-control: rgba(255, 255, 255, 0.14);
|
|
165
|
+
--stx-mac-control-line: rgba(255, 255, 255, 0.06);
|
|
166
|
+
--stx-mac-control-shadow: 0 0.5px 1.5px rgba(0, 0, 0, 0.4), inset 0 0.5px 0 rgba(255, 255, 255, 0.12);
|
|
167
|
+
--stx-mac-switch-on: #30d158;
|
|
168
|
+
--stx-mac-knob: #ffffff;
|
|
169
|
+
--stx-mac-danger: #ff453a;
|
|
170
|
+
}
|
|
171
|
+
@media (max-resolution: 1.5dppx) {
|
|
172
|
+
:where(:root) {
|
|
173
|
+
--stx-mac-hairline: 1px;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
@media (prefers-contrast: more) {
|
|
177
|
+
:where(:root) {
|
|
178
|
+
--stx-mac-separator: rgba(0, 0, 0, 0.4);
|
|
179
|
+
--stx-mac-control-line: rgba(0, 0, 0, 0.5);
|
|
180
|
+
--stx-mac-ink-secondary: rgba(0, 0, 0, 0.75);
|
|
181
|
+
--stx-mac-hairline: 1px;
|
|
182
|
+
}
|
|
183
|
+
:where(.dark) {
|
|
184
|
+
--stx-mac-separator: rgba(255, 255, 255, 0.45);
|
|
185
|
+
--stx-mac-control-line: rgba(255, 255, 255, 0.5);
|
|
186
|
+
--stx-mac-ink-secondary: rgba(255, 255, 255, 0.8);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
:where([data-stx-appearance-picker]) {
|
|
191
|
+
--stx-appearance-width: 67px;
|
|
192
|
+
--stx-appearance-height: 44px;
|
|
193
|
+
--stx-appearance-radius: 7px;
|
|
194
|
+
--stx-appearance-gap: 16px;
|
|
195
|
+
--stx-appearance-ring: 2.5px;
|
|
196
|
+
--stx-appearance-ring-gap: 2px;
|
|
197
|
+
--stx-appearance-ring-color: var(--stx-mac-accent);
|
|
198
|
+
--stx-appearance-caption-gap: 5px;
|
|
199
|
+
display: inline-flex;
|
|
200
|
+
flex-direction: row;
|
|
201
|
+
align-items: flex-start;
|
|
202
|
+
gap: var(--stx-appearance-gap);
|
|
203
|
+
box-sizing: border-box;
|
|
204
|
+
font-family: var(--stx-mac-font);
|
|
205
|
+
-webkit-font-smoothing: antialiased;
|
|
206
|
+
cursor: default;
|
|
207
|
+
-webkit-user-select: none;
|
|
208
|
+
user-select: none;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
:where([data-stx-appearance-picker]) > .stx-appearance-option {
|
|
212
|
+
display: flex;
|
|
213
|
+
flex: 0 0 auto;
|
|
214
|
+
flex-direction: column;
|
|
215
|
+
align-items: center;
|
|
216
|
+
box-sizing: border-box;
|
|
217
|
+
width: var(--stx-appearance-width);
|
|
218
|
+
margin: 0;
|
|
219
|
+
padding: 0;
|
|
220
|
+
border: 0;
|
|
221
|
+
background: transparent;
|
|
222
|
+
color: inherit;
|
|
223
|
+
font: inherit;
|
|
224
|
+
cursor: default;
|
|
225
|
+
outline: none;
|
|
226
|
+
-webkit-appearance: none;
|
|
227
|
+
appearance: none;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
:where([data-stx-appearance-picker]) .stx-appearance-frame {
|
|
231
|
+
position: relative;
|
|
232
|
+
display: block;
|
|
233
|
+
width: var(--stx-appearance-width);
|
|
234
|
+
height: var(--stx-appearance-height);
|
|
235
|
+
}
|
|
236
|
+
/* The ring, a gap away from the picture. */
|
|
237
|
+
:where([data-stx-appearance-picker]) .stx-appearance-frame::after {
|
|
238
|
+
content: '';
|
|
239
|
+
position: absolute;
|
|
240
|
+
inset: calc((var(--stx-appearance-ring) + var(--stx-appearance-ring-gap)) * -1);
|
|
241
|
+
box-sizing: border-box;
|
|
242
|
+
border: var(--stx-appearance-ring) solid transparent;
|
|
243
|
+
border-radius: calc(var(--stx-appearance-radius) + var(--stx-appearance-ring) + var(--stx-appearance-ring-gap));
|
|
244
|
+
pointer-events: none;
|
|
245
|
+
transition: border-color 150ms ease, box-shadow 150ms ease;
|
|
246
|
+
}
|
|
247
|
+
:where([data-stx-appearance-picker]) > .stx-appearance-option[aria-checked="true"] .stx-appearance-frame::after { border-color: var(--stx-appearance-ring-color); }
|
|
248
|
+
:where([data-stx-appearance-picker]) > .stx-appearance-option:focus-visible .stx-appearance-frame::after { box-shadow: var(--stx-mac-focus-ring); }
|
|
249
|
+
:where([data-stx-appearance-picker]) > .stx-appearance-option:active:not(:disabled) .stx-appearance-thumb { filter: brightness(0.94); }
|
|
250
|
+
:where([data-stx-appearance-picker]) > .stx-appearance-option:disabled { opacity: 0.45; }
|
|
251
|
+
|
|
252
|
+
:where([data-stx-appearance-picker]) .stx-appearance-thumb {
|
|
253
|
+
position: absolute;
|
|
254
|
+
inset: 0;
|
|
255
|
+
overflow: hidden;
|
|
256
|
+
border-radius: var(--stx-appearance-radius);
|
|
257
|
+
box-shadow: 0 0 0 var(--stx-mac-hairline) rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.12);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/*
|
|
261
|
+
* A desktop in miniature: wallpaper under a menu bar, a small window with a
|
|
262
|
+
* selected row, and the corner of a larger one with its three buttons. One
|
|
263
|
+
* element and its two pseudo-elements a scheme; `auto` shows the left half of
|
|
264
|
+
* each side by side.
|
|
265
|
+
*/
|
|
266
|
+
:where([data-stx-appearance-picker]) .stx-appearance-scene {
|
|
267
|
+
--stx-appearance-bar: rgba(255, 255, 255, 0.55);
|
|
268
|
+
--stx-appearance-pane: rgba(255, 255, 255, 0.6);
|
|
269
|
+
--stx-appearance-window: #f5f5f5;
|
|
270
|
+
position: absolute;
|
|
271
|
+
top: 0;
|
|
272
|
+
left: 0;
|
|
273
|
+
display: none;
|
|
274
|
+
width: var(--stx-appearance-width);
|
|
275
|
+
height: var(--stx-appearance-height);
|
|
276
|
+
overflow: hidden;
|
|
277
|
+
background:
|
|
278
|
+
linear-gradient(var(--stx-appearance-bar), var(--stx-appearance-bar)) top left / 100% 4px no-repeat,
|
|
279
|
+
linear-gradient(128deg, rgba(255, 255, 255, 0.8) 0 24%, rgba(255, 255, 255, 0) 24.5%),
|
|
280
|
+
radial-gradient(120% 90% at 20% 100%, #2a63d8 0 40%, rgba(42, 99, 216, 0) 70%),
|
|
281
|
+
linear-gradient(160deg, #cfe3f8 0%, #86b9ee 40%, #3d74d9 75%, #2148b0 100%);
|
|
282
|
+
}
|
|
283
|
+
:where([data-stx-appearance-picker]) .stx-appearance-scene[data-scheme="dark"] {
|
|
284
|
+
--stx-appearance-bar: rgba(0, 0, 0, 0.38);
|
|
285
|
+
--stx-appearance-pane: rgba(20, 20, 40, 0.55);
|
|
286
|
+
--stx-appearance-window: #1c1c1e;
|
|
287
|
+
background:
|
|
288
|
+
linear-gradient(var(--stx-appearance-bar), var(--stx-appearance-bar)) top left / 100% 4px no-repeat,
|
|
289
|
+
linear-gradient(128deg, rgba(120, 110, 230, 0.55) 0 24%, rgba(120, 110, 230, 0) 24.5%),
|
|
290
|
+
radial-gradient(120% 90% at 20% 100%, #0c0f52 0 40%, rgba(12, 15, 82, 0) 70%),
|
|
291
|
+
linear-gradient(160deg, #4b47c9 0%, #2c2aa0 40%, #17176b 75%, #0a0b3a 100%);
|
|
292
|
+
}
|
|
293
|
+
:where([data-stx-appearance-picker]) .stx-appearance-scene::before {
|
|
294
|
+
content: '';
|
|
295
|
+
position: absolute;
|
|
296
|
+
top: 7px;
|
|
297
|
+
left: 3px;
|
|
298
|
+
width: 38px;
|
|
299
|
+
height: 12px;
|
|
300
|
+
border-radius: 2.5px;
|
|
301
|
+
background:
|
|
302
|
+
linear-gradient(#2f6bf0, #2f6bf0) 3px 3.5px / 31px 5px no-repeat,
|
|
303
|
+
var(--stx-appearance-pane);
|
|
304
|
+
}
|
|
305
|
+
:where([data-stx-appearance-picker]) .stx-appearance-scene::after {
|
|
306
|
+
content: '';
|
|
307
|
+
position: absolute;
|
|
308
|
+
top: 25px;
|
|
309
|
+
left: 19px;
|
|
310
|
+
width: 60px;
|
|
311
|
+
height: 30px;
|
|
312
|
+
border-radius: 5px;
|
|
313
|
+
background:
|
|
314
|
+
radial-gradient(circle at 9px 9.5px, #ff5f57 0 2.4px, rgba(255, 95, 87, 0) 2.9px),
|
|
315
|
+
radial-gradient(circle at 17px 9.5px, #febc2e 0 2.4px, rgba(254, 188, 46, 0) 2.9px),
|
|
316
|
+
radial-gradient(circle at 25px 9.5px, #28c840 0 2.4px, rgba(40, 200, 64, 0) 2.9px),
|
|
317
|
+
var(--stx-appearance-window);
|
|
318
|
+
box-shadow: 0 0 4px rgba(0, 0, 0, 0.35);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
:where([data-stx-appearance-picker]) [data-mode="light"] .stx-appearance-scene[data-scheme="light"],
|
|
322
|
+
:where([data-stx-appearance-picker]) [data-mode="dark"] .stx-appearance-scene[data-scheme="dark"],
|
|
323
|
+
:where([data-stx-appearance-picker]) [data-mode="auto"] .stx-appearance-scene { display: block; }
|
|
324
|
+
:where([data-stx-appearance-picker]) [data-mode="auto"] .stx-appearance-scene { width: 50%; }
|
|
325
|
+
:where([data-stx-appearance-picker]) [data-mode="auto"] .stx-appearance-scene[data-scheme="dark"] { left: 50%; }
|
|
326
|
+
|
|
327
|
+
:where([data-stx-appearance-picker]) .stx-appearance-caption {
|
|
328
|
+
display: block;
|
|
329
|
+
max-width: calc(var(--stx-appearance-width) + var(--stx-appearance-gap) - 4px);
|
|
330
|
+
margin-top: var(--stx-appearance-caption-gap);
|
|
331
|
+
overflow: hidden;
|
|
332
|
+
font-size: var(--stx-mac-font-size-small);
|
|
333
|
+
line-height: 13px;
|
|
334
|
+
text-overflow: ellipsis;
|
|
335
|
+
white-space: nowrap;
|
|
336
|
+
color: var(--stx-mac-ink-secondary);
|
|
337
|
+
}
|
|
338
|
+
:where([data-stx-appearance-picker]) > .stx-appearance-option[aria-checked="true"] .stx-appearance-caption {
|
|
339
|
+
font-weight: 600;
|
|
340
|
+
color: var(--stx-mac-ink);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
@media (prefers-reduced-motion: reduce) {
|
|
344
|
+
:where([data-stx-appearance-picker]) .stx-appearance-frame::after { transition: none; }
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
@media (prefers-contrast: more) {
|
|
348
|
+
:where([data-stx-appearance-picker]) { --stx-appearance-ring: 3px; }
|
|
349
|
+
:where([data-stx-appearance-picker]) .stx-appearance-thumb { box-shadow: 0 0 0 1px var(--stx-mac-ink-secondary); }
|
|
350
|
+
}
|
|
351
|
+
</style>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# AppearancePicker
|
|
2
|
+
|
|
3
|
+
Light, dark, or whatever the system is, picked from three small pictures of a desktop, as System Settings offers it.
|
|
4
|
+
|
|
5
|
+
```html
|
|
6
|
+
<script client>
|
|
7
|
+
const appearance = state('auto')
|
|
8
|
+
const mode = useColorMode()
|
|
9
|
+
|
|
10
|
+
effect(() => mode.set(appearance()))
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<AppearancePicker v-model:value="appearance" label="Appearance" />
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
It reports the choice and does nothing else. Putting the choice into effect is the page's business: usually stx's `useColorMode()`, as above, and in a Craft app the window's appearance as well. The picker never touches the `dark` class.
|
|
17
|
+
|
|
18
|
+
## Props
|
|
19
|
+
|
|
20
|
+
| Prop | Default | What it does |
|
|
21
|
+
|---|---|---|
|
|
22
|
+
| `value` | `auto` | `light`, `dark` or `auto`. `v-model:value`. Anything else is `auto`. |
|
|
23
|
+
| `options` | all three | Which choices to offer, in order, and what to call them: `['light', 'dark']`, or `[{ value: 'light', label: 'Hell' }, { value: 'dark', label: 'Dunkel' }]`. Anything that is not one of the three modes is left out. |
|
|
24
|
+
| `label` | none | The accessible name of the group. Inside a `<SettingsRow>` it can be left out: the row's label names the group. |
|
|
25
|
+
| `disabled` | `false` | Nothing can be chosen. |
|
|
26
|
+
| `id`, `className` | | On the root element. |
|
|
27
|
+
|
|
28
|
+
## Events
|
|
29
|
+
|
|
30
|
+
| Event | Payload | When |
|
|
31
|
+
|---|---|---|
|
|
32
|
+
| `change` | `light`, `dark` or `auto` | A different choice was made. |
|
|
33
|
+
| `update:value` | the same | The same moment. This is what `v-model:value` listens to. |
|
|
34
|
+
|
|
35
|
+
## Keys
|
|
36
|
+
|
|
37
|
+
A radio group with one tab stop, on the chosen picture.
|
|
38
|
+
|
|
39
|
+
| Key | Does |
|
|
40
|
+
|---|---|
|
|
41
|
+
| Arrow Right, Arrow Down | chooses the next picture, round to the first |
|
|
42
|
+
| Arrow Left, Arrow Up | chooses the one before, round to the last |
|
|
43
|
+
| Home, End | chooses the first, the last |
|
|
44
|
+
| Space, Enter | chooses the focused picture |
|
|
45
|
+
|
|
46
|
+
## Accessibility
|
|
47
|
+
|
|
48
|
+
The root is `role="radiogroup"` and each choice a `<button role="radio">` with `aria-checked`, named by its caption. The pictures are drawn in CSS and hidden from a screen reader.
|
|
49
|
+
|
|
50
|
+
## Styling
|
|
51
|
+
|
|
52
|
+
Each picture is 67 by 44 points: wallpaper under a menu bar, a small window with a selected row, and the corner of a larger window with its three buttons. `auto` shows the left half of the light picture beside the left half of the dark one. The pictures are fixed drawings and do not follow the page's theme, since they show what each choice looks like. The ring and the captions do follow it.
|
|
53
|
+
|
|
54
|
+
| Variable | Default |
|
|
55
|
+
|---|---|
|
|
56
|
+
| `--stx-appearance-width`, `--stx-appearance-height` | `67px`, `44px` |
|
|
57
|
+
| `--stx-appearance-radius` | `7px` |
|
|
58
|
+
| `--stx-appearance-gap` | `16px` |
|
|
59
|
+
| `--stx-appearance-ring`, `--stx-appearance-ring-gap` | `2.5px`, `2px` |
|
|
60
|
+
| `--stx-appearance-ring-color` | the accent |
|
|
61
|
+
| `--stx-appearance-caption-gap` | `5px` |
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { default as AppearancePicker } from './AppearancePicker.stx'
|
|
2
|
+
|
|
3
|
+
export type AppearanceChoice = 'light' | 'dark' | 'auto'
|
|
4
|
+
|
|
5
|
+
/** A choice to offer, renamed. A bare mode keeps its English name. */
|
|
6
|
+
export interface AppearanceOption {
|
|
7
|
+
value: AppearanceChoice
|
|
8
|
+
label?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface AppearancePickerProps {
|
|
12
|
+
/** The choice. `v-model:value`. Default `auto`. */
|
|
13
|
+
value?: AppearanceChoice
|
|
14
|
+
/** Which choices to offer, in order, and what to call them. Default all three. */
|
|
15
|
+
options?: Array<AppearanceOption | AppearanceChoice>
|
|
16
|
+
/** The accessible name of the group. Left out inside a `<SettingsRow>`, the row's label names it. */
|
|
17
|
+
label?: string
|
|
18
|
+
disabled?: boolean
|
|
19
|
+
id?: string
|
|
20
|
+
className?: string
|
|
21
|
+
onChange?: (value: AppearanceChoice) => void
|
|
22
|
+
}
|
package/src/ui/button/Button.stx
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
<script server cache>
|
|
2
2
|
export const variant = $props.variant || 'primary'
|
|
3
|
+
/*
|
|
4
|
+
* `appearance="mac"` draws the push button a Mac draws: 22px tall, a capsule,
|
|
5
|
+
* 13px words on a raised face. `variant` already says what a button is FOR
|
|
6
|
+
* here, so the look has a prop of its own, and `variant` keeps meaning intent:
|
|
7
|
+
* `primary` is the accent-filled default button, `danger` the destructive one
|
|
8
|
+
* (red words on the plain face), `ghost` a button with no face until it is
|
|
9
|
+
* pointed at, and anything else, including no variant at all, the plain push
|
|
10
|
+
* button, because on a Mac most buttons are that. It has one size, so `size`
|
|
11
|
+
* is not read. The <button>, its events and its states are the ones below;
|
|
12
|
+
* only the classes change, to `stx-mac-button`, which this file's <style>
|
|
13
|
+
* block draws from the `--stx-mac-*` tokens.
|
|
14
|
+
*/
|
|
15
|
+
export const mac = $props.appearance === 'mac'
|
|
16
|
+
const macIntents = { primary: 'primary', danger: 'destructive', ghost: 'plain' }
|
|
17
|
+
export const macIntent = macIntents[$props.variant] || 'default'
|
|
3
18
|
export const size = $props.size || 'md'
|
|
4
19
|
export const disabled = $bool($props.disabled)
|
|
5
20
|
export const loading = $bool($props.loading)
|
|
@@ -232,6 +247,39 @@ function onClick(event) {
|
|
|
232
247
|
<span :show="!isLoading()" class="{{ iconClasses }} {{ nativeTextClasses }}">{!! rightIcon !!}</span>
|
|
233
248
|
@endif
|
|
234
249
|
</button>
|
|
250
|
+
@elseif(mac)
|
|
251
|
+
<button
|
|
252
|
+
type="{{ type }}"
|
|
253
|
+
class="stx-mac-button {{ fullWidth ? 'stx-mac-button-full' : '' }} {{ className }}"
|
|
254
|
+
data-intent="{{ macIntent }}"
|
|
255
|
+
@if(isDisabled)disabled@endif
|
|
256
|
+
:disabled="isDisabled()"
|
|
257
|
+
aria-busy="{{ loading ? 'true' : 'false' }}"
|
|
258
|
+
:aria-busy="isLoading() ? 'true' : 'false'"
|
|
259
|
+
@if(ariaLabel)aria-label="{{ ariaLabel }}"@endif
|
|
260
|
+
:aria-label="String(ariaLabelProp() ?? '') || null"
|
|
261
|
+
@click="onClick($event)"
|
|
262
|
+
>
|
|
263
|
+
<span :show="isLoading()" @if(!loading)x-cloak@endif class="stx-mac-button-spinner" aria-hidden="true"></span>
|
|
264
|
+
|
|
265
|
+
@if(leftIcon)
|
|
266
|
+
<span :show="!isLoading()" @if(loading)x-cloak@endif class="stx-mac-button-icon">{!! leftIcon !!}</span>
|
|
267
|
+
@endif
|
|
268
|
+
|
|
269
|
+
{{-- The slot is the label's fallback and the label is decided on the
|
|
270
|
+
client, exactly as in the default look below. --}}
|
|
271
|
+
<span style="display:contents" :if="!labelText()"><slot /></span>
|
|
272
|
+
|
|
273
|
+
<span
|
|
274
|
+
:if="labelText()"
|
|
275
|
+
@if(!hasLabel)x-cloak@endif
|
|
276
|
+
:text="labelText()"
|
|
277
|
+
>{{ label }}</span>
|
|
278
|
+
|
|
279
|
+
@if(rightIcon)
|
|
280
|
+
<span :show="!isLoading()" @if(loading)x-cloak@endif class="stx-mac-button-icon">{!! rightIcon !!}</span>
|
|
281
|
+
@endif
|
|
282
|
+
</button>
|
|
235
283
|
@else
|
|
236
284
|
<button
|
|
237
285
|
type="{{ type }}"
|
|
@@ -305,3 +353,204 @@ function onClick(event) {
|
|
|
305
353
|
@endif
|
|
306
354
|
</button>
|
|
307
355
|
@endif
|
|
356
|
+
|
|
357
|
+
<style data-native-exclude>
|
|
358
|
+
:where(:root) {
|
|
359
|
+
--stx-mac-font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI Variable Text', 'Segoe UI', system-ui, Roboto, 'Helvetica Neue', sans-serif;
|
|
360
|
+
--stx-mac-font-size: 13px;
|
|
361
|
+
--stx-mac-font-size-small: 11px;
|
|
362
|
+
--stx-mac-hairline: 0.5px;
|
|
363
|
+
--stx-mac-focus-ring: 0 0 0 3px color-mix(in srgb, var(--stx-mac-accent) 35%, transparent);
|
|
364
|
+
--stx-mac-card-radius: 12px;
|
|
365
|
+
--stx-mac-control-radius: 6px;
|
|
366
|
+
--stx-mac-row-height: 38px;
|
|
367
|
+
--stx-mac-row-inset: 10px;
|
|
368
|
+
--stx-mac-sidebar-width: 226px;
|
|
369
|
+
--stx-mac-accent: var(--stx-accent, rgb(0, 122, 255));
|
|
370
|
+
--stx-mac-accent-ink: #ffffff;
|
|
371
|
+
--stx-mac-ink: rgba(0, 0, 0, 0.85);
|
|
372
|
+
--stx-mac-ink-secondary: rgba(0, 0, 0, 0.5);
|
|
373
|
+
--stx-mac-ink-tertiary: rgba(0, 0, 0, 0.26);
|
|
374
|
+
--stx-mac-window: #ffffff;
|
|
375
|
+
--stx-mac-sidebar: #f2f1f0;
|
|
376
|
+
--stx-mac-card: rgba(0, 0, 0, 0.04);
|
|
377
|
+
--stx-mac-separator: rgba(0, 0, 0, 0.1);
|
|
378
|
+
--stx-mac-hover: rgba(0, 0, 0, 0.05);
|
|
379
|
+
--stx-mac-selection-inactive: rgba(0, 0, 0, 0.08);
|
|
380
|
+
--stx-mac-well: rgba(0, 0, 0, 0.07);
|
|
381
|
+
--stx-mac-control: #ffffff;
|
|
382
|
+
--stx-mac-control-line: rgba(0, 0, 0, 0.12);
|
|
383
|
+
--stx-mac-control-shadow: 0 0.5px 1.5px rgba(0, 0, 0, 0.14), 0 0 0 0.5px rgba(0, 0, 0, 0.08);
|
|
384
|
+
--stx-mac-switch-on: #34c759;
|
|
385
|
+
--stx-mac-knob: #ffffff;
|
|
386
|
+
--stx-mac-danger: #ff3b30;
|
|
387
|
+
}
|
|
388
|
+
:where(.dark) {
|
|
389
|
+
--stx-mac-accent: var(--stx-accent, #0a84ff);
|
|
390
|
+
--stx-mac-accent-ink: #ffffff;
|
|
391
|
+
--stx-mac-ink: rgba(255, 255, 255, 0.85);
|
|
392
|
+
--stx-mac-ink-secondary: rgba(255, 255, 255, 0.55);
|
|
393
|
+
--stx-mac-ink-tertiary: rgba(255, 255, 255, 0.25);
|
|
394
|
+
--stx-mac-window: #1e1e1e;
|
|
395
|
+
--stx-mac-sidebar: #2a2a2a;
|
|
396
|
+
--stx-mac-card: rgba(255, 255, 255, 0.05);
|
|
397
|
+
--stx-mac-separator: rgba(255, 255, 255, 0.1);
|
|
398
|
+
--stx-mac-hover: rgba(255, 255, 255, 0.06);
|
|
399
|
+
--stx-mac-selection-inactive: rgba(255, 255, 255, 0.1);
|
|
400
|
+
--stx-mac-well: rgba(255, 255, 255, 0.1);
|
|
401
|
+
--stx-mac-control: rgba(255, 255, 255, 0.14);
|
|
402
|
+
--stx-mac-control-line: rgba(255, 255, 255, 0.06);
|
|
403
|
+
--stx-mac-control-shadow: 0 0.5px 1.5px rgba(0, 0, 0, 0.4), inset 0 0.5px 0 rgba(255, 255, 255, 0.12);
|
|
404
|
+
--stx-mac-switch-on: #30d158;
|
|
405
|
+
--stx-mac-knob: #ffffff;
|
|
406
|
+
--stx-mac-danger: #ff453a;
|
|
407
|
+
}
|
|
408
|
+
@media (max-resolution: 1.5dppx) {
|
|
409
|
+
:where(:root) {
|
|
410
|
+
--stx-mac-hairline: 1px;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
@media (prefers-contrast: more) {
|
|
414
|
+
:where(:root) {
|
|
415
|
+
--stx-mac-separator: rgba(0, 0, 0, 0.4);
|
|
416
|
+
--stx-mac-control-line: rgba(0, 0, 0, 0.5);
|
|
417
|
+
--stx-mac-ink-secondary: rgba(0, 0, 0, 0.75);
|
|
418
|
+
--stx-mac-hairline: 1px;
|
|
419
|
+
}
|
|
420
|
+
:where(.dark) {
|
|
421
|
+
--stx-mac-separator: rgba(255, 255, 255, 0.45);
|
|
422
|
+
--stx-mac-control-line: rgba(255, 255, 255, 0.5);
|
|
423
|
+
--stx-mac-ink-secondary: rgba(255, 255, 255, 0.8);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
.stx-mac-button {
|
|
428
|
+
--stx-mac-button-pressed: color-mix(in srgb, var(--stx-mac-ink) 8%, transparent);
|
|
429
|
+
display: inline-flex;
|
|
430
|
+
align-items: center;
|
|
431
|
+
justify-content: center;
|
|
432
|
+
gap: 4px;
|
|
433
|
+
box-sizing: border-box;
|
|
434
|
+
height: 22px;
|
|
435
|
+
margin: 0;
|
|
436
|
+
padding: 0 12px;
|
|
437
|
+
border: 0;
|
|
438
|
+
border-radius: 11px;
|
|
439
|
+
background-color: var(--stx-mac-control);
|
|
440
|
+
box-shadow: var(--stx-mac-control-shadow);
|
|
441
|
+
line-height: 16px;
|
|
442
|
+
white-space: nowrap;
|
|
443
|
+
-webkit-appearance: none;
|
|
444
|
+
appearance: none;
|
|
445
|
+
outline: none;
|
|
446
|
+
transition: background-color 150ms ease, box-shadow 150ms ease, filter 150ms ease;
|
|
447
|
+
font-family: var(--stx-mac-font);
|
|
448
|
+
font-size: var(--stx-mac-font-size);
|
|
449
|
+
letter-spacing: -0.08px;
|
|
450
|
+
-webkit-font-smoothing: antialiased;
|
|
451
|
+
color: var(--stx-mac-ink);
|
|
452
|
+
cursor: default;
|
|
453
|
+
-webkit-user-select: none;
|
|
454
|
+
user-select: none;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
.stx-mac-button-full {
|
|
458
|
+
display: flex;
|
|
459
|
+
width: 100%;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
.stx-mac-button:active:not(:disabled) {
|
|
463
|
+
background-image: linear-gradient(var(--stx-mac-button-pressed), var(--stx-mac-button-pressed));
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
.stx-mac-button[data-intent='primary'] {
|
|
467
|
+
background-color: var(--stx-mac-accent);
|
|
468
|
+
box-shadow: none;
|
|
469
|
+
color: var(--stx-mac-accent-ink);
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
.stx-mac-button[data-intent='primary']:active:not(:disabled) {
|
|
473
|
+
background-image: none;
|
|
474
|
+
filter: brightness(0.9);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
.stx-mac-button[data-intent='destructive'] {
|
|
478
|
+
color: var(--stx-mac-danger);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
.stx-mac-button[data-intent='plain'] {
|
|
482
|
+
background-color: transparent;
|
|
483
|
+
box-shadow: none;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
.stx-mac-button[data-intent='plain']:hover:not(:disabled) {
|
|
487
|
+
background-color: var(--stx-mac-hover);
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
.stx-mac-button:focus-visible {
|
|
491
|
+
box-shadow: var(--stx-mac-control-shadow), var(--stx-mac-focus-ring);
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
.stx-mac-button[data-intent='primary']:focus-visible,
|
|
495
|
+
.stx-mac-button[data-intent='plain']:focus-visible {
|
|
496
|
+
box-shadow: var(--stx-mac-focus-ring);
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
.stx-mac-button:disabled {
|
|
500
|
+
opacity: 0.5;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
.stx-mac-button-icon {
|
|
504
|
+
display: inline-flex;
|
|
505
|
+
flex: none;
|
|
506
|
+
align-items: center;
|
|
507
|
+
justify-content: center;
|
|
508
|
+
width: 13px;
|
|
509
|
+
height: 13px;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
.stx-mac-button-spinner {
|
|
513
|
+
flex: none;
|
|
514
|
+
box-sizing: border-box;
|
|
515
|
+
width: 12px;
|
|
516
|
+
height: 12px;
|
|
517
|
+
border: 1.5px solid currentColor;
|
|
518
|
+
border-right-color: transparent;
|
|
519
|
+
border-radius: 50%;
|
|
520
|
+
animation: stx-mac-button-spin 0.7s linear infinite;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
@keyframes stx-mac-button-spin {
|
|
524
|
+
to {
|
|
525
|
+
transform: rotate(360deg);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
/* A window that is not the key window gives up its default button's colour. */
|
|
530
|
+
:where([data-stx-window-active='false']) .stx-mac-button[data-intent='primary'],
|
|
531
|
+
:root[data-craft-window-active='false'] .stx-mac-button[data-intent='primary'] {
|
|
532
|
+
background-color: var(--stx-mac-control);
|
|
533
|
+
box-shadow: var(--stx-mac-control-shadow);
|
|
534
|
+
color: var(--stx-mac-ink);
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
@media (prefers-reduced-motion: reduce) {
|
|
538
|
+
.stx-mac-button {
|
|
539
|
+
transition: none;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
.stx-mac-button-spinner {
|
|
543
|
+
animation-duration: 2.4s;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
@media (prefers-contrast: more) {
|
|
548
|
+
.stx-mac-button:not([data-intent='primary']) {
|
|
549
|
+
box-shadow: inset 0 0 0 1px var(--stx-mac-control-line);
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
.stx-mac-button:not([data-intent='primary']):focus-visible {
|
|
553
|
+
box-shadow: inset 0 0 0 1px var(--stx-mac-control-line), var(--stx-mac-focus-ring);
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
</style>
|