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,151 @@
1
+ <script lang="ts">
2
+ export let as: 'article' | 'div' | 'section' = 'article';
3
+ export let tone: 'panel' | 'raised' | 'outline' = 'panel';
4
+ export let padding: 'none' | 'sm' | 'md' | 'lg' = 'md';
5
+ export let hover = false;
6
+ export let id: string | null = null;
7
+ export let ariaLabel: string | null = null;
8
+ export let ariaLabelledBy: string | null = null;
9
+
10
+ $: role = as === 'div' ? 'region' : undefined;
11
+ </script>
12
+
13
+ <svelte:element
14
+ this={as}
15
+ class={`zdp-card zdp-card--${tone} zdp-card--padding-${padding} ${hover ? 'zdp-card--hover' : ''}`}
16
+ {id}
17
+ role={role}
18
+ aria-label={ariaLabel ?? undefined}
19
+ aria-labelledby={ariaLabelledBy ?? undefined}
20
+ >
21
+ {#if $$slots.header}
22
+ <div class="zdp-card__header">
23
+ <slot name="header" />
24
+ </div>
25
+ {/if}
26
+
27
+ {#if $$slots.body || $$slots.default}
28
+ <div class="zdp-card__body">
29
+ <slot name="body" />
30
+ <slot />
31
+ </div>
32
+ {/if}
33
+
34
+ {#if $$slots.footer}
35
+ <div class="zdp-card__footer">
36
+ <slot name="footer" />
37
+ </div>
38
+ {/if}
39
+
40
+ {#if $$slots.actions}
41
+ <div class="zdp-card__actions">
42
+ <slot name="actions" />
43
+ </div>
44
+ {/if}
45
+ </svelte:element>
46
+
47
+ <style>
48
+ .zdp-card {
49
+ border: 1px solid var(--zdp-color-line-subtle);
50
+ border-radius: var(--zdp-radius-lg);
51
+ box-sizing: border-box;
52
+ color: var(--zdp-color-ink-normal);
53
+ display: grid;
54
+ font-family: var(--zdp-font-family-sans);
55
+ gap: var(--zdp-space-4);
56
+ min-width: 0;
57
+ }
58
+
59
+ .zdp-card--panel {
60
+ background: var(--zdp-color-surface-panel);
61
+ }
62
+
63
+ .zdp-card--raised {
64
+ background: var(--zdp-color-surface-raised);
65
+ }
66
+
67
+ .zdp-card--outline {
68
+ background: transparent;
69
+ }
70
+
71
+ .zdp-card--padding-none {
72
+ padding: 0;
73
+ }
74
+
75
+ .zdp-card--padding-sm {
76
+ padding: var(--zdp-space-3);
77
+ }
78
+
79
+ .zdp-card--padding-md {
80
+ padding: var(--zdp-space-4);
81
+ }
82
+
83
+ .zdp-card--padding-lg {
84
+ padding: var(--zdp-space-6);
85
+ }
86
+
87
+ .zdp-card--hover {
88
+ cursor: pointer;
89
+ transition: border-color var(--zdp-motion-fast) ease;
90
+ }
91
+
92
+ .zdp-card--hover:hover {
93
+ border-color: var(--zdp-color-line-strong);
94
+ }
95
+
96
+ .zdp-card--hover:focus-visible {
97
+ outline: var(--zdp-control-focus-outline-width) solid var(--zdp-color-focus-line);
98
+ outline-offset: var(--zdp-control-focus-outline-offset);
99
+ }
100
+
101
+ .zdp-card__header {
102
+ display: grid;
103
+ gap: var(--zdp-space-2);
104
+ min-width: 0;
105
+ }
106
+
107
+ .zdp-card__body {
108
+ display: grid;
109
+ gap: var(--zdp-space-2);
110
+ min-width: 0;
111
+ }
112
+
113
+ .zdp-card__body :global(*) {
114
+ margin-block: 0;
115
+ }
116
+
117
+ .zdp-card__body :global(:where(h1, h2, h3, h4, h5, h6)) {
118
+ color: var(--zdp-color-ink-strong);
119
+ font-family: var(--zdp-font-family-display);
120
+ font-size: var(--zdp-type-title-size);
121
+ font-weight: var(--zdp-font-weight-medium);
122
+ line-height: var(--zdp-type-title-line-height);
123
+ }
124
+
125
+ .zdp-card__body :global(p) {
126
+ color: var(--zdp-color-ink-muted);
127
+ font-size: var(--zdp-type-body-small-size);
128
+ line-height: var(--zdp-type-body-small-line-height);
129
+ }
130
+
131
+ .zdp-card__footer {
132
+ color: var(--zdp-color-ink-muted);
133
+ font-size: var(--zdp-type-caption-size);
134
+ line-height: var(--zdp-type-caption-line-height);
135
+ min-width: 0;
136
+ }
137
+
138
+ .zdp-card__actions {
139
+ align-items: center;
140
+ display: flex;
141
+ flex-wrap: wrap;
142
+ gap: var(--zdp-space-2);
143
+ min-width: 0;
144
+ }
145
+
146
+ @media (prefers-reduced-motion: reduce) {
147
+ .zdp-card--hover {
148
+ transition: none;
149
+ }
150
+ }
151
+ </style>
@@ -0,0 +1,58 @@
1
+ <script lang="ts">
2
+ export let as: 'h2' | 'h3' | 'h4' | 'h5' | 'div' = 'h3';
3
+ export let id: string | null = null;
4
+ </script>
5
+
6
+ <div class="zdp-card-header">
7
+ <svelte:element this={as} class="zdp-card-header__title" {id}>
8
+ <slot />
9
+ </svelte:element>
10
+ {#if $$slots.subtitle}
11
+ <p class="zdp-card-header__subtitle">
12
+ <slot name="subtitle" />
13
+ </p>
14
+ {/if}
15
+ {#if $$slots.badge}
16
+ <span class="zdp-card-header__badge">
17
+ <slot name="badge" />
18
+ </span>
19
+ {/if}
20
+ </div>
21
+
22
+ <style>
23
+ .zdp-card-header {
24
+ align-items: start;
25
+ display: grid;
26
+ gap: var(--zdp-space-1);
27
+ grid-template-columns: 1fr auto;
28
+ min-width: 0;
29
+ }
30
+
31
+ .zdp-card-header__title {
32
+ color: var(--zdp-color-ink-strong);
33
+ font-family: var(--zdp-font-family-display);
34
+ font-size: var(--zdp-type-title-size);
35
+ font-weight: var(--zdp-font-weight-medium);
36
+ grid-column: 1 / -1;
37
+ line-height: var(--zdp-type-title-line-height);
38
+ margin: 0;
39
+ min-width: 0;
40
+ }
41
+
42
+ .zdp-card-header__subtitle {
43
+ color: var(--zdp-color-ink-muted);
44
+ font-size: var(--zdp-type-body-small-size);
45
+ grid-column: 1 / -1;
46
+ line-height: var(--zdp-type-body-small-line-height);
47
+ margin: 0;
48
+ min-width: 0;
49
+ }
50
+
51
+ .zdp-card-header__badge {
52
+ align-self: center;
53
+ grid-column: 2;
54
+ grid-row: 1;
55
+ justify-self: end;
56
+ min-width: 0;
57
+ }
58
+ </style>
@@ -0,0 +1,135 @@
1
+ <script lang="ts">
2
+ export let id: string | null = null;
3
+ export let name: string | null = null;
4
+ export let value: string | null = null;
5
+ export let checked = false;
6
+ export let describedBy: string | null = null;
7
+ export let invalid = false;
8
+ export let disabled = false;
9
+ export let required = false;
10
+
11
+ function handleChange(event: Event): void {
12
+ checked = (event.currentTarget as HTMLInputElement).checked;
13
+ }
14
+ </script>
15
+
16
+ <label class="zdp-choice zdp-choice--checkbox" data-invalid={invalid ? 'true' : undefined}>
17
+ <input
18
+ class="zdp-choice__input"
19
+ id={id ?? undefined}
20
+ name={name ?? undefined}
21
+ type="checkbox"
22
+ value={value ?? undefined}
23
+ {checked}
24
+ aria-describedby={describedBy ?? undefined}
25
+ aria-invalid={invalid ? 'true' : undefined}
26
+ {disabled}
27
+ {required}
28
+ onchange={handleChange}
29
+ />
30
+ <span class="zdp-choice__mark" aria-hidden="true"></span>
31
+ <span class="zdp-choice__body">
32
+ <span class="zdp-choice__label"><slot /></span>
33
+ <slot name="help" />
34
+ </span>
35
+ </label>
36
+
37
+ <style>
38
+ .zdp-choice {
39
+ align-items: start;
40
+ color: var(--zdp-color-ink-normal);
41
+ cursor: pointer;
42
+ display: grid;
43
+ font-family: var(--zdp-font-family-sans);
44
+ gap: var(--zdp-space-3);
45
+ grid-template-columns: var(--zdp-control-choice-size) minmax(0, 1fr);
46
+ line-height: var(--zdp-type-body-small-line-height);
47
+ min-width: 0;
48
+ -webkit-user-select: none;
49
+ user-select: none;
50
+ }
51
+
52
+ .zdp-choice__input {
53
+ height: 1px;
54
+ margin: 0;
55
+ opacity: 0;
56
+ position: absolute;
57
+ width: 1px;
58
+ }
59
+
60
+ .zdp-choice__mark {
61
+ align-items: center;
62
+ background: var(--zdp-color-surface-panel);
63
+ border: var(--zdp-control-border-width) solid var(--zdp-color-line-strong);
64
+ border-radius: var(--zdp-control-radius);
65
+ box-sizing: border-box;
66
+ color: var(--zdp-color-ink-strong);
67
+ display: inline-flex;
68
+ height: var(--zdp-control-choice-size);
69
+ justify-content: center;
70
+ margin-top: var(--zdp-control-switch-thumb-offset);
71
+ -webkit-user-select: none;
72
+ user-select: none;
73
+ transition:
74
+ background-color var(--zdp-motion-fast) ease,
75
+ border-color var(--zdp-motion-fast) ease,
76
+ color var(--zdp-motion-fast) ease;
77
+ width: var(--zdp-control-choice-size);
78
+ }
79
+
80
+ .zdp-choice__mark::after {
81
+ border-bottom: 2px solid currentcolor;
82
+ border-left: 2px solid currentcolor;
83
+ content: "";
84
+ display: none;
85
+ height: 0.3rem;
86
+ margin-bottom: 0.0625rem;
87
+ rotate: -45deg;
88
+ width: 0.6rem;
89
+ }
90
+
91
+ .zdp-choice:hover .zdp-choice__input:not(:checked):not(:disabled) + .zdp-choice__mark {
92
+ background: var(--zdp-color-surface-raised);
93
+ border-color: var(--zdp-color-line-strong);
94
+ }
95
+
96
+ .zdp-choice__input:checked + .zdp-choice__mark {
97
+ background: var(--zdp-color-accent-primary);
98
+ border-color: var(--zdp-color-accent-primary-strong);
99
+ }
100
+
101
+ :global([data-zdp-theme="dark"]) .zdp-choice__input:checked + .zdp-choice__mark {
102
+ color: var(--zdp-color-ink-inverse);
103
+ }
104
+
105
+ .zdp-choice__input:checked + .zdp-choice__mark::after {
106
+ display: block;
107
+ }
108
+
109
+ .zdp-choice__input:focus-visible + .zdp-choice__mark {
110
+ border-color: var(--zdp-color-focus-line);
111
+ outline: var(--zdp-control-focus-outline-width) solid var(--zdp-color-focus-surface);
112
+ outline-offset: var(--zdp-control-focus-outline-offset);
113
+ }
114
+
115
+ .zdp-choice__input[aria-invalid="true"] + .zdp-choice__mark {
116
+ border-color: var(--zdp-color-accent-danger);
117
+ }
118
+
119
+ .zdp-choice:has(.zdp-choice__input:disabled) {
120
+ cursor: not-allowed;
121
+ opacity: 0.56;
122
+ }
123
+
124
+ .zdp-choice__body {
125
+ display: grid;
126
+ gap: var(--zdp-space-1);
127
+ min-width: 0;
128
+ }
129
+
130
+ .zdp-choice__label {
131
+ color: var(--zdp-color-ink-strong);
132
+ font-size: var(--zdp-type-body-small-size);
133
+ line-height: var(--zdp-type-body-small-line-height);
134
+ }
135
+ </style>
@@ -0,0 +1,247 @@
1
+ <script lang="ts">
2
+ import { onDestroy } from 'svelte';
3
+ import type { ZdpCodeBlockSize, ZdpCodeBlockTone } from '../code';
4
+
5
+ export let code = '';
6
+ export let language: string | null = null;
7
+ export let label: string | null = null;
8
+ export let caption: string | null = null;
9
+ export let size: ZdpCodeBlockSize = 'md';
10
+ export let tone: ZdpCodeBlockTone = 'default';
11
+ export let wrap = false;
12
+ export let showCopy = true;
13
+ export let copyLabel = 'Copy';
14
+ export let copiedLabel = 'Copied';
15
+ export let copyFailedLabel = 'Copy failed';
16
+ export let ariaLabel: string | null = null;
17
+ export let labelledBy: string | null = null;
18
+ export let describedBy: string | null = null;
19
+
20
+ type CopyState = 'idle' | 'copied' | 'failed';
21
+
22
+ let copyState: CopyState = 'idle';
23
+ let resetCopyStateTimer: ReturnType<typeof setTimeout> | null = null;
24
+
25
+ $: canCopy = showCopy && code.length > 0;
26
+ $: resolvedAriaLabel = ariaLabel ?? (!labelledBy && label ? label : null);
27
+ $: codeRegionLabel = [label ?? ariaLabel, language ? `${language} code` : 'Code'].filter(Boolean).join(' ');
28
+ $: resolvedCopyLabel =
29
+ copyState === 'copied' ? copiedLabel : copyState === 'failed' ? copyFailedLabel : copyLabel;
30
+
31
+ onDestroy(() => {
32
+ clearResetCopyStateTimer();
33
+ });
34
+
35
+ function clearResetCopyStateTimer(): void {
36
+ if (resetCopyStateTimer !== null) {
37
+ clearTimeout(resetCopyStateTimer);
38
+ resetCopyStateTimer = null;
39
+ }
40
+ }
41
+
42
+ function scheduleResetCopyState(): void {
43
+ clearResetCopyStateTimer();
44
+
45
+ resetCopyStateTimer = setTimeout(() => {
46
+ copyState = 'idle';
47
+ resetCopyStateTimer = null;
48
+ }, 1800);
49
+ }
50
+
51
+ async function handleCopy(): Promise<void> {
52
+ if (!canCopy) {
53
+ return;
54
+ }
55
+
56
+ try {
57
+ if (typeof navigator === 'undefined' || !navigator.clipboard?.writeText) {
58
+ throw new Error('Clipboard API unavailable');
59
+ }
60
+
61
+ await navigator.clipboard.writeText(code);
62
+ copyState = 'copied';
63
+ } catch {
64
+ copyState = 'failed';
65
+ }
66
+
67
+ scheduleResetCopyState();
68
+ }
69
+ </script>
70
+
71
+ <div
72
+ class={`zdp-code-block zdp-code-block--${size} zdp-code-block--${tone}`}
73
+ data-wrap={wrap ? 'true' : undefined}
74
+ role="group"
75
+ aria-label={resolvedAriaLabel ?? undefined}
76
+ aria-labelledby={labelledBy ?? undefined}
77
+ aria-describedby={describedBy ?? undefined}
78
+ >
79
+ {#if label || language || canCopy}
80
+ <div class="zdp-code-block__header">
81
+ {#if label || language}
82
+ <div class="zdp-code-block__meta">
83
+ {#if label}
84
+ <span class="zdp-code-block__title">{label}</span>
85
+ {/if}
86
+ {#if language}
87
+ <span class="zdp-code-block__language">{language}</span>
88
+ {/if}
89
+ </div>
90
+ {/if}
91
+ {#if canCopy}
92
+ <button class="zdp-code-block__copy" type="button" onclick={handleCopy}>
93
+ {resolvedCopyLabel}
94
+ </button>
95
+ {/if}
96
+ </div>
97
+ {/if}
98
+
99
+ <!-- svelte-ignore a11y_no_noninteractive_tabindex -->
100
+ <div class="zdp-code-block__scroller" role="region" aria-label={codeRegionLabel} tabindex="0">
101
+ <pre class="zdp-code-block__pre"><code class="zdp-code-block__code" data-language={language ?? undefined}>{#if code.length > 0}{code}{:else}<slot />{/if}</code></pre>
102
+ </div>
103
+
104
+ {#if caption}
105
+ <p class="zdp-code-block__caption">{caption}</p>
106
+ {/if}
107
+ </div>
108
+
109
+ <style>
110
+ .zdp-code-block {
111
+ --zdp-code-block-surface: var(--zdp-color-surface-panel);
112
+
113
+ background: var(--zdp-color-surface-panel);
114
+ border: var(--zdp-control-border-width) solid var(--zdp-color-line-subtle);
115
+ border-radius: var(--zdp-control-radius);
116
+ box-sizing: border-box;
117
+ color: var(--zdp-color-ink-normal);
118
+ display: grid;
119
+ font-family: var(--zdp-font-family-sans);
120
+ gap: 0;
121
+ min-width: 0;
122
+ overflow: hidden;
123
+ }
124
+
125
+ .zdp-code-block--muted {
126
+ --zdp-code-block-surface: var(--zdp-color-surface-raised);
127
+
128
+ background: var(--zdp-color-surface-raised);
129
+ }
130
+
131
+ .zdp-code-block__header {
132
+ align-items: center;
133
+ border-block-end: var(--zdp-control-border-width) solid var(--zdp-color-line-subtle);
134
+ display: flex;
135
+ flex-wrap: wrap;
136
+ gap: var(--zdp-space-2);
137
+ justify-content: space-between;
138
+ min-width: 0;
139
+ padding: var(--zdp-space-2) var(--zdp-space-3);
140
+ }
141
+
142
+ .zdp-code-block__meta {
143
+ align-items: center;
144
+ display: flex;
145
+ flex-wrap: wrap;
146
+ gap: var(--zdp-space-2);
147
+ min-width: 0;
148
+ }
149
+
150
+ .zdp-code-block__title {
151
+ color: var(--zdp-color-ink-strong);
152
+ font-size: var(--zdp-type-body-small-size);
153
+ font-weight: var(--zdp-font-weight-medium);
154
+ line-height: var(--zdp-type-body-small-line-height);
155
+ }
156
+
157
+ .zdp-code-block__language {
158
+ color: var(--zdp-color-ink-muted);
159
+ font-family: var(--zdp-font-family-mono);
160
+ font-size: var(--zdp-type-caption-size);
161
+ line-height: var(--zdp-type-caption-line-height);
162
+ }
163
+
164
+ .zdp-code-block__copy {
165
+ background: var(--zdp-color-surface-panel);
166
+ border: var(--zdp-control-border-width) solid var(--zdp-color-line-subtle);
167
+ border-radius: var(--zdp-control-radius);
168
+ color: var(--zdp-color-ink-strong);
169
+ cursor: pointer;
170
+ font: inherit;
171
+ font-size: var(--zdp-type-caption-size);
172
+ font-weight: var(--zdp-font-weight-medium);
173
+ line-height: var(--zdp-type-caption-line-height);
174
+ min-height: var(--zdp-control-height-sm);
175
+ padding: 0 var(--zdp-space-3);
176
+ -webkit-user-select: none;
177
+ user-select: none;
178
+ }
179
+
180
+ .zdp-code-block__copy:hover {
181
+ background: var(--zdp-color-surface-raised);
182
+ border-color: var(--zdp-color-line-strong);
183
+ }
184
+
185
+ .zdp-code-block__copy:focus-visible {
186
+ border-color: var(--zdp-color-focus-line);
187
+ outline: var(--zdp-control-focus-outline-width) solid var(--zdp-color-focus-surface);
188
+ outline-offset: var(--zdp-control-focus-outline-offset);
189
+ }
190
+
191
+ .zdp-code-block__scroller {
192
+ background: var(--zdp-code-block-surface);
193
+ color: var(--zdp-color-ink-strong);
194
+ min-width: 0;
195
+ overscroll-behavior-inline: contain;
196
+ overflow-x: auto;
197
+ padding: var(--zdp-space-4);
198
+ scrollbar-gutter: stable;
199
+ -webkit-overflow-scrolling: touch;
200
+ touch-action: pan-x pan-y;
201
+ }
202
+
203
+ .zdp-code-block__scroller:focus-visible {
204
+ outline: var(--zdp-control-focus-outline-width) solid var(--zdp-color-focus-surface);
205
+ outline-offset: calc(var(--zdp-control-focus-outline-offset) * -1);
206
+ }
207
+
208
+ .zdp-code-block__pre {
209
+ background: var(--zdp-code-block-surface);
210
+ font-family: var(--zdp-font-family-mono);
211
+ font-size: var(--zdp-type-data-size);
212
+ line-height: var(--zdp-font-line-height-normal);
213
+ margin: 0;
214
+ min-width: max-content;
215
+ tab-size: 2;
216
+ white-space: pre;
217
+ }
218
+
219
+ .zdp-code-block__code {
220
+ background: var(--zdp-code-block-surface);
221
+ color: inherit;
222
+ font: inherit;
223
+ }
224
+
225
+ .zdp-code-block[data-wrap="true"] .zdp-code-block__pre {
226
+ min-width: 0;
227
+ white-space: pre-wrap;
228
+ word-break: break-word;
229
+ }
230
+
231
+ .zdp-code-block__caption {
232
+ border-block-start: var(--zdp-control-border-width) solid var(--zdp-color-line-subtle);
233
+ color: var(--zdp-color-ink-muted);
234
+ font-size: var(--zdp-type-caption-size);
235
+ line-height: var(--zdp-type-caption-line-height);
236
+ margin: 0;
237
+ padding: var(--zdp-space-2) var(--zdp-space-3);
238
+ }
239
+
240
+ .zdp-code-block--sm .zdp-code-block__scroller {
241
+ padding: var(--zdp-space-3);
242
+ }
243
+
244
+ .zdp-code-block--sm .zdp-code-block__pre {
245
+ font-size: var(--zdp-type-caption-size);
246
+ }
247
+ </style>