zdp-design-system 0.43.8

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.
Files changed (110) hide show
  1. package/CHANGELOG.md +449 -0
  2. package/LICENSE +21 -0
  3. package/README.md +568 -0
  4. package/THIRD_PARTY_NOTICES.md +34 -0
  5. package/dist/code.ts +2 -0
  6. package/dist/combobox.ts +9 -0
  7. package/dist/command.ts +1 -0
  8. package/dist/components/Accordion.svelte +97 -0
  9. package/dist/components/Avatar.svelte +90 -0
  10. package/dist/components/Badge.svelte +61 -0
  11. package/dist/components/Breadcrumb.svelte +97 -0
  12. package/dist/components/Button.svelte +163 -0
  13. package/dist/components/Callout.svelte +81 -0
  14. package/dist/components/Card.svelte +151 -0
  15. package/dist/components/CardHeader.svelte +58 -0
  16. package/dist/components/Checkbox.svelte +135 -0
  17. package/dist/components/CodeBlock.svelte +247 -0
  18. package/dist/components/Combobox.svelte +552 -0
  19. package/dist/components/CommandField.svelte +230 -0
  20. package/dist/components/ConfirmAction.svelte +307 -0
  21. package/dist/components/Container.svelte +63 -0
  22. package/dist/components/Dialog.svelte +303 -0
  23. package/dist/components/Disclosure.svelte +176 -0
  24. package/dist/components/Divider.svelte +41 -0
  25. package/dist/components/EmptyState.svelte +79 -0
  26. package/dist/components/ErrorText.svelte +18 -0
  27. package/dist/components/Field.svelte +38 -0
  28. package/dist/components/Grid.svelte +76 -0
  29. package/dist/components/HelpText.svelte +17 -0
  30. package/dist/components/Icon.svelte +45 -0
  31. package/dist/components/IconButton.svelte +162 -0
  32. package/dist/components/IdentityChip.svelte +130 -0
  33. package/dist/components/Inline.svelte +85 -0
  34. package/dist/components/InlineCode.svelte +27 -0
  35. package/dist/components/Input.svelte +109 -0
  36. package/dist/components/Kbd.svelte +63 -0
  37. package/dist/components/KeyValue.svelte +73 -0
  38. package/dist/components/Label.svelte +43 -0
  39. package/dist/components/Link.svelte +70 -0
  40. package/dist/components/LocaleSwitcher.svelte +209 -0
  41. package/dist/components/Menu.svelte +491 -0
  42. package/dist/components/Page.svelte +36 -0
  43. package/dist/components/PageHeader.svelte +93 -0
  44. package/dist/components/Pagination.svelte +297 -0
  45. package/dist/components/Popover.svelte +208 -0
  46. package/dist/components/Progress.svelte +111 -0
  47. package/dist/components/Radio.svelte +132 -0
  48. package/dist/components/Section.svelte +52 -0
  49. package/dist/components/SegmentedControl.svelte +190 -0
  50. package/dist/components/Select.svelte +88 -0
  51. package/dist/components/ShareDock.svelte +304 -0
  52. package/dist/components/Sheet.svelte +332 -0
  53. package/dist/components/ShortcutHint.svelte +52 -0
  54. package/dist/components/Skeleton.svelte +82 -0
  55. package/dist/components/SkipLink.svelte +40 -0
  56. package/dist/components/SortHeader.svelte +138 -0
  57. package/dist/components/Spinner.svelte +82 -0
  58. package/dist/components/Stack.svelte +62 -0
  59. package/dist/components/StatusToast.svelte +133 -0
  60. package/dist/components/Surface.svelte +53 -0
  61. package/dist/components/Switch.svelte +152 -0
  62. package/dist/components/Table.svelte +94 -0
  63. package/dist/components/TableToolbar.svelte +195 -0
  64. package/dist/components/Tabs.svelte +205 -0
  65. package/dist/components/TermSheet.svelte +392 -0
  66. package/dist/components/TermTrigger.svelte +70 -0
  67. package/dist/components/TextScaleControl.svelte +219 -0
  68. package/dist/components/Textarea.svelte +106 -0
  69. package/dist/components/ThemeToggle.svelte +148 -0
  70. package/dist/components/Toast.svelte +180 -0
  71. package/dist/components/Toolbar.svelte +83 -0
  72. package/dist/components/Tooltip.svelte +199 -0
  73. package/dist/components/VisuallyHidden.svelte +18 -0
  74. package/dist/disclosure.ts +11 -0
  75. package/dist/focusable.ts +36 -0
  76. package/dist/identity.ts +5 -0
  77. package/dist/index.d.ts +106 -0
  78. package/dist/index.js +76 -0
  79. package/dist/index.ts +106 -0
  80. package/dist/menu.ts +12 -0
  81. package/dist/modal-layer.ts +108 -0
  82. package/dist/pagination.ts +10 -0
  83. package/dist/preferences.js +14 -0
  84. package/dist/preferences.ts +36 -0
  85. package/dist/progress.ts +4 -0
  86. package/dist/schemas/design-tokens.schema.json +119 -0
  87. package/dist/segmented.ts +8 -0
  88. package/dist/share.d.ts +48 -0
  89. package/dist/share.js +115 -0
  90. package/dist/share.ts +99 -0
  91. package/dist/sheet.ts +3 -0
  92. package/dist/shortcuts.js +125 -0
  93. package/dist/shortcuts.ts +153 -0
  94. package/dist/styles/brand-fonts.css +10 -0
  95. package/dist/styles/components.css +4686 -0
  96. package/dist/styles/expressive-fonts.css +2 -0
  97. package/dist/styles/index.css +2 -0
  98. package/dist/styles/locale-fonts.css +4 -0
  99. package/dist/styles/tokens.css +413 -0
  100. package/dist/table-tools.ts +10 -0
  101. package/dist/term.ts +16 -0
  102. package/dist/theme.ts +2 -0
  103. package/dist/toast.ts +14 -0
  104. package/dist/tokens/zdp.tokens.json +241 -0
  105. package/dist/tokens.js +122 -0
  106. package/dist/tokens.ts +123 -0
  107. package/docs/CONSUMER_CONTRACT.md +482 -0
  108. package/docs/EXTERNAL_UI_ADOPTION.md +141 -0
  109. package/docs/INTERACTIVE_PRIMITIVE_AUDIT.md +127 -0
  110. package/package.json +78 -0
