@salmexio/ui 0.1.0 → 0.2.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/dist/dialogs/Modal/Modal.svelte +427 -0
- package/dist/dialogs/Modal/Modal.svelte.d.ts +43 -0
- package/dist/dialogs/Modal/Modal.svelte.d.ts.map +1 -0
- package/dist/dialogs/Modal/index.d.ts +2 -0
- package/dist/dialogs/Modal/index.d.ts.map +1 -0
- package/dist/dialogs/Modal/index.js +1 -0
- package/dist/dialogs/index.d.ts +3 -0
- package/dist/dialogs/index.d.ts.map +1 -0
- package/dist/dialogs/index.js +2 -0
- package/dist/dialogs/modalStore.d.ts +13 -0
- package/dist/dialogs/modalStore.d.ts.map +1 -0
- package/dist/dialogs/modalStore.js +13 -0
- package/dist/feedback/Alert/Alert.svelte +63 -63
- package/dist/feedback/Alert/Alert.svelte.d.ts.map +1 -1
- package/dist/feedback/Spinner/Spinner.svelte +55 -55
- package/dist/feedback/Spinner/Spinner.svelte.d.ts.map +1 -1
- package/dist/forms/Checkbox/Checkbox.svelte +328 -0
- package/dist/forms/Checkbox/Checkbox.svelte.d.ts +30 -0
- package/dist/forms/Checkbox/Checkbox.svelte.d.ts.map +1 -0
- package/dist/forms/Checkbox/index.d.ts +2 -0
- package/dist/forms/Checkbox/index.d.ts.map +1 -0
- package/dist/forms/Checkbox/index.js +1 -0
- package/dist/forms/TextInput/TextInput.svelte +141 -141
- package/dist/forms/TextInput/TextInput.svelte.d.ts.map +1 -1
- package/dist/forms/index.d.ts +1 -0
- package/dist/forms/index.d.ts.map +1 -1
- package/dist/forms/index.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/layout/Card/Card.svelte +59 -59
- package/dist/layout/Card/Card.svelte.d.ts.map +1 -1
- package/dist/layout/Container/Container.svelte +34 -34
- package/dist/layout/Container/Container.svelte.d.ts.map +1 -1
- package/dist/navigation/Tabs/Tabs.svelte +100 -101
- package/dist/navigation/Tabs/Tabs.svelte.d.ts.map +1 -1
- package/dist/primitives/Badge/Badge.svelte +35 -42
- package/dist/primitives/Badge/Badge.svelte.d.ts.map +1 -1
- package/dist/primitives/Button/Button.svelte +47 -47
- package/dist/primitives/Button/Button.svelte.d.ts.map +1 -1
- package/dist/routes/+layout.svelte +1 -1
- package/dist/styles/tokens.css +94 -91
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/keyboard.d.ts +28 -0
- package/dist/utils/keyboard.d.ts.map +1 -0
- package/dist/utils/keyboard.js +67 -0
- package/dist/windowing/Window/Window.svelte +602 -0
- package/dist/windowing/Window/Window.svelte.d.ts +65 -0
- package/dist/windowing/Window/Window.svelte.d.ts.map +1 -0
- package/dist/windowing/Window/index.d.ts +2 -0
- package/dist/windowing/Window/index.d.ts.map +1 -0
- package/dist/windowing/Window/index.js +1 -0
- package/dist/windowing/WindowManager/WindowManager.svelte +410 -0
- package/dist/windowing/WindowManager/WindowManager.svelte.d.ts +38 -0
- package/dist/windowing/WindowManager/WindowManager.svelte.d.ts.map +1 -0
- package/dist/windowing/WindowManager/index.d.ts +2 -0
- package/dist/windowing/WindowManager/index.d.ts.map +1 -0
- package/dist/windowing/WindowManager/index.js +1 -0
- package/dist/windowing/index.d.ts +5 -0
- package/dist/windowing/index.d.ts.map +1 -0
- package/dist/windowing/index.js +3 -0
- package/dist/windowing/windowStore.svelte.d.ts +49 -0
- package/dist/windowing/windowStore.svelte.d.ts.map +1 -0
- package/dist/windowing/windowStore.svelte.js +170 -0
- package/package.json +1 -1
|
@@ -6,62 +6,62 @@
|
|
|
6
6
|
role="status", aria-label, delay, overlay. prefers-reduced-motion respected.
|
|
7
7
|
-->
|
|
8
8
|
<script lang="ts">
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
9
|
+
import { cn } from '../../utils/cn.js';
|
|
10
|
+
|
|
11
|
+
type SpinnerSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
12
|
+
type SpinnerVariant = 'primary' | 'secondary' | 'white';
|
|
13
|
+
type SpinnerStyle = 'ring' | 'bars' | 'segment' | 'dots' | 'pulse';
|
|
14
|
+
|
|
15
|
+
interface Props {
|
|
16
|
+
size?: SpinnerSize;
|
|
17
|
+
variant?: SpinnerVariant;
|
|
18
|
+
style?: SpinnerStyle;
|
|
19
|
+
label?: string;
|
|
20
|
+
showLabel?: boolean;
|
|
21
|
+
delay?: number;
|
|
22
|
+
overlay?: boolean;
|
|
23
|
+
class?: string;
|
|
24
|
+
id?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let {
|
|
28
|
+
size = 'md',
|
|
29
|
+
variant = 'primary',
|
|
30
|
+
style = 'ring',
|
|
31
|
+
label = 'Loading...',
|
|
32
|
+
showLabel = false,
|
|
33
|
+
delay = 0,
|
|
34
|
+
overlay = false,
|
|
35
|
+
class: className = '',
|
|
36
|
+
id
|
|
37
|
+
}: Props = $props();
|
|
38
|
+
|
|
39
|
+
let isVisible = $state(false);
|
|
40
|
+
|
|
41
|
+
$effect(() => {
|
|
42
|
+
if (delay === 0) {
|
|
43
|
+
isVisible = true;
|
|
44
|
+
return;
|
|
25
45
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
isVisible = false;
|
|
47
|
-
const t = setTimeout(() => {
|
|
48
|
-
isVisible = true;
|
|
49
|
-
}, delay);
|
|
50
|
-
return () => clearTimeout(t);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
const sizeConfig: Record<
|
|
54
|
-
SpinnerSize,
|
|
55
|
-
{ dimension: number; stroke: number; fontSize: string; dotSize: number }
|
|
56
|
-
> = {
|
|
57
|
-
xs: { dimension: 16, stroke: 2.5, fontSize: 'var(--salmex-font-size-xs)', dotSize: 4 },
|
|
58
|
-
sm: { dimension: 20, stroke: 3, fontSize: 'var(--salmex-font-size-sm)', dotSize: 5 },
|
|
59
|
-
md: { dimension: 28, stroke: 4, fontSize: 'var(--salmex-font-size-sm)', dotSize: 6 },
|
|
60
|
-
lg: { dimension: 40, stroke: 5, fontSize: 'var(--salmex-font-size-base)', dotSize: 8 },
|
|
61
|
-
xl: { dimension: 56, stroke: 6, fontSize: 'var(--salmex-font-size-md)', dotSize: 10 }
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const config = $derived(sizeConfig[size]);
|
|
46
|
+
isVisible = false;
|
|
47
|
+
const t = setTimeout(() => {
|
|
48
|
+
isVisible = true;
|
|
49
|
+
}, delay);
|
|
50
|
+
return () => clearTimeout(t);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const sizeConfig: Record<
|
|
54
|
+
SpinnerSize,
|
|
55
|
+
{ dimension: number; stroke: number; fontSize: string; dotSize: number }
|
|
56
|
+
> = {
|
|
57
|
+
xs: { dimension: 16, stroke: 2.5, fontSize: 'var(--salmex-font-size-xs)', dotSize: 4 },
|
|
58
|
+
sm: { dimension: 20, stroke: 3, fontSize: 'var(--salmex-font-size-sm)', dotSize: 5 },
|
|
59
|
+
md: { dimension: 28, stroke: 4, fontSize: 'var(--salmex-font-size-sm)', dotSize: 6 },
|
|
60
|
+
lg: { dimension: 40, stroke: 5, fontSize: 'var(--salmex-font-size-base)', dotSize: 8 },
|
|
61
|
+
xl: { dimension: 56, stroke: 6, fontSize: 'var(--salmex-font-size-md)', dotSize: 10 }
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const config = $derived(sizeConfig[size]);
|
|
65
65
|
</script>
|
|
66
66
|
|
|
67
67
|
{#if isVisible}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spinner.svelte.d.ts","sourceRoot":"","sources":["../../../src/feedback/Spinner/Spinner.svelte.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Spinner.svelte.d.ts","sourceRoot":"","sources":["../../../src/feedback/Spinner/Spinner.svelte.ts"],"names":[],"mappings":"AAMA,KAAK,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AACpD,KAAK,cAAc,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;AACxD,KAAK,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;AAEnE,UAAU,KAAK;IACd,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;CACZ;AA2GD;;;;;;GAMG;AACH,QAAA,MAAM,OAAO,2CAAwC,CAAC;AACtD,KAAK,OAAO,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;AAC1C,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component Checkbox
|
|
3
|
+
|
|
4
|
+
Win2K × Basquiat — 3D checkbox with bold borders, crown yellow check.
|
|
5
|
+
Uses native <input type="checkbox"> per WAI-ARIA APG (best practice: native over custom role="checkbox").
|
|
6
|
+
Label, description, error, indeterminate. Full a11y; focus and semantics follow the native input.
|
|
7
|
+
-->
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { cn } from '../../utils/cn.js';
|
|
10
|
+
import { generateId } from '../../utils/keyboard.js';
|
|
11
|
+
|
|
12
|
+
type CheckboxSize = 'sm' | 'md' | 'lg';
|
|
13
|
+
|
|
14
|
+
interface Props {
|
|
15
|
+
id?: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
value?: string;
|
|
18
|
+
label: string;
|
|
19
|
+
checked?: boolean;
|
|
20
|
+
description?: string;
|
|
21
|
+
required?: boolean;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
error?: string;
|
|
24
|
+
indeterminate?: boolean;
|
|
25
|
+
size?: CheckboxSize;
|
|
26
|
+
hideLabel?: boolean;
|
|
27
|
+
class?: string;
|
|
28
|
+
onchange?: (event: Event) => void;
|
|
29
|
+
testId?: string;
|
|
30
|
+
validateOnMount?: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
let {
|
|
34
|
+
id = generateId('checkbox'),
|
|
35
|
+
name,
|
|
36
|
+
value,
|
|
37
|
+
label,
|
|
38
|
+
checked = $bindable(false),
|
|
39
|
+
description = '',
|
|
40
|
+
required = false,
|
|
41
|
+
disabled = false,
|
|
42
|
+
error = '',
|
|
43
|
+
indeterminate = false,
|
|
44
|
+
size = 'md',
|
|
45
|
+
hideLabel = false,
|
|
46
|
+
class: className = '',
|
|
47
|
+
onchange,
|
|
48
|
+
testId,
|
|
49
|
+
validateOnMount = false
|
|
50
|
+
}: Props = $props();
|
|
51
|
+
|
|
52
|
+
let inputElement = $state<HTMLInputElement | undefined>(undefined);
|
|
53
|
+
let hasInteracted = $state(false);
|
|
54
|
+
|
|
55
|
+
$effect(() => {
|
|
56
|
+
const el = inputElement;
|
|
57
|
+
if (el) el.indeterminate = indeterminate;
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const showChecked = $derived(checked && !indeterminate);
|
|
61
|
+
const shouldValidate = $derived(hasInteracted || validateOnMount);
|
|
62
|
+
const showError = $derived(shouldValidate && !!error);
|
|
63
|
+
const errorId = $derived(`${id}-error`);
|
|
64
|
+
const descriptionId = $derived(`${id}-description`);
|
|
65
|
+
const ariaDescribedBy = $derived(
|
|
66
|
+
[showError && errorId, description && descriptionId].filter(Boolean).join(' ') || undefined
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
function handleChange(e: Event) {
|
|
70
|
+
hasInteracted = true;
|
|
71
|
+
onchange?.(e);
|
|
72
|
+
}
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<div
|
|
76
|
+
class={cn(
|
|
77
|
+
'salmex-checkbox',
|
|
78
|
+
`salmex-checkbox-${size}`,
|
|
79
|
+
disabled && 'salmex-checkbox-disabled',
|
|
80
|
+
className
|
|
81
|
+
)}
|
|
82
|
+
>
|
|
83
|
+
<label for={id} class="salmex-checkbox-label">
|
|
84
|
+
<input
|
|
85
|
+
bind:this={inputElement}
|
|
86
|
+
{id}
|
|
87
|
+
{name}
|
|
88
|
+
{value}
|
|
89
|
+
type="checkbox"
|
|
90
|
+
bind:checked
|
|
91
|
+
{disabled}
|
|
92
|
+
{required}
|
|
93
|
+
aria-invalid={showError}
|
|
94
|
+
aria-describedby={ariaDescribedBy}
|
|
95
|
+
class="salmex-checkbox-input"
|
|
96
|
+
data-testid={testId}
|
|
97
|
+
onchange={handleChange}
|
|
98
|
+
/>
|
|
99
|
+
<span
|
|
100
|
+
class={cn(
|
|
101
|
+
'salmex-checkbox-box',
|
|
102
|
+
(checked || indeterminate) && 'salmex-checkbox-box-checked',
|
|
103
|
+
indeterminate && 'salmex-checkbox-box-indeterminate',
|
|
104
|
+
showError && 'salmex-checkbox-box-error'
|
|
105
|
+
)}
|
|
106
|
+
aria-hidden="true"
|
|
107
|
+
>
|
|
108
|
+
{#if showChecked}
|
|
109
|
+
<svg class="salmex-checkbox-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
110
|
+
<polyline points="20 6 9 17 4 12" />
|
|
111
|
+
</svg>
|
|
112
|
+
{:else if indeterminate}
|
|
113
|
+
<svg class="salmex-checkbox-icon salmex-checkbox-icon-minus" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" aria-hidden="true">
|
|
114
|
+
<line x1="5" y1="12" x2="19" y2="12" />
|
|
115
|
+
</svg>
|
|
116
|
+
{/if}
|
|
117
|
+
</span>
|
|
118
|
+
<span class="salmex-checkbox-content" class:salmex-sr-only={hideLabel}>
|
|
119
|
+
<span class="salmex-checkbox-text">
|
|
120
|
+
{label}
|
|
121
|
+
{#if required}
|
|
122
|
+
<span class="salmex-checkbox-required" aria-hidden="true">*</span>
|
|
123
|
+
{/if}
|
|
124
|
+
</span>
|
|
125
|
+
{#if description && !hideLabel}
|
|
126
|
+
<span id={descriptionId} class="salmex-checkbox-description">{description}</span>
|
|
127
|
+
{/if}
|
|
128
|
+
</span>
|
|
129
|
+
</label>
|
|
130
|
+
{#if showError}
|
|
131
|
+
<p id={errorId} class="salmex-checkbox-error" role="alert">{error}</p>
|
|
132
|
+
{/if}
|
|
133
|
+
</div>
|
|
134
|
+
|
|
135
|
+
<style>
|
|
136
|
+
.salmex-checkbox {
|
|
137
|
+
display: flex;
|
|
138
|
+
flex-direction: column;
|
|
139
|
+
gap: var(--salmex-space-1);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.salmex-checkbox-disabled {
|
|
143
|
+
opacity: 0.6;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.salmex-checkbox-label {
|
|
147
|
+
display: flex;
|
|
148
|
+
align-items: center;
|
|
149
|
+
gap: var(--salmex-space-2);
|
|
150
|
+
cursor: pointer;
|
|
151
|
+
user-select: none;
|
|
152
|
+
font-family: var(--salmex-font-system);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.salmex-checkbox-label:has(.salmex-checkbox-description) {
|
|
156
|
+
align-items: flex-start;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.salmex-checkbox-label:has(.salmex-checkbox-description) .salmex-checkbox-box {
|
|
160
|
+
margin-top: 2px;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.salmex-checkbox-disabled .salmex-checkbox-label {
|
|
164
|
+
cursor: not-allowed;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/* Visually hidden, not display:none — keeps focus and semantics */
|
|
168
|
+
.salmex-checkbox-input {
|
|
169
|
+
position: absolute;
|
|
170
|
+
width: 1px;
|
|
171
|
+
height: 1px;
|
|
172
|
+
padding: 0;
|
|
173
|
+
margin: -1px;
|
|
174
|
+
overflow: hidden;
|
|
175
|
+
clip: rect(0, 0, 0, 0);
|
|
176
|
+
white-space: nowrap;
|
|
177
|
+
border: 0;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/* Win2K × Basquiat — 3D box */
|
|
181
|
+
.salmex-checkbox-box {
|
|
182
|
+
flex-shrink: 0;
|
|
183
|
+
display: flex;
|
|
184
|
+
align-items: center;
|
|
185
|
+
justify-content: center;
|
|
186
|
+
background: rgb(var(--salmex-button-face));
|
|
187
|
+
border: 2px solid rgb(var(--salmex-button-dark-edge));
|
|
188
|
+
box-shadow:
|
|
189
|
+
inset 2px 2px 0 rgb(var(--salmex-button-highlight)),
|
|
190
|
+
inset -2px -2px 0 rgb(var(--salmex-button-shadow));
|
|
191
|
+
transition: background var(--salmex-transition-fast), border-color var(--salmex-transition-fast),
|
|
192
|
+
box-shadow var(--salmex-transition-fast);
|
|
193
|
+
color: rgb(var(--salmex-chalk-white));
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.salmex-checkbox-sm .salmex-checkbox-box {
|
|
197
|
+
width: 16px;
|
|
198
|
+
height: 16px;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.salmex-checkbox-md .salmex-checkbox-box {
|
|
202
|
+
width: 20px;
|
|
203
|
+
height: 20px;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.salmex-checkbox-lg .salmex-checkbox-box {
|
|
207
|
+
width: 24px;
|
|
208
|
+
height: 24px;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.salmex-checkbox-icon {
|
|
212
|
+
width: 100%;
|
|
213
|
+
height: 100%;
|
|
214
|
+
padding: 2px;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.salmex-checkbox-icon-minus {
|
|
218
|
+
padding: 3px 4px;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/* Checked — electric blue fill, crown accent */
|
|
222
|
+
.salmex-checkbox-box-checked {
|
|
223
|
+
background: rgb(var(--salmex-electric-blue));
|
|
224
|
+
border-color: rgb(var(--salmex-button-dark-edge));
|
|
225
|
+
box-shadow:
|
|
226
|
+
inset 2px 2px 0 rgb(var(--salmex-button-highlight)),
|
|
227
|
+
inset -2px -2px 0 rgb(var(--salmex-button-shadow)),
|
|
228
|
+
0 0 0 2px rgb(var(--salmex-border-dark));
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
:global([data-theme='dark']) .salmex-checkbox-box-checked {
|
|
232
|
+
background: rgb(var(--salmex-electric-blue));
|
|
233
|
+
border-color: rgb(var(--salmex-button-dark-edge));
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/* Indeterminate — same as checked, minus icon */
|
|
237
|
+
.salmex-checkbox-box-indeterminate {
|
|
238
|
+
background: rgb(var(--salmex-electric-blue));
|
|
239
|
+
border-color: rgb(var(--salmex-button-dark-edge));
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.salmex-checkbox-label:hover .salmex-checkbox-box:not(.salmex-checkbox-box-checked):not(.salmex-checkbox-box-indeterminate) {
|
|
243
|
+
border-color: rgb(var(--salmex-electric-blue));
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/* Focus — crown yellow ring (design system) */
|
|
247
|
+
.salmex-checkbox-input:focus-visible + .salmex-checkbox-box {
|
|
248
|
+
box-shadow:
|
|
249
|
+
inset 2px 2px 0 rgb(var(--salmex-button-highlight)),
|
|
250
|
+
inset -2px -2px 0 rgb(var(--salmex-button-shadow)),
|
|
251
|
+
0 0 0 2px rgb(var(--salmex-midnight-black)),
|
|
252
|
+
0 0 0 5px rgb(var(--salmex-crown-yellow));
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
:global([data-theme='dark']) .salmex-checkbox-input:focus-visible + .salmex-checkbox-box {
|
|
256
|
+
box-shadow:
|
|
257
|
+
inset 2px 2px 0 rgb(var(--salmex-button-highlight)),
|
|
258
|
+
inset -2px -2px 0 rgb(var(--salmex-button-shadow)),
|
|
259
|
+
0 0 0 3px rgb(var(--salmex-crown-yellow));
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/* High contrast / forced colors: solid outline so focus is visible (APG) */
|
|
263
|
+
@media (forced-colors: active) {
|
|
264
|
+
.salmex-checkbox-input:focus-visible + .salmex-checkbox-box {
|
|
265
|
+
outline: 2px solid CanvasText;
|
|
266
|
+
outline-offset: 2px;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.salmex-checkbox-box-error {
|
|
271
|
+
border-color: rgb(var(--salmex-street-red));
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
:global([data-theme='dark']) .salmex-checkbox-box-error {
|
|
275
|
+
border-color: rgb(var(--salmex-street-red));
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.salmex-checkbox-content {
|
|
279
|
+
display: flex;
|
|
280
|
+
flex-direction: column;
|
|
281
|
+
gap: 2px;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.salmex-checkbox-text {
|
|
285
|
+
font-size: var(--salmex-font-size-sm);
|
|
286
|
+
font-weight: 600;
|
|
287
|
+
color: rgb(var(--salmex-text-primary));
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.salmex-checkbox-required {
|
|
291
|
+
color: rgb(var(--salmex-street-red));
|
|
292
|
+
margin-left: 2px;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.salmex-checkbox-description {
|
|
296
|
+
font-size: var(--salmex-font-size-xs);
|
|
297
|
+
color: rgb(var(--salmex-text-secondary));
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.salmex-checkbox-error {
|
|
301
|
+
font-size: var(--salmex-font-size-xs);
|
|
302
|
+
font-weight: 600;
|
|
303
|
+
color: rgb(var(--salmex-street-red));
|
|
304
|
+
margin: 0 0 0 calc(20px + var(--salmex-space-2));
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.salmex-checkbox-lg .salmex-checkbox-error {
|
|
308
|
+
margin-left: calc(24px + var(--salmex-space-2));
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.salmex-sr-only {
|
|
312
|
+
position: absolute;
|
|
313
|
+
width: 1px;
|
|
314
|
+
height: 1px;
|
|
315
|
+
padding: 0;
|
|
316
|
+
margin: -1px;
|
|
317
|
+
overflow: hidden;
|
|
318
|
+
clip: rect(0, 0, 0, 0);
|
|
319
|
+
white-space: nowrap;
|
|
320
|
+
border: 0;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
@media (prefers-reduced-motion: reduce) {
|
|
324
|
+
.salmex-checkbox-box {
|
|
325
|
+
transition: none;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
</style>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
type CheckboxSize = 'sm' | 'md' | 'lg';
|
|
2
|
+
interface Props {
|
|
3
|
+
id?: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
value?: string;
|
|
6
|
+
label: string;
|
|
7
|
+
checked?: boolean;
|
|
8
|
+
description?: string;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
error?: string;
|
|
12
|
+
indeterminate?: boolean;
|
|
13
|
+
size?: CheckboxSize;
|
|
14
|
+
hideLabel?: boolean;
|
|
15
|
+
class?: string;
|
|
16
|
+
onchange?: (event: Event) => void;
|
|
17
|
+
testId?: string;
|
|
18
|
+
validateOnMount?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Checkbox
|
|
22
|
+
*
|
|
23
|
+
* Win2K × Basquiat — 3D checkbox with bold borders, crown yellow check.
|
|
24
|
+
* Uses native <input type="checkbox"> per WAI-ARIA APG (best practice: native over custom role="checkbox").
|
|
25
|
+
* Label, description, error, indeterminate. Full a11y; focus and semantics follow the native input.
|
|
26
|
+
*/
|
|
27
|
+
declare const Checkbox: import("svelte").Component<Props, {}, "checked">;
|
|
28
|
+
type Checkbox = ReturnType<typeof Checkbox>;
|
|
29
|
+
export default Checkbox;
|
|
30
|
+
//# sourceMappingURL=Checkbox.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Checkbox.svelte.d.ts","sourceRoot":"","sources":["../../../src/forms/Checkbox/Checkbox.svelte.ts"],"names":[],"mappings":"AAOA,KAAK,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEvC,UAAU,KAAK;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC1B;AA+FD;;;;;;GAMG;AACH,QAAA,MAAM,QAAQ,kDAAwC,CAAC;AACvD,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/forms/Checkbox/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Checkbox } from './Checkbox.svelte';
|