@dumiflex/wp-kit 0.3.0 → 0.5.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 +92 -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 +146 -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 +293 -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 +127 -125
- package/src/InlineEdit.vue +183 -183
- package/src/Input.vue +99 -99
- package/src/Kbd.vue +56 -56
- package/src/Lightbox.vue +176 -173
- package/src/ListFilter.vue +85 -85
- package/src/ListRow.vue +204 -204
- package/src/LoadingMark.vue +217 -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 +98 -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/highlight.ts +199 -0
- 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/loading-mark-motion.ts +249 -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/DropdownMenu.vue
CHANGED
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
/**
|
|
3
|
-
* A list of actions behind a button: the "⋯" menu, "More", "Add…". The
|
|
4
|
-
* trigger toggles it; arrows, Home/End and Enter work; Escape or a pick
|
|
5
|
-
* closes it and focus goes back to the trigger. Items are ContextMenu
|
|
6
|
-
* entries (sections, icons, dividers, danger, subtitles), so a row's
|
|
7
|
-
* right-click menu and its ⋯ menu can share one list.
|
|
8
|
-
*
|
|
9
|
-
* <DropdownMenu :items="rowActions" label="Hair colour actions">
|
|
10
|
-
* <template #trigger="{ props }"><Button v-bind="props" variant="ghost" icon="pi-ellipsis-h" aria-label="More" /></template>
|
|
11
|
-
* </DropdownMenu>
|
|
12
|
-
*/
|
|
13
|
-
import { computed, ref } from "vue";
|
|
14
|
-
import ContextMenu, { type ContextMenuEntry, type ContextMenuHeader } from "./ContextMenu.vue";
|
|
15
|
-
import type { Placement } from "./floating";
|
|
16
|
-
|
|
17
|
-
const props = withDefaults(defineProps<{
|
|
18
|
-
items: ContextMenuEntry[];
|
|
19
|
-
header?: ContextMenuHeader | undefined;
|
|
20
|
-
placement?: Placement | undefined;
|
|
21
|
-
/** Names the menu for screen readers when the trigger is an icon. */
|
|
22
|
-
label?: string | undefined;
|
|
23
|
-
}>(), { placement: "bottom-start" });
|
|
24
|
-
|
|
25
|
-
const open = ref(false);
|
|
26
|
-
const anchorEl = ref<HTMLElement | null>(null);
|
|
27
|
-
|
|
28
|
-
function trigger(): HTMLElement | null {
|
|
29
|
-
return (anchorEl.value?.firstElementChild as HTMLElement | null) ?? anchorEl.value;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function close(): void {
|
|
33
|
-
if (!open.value) return;
|
|
34
|
-
open.value = false;
|
|
35
|
-
trigger()?.focus();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const triggerProps = computed(() => ({
|
|
39
|
-
"aria-haspopup": "menu" as const,
|
|
40
|
-
"aria-expanded": open.value,
|
|
41
|
-
"aria-label": props.label,
|
|
42
|
-
onClick: () => { open.value = !open.value; },
|
|
43
|
-
onKeydown: (ev: KeyboardEvent) => {
|
|
44
|
-
if ((ev.key === "ArrowDown" || ev.key === "ArrowUp") && !open.value) {
|
|
45
|
-
ev.preventDefault();
|
|
46
|
-
open.value = true;
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
}));
|
|
50
|
-
</script>
|
|
51
|
-
|
|
52
|
-
<template>
|
|
53
|
-
<span ref="anchorEl" class="wp-dropdown-anchor">
|
|
54
|
-
<slot name="trigger" :props="triggerProps" :open="open" />
|
|
55
|
-
</span>
|
|
56
|
-
<ContextMenu
|
|
57
|
-
:visible="open"
|
|
58
|
-
:x="0"
|
|
59
|
-
:y="0"
|
|
60
|
-
:anchor="trigger()"
|
|
61
|
-
:placement="placement"
|
|
62
|
-
:items="items"
|
|
63
|
-
:header="header"
|
|
64
|
-
@close="close"
|
|
65
|
-
/>
|
|
66
|
-
</template>
|
|
67
|
-
|
|
68
|
-
<style>
|
|
69
|
-
@layer wp-extension {
|
|
70
|
-
.wp-dropdown-anchor { display: inline-flex; }
|
|
71
|
-
}
|
|
72
|
-
</style>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A list of actions behind a button: the "⋯" menu, "More", "Add…". The
|
|
4
|
+
* trigger toggles it; arrows, Home/End and Enter work; Escape or a pick
|
|
5
|
+
* closes it and focus goes back to the trigger. Items are ContextMenu
|
|
6
|
+
* entries (sections, icons, dividers, danger, subtitles), so a row's
|
|
7
|
+
* right-click menu and its ⋯ menu can share one list.
|
|
8
|
+
*
|
|
9
|
+
* <DropdownMenu :items="rowActions" label="Hair colour actions">
|
|
10
|
+
* <template #trigger="{ props }"><Button v-bind="props" variant="ghost" icon="pi-ellipsis-h" aria-label="More" /></template>
|
|
11
|
+
* </DropdownMenu>
|
|
12
|
+
*/
|
|
13
|
+
import { computed, ref } from "vue";
|
|
14
|
+
import ContextMenu, { type ContextMenuEntry, type ContextMenuHeader } from "./ContextMenu.vue";
|
|
15
|
+
import type { Placement } from "./floating";
|
|
16
|
+
|
|
17
|
+
const props = withDefaults(defineProps<{
|
|
18
|
+
items: ContextMenuEntry[];
|
|
19
|
+
header?: ContextMenuHeader | undefined;
|
|
20
|
+
placement?: Placement | undefined;
|
|
21
|
+
/** Names the menu for screen readers when the trigger is an icon. */
|
|
22
|
+
label?: string | undefined;
|
|
23
|
+
}>(), { placement: "bottom-start" });
|
|
24
|
+
|
|
25
|
+
const open = ref(false);
|
|
26
|
+
const anchorEl = ref<HTMLElement | null>(null);
|
|
27
|
+
|
|
28
|
+
function trigger(): HTMLElement | null {
|
|
29
|
+
return (anchorEl.value?.firstElementChild as HTMLElement | null) ?? anchorEl.value;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function close(): void {
|
|
33
|
+
if (!open.value) return;
|
|
34
|
+
open.value = false;
|
|
35
|
+
trigger()?.focus();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const triggerProps = computed(() => ({
|
|
39
|
+
"aria-haspopup": "menu" as const,
|
|
40
|
+
"aria-expanded": open.value,
|
|
41
|
+
"aria-label": props.label,
|
|
42
|
+
onClick: () => { open.value = !open.value; },
|
|
43
|
+
onKeydown: (ev: KeyboardEvent) => {
|
|
44
|
+
if ((ev.key === "ArrowDown" || ev.key === "ArrowUp") && !open.value) {
|
|
45
|
+
ev.preventDefault();
|
|
46
|
+
open.value = true;
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
}));
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<template>
|
|
53
|
+
<span ref="anchorEl" class="wp-dropdown-anchor">
|
|
54
|
+
<slot name="trigger" :props="triggerProps" :open="open" />
|
|
55
|
+
</span>
|
|
56
|
+
<ContextMenu
|
|
57
|
+
:visible="open"
|
|
58
|
+
:x="0"
|
|
59
|
+
:y="0"
|
|
60
|
+
:anchor="trigger()"
|
|
61
|
+
:placement="placement"
|
|
62
|
+
:items="items"
|
|
63
|
+
:header="header"
|
|
64
|
+
@close="close"
|
|
65
|
+
/>
|
|
66
|
+
</template>
|
|
67
|
+
|
|
68
|
+
<style>
|
|
69
|
+
@layer wp-extension {
|
|
70
|
+
.wp-dropdown-anchor { display: inline-flex; }
|
|
71
|
+
}
|
|
72
|
+
</style>
|
package/src/EmptyState.vue
CHANGED
|
@@ -1,111 +1,111 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import Icon from "./Icon.vue";
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
icon: string;
|
|
6
|
-
headline: string;
|
|
7
|
-
body?: string | undefined;
|
|
8
|
-
/** "library" = encouraging first-run; "no-results" = corrective for
|
|
9
|
-
* filter misses; "error" = network/permission failure with retry. */
|
|
10
|
-
variant?: "library" | "no-results" | "error" | undefined;
|
|
11
|
-
/** How much room it takes. `page` fills an empty list page, `panel` (the
|
|
12
|
-
* default) sits in a card or panel at its own height, `inline` is one
|
|
13
|
-
* compact row for a small box. */
|
|
14
|
-
size?: "page" | "panel" | "inline" | undefined;
|
|
15
|
-
}
|
|
16
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
17
|
-
variant: "library",
|
|
18
|
-
size: "panel",
|
|
19
|
-
});
|
|
20
|
-
const ICON_PX = { page: 40, panel: 26, inline: 16 } as const;
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
<template>
|
|
24
|
-
<div class="wp-empty" :class="[`wp-empty--${variant}`, `wp-empty--${props.size}`]" data-test="empty-state">
|
|
25
|
-
<div class="wp-empty__icon">
|
|
26
|
-
<Icon :name="icon" :size="ICON_PX[props.size]" />
|
|
27
|
-
</div>
|
|
28
|
-
<h3 class="wp-empty__headline">{{ headline }}</h3>
|
|
29
|
-
<p v-if="body" class="wp-empty__body">{{ body }}</p>
|
|
30
|
-
<div v-if="$slots.cta" class="wp-empty__cta">
|
|
31
|
-
<slot name="cta" />
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
</template>
|
|
35
|
-
|
|
36
|
-
<style scoped>
|
|
37
|
-
.wp-empty {
|
|
38
|
-
display: flex;
|
|
39
|
-
flex-direction: column;
|
|
40
|
-
align-items: center;
|
|
41
|
-
justify-content: center;
|
|
42
|
-
text-align: center;
|
|
43
|
-
padding: var(--wp-space-7) var(--wp-space-6);
|
|
44
|
-
gap: var(--wp-space-4);
|
|
45
|
-
box-sizing: border-box;
|
|
46
|
-
}
|
|
47
|
-
/* Page: an empty list page. The message reads as the page's content, not a
|
|
48
|
-
* line floating at the top of a tall area, but stops well short of the old
|
|
49
|
-
* 60vh that also hit cards and panels. `min-height` keeps the layout flat
|
|
50
|
-
* (no 100% chain through the table), so a full list is untouched. */
|
|
51
|
-
.wp-empty--page {
|
|
52
|
-
min-height: max(40vh, 320px);
|
|
53
|
-
padding: var(--wp-space-8) var(--wp-space-6);
|
|
54
|
-
gap: var(--wp-space-5);
|
|
55
|
-
}
|
|
56
|
-
/* Inline: one compact row for a small box or a list section. */
|
|
57
|
-
.wp-empty--inline {
|
|
58
|
-
flex-direction: row;
|
|
59
|
-
flex-wrap: wrap;
|
|
60
|
-
justify-content: flex-start;
|
|
61
|
-
text-align: left;
|
|
62
|
-
padding: var(--wp-space-4);
|
|
63
|
-
gap: var(--wp-space-3);
|
|
64
|
-
}
|
|
65
|
-
.wp-empty__icon {
|
|
66
|
-
display: inline-flex;
|
|
67
|
-
align-items: center;
|
|
68
|
-
justify-content: center;
|
|
69
|
-
flex-shrink: 0;
|
|
70
|
-
width: 52px;
|
|
71
|
-
height: 52px;
|
|
72
|
-
border-radius: var(--wp-radius-lg);
|
|
73
|
-
background: var(--wp-bg-2);
|
|
74
|
-
color: var(--wp-text-muted);
|
|
75
|
-
}
|
|
76
|
-
.wp-empty--page .wp-empty__icon { width: 80px; height: 80px; border-radius: var(--wp-radius-xl); }
|
|
77
|
-
.wp-empty--inline .wp-empty__icon { width: 28px; height: 28px; border-radius: var(--wp-radius-sm); }
|
|
78
|
-
.wp-empty--no-results .wp-empty__icon {
|
|
79
|
-
background: transparent;
|
|
80
|
-
border: 1px dashed var(--wp-border);
|
|
81
|
-
}
|
|
82
|
-
.wp-empty--error .wp-empty__icon {
|
|
83
|
-
background: color-mix(in oklab, var(--wp-danger) 12%, transparent);
|
|
84
|
-
color: var(--wp-danger);
|
|
85
|
-
border: 1px solid color-mix(in oklab, var(--wp-danger) 30%, transparent);
|
|
86
|
-
}
|
|
87
|
-
.wp-empty__headline {
|
|
88
|
-
margin: 0;
|
|
89
|
-
color: var(--wp-text);
|
|
90
|
-
font-size: var(--wp-text-md);
|
|
91
|
-
line-height: var(--wp-line-md, 1.4);
|
|
92
|
-
font-weight: var(--wp-weight-semibold);
|
|
93
|
-
}
|
|
94
|
-
.wp-empty--page .wp-empty__headline {
|
|
95
|
-
font-size: var(--wp-text-lg);
|
|
96
|
-
line-height: var(--wp-line-lg);
|
|
97
|
-
}
|
|
98
|
-
.wp-empty--inline .wp-empty__headline { font-size: var(--wp-text-base); }
|
|
99
|
-
.wp-empty__body {
|
|
100
|
-
margin: 0;
|
|
101
|
-
font-size: var(--wp-text-sm);
|
|
102
|
-
line-height: var(--wp-line-sm);
|
|
103
|
-
color: var(--wp-text-muted);
|
|
104
|
-
max-width: 360px;
|
|
105
|
-
}
|
|
106
|
-
.wp-empty--inline .wp-empty__body { flex-basis: 100%; max-width: none; padding-left: calc(28px + var(--wp-space-3)); margin-top: calc(var(--wp-space-3) * -1); }
|
|
107
|
-
.wp-empty__cta {
|
|
108
|
-
margin-top: var(--wp-space-2);
|
|
109
|
-
}
|
|
110
|
-
.wp-empty--inline .wp-empty__cta { margin: 0 0 0 auto; }
|
|
111
|
-
</style>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import Icon from "./Icon.vue";
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
icon: string;
|
|
6
|
+
headline: string;
|
|
7
|
+
body?: string | undefined;
|
|
8
|
+
/** "library" = encouraging first-run; "no-results" = corrective for
|
|
9
|
+
* filter misses; "error" = network/permission failure with retry. */
|
|
10
|
+
variant?: "library" | "no-results" | "error" | undefined;
|
|
11
|
+
/** How much room it takes. `page` fills an empty list page, `panel` (the
|
|
12
|
+
* default) sits in a card or panel at its own height, `inline` is one
|
|
13
|
+
* compact row for a small box. */
|
|
14
|
+
size?: "page" | "panel" | "inline" | undefined;
|
|
15
|
+
}
|
|
16
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
17
|
+
variant: "library",
|
|
18
|
+
size: "panel",
|
|
19
|
+
});
|
|
20
|
+
const ICON_PX = { page: 40, panel: 26, inline: 16 } as const;
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<div class="wp-empty" :class="[`wp-empty--${variant}`, `wp-empty--${props.size}`]" data-test="empty-state">
|
|
25
|
+
<div class="wp-empty__icon">
|
|
26
|
+
<Icon :name="icon" :size="ICON_PX[props.size]" />
|
|
27
|
+
</div>
|
|
28
|
+
<h3 class="wp-empty__headline">{{ headline }}</h3>
|
|
29
|
+
<p v-if="body" class="wp-empty__body">{{ body }}</p>
|
|
30
|
+
<div v-if="$slots.cta" class="wp-empty__cta">
|
|
31
|
+
<slot name="cta" />
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<style scoped>
|
|
37
|
+
.wp-empty {
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
align-items: center;
|
|
41
|
+
justify-content: center;
|
|
42
|
+
text-align: center;
|
|
43
|
+
padding: var(--wp-space-7) var(--wp-space-6);
|
|
44
|
+
gap: var(--wp-space-4);
|
|
45
|
+
box-sizing: border-box;
|
|
46
|
+
}
|
|
47
|
+
/* Page: an empty list page. The message reads as the page's content, not a
|
|
48
|
+
* line floating at the top of a tall area, but stops well short of the old
|
|
49
|
+
* 60vh that also hit cards and panels. `min-height` keeps the layout flat
|
|
50
|
+
* (no 100% chain through the table), so a full list is untouched. */
|
|
51
|
+
.wp-empty--page {
|
|
52
|
+
min-height: max(40vh, 320px);
|
|
53
|
+
padding: var(--wp-space-8) var(--wp-space-6);
|
|
54
|
+
gap: var(--wp-space-5);
|
|
55
|
+
}
|
|
56
|
+
/* Inline: one compact row for a small box or a list section. */
|
|
57
|
+
.wp-empty--inline {
|
|
58
|
+
flex-direction: row;
|
|
59
|
+
flex-wrap: wrap;
|
|
60
|
+
justify-content: flex-start;
|
|
61
|
+
text-align: left;
|
|
62
|
+
padding: var(--wp-space-4);
|
|
63
|
+
gap: var(--wp-space-3);
|
|
64
|
+
}
|
|
65
|
+
.wp-empty__icon {
|
|
66
|
+
display: inline-flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
justify-content: center;
|
|
69
|
+
flex-shrink: 0;
|
|
70
|
+
width: 52px;
|
|
71
|
+
height: 52px;
|
|
72
|
+
border-radius: var(--wp-radius-lg);
|
|
73
|
+
background: var(--wp-bg-2);
|
|
74
|
+
color: var(--wp-text-muted);
|
|
75
|
+
}
|
|
76
|
+
.wp-empty--page .wp-empty__icon { width: 80px; height: 80px; border-radius: var(--wp-radius-xl); }
|
|
77
|
+
.wp-empty--inline .wp-empty__icon { width: 28px; height: 28px; border-radius: var(--wp-radius-sm); }
|
|
78
|
+
.wp-empty--no-results .wp-empty__icon {
|
|
79
|
+
background: transparent;
|
|
80
|
+
border: 1px dashed var(--wp-border);
|
|
81
|
+
}
|
|
82
|
+
.wp-empty--error .wp-empty__icon {
|
|
83
|
+
background: color-mix(in oklab, var(--wp-danger) 12%, transparent);
|
|
84
|
+
color: var(--wp-danger);
|
|
85
|
+
border: 1px solid color-mix(in oklab, var(--wp-danger) 30%, transparent);
|
|
86
|
+
}
|
|
87
|
+
.wp-empty__headline {
|
|
88
|
+
margin: 0;
|
|
89
|
+
color: var(--wp-text);
|
|
90
|
+
font-size: var(--wp-text-md);
|
|
91
|
+
line-height: var(--wp-line-md, 1.4);
|
|
92
|
+
font-weight: var(--wp-weight-semibold);
|
|
93
|
+
}
|
|
94
|
+
.wp-empty--page .wp-empty__headline {
|
|
95
|
+
font-size: var(--wp-text-lg);
|
|
96
|
+
line-height: var(--wp-line-lg);
|
|
97
|
+
}
|
|
98
|
+
.wp-empty--inline .wp-empty__headline { font-size: var(--wp-text-base); }
|
|
99
|
+
.wp-empty__body {
|
|
100
|
+
margin: 0;
|
|
101
|
+
font-size: var(--wp-text-sm);
|
|
102
|
+
line-height: var(--wp-line-sm);
|
|
103
|
+
color: var(--wp-text-muted);
|
|
104
|
+
max-width: 360px;
|
|
105
|
+
}
|
|
106
|
+
.wp-empty--inline .wp-empty__body { flex-basis: 100%; max-width: none; padding-left: calc(28px + var(--wp-space-3)); margin-top: calc(var(--wp-space-3) * -1); }
|
|
107
|
+
.wp-empty__cta {
|
|
108
|
+
margin-top: var(--wp-space-2);
|
|
109
|
+
}
|
|
110
|
+
.wp-empty--inline .wp-empty__cta { margin: 0 0 0 auto; }
|
|
111
|
+
</style>
|
package/src/Field.vue
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed } from "vue";
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
label?: string | undefined;
|
|
6
|
-
hint?: string | undefined;
|
|
7
|
-
error?: string | undefined;
|
|
8
|
-
for?: string | undefined;
|
|
9
|
-
required?: boolean | undefined;
|
|
10
|
-
}
|
|
11
|
-
const props = defineProps<Props>();
|
|
12
|
-
|
|
13
|
-
const classes = computed(() => [
|
|
14
|
-
"wp-field",
|
|
15
|
-
props.error && "wp-field--error",
|
|
16
|
-
]);
|
|
17
|
-
</script>
|
|
18
|
-
|
|
19
|
-
<template>
|
|
20
|
-
<div :class="classes">
|
|
21
|
-
<label v-if="label" :for="props.for" class="wp-field__label">
|
|
22
|
-
{{ label }}<span v-if="required" aria-hidden="true"> *</span>
|
|
23
|
-
</label>
|
|
24
|
-
<slot :ariaInvalid="!!error" />
|
|
25
|
-
<div v-if="error" class="wp-field__error" role="alert">{{ error }}</div>
|
|
26
|
-
<div v-else-if="hint" class="wp-field__hint">{{ hint }}</div>
|
|
27
|
-
</div>
|
|
28
|
-
</template>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
label?: string | undefined;
|
|
6
|
+
hint?: string | undefined;
|
|
7
|
+
error?: string | undefined;
|
|
8
|
+
for?: string | undefined;
|
|
9
|
+
required?: boolean | undefined;
|
|
10
|
+
}
|
|
11
|
+
const props = defineProps<Props>();
|
|
12
|
+
|
|
13
|
+
const classes = computed(() => [
|
|
14
|
+
"wp-field",
|
|
15
|
+
props.error && "wp-field--error",
|
|
16
|
+
]);
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<div :class="classes">
|
|
21
|
+
<label v-if="label" :for="props.for" class="wp-field__label">
|
|
22
|
+
{{ label }}<span v-if="required" aria-hidden="true"> *</span>
|
|
23
|
+
</label>
|
|
24
|
+
<slot :ariaInvalid="!!error" />
|
|
25
|
+
<div v-if="error" class="wp-field__error" role="alert">{{ error }}</div>
|
|
26
|
+
<div v-else-if="hint" class="wp-field__hint">{{ hint }}</div>
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|