@@ -0,0 +1,230 @@
1
+ <script lang="ts">
2
+ import type { HTMLInputAttributes } from 'svelte/elements';
3
+ import type { ZdpCommandFieldSize } from '../command';
4
+ import ShortcutHint from './ShortcutHint.svelte';
5
+
6
+ type DescribedBy = string | readonly string[] | null;
7
+ type AriaAutocomplete = 'none' | 'inline' | 'list' | 'both';
8
+
9
+ export let id: string | null = null;
10
+ export let name: string | null = null;
11
+ export let value = '';
12
+ export let type: HTMLInputAttributes['type'] = 'search';
13
+ export let label: string | null = 'Search';
14
+ export let labelVisible = false;
15
+ export let ariaLabel: string | null = null;
16
+ export let placeholder: string | null = 'Search query';
17
+ export let autocomplete: HTMLInputAttributes['autocomplete'] | null = 'off';
18
+ export let describedBy: DescribedBy = null;
19
+ export let errorMessageId: string | null = null;
20
+ export let invalid = false;
21
+ export let disabled = false;
22
+ export let readonly = false;
23
+ export let required = false;
24
+ export let size: ZdpCommandFieldSize = 'md';
25
+ export let shortcutKeys: readonly string[] = ['/'];
26
+ export let ariaKeyShortcuts: string | null = null;
27
+ export let ariaAutocomplete: AriaAutocomplete | null = null;
28
+ export let ariaControls: string | null = null;
29
+ export let ariaExpanded: boolean | null = null;
30
+ export let ariaActivedescendant: string | null = null;
31
+ export let inputmode: HTMLInputAttributes['inputmode'] | null = null;
32
+ export let enterkeyhint: HTMLInputAttributes['enterkeyhint'] | null = null;
33
+ export let oninput: ((event: Event) => void) | null = null;
34
+ export let onfocus: ((event: FocusEvent) => void) | null = null;
35
+ export let onblur: ((event: FocusEvent) => void) | null = null;
36
+ export let onkeydown: ((event: KeyboardEvent) => void) | null = null;
37
+
38
+ $: ariaDescribedBy = normalizeIdRefs(describedBy);
39
+ $: resolvedErrorMessageId = invalid && errorMessageId ? errorMessageId : null;
40
+ $: hasShortcut = shortcutKeys.length > 0;
41
+ $: inputAriaLabel = label ? undefined : ariaLabel ?? 'Search';
42
+
43
+ function handleInput(event: Event): void {
44
+ value = (event.currentTarget as HTMLInputElement).value;
45
+ oninput?.(event);
46
+ }
47
+
48
+ function normalizeIdRefs(value: DescribedBy): string | null {
49
+ if (value === null) {
50
+ return null;
51
+ }
52
+
53
+ if (typeof value === 'string') {
54
+ const normalized = value.trim();
55
+ return normalized ? normalized : null;
56
+ }
57
+
58
+ const normalized = value.map((entry) => entry.trim()).filter(Boolean);
59
+ return normalized.length > 0 ? normalized.join(' ') : null;
60
+ }
61
+ </script>
62
+
63
+ <label
64
+ class={`zdp-command-field-shell zdp-command-field-shell--${size}`}
65
+ data-invalid={invalid ? 'true' : undefined}
66
+ data-disabled={disabled ? 'true' : undefined}
67
+ >
68
+ {#if label}
69
+ <span class={`zdp-command-field__label ${labelVisible ? '' : 'zdp-command-field__label--hidden'}`}>
70
+ {label}
71
+ </span>
72
+ {/if}
73
+ <span class={`zdp-command-field zdp-command-field--${size}`}>
74
+ <input
75
+ class="zdp-command-field__input"
76
+ id={id ?? undefined}
77
+ name={name ?? undefined}
78
+ {type}
79
+ {value}
80
+ placeholder={placeholder ?? undefined}
81
+ autocomplete={autocomplete ?? undefined}
82
+ aria-label={inputAriaLabel}
83
+ aria-describedby={ariaDescribedBy ?? undefined}
84
+ aria-errormessage={resolvedErrorMessageId ?? undefined}
85
+ aria-invalid={invalid ? 'true' : undefined}
86
+ aria-keyshortcuts={ariaKeyShortcuts ?? undefined}
87
+ aria-autocomplete={ariaAutocomplete ?? undefined}
88
+ aria-controls={ariaControls ?? undefined}
89
+ aria-expanded={ariaExpanded ?? undefined}
90
+ aria-activedescendant={ariaActivedescendant ?? undefined}
91
+ {disabled}
92
+ readonly={readonly}
93
+ {required}
94
+ inputmode={inputmode ?? undefined}
95
+ enterkeyhint={enterkeyhint ?? undefined}
96
+ oninput={handleInput}
97
+ onfocus={onfocus ?? undefined}
98
+ onblur={onblur ?? undefined}
99
+ onkeydown={onkeydown ?? undefined}
100
+ />
101
+ {#if hasShortcut}
102
+ <span class="zdp-command-field__shortcut" aria-hidden="true">
103
+ <ShortcutHint keys={shortcutKeys} size={size} />
104
+ </span>
105
+ {/if}
106
+ </span>
107
+ </label>
108
+
109
+ <style>
110
+ .zdp-command-field-shell {
111
+ box-sizing: border-box;
112
+ display: grid;
113
+ gap: var(--zdp-space-2);
114
+ inline-size: 100%;
115
+ min-width: 0;
116
+ }
117
+
118
+ .zdp-command-field-shell--sm {
119
+ gap: var(--zdp-space-1);
120
+ }
121
+
122
+ .zdp-command-field-shell--md {
123
+ gap: var(--zdp-space-2);
124
+ }
125
+
126
+ .zdp-command-field__label {
127
+ color: var(--zdp-color-ink-strong);
128
+ font-family: var(--zdp-font-family-sans);
129
+ font-size: var(--zdp-type-label-size);
130
+ font-weight: var(--zdp-font-weight-medium);
131
+ line-height: var(--zdp-type-label-line-height);
132
+ }
133
+
134
+ .zdp-command-field__label--hidden {
135
+ block-size: 1px;
136
+ clip: rect(0 0 0 0);
137
+ clip-path: inset(50%);
138
+ inline-size: 1px;
139
+ margin: -1px;
140
+ overflow: hidden;
141
+ padding: 0;
142
+ position: absolute;
143
+ white-space: nowrap;
144
+ }
145
+
146
+ .zdp-command-field {
147
+ align-items: center;
148
+ background: var(--zdp-color-surface-panel);
149
+ border: var(--zdp-control-border-width) solid var(--zdp-color-line-subtle);
150
+ border-radius: var(--zdp-radius-md);
151
+ box-sizing: border-box;
152
+ color: var(--zdp-color-ink-strong);
153
+ display: flex;
154
+ font-family: var(--zdp-font-family-sans);
155
+ font-size: var(--zdp-type-control-size);
156
+ gap: var(--zdp-space-2);
157
+ inline-size: 100%;
158
+ min-width: 0;
159
+ transition:
160
+ background-color var(--zdp-motion-fast) ease,
161
+ border-color var(--zdp-motion-fast) ease,
162
+ color var(--zdp-motion-fast) ease;
163
+ }
164
+
165
+ .zdp-command-field--sm {
166
+ min-height: var(--zdp-control-height-sm);
167
+ padding: 0 var(--zdp-space-2);
168
+ }
169
+
170
+ .zdp-command-field--md {
171
+ min-height: var(--zdp-control-height-md);
172
+ padding: 0 var(--zdp-space-2) 0 var(--zdp-space-3);
173
+ }
174
+
175
+ .zdp-command-field:hover {
176
+ background: var(--zdp-color-surface-raised);
177
+ border-color: var(--zdp-color-line-strong);
178
+ }
179
+
180
+ .zdp-command-field:focus-within {
181
+ border-color: var(--zdp-color-focus-line);
182
+ outline: var(--zdp-control-focus-outline-width) solid var(--zdp-color-focus-surface);
183
+ outline-offset: var(--zdp-control-focus-outline-offset);
184
+ }
185
+
186
+ .zdp-command-field-shell[data-invalid="true"] .zdp-command-field {
187
+ border-color: var(--zdp-color-accent-danger);
188
+ }
189
+
190
+ .zdp-command-field-shell[data-disabled="true"] .zdp-command-field {
191
+ cursor: not-allowed;
192
+ opacity: 0.56;
193
+ }
194
+
195
+ .zdp-command-field__input {
196
+ background: transparent;
197
+ border: 0;
198
+ color: inherit;
199
+ flex: 1 1 auto;
200
+ font: inherit;
201
+ min-height: calc(var(--zdp-control-height-md) - 2px);
202
+ min-width: 0;
203
+ padding: 0;
204
+ }
205
+
206
+ .zdp-command-field--sm .zdp-command-field__input {
207
+ min-height: calc(var(--zdp-control-height-sm) - 2px);
208
+ }
209
+
210
+ .zdp-command-field__input::placeholder {
211
+ color: var(--zdp-color-ink-muted);
212
+ }
213
+
214
+ .zdp-command-field__input:focus {
215
+ outline: 0;
216
+ }
217
+
218
+ .zdp-command-field__input::-webkit-calendar-picker-indicator {
219
+ display: none !important;
220
+ }
221
+
222
+ .zdp-command-field__shortcut {
223
+ align-items: center;
224
+ display: inline-flex;
225
+ flex: 0 0 auto;
226
+ pointer-events: none;
227
+ -webkit-user-select: none;
228
+ user-select: none;
229
+ }
230
+ </style>
@@ -0,0 +1,307 @@
1
+ <script lang="ts">
2
+ import { onDestroy } from 'svelte';
3
+
4
+ export let id: string | null = null;
5
+ export let tone: 'primary' | 'danger' = 'primary';
6
+ export let label = 'Slide to confirm';
7
+ export let hint = 'Slide or hold for 2 seconds';
8
+ export let completeLabel = 'Confirmed';
9
+ export let disabled = false;
10
+ export let durationMs = 2000;
11
+ export let onconfirm: (() => void) | null = null;
12
+
13
+ let progress = 0;
14
+ let active = false;
15
+ let confirmed = false;
16
+ let startX = 0;
17
+ let trackWidth = 1;
18
+ let startedAt = 0;
19
+ let progressTimer: number | null = null;
20
+ let resetTimer: number | null = null;
21
+
22
+ $: safeDurationMs = Math.max(600, durationMs);
23
+ $: progressStyle = `--zdp-confirm-action-progress: ${progress};`;
24
+
25
+ function beginInteraction(clientX: number | null, element: HTMLButtonElement): void {
26
+ if (disabled || confirmed) {
27
+ return;
28
+ }
29
+
30
+ clearTimers();
31
+ active = true;
32
+ progress = 0;
33
+ startedAt = Date.now();
34
+ startX = clientX ?? 0;
35
+ trackWidth = Math.max(1, element.getBoundingClientRect().width);
36
+ progressTimer = window.setInterval(updateHoldProgress, 40);
37
+ }
38
+
39
+ function updateHoldProgress(): void {
40
+ if (!active) {
41
+ return;
42
+ }
43
+
44
+ progress = Math.max(progress, Math.min(1, (Date.now() - startedAt) / safeDurationMs));
45
+
46
+ if (progress >= 1) {
47
+ confirmAction();
48
+ }
49
+ }
50
+
51
+ function updateSlideProgress(clientX: number): void {
52
+ if (!active || disabled || confirmed) {
53
+ return;
54
+ }
55
+
56
+ progress = Math.max(progress, Math.min(1, (clientX - startX) / trackWidth));
57
+
58
+ if (progress >= 0.92) {
59
+ confirmAction();
60
+ }
61
+ }
62
+
63
+ function confirmAction(): void {
64
+ if (confirmed) {
65
+ return;
66
+ }
67
+
68
+ clearTimers();
69
+ active = false;
70
+ confirmed = true;
71
+ progress = 1;
72
+ onconfirm?.();
73
+ resetTimer = window.setTimeout(reset, 1000);
74
+ }
75
+
76
+ function cancelInteraction(): void {
77
+ if (confirmed) {
78
+ return;
79
+ }
80
+
81
+ clearTimers();
82
+ active = false;
83
+ progress = 0;
84
+ }
85
+
86
+ function reset(): void {
87
+ clearTimers();
88
+ active = false;
89
+ confirmed = false;
90
+ progress = 0;
91
+ }
92
+
93
+ function clearTimers(): void {
94
+ if (progressTimer !== null) {
95
+ window.clearInterval(progressTimer);
96
+ progressTimer = null;
97
+ }
98
+
99
+ if (resetTimer !== null) {
100
+ window.clearTimeout(resetTimer);
101
+ resetTimer = null;
102
+ }
103
+ }
104
+
105
+ function handlePointerDown(event: PointerEvent): void {
106
+ const button = event.currentTarget as HTMLButtonElement;
107
+ button.setPointerCapture(event.pointerId);
108
+ beginInteraction(event.clientX, button);
109
+ }
110
+
111
+ function handlePointerMove(event: PointerEvent): void {
112
+ updateSlideProgress(event.clientX);
113
+ }
114
+
115
+ function handlePointerEnd(event: PointerEvent): void {
116
+ const button = event.currentTarget as HTMLButtonElement;
117
+
118
+ if (button.hasPointerCapture(event.pointerId)) {
119
+ button.releasePointerCapture(event.pointerId);
120
+ }
121
+
122
+ cancelInteraction();
123
+ }
124
+
125
+ function handleKeydown(event: KeyboardEvent): void {
126
+ if (event.key !== 'Enter' && event.key !== ' ') {
127
+ return;
128
+ }
129
+
130
+ event.preventDefault();
131
+
132
+ if (!active) {
133
+ beginInteraction(null, event.currentTarget as HTMLButtonElement);
134
+ }
135
+ }
136
+
137
+ function handleKeyup(event: KeyboardEvent): void {
138
+ if (event.key === 'Enter' || event.key === ' ') {
139
+ event.preventDefault();
140
+ cancelInteraction();
141
+ }
142
+ }
143
+
144
+ onDestroy(clearTimers);
145
+ </script>
146
+
147
+ <button
148
+ class={`zdp-confirm-action zdp-confirm-action--${tone}`}
149
+ {id}
150
+ type="button"
151
+ {disabled}
152
+ aria-disabled={disabled}
153
+ aria-live="polite"
154
+ data-active={active ? 'true' : undefined}
155
+ data-confirmed={confirmed ? 'true' : undefined}
156
+ style={progressStyle}
157
+ onpointerdown={handlePointerDown}
158
+ onpointermove={handlePointerMove}
159
+ onpointerup={handlePointerEnd}
160
+ onpointercancel={handlePointerEnd}
161
+ onkeydown={handleKeydown}
162
+ onkeyup={handleKeyup}
163
+ >
164
+ <span class="zdp-confirm-action__fill" aria-hidden="true"></span>
165
+ <span class="zdp-confirm-action__thumb" aria-hidden="true">
166
+ <svg class="zdp-confirm-action__glyph" viewBox="0 0 24 24" focusable="false" aria-hidden="true">
167
+ <path d="M5 12h14m-6-6 6 6-6 6" />
168
+ </svg>
169
+ </span>
170
+ <span class="zdp-confirm-action__body">
171
+ <span class="zdp-confirm-action__label">{confirmed ? completeLabel : label}</span>
172
+ <span class="zdp-confirm-action__hint">{hint}</span>
173
+ </span>
174
+ </button>
175
+
176
+ <style>
177
+ .zdp-confirm-action {
178
+ --zdp-confirm-action-progress: 0;
179
+ --zdp-confirm-action-fill: var(--zdp-color-accent-primary);
180
+
181
+ align-items: center;
182
+ background: var(--zdp-color-surface-panel);
183
+ border: var(--zdp-control-border-width) solid var(--zdp-color-line-strong);
184
+ border-radius: var(--zdp-control-radius);
185
+ box-sizing: border-box;
186
+ color: var(--zdp-color-ink-strong);
187
+ cursor: pointer;
188
+ display: inline-grid;
189
+ font-family: var(--zdp-font-family-sans);
190
+ grid-template-columns: var(--zdp-control-height-sm) minmax(0, 1fr);
191
+ isolation: isolate;
192
+ min-height: calc(var(--zdp-control-height-md) + var(--zdp-space-3));
193
+ min-width: min(100%, 18rem);
194
+ overflow: hidden;
195
+ padding: var(--zdp-space-2) var(--zdp-space-4) var(--zdp-space-2) var(--zdp-space-2);
196
+ position: relative;
197
+ text-align: start;
198
+ touch-action: none;
199
+ -webkit-user-select: none;
200
+ user-select: none;
201
+ vertical-align: middle;
202
+ }
203
+
204
+ .zdp-confirm-action__fill {
205
+ background: var(--zdp-confirm-action-fill);
206
+ bottom: 0;
207
+ left: 0;
208
+ position: absolute;
209
+ top: 0;
210
+ width: calc(var(--zdp-confirm-action-progress) * 100%);
211
+ z-index: -1;
212
+ }
213
+
214
+ .zdp-confirm-action__thumb {
215
+ align-items: center;
216
+ background: var(--zdp-color-accent-primary);
217
+ border: var(--zdp-control-border-width) solid var(--zdp-color-accent-primary-strong);
218
+ border-radius: var(--zdp-control-radius);
219
+ box-sizing: border-box;
220
+ color: var(--zdp-color-ink-strong);
221
+ display: inline-flex;
222
+ font-size: var(--zdp-control-glyph-sm);
223
+ height: var(--zdp-control-height-sm);
224
+ justify-content: center;
225
+ line-height: 1;
226
+ width: var(--zdp-control-height-sm);
227
+ }
228
+
229
+ .zdp-confirm-action__glyph {
230
+ display: block;
231
+ fill: none;
232
+ height: var(--zdp-control-glyph-sm);
233
+ stroke: currentColor;
234
+ stroke-linecap: round;
235
+ stroke-linejoin: round;
236
+ stroke-width: 2.25;
237
+ width: var(--zdp-control-glyph-sm);
238
+ }
239
+
240
+ :global([data-zdp-theme="dark"]) .zdp-confirm-action__thumb {
241
+ color: var(--zdp-color-ink-inverse);
242
+ }
243
+
244
+ :global([data-zdp-theme="dark"]) .zdp-confirm-action {
245
+ --zdp-confirm-action-fill: var(--zdp-color-accent-primary-soft);
246
+ }
247
+
248
+ .zdp-confirm-action__body {
249
+ display: grid;
250
+ gap: var(--zdp-space-1);
251
+ min-width: 0;
252
+ padding-left: var(--zdp-space-3);
253
+ }
254
+
255
+ .zdp-confirm-action__label {
256
+ color: var(--zdp-color-ink-strong);
257
+ font-size: var(--zdp-type-control-size);
258
+ font-weight: var(--zdp-font-weight-medium);
259
+ line-height: var(--zdp-type-control-line-height);
260
+ }
261
+
262
+ .zdp-confirm-action__hint {
263
+ color: var(--zdp-color-ink-muted);
264
+ font-size: var(--zdp-type-caption-size);
265
+ line-height: var(--zdp-type-caption-line-height);
266
+ }
267
+
268
+ .zdp-confirm-action:hover:not(:disabled) {
269
+ background: var(--zdp-color-surface-raised);
270
+ border-color: var(--zdp-color-line-strong);
271
+ }
272
+
273
+ .zdp-confirm-action:focus-visible {
274
+ border-color: var(--zdp-color-focus-line);
275
+ outline: var(--zdp-control-focus-outline-width) solid var(--zdp-color-focus-surface);
276
+ outline-offset: var(--zdp-control-focus-outline-offset);
277
+ }
278
+
279
+ .zdp-confirm-action--danger {
280
+ border-color: var(--zdp-color-accent-danger);
281
+ }
282
+
283
+ .zdp-confirm-action--danger .zdp-confirm-action__fill {
284
+ background: var(--zdp-color-accent-danger);
285
+ opacity: 0.24;
286
+ }
287
+
288
+ .zdp-confirm-action--danger .zdp-confirm-action__thumb {
289
+ background: var(--zdp-color-accent-danger);
290
+ border-color: var(--zdp-color-accent-danger);
291
+ }
292
+
293
+ .zdp-confirm-action[data-active="true"],
294
+ .zdp-confirm-action[data-confirmed="true"] {
295
+ border-color: var(--zdp-color-focus-line);
296
+ }
297
+
298
+ .zdp-confirm-action[data-confirmed="true"] .zdp-confirm-action__thumb {
299
+ background: var(--zdp-color-accent-success);
300
+ border-color: var(--zdp-color-accent-success);
301
+ }
302
+
303
+ .zdp-confirm-action:disabled {
304
+ cursor: not-allowed;
305
+ opacity: 0.56;
306
+ }
307
+ </style>
@@ -0,0 +1,63 @@
1
+ <script lang="ts">
2
+ export let as: 'div' | 'section' | 'article' | 'header' | 'footer' = 'div';
3
+ export let size: 'sm' | 'md' | 'lg' | 'xl' | 'full' = 'lg';
4
+ export let padding: 'none' | 'sm' | 'md' | 'lg' = 'md';
5
+ export let id: string | null = null;
6
+ export let labelledBy: string | null = null;
7
+
8
+ $: labelledGroupRole = as === 'div' && labelledBy ? 'group' : undefined;
9
+ </script>
10
+
11
+ <svelte:element
12
+ this={as}
13
+ class={`zdp-container zdp-container--${size} zdp-container--padding-${padding}`}
14
+ {id}
15
+ role={labelledGroupRole}
16
+ aria-labelledby={labelledBy ?? undefined}
17
+ >
18
+ <slot />
19
+ </svelte:element>
20
+
21
+ <style>
22
+ .zdp-container {
23
+ inline-size: 100%;
24
+ margin-inline: auto;
25
+ min-width: 0;
26
+ }
27
+
28
+ .zdp-container--sm {
29
+ max-inline-size: var(--zdp-breakpoint-mobile);
30
+ }
31
+
32
+ .zdp-container--md {
33
+ max-inline-size: var(--zdp-breakpoint-tablet);
34
+ }
35
+
36
+ .zdp-container--lg {
37
+ max-inline-size: var(--zdp-breakpoint-desktop);
38
+ }
39
+
40
+ .zdp-container--xl {
41
+ max-inline-size: var(--zdp-breakpoint-wide);
42
+ }
43
+
44
+ .zdp-container--full {
45
+ max-inline-size: none;
46
+ }
47
+
48
+ .zdp-container--padding-none {
49
+ padding-inline: 0;
50
+ }
51
+
52
+ .zdp-container--padding-sm {
53
+ padding-inline: var(--zdp-space-3);
54
+ }
55
+
56
+ .zdp-container--padding-md {
57
+ padding-inline: var(--zdp-space-4);
58
+ }
59
+
60
+ .zdp-container--padding-lg {
61
+ padding-inline: var(--zdp-space-6);
62
+ }
63
+ </style>