@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.
Files changed (130) hide show
  1. package/CHANGELOG.md +92 -51
  2. package/LICENSE +674 -674
  3. package/README.md +73 -76
  4. package/package.json +78 -77
  5. package/src/Avatar.vue +83 -83
  6. package/src/Badge.vue +97 -97
  7. package/src/Banner.vue +118 -118
  8. package/src/BookmarkButton.vue +27 -27
  9. package/src/BundleMeta.vue +51 -51
  10. package/src/Button.vue +103 -103
  11. package/src/Card.vue +68 -68
  12. package/src/Checkbox.vue +109 -107
  13. package/src/Chip.vue +163 -97
  14. package/src/ChoiceCards.vue +133 -133
  15. package/src/CloseButton.vue +69 -69
  16. package/src/CodeBlock.vue +146 -119
  17. package/src/ColorField.vue +188 -206
  18. package/src/ColorPicker.vue +201 -201
  19. package/src/Combobox.vue +331 -334
  20. package/src/ConfirmDialog.vue +165 -163
  21. package/src/ConfirmModal.vue +147 -147
  22. package/src/ConstraintMatrixPreview.vue +708 -708
  23. package/src/ContextMenu.vue +386 -379
  24. package/src/CopyButton.vue +156 -156
  25. package/src/DataTable.vue +293 -292
  26. package/src/DatePicker.vue +234 -234
  27. package/src/DescriptionList.vue +73 -73
  28. package/src/DiffView.vue +68 -68
  29. package/src/Disclosure.vue +166 -166
  30. package/src/DragHandle.vue +49 -49
  31. package/src/Drawer.vue +131 -131
  32. package/src/DropZone.vue +196 -196
  33. package/src/DropdownMenu.vue +72 -72
  34. package/src/EmptyState.vue +111 -111
  35. package/src/Field.vue +28 -28
  36. package/src/HsvPicker.vue +208 -208
  37. package/src/Icon.vue +39 -39
  38. package/src/IconPicker.vue +209 -209
  39. package/src/ImageGrid.vue +127 -125
  40. package/src/InlineEdit.vue +183 -183
  41. package/src/Input.vue +99 -99
  42. package/src/Kbd.vue +56 -56
  43. package/src/Lightbox.vue +176 -173
  44. package/src/ListFilter.vue +85 -85
  45. package/src/ListRow.vue +204 -204
  46. package/src/LoadingMark.vue +217 -161
  47. package/src/Logo.vue +60 -60
  48. package/src/Modal.vue +78 -76
  49. package/src/ModalShell.vue +109 -107
  50. package/src/Pagination.vue +106 -106
  51. package/src/Popover.vue +180 -171
  52. package/src/PostCard.vue +210 -211
  53. package/src/ProgressBar.vue +90 -90
  54. package/src/RadioGroup.vue +177 -177
  55. package/src/RangeSlider.vue +183 -183
  56. package/src/RelativeDate.vue +35 -35
  57. package/src/ResizeHandle.vue +143 -143
  58. package/src/SearchInput.vue +192 -199
  59. package/src/Select.vue +644 -641
  60. package/src/Separator.vue +54 -54
  61. package/src/Skeleton.vue +98 -82
  62. package/src/Slider.vue +198 -198
  63. package/src/SortableList.vue +260 -260
  64. package/src/SplitPane.vue +68 -68
  65. package/src/StarButton.vue +40 -40
  66. package/src/Stepper.vue +141 -141
  67. package/src/SupportLinks.vue +93 -93
  68. package/src/TagInput.vue +297 -300
  69. package/src/Textarea.vue +57 -57
  70. package/src/Timeline.vue +92 -92
  71. package/src/ToastCard.vue +119 -119
  72. package/src/ToastHost.vue +40 -40
  73. package/src/Toggle.vue +36 -36
  74. package/src/TokenizedValue.vue +310 -310
  75. package/src/Toolbar.vue +110 -110
  76. package/src/VirtualList.vue +87 -87
  77. package/src/VisuallyHidden.vue +29 -29
  78. package/src/WpButton.vue +75 -75
  79. package/src/WpCheck.vue +104 -102
  80. package/src/WpIconButton.vue +107 -107
  81. package/src/WpImageZoom.vue +544 -544
  82. package/src/WpNumber.vue +178 -183
  83. package/src/WpSegmented.vue +175 -175
  84. package/src/WpSelect.vue +93 -89
  85. package/src/WpSwitch.vue +163 -163
  86. package/src/WpTabs.vue +188 -188
  87. package/src/_modal-motion.css +33 -33
  88. package/src/_skeleton.css +50 -50
  89. package/src/axis-color.ts +42 -42
  90. package/src/button.css +169 -169
  91. package/src/calendar.ts +59 -59
  92. package/src/clipboard.ts +50 -50
  93. package/src/colour-presets.ts +12 -12
  94. package/src/diff.ts +51 -51
  95. package/src/drop-zone.ts +41 -41
  96. package/src/field.css +50 -0
  97. package/src/flip.ts +237 -237
  98. package/src/floating-layer.ts +48 -0
  99. package/src/floating.ts +99 -99
  100. package/src/highlight.ts +199 -0
  101. package/src/hsv.ts +100 -100
  102. package/src/icon-catalog.ts +52 -52
  103. package/src/image-zoom.ts +93 -93
  104. package/src/kind-colour.ts +28 -0
  105. package/src/loading-mark-motion.ts +249 -0
  106. package/src/logo-paths.ts +21 -21
  107. package/src/matrix-axis.ts +91 -91
  108. package/src/pagination.ts +27 -27
  109. package/src/platform-keys.ts +29 -29
  110. package/src/rich-tokenize.ts +357 -357
  111. package/src/select-types.ts +32 -32
  112. package/src/slider-math.ts +45 -45
  113. package/src/sortable.ts +22 -22
  114. package/src/theme/fonts/OFL-Fraunces.txt +93 -93
  115. package/src/theme/fonts/OFL-JetBrainsMono.txt +93 -93
  116. package/src/theme/fonts/OFL-Manrope.txt +93 -93
  117. package/src/theme/looks.css +428 -428
  118. package/src/theme/palettes.css +254 -254
  119. package/src/theme/tokens.css +2896 -2894
  120. package/src/tokens.ts +56 -56
  121. package/src/tooltip.css +43 -43
  122. package/src/tooltip.ts +146 -146
  123. package/src/useDialogFocus.ts +73 -73
  124. package/src/useGrowableField.ts +357 -357
  125. package/src/useModalKeyShield.ts +116 -116
  126. package/src/useToast.ts +48 -48
  127. package/src/wp-logo.svg +14 -14
  128. package/src/ChipToggle.vue +0 -92
  129. package/src/KindChip.vue +0 -53
  130. package/src/RatingBadge.vue +0 -42
