@dumiflex/wp-kit 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +77 -51
- package/LICENSE +674 -674
- package/README.md +73 -76
- package/package.json +78 -77
- package/src/Avatar.vue +83 -83
- package/src/Badge.vue +97 -97
- package/src/Banner.vue +118 -118
- package/src/BookmarkButton.vue +27 -27
- package/src/BundleMeta.vue +51 -51
- package/src/Button.vue +103 -103
- package/src/Card.vue +68 -68
- package/src/Checkbox.vue +109 -107
- package/src/Chip.vue +163 -97
- package/src/ChoiceCards.vue +133 -133
- package/src/CloseButton.vue +69 -69
- package/src/CodeBlock.vue +119 -119
- package/src/ColorField.vue +188 -206
- package/src/ColorPicker.vue +201 -201
- package/src/Combobox.vue +331 -334
- package/src/ConfirmDialog.vue +165 -163
- package/src/ConfirmModal.vue +147 -147
- package/src/ConstraintMatrixPreview.vue +708 -708
- package/src/ContextMenu.vue +386 -379
- package/src/CopyButton.vue +156 -156
- package/src/DataTable.vue +292 -292
- package/src/DatePicker.vue +234 -234
- package/src/DescriptionList.vue +73 -73
- package/src/DiffView.vue +68 -68
- package/src/Disclosure.vue +166 -166
- package/src/DragHandle.vue +49 -49
- package/src/Drawer.vue +131 -131
- package/src/DropZone.vue +196 -196
- package/src/DropdownMenu.vue +72 -72
- package/src/EmptyState.vue +111 -111
- package/src/Field.vue +28 -28
- package/src/HsvPicker.vue +208 -208
- package/src/Icon.vue +39 -39
- package/src/IconPicker.vue +209 -209
- package/src/ImageGrid.vue +125 -125
- package/src/InlineEdit.vue +183 -183
- package/src/Input.vue +99 -99
- package/src/Kbd.vue +56 -56
- package/src/Lightbox.vue +173 -173
- package/src/ListFilter.vue +85 -85
- package/src/ListRow.vue +204 -204
- package/src/LoadingMark.vue +175 -161
- package/src/Logo.vue +60 -60
- package/src/Modal.vue +78 -76
- package/src/ModalShell.vue +109 -107
- package/src/Pagination.vue +106 -106
- package/src/Popover.vue +180 -171
- package/src/PostCard.vue +210 -211
- package/src/ProgressBar.vue +90 -90
- package/src/RadioGroup.vue +177 -177
- package/src/RangeSlider.vue +183 -183
- package/src/RelativeDate.vue +35 -35
- package/src/ResizeHandle.vue +143 -143
- package/src/SearchInput.vue +192 -199
- package/src/Select.vue +644 -641
- package/src/Separator.vue +54 -54
- package/src/Skeleton.vue +82 -82
- package/src/Slider.vue +198 -198
- package/src/SortableList.vue +260 -260
- package/src/SplitPane.vue +68 -68
- package/src/StarButton.vue +40 -40
- package/src/Stepper.vue +141 -141
- package/src/SupportLinks.vue +93 -93
- package/src/TagInput.vue +297 -300
- package/src/Textarea.vue +57 -57
- package/src/Timeline.vue +92 -92
- package/src/ToastCard.vue +119 -119
- package/src/ToastHost.vue +40 -40
- package/src/Toggle.vue +36 -36
- package/src/TokenizedValue.vue +310 -310
- package/src/Toolbar.vue +110 -110
- package/src/VirtualList.vue +87 -87
- package/src/VisuallyHidden.vue +29 -29
- package/src/WpButton.vue +75 -75
- package/src/WpCheck.vue +104 -102
- package/src/WpIconButton.vue +107 -107
- package/src/WpImageZoom.vue +544 -544
- package/src/WpNumber.vue +178 -183
- package/src/WpSegmented.vue +175 -175
- package/src/WpSelect.vue +93 -89
- package/src/WpSwitch.vue +163 -163
- package/src/WpTabs.vue +188 -188
- package/src/_modal-motion.css +33 -33
- package/src/_skeleton.css +50 -50
- package/src/axis-color.ts +42 -42
- package/src/button.css +169 -169
- package/src/calendar.ts +59 -59
- package/src/clipboard.ts +50 -50
- package/src/colour-presets.ts +12 -12
- package/src/diff.ts +51 -51
- package/src/drop-zone.ts +41 -41
- package/src/field.css +50 -0
- package/src/flip.ts +237 -237
- package/src/floating-layer.ts +48 -0
- package/src/floating.ts +99 -99
- package/src/hsv.ts +100 -100
- package/src/icon-catalog.ts +52 -52
- package/src/image-zoom.ts +93 -93
- package/src/kind-colour.ts +28 -0
- package/src/logo-paths.ts +21 -21
- package/src/matrix-axis.ts +91 -91
- package/src/pagination.ts +27 -27
- package/src/platform-keys.ts +29 -29
- package/src/rich-tokenize.ts +357 -357
- package/src/select-types.ts +32 -32
- package/src/slider-math.ts +45 -45
- package/src/sortable.ts +22 -22
- package/src/theme/fonts/OFL-Fraunces.txt +93 -93
- package/src/theme/fonts/OFL-JetBrainsMono.txt +93 -93
- package/src/theme/fonts/OFL-Manrope.txt +93 -93
- package/src/theme/looks.css +428 -428
- package/src/theme/palettes.css +254 -254
- package/src/theme/tokens.css +2896 -2894
- package/src/tokens.ts +56 -56
- package/src/tooltip.css +43 -43
- package/src/tooltip.ts +146 -146
- package/src/useDialogFocus.ts +73 -73
- package/src/useGrowableField.ts +357 -357
- package/src/useModalKeyShield.ts +116 -116
- package/src/useToast.ts +48 -48
- package/src/wp-logo.svg +14 -14
- package/src/ChipToggle.vue +0 -92
- package/src/KindChip.vue +0 -53
- package/src/RatingBadge.vue +0 -42
package/src/CopyButton.vue
CHANGED
|
@@ -1,156 +1,156 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
/**
|
|
3
|
-
* Copy button: copies text and says so in place. The icon turns into a
|
|
4
|
-
* check ("Copied") or a cross ("Couldn't copy") for a moment, the tooltip
|
|
5
|
-
* and a polite live region say the same, so the message is the same
|
|
6
|
-
* everywhere and nobody needs a toast for it. Works on the canvas and in the
|
|
7
|
-
* manager, and on plain-http pages (see `clipboard.ts`).
|
|
8
|
-
*
|
|
9
|
-
* <CopyButton :text="prompt" label="Copy prompt" />
|
|
10
|
-
* <CopyButton :text="() => buildExport()" label="Copy JSON" show-label />
|
|
11
|
-
*
|
|
12
|
-
* `text` may be a function (also async) so costly text is built on click.
|
|
13
|
-
*
|
|
14
|
-
* With slot content it is an inline copy target instead (an id in a row):
|
|
15
|
-
* the slot is the visible text, styled by the caller, and the icon shows on
|
|
16
|
-
* hover, on focus and after a copy.
|
|
17
|
-
*
|
|
18
|
-
* <CopyButton :text="row.id" :label="`Copy ID ${row.id}`" class="wp-id">{{ row.id }}</CopyButton>
|
|
19
|
-
*/
|
|
20
|
-
import { computed, onBeforeUnmount, ref, useSlots } from "vue";
|
|
21
|
-
import { copyText } from "./clipboard";
|
|
22
|
-
import { vTooltip } from "./tooltip";
|
|
23
|
-
|
|
24
|
-
const props = withDefaults(defineProps<{
|
|
25
|
-
text: string | (() => string | Promise<string>);
|
|
26
|
-
/** The button's name and tooltip, e.g. "Copy prompt". */
|
|
27
|
-
label?: string | undefined;
|
|
28
|
-
/** Show the label next to the icon. */
|
|
29
|
-
showLabel?: boolean | undefined;
|
|
30
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
31
|
-
/** `ghost` (default) for rows and toolbars, `secondary` for a filled button. */
|
|
32
|
-
variant?: "ghost" | "secondary" | undefined;
|
|
33
|
-
disabled?: boolean | undefined;
|
|
34
|
-
/** The PrimeIcons class shown before a copy, e.g. "pi-link" for a link. */
|
|
35
|
-
icon?: string | undefined;
|
|
36
|
-
}>(), { icon: "pi-copy", label: "Copy", size: "md", variant: "ghost" });
|
|
37
|
-
|
|
38
|
-
const emit = defineEmits<{ (e: "copied", text: string): void; (e: "failed"): void }>();
|
|
39
|
-
|
|
40
|
-
const slots = useSlots();
|
|
41
|
-
const state = ref<"idle" | "copied" | "failed">("idle");
|
|
42
|
-
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
43
|
-
const RESET_MS = 1600;
|
|
44
|
-
|
|
45
|
-
const shown = computed(() =>
|
|
46
|
-
state.value === "copied" ? "Copied" : state.value === "failed" ? "Couldn't copy" : props.label);
|
|
47
|
-
const icon = computed(() =>
|
|
48
|
-
state.value === "copied" ? "pi-check" : state.value === "failed" ? "pi-times" : props.icon);
|
|
49
|
-
|
|
50
|
-
async function onClick(): Promise<void> {
|
|
51
|
-
if (props.disabled) return;
|
|
52
|
-
let value = "";
|
|
53
|
-
try {
|
|
54
|
-
value = typeof props.text === "function" ? await props.text() : props.text;
|
|
55
|
-
} catch {
|
|
56
|
-
value = "";
|
|
57
|
-
}
|
|
58
|
-
const ok = value !== "" && await copyText(value);
|
|
59
|
-
state.value = ok ? "copied" : "failed";
|
|
60
|
-
if (ok) emit("copied", value);
|
|
61
|
-
else emit("failed");
|
|
62
|
-
clearTimeout(timer);
|
|
63
|
-
timer = setTimeout(() => { state.value = "idle"; }, RESET_MS);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
onBeforeUnmount(() => clearTimeout(timer));
|
|
67
|
-
</script>
|
|
68
|
-
|
|
69
|
-
<template>
|
|
70
|
-
<button
|
|
71
|
-
v-tooltip="showLabel ? null : shown"
|
|
72
|
-
:data-inline="slots.default ? 'true' : undefined"
|
|
73
|
-
type="button"
|
|
74
|
-
class="wp-copy-btn"
|
|
75
|
-
:data-size="size"
|
|
76
|
-
:data-variant="variant"
|
|
77
|
-
:data-state="state"
|
|
78
|
-
:data-labelled="showLabel || undefined"
|
|
79
|
-
:aria-label="showLabel ? undefined : label"
|
|
80
|
-
:disabled="disabled"
|
|
81
|
-
@click="onClick"
|
|
82
|
-
>
|
|
83
|
-
<template v-if="slots.default">
|
|
84
|
-
<slot />
|
|
85
|
-
<i class="pi wp-copy-btn__inline-icon" :class="icon" aria-hidden="true" />
|
|
86
|
-
</template>
|
|
87
|
-
<template v-else>
|
|
88
|
-
<i class="pi" :class="icon" aria-hidden="true" />
|
|
89
|
-
<span v-if="showLabel" class="wp-copy-btn__text">{{ shown }}</span>
|
|
90
|
-
</template>
|
|
91
|
-
<span class="wp-copy-btn__live" aria-live="polite">{{ state === "idle" ? "" : shown }}</span>
|
|
92
|
-
</button>
|
|
93
|
-
</template>
|
|
94
|
-
|
|
95
|
-
<style scoped>
|
|
96
|
-
.wp-copy-btn { position: relative; }
|
|
97
|
-
.wp-copy-btn:not([data-inline]) {
|
|
98
|
-
display: inline-flex;
|
|
99
|
-
align-items: center;
|
|
100
|
-
justify-content: center;
|
|
101
|
-
gap: 6px;
|
|
102
|
-
flex: none;
|
|
103
|
-
min-width: var(--wp-control-h-md);
|
|
104
|
-
height: var(--wp-control-h-md);
|
|
105
|
-
margin: 0;
|
|
106
|
-
padding: 0;
|
|
107
|
-
border: 1px solid transparent;
|
|
108
|
-
border-radius: var(--wp-radius);
|
|
109
|
-
background: transparent;
|
|
110
|
-
color: var(--wp-text-muted);
|
|
111
|
-
font: 500 var(--wp-text-sm)/1 var(--wp-font-sans);
|
|
112
|
-
white-space: nowrap;
|
|
113
|
-
cursor: pointer;
|
|
114
|
-
transition: background var(--wp-motion-hover), color var(--wp-motion-hover), border-color var(--wp-motion-hover);
|
|
115
|
-
}
|
|
116
|
-
.wp-copy-btn[data-labelled] { padding: 0 var(--wp-space-5); }
|
|
117
|
-
.wp-copy-btn[data-size="sm"] { min-width: var(--wp-control-h-sm); height: var(--wp-control-h-sm); border-radius: var(--wp-radius-sm); font-size: var(--wp-text-xs); gap: 4px; }
|
|
118
|
-
.wp-copy-btn[data-size="sm"][data-labelled] { padding: 0 var(--wp-space-4); }
|
|
119
|
-
.wp-copy-btn[data-size="lg"] { min-width: var(--wp-control-h-lg); height: var(--wp-control-h-lg); }
|
|
120
|
-
.wp-copy-btn[data-variant="secondary"] { background: var(--wp-bg-3); border-color: var(--wp-border); color: var(--wp-text); }
|
|
121
|
-
.wp-copy-btn:not([data-inline]) .pi { font-size: 12px; }
|
|
122
|
-
.wp-copy-btn[data-size="sm"]:not([data-inline]) .pi { font-size: 11px; }
|
|
123
|
-
.wp-copy-btn:not([data-inline]):hover:not(:disabled) { background: var(--wp-bg-3); border-color: var(--wp-border); color: var(--wp-text); }
|
|
124
|
-
.wp-copy-btn[data-variant="secondary"]:hover:not(:disabled) { background: var(--wp-bg-4); border-color: var(--wp-border-strong); }
|
|
125
|
-
.wp-copy-btn:not([data-inline]):focus-visible { outline: none; box-shadow: 0 0 0 2px var(--wp-border-focus); }
|
|
126
|
-
.wp-copy-btn:disabled { opacity: 0.45; cursor: not-allowed; }
|
|
127
|
-
.wp-copy-btn[data-state="copied"] .pi { color: var(--wp-success); }
|
|
128
|
-
.wp-copy-btn[data-state="failed"] .pi { color: var(--wp-danger); }
|
|
129
|
-
/* Inline: the caller's class draws the text; only the icon is ours. */
|
|
130
|
-
.wp-copy-btn[data-inline] {
|
|
131
|
-
display: inline-flex;
|
|
132
|
-
align-items: center;
|
|
133
|
-
gap: 4px;
|
|
134
|
-
margin: 0;
|
|
135
|
-
border: 0;
|
|
136
|
-
border-radius: var(--wp-radius-sm);
|
|
137
|
-
text-align: left;
|
|
138
|
-
cursor: copy;
|
|
139
|
-
}
|
|
140
|
-
.wp-copy-btn[data-inline]:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--wp-border-focus); }
|
|
141
|
-
.wp-copy-btn__inline-icon { font-size: 0.85em; opacity: 0; transition: opacity var(--wp-motion-hover); }
|
|
142
|
-
.wp-copy-btn[data-inline]:hover .wp-copy-btn__inline-icon,
|
|
143
|
-
.wp-copy-btn[data-inline]:focus-visible .wp-copy-btn__inline-icon,
|
|
144
|
-
.wp-copy-btn[data-inline]:not([data-state="idle"]) .wp-copy-btn__inline-icon { opacity: 1; }
|
|
145
|
-
.wp-copy-btn__live {
|
|
146
|
-
position: absolute;
|
|
147
|
-
width: 1px;
|
|
148
|
-
height: 1px;
|
|
149
|
-
overflow: hidden;
|
|
150
|
-
clip-path: inset(50%);
|
|
151
|
-
white-space: nowrap;
|
|
152
|
-
}
|
|
153
|
-
@media (prefers-reduced-motion: reduce) {
|
|
154
|
-
.wp-copy-btn { transition: none; }
|
|
155
|
-
}
|
|
156
|
-
</style>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Copy button: copies text and says so in place. The icon turns into a
|
|
4
|
+
* check ("Copied") or a cross ("Couldn't copy") for a moment, the tooltip
|
|
5
|
+
* and a polite live region say the same, so the message is the same
|
|
6
|
+
* everywhere and nobody needs a toast for it. Works on the canvas and in the
|
|
7
|
+
* manager, and on plain-http pages (see `clipboard.ts`).
|
|
8
|
+
*
|
|
9
|
+
* <CopyButton :text="prompt" label="Copy prompt" />
|
|
10
|
+
* <CopyButton :text="() => buildExport()" label="Copy JSON" show-label />
|
|
11
|
+
*
|
|
12
|
+
* `text` may be a function (also async) so costly text is built on click.
|
|
13
|
+
*
|
|
14
|
+
* With slot content it is an inline copy target instead (an id in a row):
|
|
15
|
+
* the slot is the visible text, styled by the caller, and the icon shows on
|
|
16
|
+
* hover, on focus and after a copy.
|
|
17
|
+
*
|
|
18
|
+
* <CopyButton :text="row.id" :label="`Copy ID ${row.id}`" class="wp-id">{{ row.id }}</CopyButton>
|
|
19
|
+
*/
|
|
20
|
+
import { computed, onBeforeUnmount, ref, useSlots } from "vue";
|
|
21
|
+
import { copyText } from "./clipboard";
|
|
22
|
+
import { vTooltip } from "./tooltip";
|
|
23
|
+
|
|
24
|
+
const props = withDefaults(defineProps<{
|
|
25
|
+
text: string | (() => string | Promise<string>);
|
|
26
|
+
/** The button's name and tooltip, e.g. "Copy prompt". */
|
|
27
|
+
label?: string | undefined;
|
|
28
|
+
/** Show the label next to the icon. */
|
|
29
|
+
showLabel?: boolean | undefined;
|
|
30
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
31
|
+
/** `ghost` (default) for rows and toolbars, `secondary` for a filled button. */
|
|
32
|
+
variant?: "ghost" | "secondary" | undefined;
|
|
33
|
+
disabled?: boolean | undefined;
|
|
34
|
+
/** The PrimeIcons class shown before a copy, e.g. "pi-link" for a link. */
|
|
35
|
+
icon?: string | undefined;
|
|
36
|
+
}>(), { icon: "pi-copy", label: "Copy", size: "md", variant: "ghost" });
|
|
37
|
+
|
|
38
|
+
const emit = defineEmits<{ (e: "copied", text: string): void; (e: "failed"): void }>();
|
|
39
|
+
|
|
40
|
+
const slots = useSlots();
|
|
41
|
+
const state = ref<"idle" | "copied" | "failed">("idle");
|
|
42
|
+
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
43
|
+
const RESET_MS = 1600;
|
|
44
|
+
|
|
45
|
+
const shown = computed(() =>
|
|
46
|
+
state.value === "copied" ? "Copied" : state.value === "failed" ? "Couldn't copy" : props.label);
|
|
47
|
+
const icon = computed(() =>
|
|
48
|
+
state.value === "copied" ? "pi-check" : state.value === "failed" ? "pi-times" : props.icon);
|
|
49
|
+
|
|
50
|
+
async function onClick(): Promise<void> {
|
|
51
|
+
if (props.disabled) return;
|
|
52
|
+
let value = "";
|
|
53
|
+
try {
|
|
54
|
+
value = typeof props.text === "function" ? await props.text() : props.text;
|
|
55
|
+
} catch {
|
|
56
|
+
value = "";
|
|
57
|
+
}
|
|
58
|
+
const ok = value !== "" && await copyText(value);
|
|
59
|
+
state.value = ok ? "copied" : "failed";
|
|
60
|
+
if (ok) emit("copied", value);
|
|
61
|
+
else emit("failed");
|
|
62
|
+
clearTimeout(timer);
|
|
63
|
+
timer = setTimeout(() => { state.value = "idle"; }, RESET_MS);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
onBeforeUnmount(() => clearTimeout(timer));
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
<template>
|
|
70
|
+
<button
|
|
71
|
+
v-tooltip="showLabel ? null : shown"
|
|
72
|
+
:data-inline="slots.default ? 'true' : undefined"
|
|
73
|
+
type="button"
|
|
74
|
+
class="wp-copy-btn"
|
|
75
|
+
:data-size="size"
|
|
76
|
+
:data-variant="variant"
|
|
77
|
+
:data-state="state"
|
|
78
|
+
:data-labelled="showLabel || undefined"
|
|
79
|
+
:aria-label="showLabel ? undefined : label"
|
|
80
|
+
:disabled="disabled"
|
|
81
|
+
@click="onClick"
|
|
82
|
+
>
|
|
83
|
+
<template v-if="slots.default">
|
|
84
|
+
<slot />
|
|
85
|
+
<i class="pi wp-copy-btn__inline-icon" :class="icon" aria-hidden="true" />
|
|
86
|
+
</template>
|
|
87
|
+
<template v-else>
|
|
88
|
+
<i class="pi" :class="icon" aria-hidden="true" />
|
|
89
|
+
<span v-if="showLabel" class="wp-copy-btn__text">{{ shown }}</span>
|
|
90
|
+
</template>
|
|
91
|
+
<span class="wp-copy-btn__live" aria-live="polite">{{ state === "idle" ? "" : shown }}</span>
|
|
92
|
+
</button>
|
|
93
|
+
</template>
|
|
94
|
+
|
|
95
|
+
<style scoped>
|
|
96
|
+
.wp-copy-btn { position: relative; }
|
|
97
|
+
.wp-copy-btn:not([data-inline]) {
|
|
98
|
+
display: inline-flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
justify-content: center;
|
|
101
|
+
gap: 6px;
|
|
102
|
+
flex: none;
|
|
103
|
+
min-width: var(--wp-control-h-md);
|
|
104
|
+
height: var(--wp-control-h-md);
|
|
105
|
+
margin: 0;
|
|
106
|
+
padding: 0;
|
|
107
|
+
border: 1px solid transparent;
|
|
108
|
+
border-radius: var(--wp-radius);
|
|
109
|
+
background: transparent;
|
|
110
|
+
color: var(--wp-text-muted);
|
|
111
|
+
font: 500 var(--wp-text-sm)/1 var(--wp-font-sans);
|
|
112
|
+
white-space: nowrap;
|
|
113
|
+
cursor: pointer;
|
|
114
|
+
transition: background var(--wp-motion-hover), color var(--wp-motion-hover), border-color var(--wp-motion-hover);
|
|
115
|
+
}
|
|
116
|
+
.wp-copy-btn[data-labelled] { padding: 0 var(--wp-space-5); }
|
|
117
|
+
.wp-copy-btn[data-size="sm"] { min-width: var(--wp-control-h-sm); height: var(--wp-control-h-sm); border-radius: var(--wp-radius-sm); font-size: var(--wp-text-xs); gap: 4px; }
|
|
118
|
+
.wp-copy-btn[data-size="sm"][data-labelled] { padding: 0 var(--wp-space-4); }
|
|
119
|
+
.wp-copy-btn[data-size="lg"] { min-width: var(--wp-control-h-lg); height: var(--wp-control-h-lg); }
|
|
120
|
+
.wp-copy-btn[data-variant="secondary"] { background: var(--wp-bg-3); border-color: var(--wp-border); color: var(--wp-text); }
|
|
121
|
+
.wp-copy-btn:not([data-inline]) .pi { font-size: 12px; }
|
|
122
|
+
.wp-copy-btn[data-size="sm"]:not([data-inline]) .pi { font-size: 11px; }
|
|
123
|
+
.wp-copy-btn:not([data-inline]):hover:not(:disabled) { background: var(--wp-bg-3); border-color: var(--wp-border); color: var(--wp-text); }
|
|
124
|
+
.wp-copy-btn[data-variant="secondary"]:hover:not(:disabled) { background: var(--wp-bg-4); border-color: var(--wp-border-strong); }
|
|
125
|
+
.wp-copy-btn:not([data-inline]):focus-visible { outline: none; box-shadow: 0 0 0 2px var(--wp-border-focus); }
|
|
126
|
+
.wp-copy-btn:disabled { opacity: 0.45; cursor: not-allowed; }
|
|
127
|
+
.wp-copy-btn[data-state="copied"] .pi { color: var(--wp-success); }
|
|
128
|
+
.wp-copy-btn[data-state="failed"] .pi { color: var(--wp-danger); }
|
|
129
|
+
/* Inline: the caller's class draws the text; only the icon is ours. */
|
|
130
|
+
.wp-copy-btn[data-inline] {
|
|
131
|
+
display: inline-flex;
|
|
132
|
+
align-items: center;
|
|
133
|
+
gap: 4px;
|
|
134
|
+
margin: 0;
|
|
135
|
+
border: 0;
|
|
136
|
+
border-radius: var(--wp-radius-sm);
|
|
137
|
+
text-align: left;
|
|
138
|
+
cursor: copy;
|
|
139
|
+
}
|
|
140
|
+
.wp-copy-btn[data-inline]:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--wp-border-focus); }
|
|
141
|
+
.wp-copy-btn__inline-icon { font-size: 0.85em; opacity: 0; transition: opacity var(--wp-motion-hover); }
|
|
142
|
+
.wp-copy-btn[data-inline]:hover .wp-copy-btn__inline-icon,
|
|
143
|
+
.wp-copy-btn[data-inline]:focus-visible .wp-copy-btn__inline-icon,
|
|
144
|
+
.wp-copy-btn[data-inline]:not([data-state="idle"]) .wp-copy-btn__inline-icon { opacity: 1; }
|
|
145
|
+
.wp-copy-btn__live {
|
|
146
|
+
position: absolute;
|
|
147
|
+
width: 1px;
|
|
148
|
+
height: 1px;
|
|
149
|
+
overflow: hidden;
|
|
150
|
+
clip-path: inset(50%);
|
|
151
|
+
white-space: nowrap;
|
|
152
|
+
}
|
|
153
|
+
@media (prefers-reduced-motion: reduce) {
|
|
154
|
+
.wp-copy-btn { transition: none; }
|
|
155
|
+
}
|
|
156
|
+
</style>
|