package/src/Input.vue CHANGED
@@ -1,99 +1,99 @@
1
- <script setup lang="ts">
2
- /**
3
- * Text field. Number fields use WpNumber (`WpNumber.vue`)
4
- * and search boxes use SearchInput; this one no longer has a number mode.
5
- */
6
- import { computed } from "vue";
7
- import Icon from "./Icon.vue";
8
-
9
- interface Props {
10
- modelValue: string;
11
- type?: "text" | "email" | "url" | "password" | "tel" | undefined;
12
- placeholder?: string | undefined;
13
- disabled?: boolean | undefined;
14
- /** Shown but not editable: dimmer fill, no focus ring, a lock icon. */
15
- readonly?: boolean | undefined;
16
- error?: boolean | undefined;
17
- /** Height on the control scale: sm 24 / md 32 / lg 40. */
18
- size?: "sm" | "md" | "lg" | undefined;
19
- /** Icon before the text (a search glass). Drawn inline, no box. */
20
- icon?: string | undefined;
21
- /** Text before the value, e.g. `$` for a variable name. */
22
- prefix?: string | undefined;
23
- /** Text after the value, e.g. a unit. */
24
- suffix?: string | undefined;
25
- id?: string | undefined;
26
- ariaLabel?: string | undefined;
27
- }
28
- const props = withDefaults(defineProps<Props>(), {
29
- type: "text",
30
- size: "md",
31
- });
32
-
33
- const emit = defineEmits<{
34
- (e: "update:modelValue", v: string): void;
35
- (e: "blur", evt: FocusEvent): void;
36
- (e: "focus", evt: FocusEvent): void;
37
- }>();
38
-
39
- const inputClasses = computed(() => [
40
- "wp-input",
41
- props.size === "sm" && "wp-input--sm",
42
- props.size === "lg" && "wp-input--lg",
43
- ]);
44
-
45
- const wrapped = computed(() => Boolean(props.icon || props.prefix || props.suffix || props.readonly));
46
- const groupClasses = computed(() => [
47
- "wp-input-group",
48
- props.size === "sm" && "wp-input-group--sm",
49
- props.size === "lg" && "wp-input-group--lg",
50
- props.readonly && "wp-input-group--readonly",
51
- props.disabled && "wp-input-group--disabled",
52
- ]);
53
-
54
- function onInput(e: Event) {
55
- emit("update:modelValue", (e.target as HTMLInputElement).value);
56
- }
57
- </script>
58
-
59
- <template>
60
- <div v-if="wrapped" :class="groupClasses" :aria-invalid="error || undefined">
61
- <span v-if="icon" class="wp-input-group__icon" aria-hidden="true">
62
- <Icon :name="icon" />
63
- </span>
64
- <span v-if="prefix" class="wp-input-group__affix wp-input-group__affix--prefix" aria-hidden="true">{{ prefix }}</span>
65
- <input
66
- :id="id"
67
- :class="inputClasses"
68
- :type="type"
69
- :value="modelValue"
70
- :placeholder="placeholder"
71
- :disabled="disabled"
72
- :readonly="readonly"
73
- :aria-label="ariaLabel"
74
- :aria-invalid="error || undefined"
75
- @input="onInput"
76
- @blur="(e) => emit('blur', e)"
77
- @focus="(e) => emit('focus', e)"
78
- />
79
- <span v-if="suffix" class="wp-input-group__affix wp-input-group__affix--suffix" aria-hidden="true">{{ suffix }}</span>
80
- <span v-if="readonly" class="wp-input-group__lock" aria-hidden="true">
81
- <Icon name="pi-lock" :size="11" />
82
- </span>
83
- </div>
84
- <input
85
- v-else
86
- :id="id"
87
- :class="inputClasses"
88
- :type="type"
89
- :value="modelValue"
90
- :placeholder="placeholder"
91
- :disabled="disabled"
92
- :readonly="readonly"
93
- :aria-label="ariaLabel"
94
- :aria-invalid="error || undefined"
95
- @input="onInput"
96
- @blur="(e) => emit('blur', e)"
97
- @focus="(e) => emit('focus', e)"
98
- />
99
- </template>
1
+ <script setup lang="ts">
2
+ /**
3
+ * Text field. Number fields use WpNumber (`WpNumber.vue`)
4
+ * and search boxes use SearchInput; this one no longer has a number mode.
5
+ */
6
+ import { computed } from "vue";
7
+ import Icon from "./Icon.vue";
8
+
9
+ interface Props {
10
+ modelValue: string;
11
+ type?: "text" | "email" | "url" | "password" | "tel" | undefined;
12
+ placeholder?: string | undefined;
13
+ disabled?: boolean | undefined;
14
+ /** Shown but not editable: dimmer fill, no focus ring, a lock icon. */
15
+ readonly?: boolean | undefined;
16
+ error?: boolean | undefined;
17
+ /** Height on the control scale: sm 24 / md 32 / lg 40. */
18
+ size?: "sm" | "md" | "lg" | undefined;
19
+ /** Icon before the text (a search glass). Drawn inline, no box. */
20
+ icon?: string | undefined;
21
+ /** Text before the value, e.g. `$` for a variable name. */
22
+ prefix?: string | undefined;
23
+ /** Text after the value, e.g. a unit. */
24
+ suffix?: string | undefined;
25
+ id?: string | undefined;
26
+ ariaLabel?: string | undefined;
27
+ }
28
+ const props = withDefaults(defineProps<Props>(), {
29
+ type: "text",
30
+ size: "md",
31
+ });
32
+
33
+ const emit = defineEmits<{
34
+ (e: "update:modelValue", v: string): void;
35
+ (e: "blur", evt: FocusEvent): void;
36
+ (e: "focus", evt: FocusEvent): void;
37
+ }>();
38
+
39
+ const inputClasses = computed(() => [
40
+ "wp-input",
41
+ props.size === "sm" && "wp-input--sm",
42
+ props.size === "lg" && "wp-input--lg",
43
+ ]);
44
+
45
+ const wrapped = computed(() => Boolean(props.icon || props.prefix || props.suffix || props.readonly));
46
+ const groupClasses = computed(() => [
47
+ "wp-input-group",
48
+ props.size === "sm" && "wp-input-group--sm",
49
+ props.size === "lg" && "wp-input-group--lg",
50
+ props.readonly && "wp-input-group--readonly",
51
+ props.disabled && "wp-input-group--disabled",
52
+ ]);
53
+
54
+ function onInput(e: Event) {
55
+ emit("update:modelValue", (e.target as HTMLInputElement).value);
56
+ }
57
+ </script>
58
+
59
+ <template>
60
+ <div v-if="wrapped" :class="groupClasses" :aria-invalid="error || undefined">
61
+ <span v-if="icon" class="wp-input-group__icon" aria-hidden="true">
62
+ <Icon :name="icon" />
63
+ </span>
64
+ <span v-if="prefix" class="wp-input-group__affix wp-input-group__affix--prefix" aria-hidden="true">{{ prefix }}</span>
65
+ <input
66
+ :id="id"
67
+ :class="inputClasses"
68
+ :type="type"
69
+ :value="modelValue"
70
+ :placeholder="placeholder"
71
+ :disabled="disabled"
72
+ :readonly="readonly"
73
+ :aria-label="ariaLabel"
74
+ :aria-invalid="error || undefined"
75
+ @input="onInput"
76
+ @blur="(e) => emit('blur', e)"
77
+ @focus="(e) => emit('focus', e)"
78
+ />
79
+ <span v-if="suffix" class="wp-input-group__affix wp-input-group__affix--suffix" aria-hidden="true">{{ suffix }}</span>
80
+ <span v-if="readonly" class="wp-input-group__lock" aria-hidden="true">
81
+ <Icon name="pi-lock" :size="11" />
82
+ </span>
83
+ </div>
84
+ <input
85
+ v-else
86
+ :id="id"
87
+ :class="inputClasses"
88
+ :type="type"
89
+ :value="modelValue"
90
+ :placeholder="placeholder"
91
+ :disabled="disabled"
92
+ :readonly="readonly"
93
+ :aria-label="ariaLabel"
94
+ :aria-invalid="error || undefined"
95
+ @input="onInput"
96
+ @blur="(e) => emit('blur', e)"
97
+ @focus="(e) => emit('focus', e)"
98
+ />
99
+ </template>
package/src/Kbd.vue CHANGED
@@ -1,56 +1,56 @@
1
- <script setup lang="ts">
2
- /**
3
- * Kbd: a keyboard shortcut drawn as keys. `Mod` reads ⌘ on a Mac and Ctrl
4
- * elsewhere (from `platform-keys.ts`), so one string fits everyone. Works on
5
- * the canvas and in the manager.
6
- *
7
- * <Kbd keys="Mod+K" />
8
- * <Kbd :keys="['Shift', 'Enter']" />
9
- *
10
- * Screen readers hear the whole chord once ("Control plus K"); the key caps
11
- * themselves are hidden from them.
12
- */
13
- import { computed } from "vue";
14
- import { isApplePlatform } from "./platform-keys";
15
-
16
- const props = withDefaults(defineProps<{
17
- /** "Mod+Shift+P" or ["Mod", "Shift", "P"]. */
18
- keys: string | string[];
19
- size?: "sm" | "md" | undefined;
20
- }>(), { size: "md" });
21
-
22
- const MAC: Record<string, string> = { Mod: "⌘", Ctrl: "⌃", Alt: "⌥", Shift: "⇧", Enter: "↵" };
23
- const SPOKEN: Record<string, string> = {
24
- "⌘": "Command", Ctrl: "Control", "⌃": "Control", Alt: "Alt", "⌥": "Option", Shift: "Shift", "⇧": "Shift",
25
- Enter: "Enter", "↵": "Enter", Esc: "Escape", "↑": "Up", "↓": "Down", "←": "Left", "→": "Right",
26
- };
27
-
28
- const caps = computed(() => {
29
- const list = Array.isArray(props.keys) ? props.keys : props.keys.split(/\+(?!$)/);
30
- const mac = isApplePlatform();
31
- return list.map((k) => k.trim()).filter(Boolean).map((k) => (k === "Mod" ? (mac ? "⌘" : "Ctrl") : mac ? MAC[k] ?? k : k));
32
- });
33
- const spoken = computed(() => caps.value.map((k) => SPOKEN[k] ?? k).join(" plus "));
34
- </script>
35
-
36
- <template>
37
- <kbd class="wp-kbd-keys" :data-size="size" :aria-label="spoken">
38
- <template v-for="(k, i) in caps" :key="i">
39
- <span v-if="i > 0" class="wp-kbd-keys__plus" aria-hidden="true">+</span>
40
- <kbd class="wp-kbd-keys__cap" aria-hidden="true">{{ k }}</kbd>
41
- </template>
42
- </kbd>
43
- </template>
44
-
45
- <style scoped>
46
- .wp-kbd-keys { display: inline-flex; align-items: center; gap: 2px; font: inherit; vertical-align: baseline; }
47
- .wp-kbd-keys__plus { color: var(--wp-text-dim); font-size: var(--wp-text-xs); }
48
- .wp-kbd-keys__cap {
49
- display: inline-grid; place-items: center; box-sizing: border-box;
50
- min-width: 20px; height: 20px; padding: 0 5px;
51
- border: 1px solid var(--wp-border-strong); border-bottom-width: 2px; border-radius: var(--wp-radius-sm);
52
- background: var(--wp-bg-2); color: var(--wp-text-muted);
53
- font: 500 11px/1 var(--wp-font-mono); white-space: nowrap;
54
- }
55
- .wp-kbd-keys[data-size="sm"] .wp-kbd-keys__cap { min-width: 16px; height: 16px; padding: 0 3px; font-size: 10px; }
56
- </style>
1
+ <script setup lang="ts">
2
+ /**
3
+ * Kbd: a keyboard shortcut drawn as keys. `Mod` reads ⌘ on a Mac and Ctrl
4
+ * elsewhere (from `platform-keys.ts`), so one string fits everyone. Works on
5
+ * the canvas and in the manager.
6
+ *
7
+ * <Kbd keys="Mod+K" />
8
+ * <Kbd :keys="['Shift', 'Enter']" />
9
+ *
10
+ * Screen readers hear the whole chord once ("Control plus K"); the key caps
11
+ * themselves are hidden from them.
12
+ */
13
+ import { computed } from "vue";
14
+ import { isApplePlatform } from "./platform-keys";
15
+
16
+ const props = withDefaults(defineProps<{
17
+ /** "Mod+Shift+P" or ["Mod", "Shift", "P"]. */
18
+ keys: string | string[];
19
+ size?: "sm" | "md" | undefined;
20
+ }>(), { size: "md" });
21
+
22
+ const MAC: Record<string, string> = { Mod: "⌘", Ctrl: "⌃", Alt: "⌥", Shift: "⇧", Enter: "↵" };
23
+ const SPOKEN: Record<string, string> = {
24
+ "⌘": "Command", Ctrl: "Control", "⌃": "Control", Alt: "Alt", "⌥": "Option", Shift: "Shift", "⇧": "Shift",
25
+ Enter: "Enter", "↵": "Enter", Esc: "Escape", "↑": "Up", "↓": "Down", "←": "Left", "→": "Right",
26
+ };
27
+
28
+ const caps = computed(() => {
29
+ const list = Array.isArray(props.keys) ? props.keys : props.keys.split(/\+(?!$)/);
30
+ const mac = isApplePlatform();
31
+ return list.map((k) => k.trim()).filter(Boolean).map((k) => (k === "Mod" ? (mac ? "⌘" : "Ctrl") : mac ? MAC[k] ?? k : k));
32
+ });
33
+ const spoken = computed(() => caps.value.map((k) => SPOKEN[k] ?? k).join(" plus "));
34
+ </script>
35
+
36
+ <template>
37
+ <kbd class="wp-kbd-keys" :data-size="size" :aria-label="spoken">
38
+ <template v-for="(k, i) in caps" :key="i">
39
+ <span v-if="i > 0" class="wp-kbd-keys__plus" aria-hidden="true">+</span>
40
+ <kbd class="wp-kbd-keys__cap" aria-hidden="true">{{ k }}</kbd>
41
+ </template>
42
+ </kbd>
43
+ </template>
44
+
45
+ <style scoped>
46
+ .wp-kbd-keys { display: inline-flex; align-items: center; gap: 2px; font: inherit; vertical-align: baseline; }
47
+ .wp-kbd-keys__plus { color: var(--wp-text-dim); font-size: var(--wp-text-xs); }
48
+ .wp-kbd-keys__cap {
49
+ display: inline-grid; place-items: center; box-sizing: border-box;
50
+ min-width: 20px; height: 20px; padding: 0 5px;
51
+ border: 1px solid var(--wp-border-strong); border-bottom-width: 2px; border-radius: var(--wp-radius-sm);
52
+ background: var(--wp-bg-2); color: var(--wp-text-muted);
53
+ font: 500 11px/1 var(--wp-font-mono); white-space: nowrap;
54
+ }
55
+ .wp-kbd-keys[data-size="sm"] .wp-kbd-keys__cap { min-width: 16px; height: 16px; padding: 0 3px; font-size: 10px; }
56
+ </style>