pxd 0.0.39 → 0.0.40

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 (216) hide show
  1. package/dist/components/active-graph/index.vue +1 -1
  2. package/dist/components/book/index.vue +1 -1
  3. package/dist/components/browser/index.vue +1 -1
  4. package/dist/components/checkbox/index.vue +3 -2
  5. package/dist/components/checkbox-group/index.vue +1 -1
  6. package/dist/components/choicebox-group/index.vue +1 -1
  7. package/dist/components/command-menu/index.vue +133 -0
  8. package/dist/components/command-menu-group/index.vue +18 -0
  9. package/dist/components/command-menu-item/index.vue +23 -0
  10. package/dist/components/drawer/index.vue +25 -25
  11. package/dist/components/error/index.vue +1 -1
  12. package/dist/components/fader/index.vue +11 -10
  13. package/dist/components/grid/index.vue +2 -2
  14. package/dist/components/grid-item/index.vue +2 -2
  15. package/dist/components/hold-button/index.vue +1 -1
  16. package/dist/components/index.d.ts +4 -0
  17. package/dist/components/index.js +4 -0
  18. package/dist/components/intersection-observer/index.vue +2 -2
  19. package/dist/components/kbd/index.vue +16 -4
  20. package/dist/components/list/index.vue +98 -90
  21. package/dist/components/list-item/index.vue +22 -33
  22. package/dist/components/loading-bar/index.vue +156 -0
  23. package/dist/components/material/index.vue +8 -8
  24. package/dist/components/menu/index.vue +18 -8
  25. package/dist/components/message/index.vue +20 -10
  26. package/dist/components/modal/index.vue +26 -28
  27. package/dist/components/overlay/index.vue +6 -5
  28. package/dist/components/pagination/index.vue +2 -2
  29. package/dist/components/placeholder/index.vue +13 -6
  30. package/dist/components/popover/index.vue +32 -24
  31. package/dist/components/radio/index.vue +3 -2
  32. package/dist/components/radio-group/index.vue +1 -1
  33. package/dist/components/scrollable/index.vue +127 -79
  34. package/dist/components/slider/index.vue +1 -1
  35. package/dist/components/stack/index.vue +4 -4
  36. package/dist/components/text/index.vue +1 -1
  37. package/dist/components/theme-switcher/index.vue +6 -2
  38. package/dist/components/tooltip/index.vue +7 -7
  39. package/dist/composables/index.d.ts +1 -0
  40. package/dist/composables/index.js +1 -0
  41. package/dist/composables/use-browser-observer.d.ts +2 -2
  42. package/dist/composables/use-color-scheme.d.ts +5 -1
  43. package/dist/composables/use-color-scheme.js +20 -1
  44. package/dist/composables/use-config-provider-context.d.ts +1 -1
  45. package/dist/composables/use-delay-destroy.d.ts +2 -2
  46. package/dist/composables/use-delay-destroy.js +4 -4
  47. package/dist/composables/use-focus-trap.js +1 -1
  48. package/dist/composables/use-loading-bar.d.ts +25 -0
  49. package/dist/composables/use-loading-bar.js +27 -0
  50. package/dist/composables/use-media-query.js +1 -1
  51. package/dist/composables/use-message.d.ts +4 -1
  52. package/dist/composables/use-message.js +18 -0
  53. package/dist/composables/use-pointer-gesture.js +2 -2
  54. package/dist/composables/use-repeat-action.js +1 -1
  55. package/dist/composables/use-virtual-list.d.ts +1 -1
  56. package/dist/contexts/avatar.d.ts +1 -1
  57. package/dist/contexts/carousel.d.ts +1 -1
  58. package/dist/contexts/checkbox.d.ts +1 -1
  59. package/dist/contexts/choicebox.d.ts +2 -2
  60. package/dist/contexts/collapse.d.ts +1 -1
  61. package/dist/contexts/command-menu.d.ts +6 -0
  62. package/dist/contexts/command-menu.js +5 -0
  63. package/dist/contexts/list.d.ts +4 -6
  64. package/dist/contexts/list.js +0 -4
  65. package/dist/contexts/radio.d.ts +1 -1
  66. package/dist/contexts/resizable.d.ts +1 -1
  67. package/dist/contexts/switch.d.ts +2 -2
  68. package/dist/index.d.ts +1 -1
  69. package/dist/index.js +1 -1
  70. package/dist/locales/en-us.d.ts +3 -0
  71. package/dist/locales/en-us.js +3 -0
  72. package/dist/locales/zh-cn.d.ts +3 -0
  73. package/dist/locales/zh-cn.js +3 -0
  74. package/dist/{components → src/components}/active-graph/index.vue.d.ts +1 -1
  75. package/dist/{components → src/components}/avatar-group/index.vue.d.ts +1 -1
  76. package/dist/{components → src/components}/badge/index.vue.d.ts +1 -1
  77. package/dist/{components → src/components}/book/index.vue.d.ts +1 -1
  78. package/dist/{components → src/components}/browser/index.vue.d.ts +1 -1
  79. package/dist/{components → src/components}/button/index.vue.d.ts +1 -1
  80. package/dist/{components → src/components}/carousel/index.vue.d.ts +1 -1
  81. package/dist/{components → src/components}/carousel-group/index.vue.d.ts +1 -1
  82. package/dist/{components → src/components}/chip/index.vue.d.ts +1 -1
  83. package/dist/{components → src/components}/choicebox/index.vue.d.ts +1 -1
  84. package/dist/{components → src/components}/choicebox-group/index.vue.d.ts +1 -1
  85. package/dist/{components → src/components}/collapse/index.vue.d.ts +1 -1
  86. package/dist/{components → src/components}/collapse-group/index.vue.d.ts +1 -1
  87. package/dist/src/components/command-menu/index.vue.d.ts +39 -0
  88. package/dist/src/components/command-menu-group/index.vue.d.ts +16 -0
  89. package/dist/src/components/command-menu-item/index.vue.d.ts +10 -0
  90. package/dist/{components → src/components}/config-provider/index.vue.d.ts +1 -1
  91. package/dist/{components → src/components}/description/index.vue.d.ts +1 -1
  92. package/dist/{components → src/components}/drawer/index.vue.d.ts +17 -12
  93. package/dist/{components → src/components}/empty-state/index.vue.d.ts +1 -1
  94. package/dist/{components → src/components}/error/index.vue.d.ts +1 -1
  95. package/dist/{components → src/components}/fader/index.vue.d.ts +3 -2
  96. package/dist/{components → src/components}/gauge/index.vue.d.ts +1 -1
  97. package/dist/{components → src/components}/grid/index.vue.d.ts +1 -1
  98. package/dist/{components → src/components}/grid-item/index.vue.d.ts +1 -1
  99. package/dist/{components → src/components}/hold-button/index.vue.d.ts +1 -1
  100. package/dist/{components → src/components}/intersection-observer/content.vue.d.ts +1 -1
  101. package/dist/{components → src/components}/intersection-observer/index.vue.d.ts +3 -3
  102. package/dist/{components → src/components}/kbd/index.vue.d.ts +2 -1
  103. package/dist/{components → src/components}/link-button/index.vue.d.ts +1 -1
  104. package/dist/src/components/list/index.vue.d.ts +40 -0
  105. package/dist/{components → src/components}/list-item/index.vue.d.ts +4 -4
  106. package/dist/src/components/loading-bar/index.vue.d.ts +14 -0
  107. package/dist/{components → src/components}/loading-dots/index.vue.d.ts +1 -1
  108. package/dist/{components → src/components}/material/index.vue.d.ts +1 -1
  109. package/dist/{components → src/components}/menu/index.vue.d.ts +11 -7
  110. package/dist/{components → src/components}/message/index.vue.d.ts +9 -9
  111. package/dist/{components → src/components}/modal/index.vue.d.ts +17 -12
  112. package/dist/{components → src/components}/more-button/index.vue.d.ts +1 -1
  113. package/dist/{components → src/components}/note/index.vue.d.ts +1 -1
  114. package/dist/{components → src/components}/number-input/index.vue.d.ts +1 -1
  115. package/dist/{components → src/components}/overlay/index.vue.d.ts +2 -4
  116. package/dist/{components → src/components}/pagination/index.vue.d.ts +1 -1
  117. package/dist/{components → src/components}/pin-input/index.vue.d.ts +1 -1
  118. package/dist/src/components/placeholder/index.vue.d.ts +9 -0
  119. package/dist/{components → src/components}/popover/index.vue.d.ts +6 -3
  120. package/dist/{components → src/components}/progress/index.vue.d.ts +1 -1
  121. package/dist/{components → src/components}/radio/index.vue.d.ts +1 -1
  122. package/dist/{components → src/components}/radio-group/index.vue.d.ts +1 -1
  123. package/dist/{components → src/components}/resizable/index.vue.d.ts +1 -1
  124. package/dist/src/components/resizable-handle/index.vue.d.ts +2 -0
  125. package/dist/{components → src/components}/resizable-panel/index.vue.d.ts +1 -1
  126. package/dist/{components → src/components}/skeleton/index.vue.d.ts +1 -1
  127. package/dist/{components → src/components}/slider/index.vue.d.ts +1 -1
  128. package/dist/{components → src/components}/snippet/index.vue.d.ts +1 -1
  129. package/dist/src/components/spinner/index.vue.d.ts +2 -0
  130. package/dist/{components → src/components}/stack/index.vue.d.ts +1 -1
  131. package/dist/{components → src/components}/status-dot/index.vue.d.ts +1 -1
  132. package/dist/{components → src/components}/switch/index.vue.d.ts +1 -1
  133. package/dist/{components → src/components}/switch-group/index.vue.d.ts +1 -1
  134. package/dist/{components → src/components}/teleport/index.vue.d.ts +1 -1
  135. package/dist/{components → src/components}/text/index.vue.d.ts +1 -1
  136. package/dist/{components → src/components}/textarea/index.vue.d.ts +1 -1
  137. package/dist/{components → src/components}/theme-switcher/index.vue.d.ts +1 -1
  138. package/dist/{components → src/components}/toggle/index.vue.d.ts +1 -1
  139. package/dist/{components → src/components}/tooltip/index.vue.d.ts +3 -5
  140. package/dist/{components → src/components}/virtual-list/index.vue.d.ts +1 -1
  141. package/dist/src/composables/use-browser-observer.d.ts +12 -0
  142. package/dist/src/composables/use-color-scheme.d.ts +11 -0
  143. package/dist/src/composables/use-config-provider-context.d.ts +7 -0
  144. package/dist/src/composables/use-copy-click.d.ts +4 -0
  145. package/dist/src/composables/use-countdown.d.ts +54 -0
  146. package/dist/src/composables/use-delay-change.d.ts +7 -0
  147. package/dist/src/composables/use-delay-destroy.d.ts +13 -0
  148. package/dist/src/composables/use-focus-trap.d.ts +4 -0
  149. package/dist/src/composables/use-loading-bar.d.ts +25 -0
  150. package/dist/src/composables/use-media-query.d.ts +15 -0
  151. package/dist/src/composables/use-message.d.ts +33 -0
  152. package/dist/src/composables/use-model-value.d.ts +11 -0
  153. package/dist/src/composables/use-pointer-gesture.d.ts +180 -0
  154. package/dist/src/composables/use-repeat-action.d.ts +16 -0
  155. package/dist/src/composables/use-unique-id-context.d.ts +2 -0
  156. package/dist/src/composables/use-virtual-list.d.ts +16 -0
  157. package/dist/src/contexts/avatar.d.ts +2 -0
  158. package/dist/src/contexts/carousel.d.ts +13 -0
  159. package/dist/src/contexts/checkbox.d.ts +2 -0
  160. package/dist/src/contexts/choicebox.d.ts +4 -0
  161. package/dist/src/contexts/collapse.d.ts +8 -0
  162. package/dist/src/contexts/command-menu.d.ts +6 -0
  163. package/dist/src/contexts/list.d.ts +7 -0
  164. package/dist/src/contexts/radio.d.ts +2 -0
  165. package/dist/src/contexts/resizable.d.ts +35 -0
  166. package/dist/src/contexts/switch.d.ts +4 -0
  167. package/dist/src/locales/en-us.d.ts +37 -0
  168. package/dist/src/plugins/dayjs-millisecond-token.d.ts +3 -0
  169. package/dist/src/utils/context.d.ts +17 -0
  170. package/dist/src/utils/date.d.ts +26 -0
  171. package/dist/src/utils/debounce/index.d.ts +73 -0
  172. package/dist/src/utils/debounce.d.ts +1 -0
  173. package/dist/src/utils/dom.d.ts +40 -0
  174. package/dist/src/utils/format.d.ts +24 -0
  175. package/dist/src/utils/get.d.ts +11 -0
  176. package/dist/src/utils/is.d.ts +4 -0
  177. package/dist/src/utils/ref.d.ts +8 -0
  178. package/dist/src/utils/regexp.d.ts +4 -0
  179. package/dist/src/utils/responsive.d.ts +3 -0
  180. package/dist/src/utils/throttle/index.d.ts +53 -0
  181. package/dist/src/utils/throttle.d.ts +1 -0
  182. package/dist/src/utils/uid.d.ts +1 -0
  183. package/dist/styles/styles.css +2 -2
  184. package/dist/styles/tw.css +4 -1
  185. package/dist/types/components/list.d.ts +4 -3
  186. package/dist/utils/date.d.ts +3 -3
  187. package/dist/utils/debounce/compat.d.ts +143 -0
  188. package/dist/utils/debounce/compat.js +47 -0
  189. package/dist/utils/debounce/index.d.ts +73 -0
  190. package/dist/utils/debounce/index.js +60 -0
  191. package/dist/utils/debounce.d.ts +1 -73
  192. package/dist/utils/debounce.js +1 -60
  193. package/dist/utils/event.d.ts +8 -0
  194. package/dist/utils/format.d.ts +3 -1
  195. package/dist/utils/format.js +3 -0
  196. package/dist/utils/responsive.d.ts +2 -1
  197. package/dist/utils/responsive.js +4 -1
  198. package/dist/utils/throttle/compat.d.ts +79 -0
  199. package/dist/utils/throttle/compat.js +9 -0
  200. package/dist/utils/throttle/index.d.ts +53 -0
  201. package/dist/utils/throttle/index.js +34 -0
  202. package/dist/utils/throttle.d.ts +1 -53
  203. package/dist/utils/throttle.js +1 -34
  204. package/package.json +10 -10
  205. package/volar.d.ts +4 -0
  206. package/dist/components/list/index.vue.d.ts +0 -29
  207. package/dist/components/placeholder/index.vue.d.ts +0 -8
  208. package/dist/components/resizable-handle/index.vue.d.ts +0 -2
  209. package/dist/components/spinner/index.vue.d.ts +0 -2
  210. /package/dist/{components → src/components}/avatar/index.vue.d.ts +0 -0
  211. /package/dist/{components → src/components}/checkbox/index.vue.d.ts +0 -0
  212. /package/dist/{components → src/components}/checkbox-group/index.vue.d.ts +0 -0
  213. /package/dist/{components → src/components}/countdown/index.vue.d.ts +0 -0
  214. /package/dist/{components → src/components}/input/index.vue.d.ts +0 -0
  215. /package/dist/{utils/events.d.ts → src/utils/event.d.ts} +0 -0
  216. /package/dist/utils/{events.js → event.js} +0 -0
@@ -328,7 +328,7 @@ onBeforeUnmount(() => {
328
328
  <Transition v-if="tooltip" name="pxd-transition--fade" mode="out-in" appear>
329
329
  <div
330
330
  v-if="showTooltip"
331
- class="pxd-active-graph--tooltip left-0 top-0 px-2 py-1 pointer-events-none absolute z-1 w-max rounded-sm bg-gray-1000 text-[13px] text-gray-100 duration-50 will-change-transform motion-safe:transition-transform"
331
+ class="pxd-active-graph--tooltip left-0 top-0 px-2 py-1 pointer-events-none absolute z-1 w-max rounded-sm bg-gray-1000 text-13px text-gray-100 duration-50 will-change-transform motion-safe:transition-transform"
332
332
  :style="`transform: translate3d(${tooltipInfo.left}px, ${tooltipInfo.top}px, 0);`"
333
333
  >
334
334
  <slot name="tooltip" :data="tooltipInfo">
@@ -7,7 +7,7 @@ defineOptions({
7
7
  const props = defineProps({
8
8
  color: { type: String, required: false },
9
9
  title: { type: [String, Number, Array, null], required: false },
10
- width: { type: null, required: false },
10
+ width: { type: [String, Number, Object], required: false },
11
11
  variant: { type: String, required: false, default: "stripe" },
12
12
  textured: { type: Boolean, required: false, default: false }
13
13
  });
@@ -36,7 +36,7 @@ const { isCopied, copyText } = useCopyClick();
36
36
  <div class="lg:max-w-xs pl-2.5 pr-1 py-1 flex w-full items-center justify-between rounded-full border border-gray-400 bg-background-200">
37
37
  <LockClosedIcon class="text-sm text-foreground-secondary" />
38
38
 
39
- <div class="pl-1.5 min-w-0 flex-1 truncate text-center text-[13px] text-gray-1000">
39
+ <div class="pl-1.5 min-w-0 flex-1 truncate text-center text-13px text-gray-1000">
40
40
  {{ address }}
41
41
  </div>
42
42
 
@@ -77,8 +77,9 @@ defineExpose({
77
77
  <label
78
78
  role="checkbox"
79
79
  :aria-checked="isChecked"
80
- class="pxd-checkbox group/checkbox gap-2 inline-flex touch-manipulation items-center"
81
- :class="{ 'is-disabled cursor-not-allowed text-gray-500': computedDisabled }"
80
+ :data-disabled="computedDisabled"
81
+ class="pxd-checkbox group/checkbox gap-2 inline-flex max-w-full cursor-pointer touch-manipulation items-center data-[disabled=true]:cursor-not-allowed"
82
+ :class="{ 'is-disabled text-gray-500': computedDisabled }"
82
83
  :for="uniqueId"
83
84
  >
84
85
  <input
@@ -37,7 +37,7 @@ defineExpose({
37
37
  </script>
38
38
 
39
39
  <template>
40
- <PStack class="pxd-checkbox-group w-max" role="group" aria-label="Checkbox Group" v-bind="$attrs">
40
+ <PStack class="pxd-checkbox-group" role="group" aria-label="Checkbox Group" v-bind="$attrs">
41
41
  <slot>
42
42
  <PCheckbox
43
43
  v-for="option in options"
@@ -45,7 +45,7 @@ provideChoiceboxGroupModelValue(modelValue);
45
45
  </script>
46
46
 
47
47
  <template>
48
- <div class="pxd-choicebox-group w-full">
48
+ <div class="pxd-choicebox-group w-full max-w-full">
49
49
  <div v-if="label || $slots.label" class="pxd-form--label">
50
50
  <slot name="label">
51
51
  {{ label }}
@@ -0,0 +1,133 @@
1
+ <script setup>
2
+ import { computed, nextTick, shallowRef } from "vue";
3
+ import { useConfigProvider } from "../../composables/use-config-provider-context";
4
+ import { useModelValue } from "../../composables/use-model-value";
5
+ import { provideCommandMenuContext } from "../../contexts/command-menu";
6
+ import { debounce } from "../../utils/debounce";
7
+ import { throttle } from "../../utils/throttle";
8
+ import { getUniqueId } from "../../utils/uid";
9
+ import PButton from "../button/index.vue";
10
+ import PList from "../list/index.vue";
11
+ import PModal from "../modal/index.vue";
12
+ defineOptions({
13
+ name: "PCommandMenu",
14
+ inheritAttrs: false,
15
+ model: {
16
+ prop: "modelValue",
17
+ event: "update:modelValue"
18
+ }
19
+ });
20
+ const props = defineProps({
21
+ width: { type: [String, Number], required: false },
22
+ modelValue: { type: Boolean, required: false, default: false },
23
+ placeholder: { type: String, required: false, default: "" },
24
+ closeOnSelectItem: { type: Boolean, required: false, default: true },
25
+ closeOnPressEscape: { type: Boolean, required: false, default: true },
26
+ closeOnClickOverlay: { type: Boolean, required: false, default: true }
27
+ });
28
+ const emits = defineEmits(["update:modelValue", "select", "show", "hide"]);
29
+ const uniqueId = getUniqueId();
30
+ const config = useConfigProvider();
31
+ const modelValue = useModelValue(props, emits);
32
+ const listRef = shallowRef();
33
+ const isEmptyResult = shallowRef(false);
34
+ const filterKeyword = shallowRef("");
35
+ const filterKeywordRegex = computed(() => {
36
+ if (!filterKeyword.value) {
37
+ return null;
38
+ }
39
+ return new RegExp(filterKeyword.value, "i");
40
+ });
41
+ const onKeywordChange = throttle(async (ev) => {
42
+ const inputValue = ev.target.value.trim();
43
+ filterKeyword.value = inputValue;
44
+ const list = listRef.value;
45
+ if (!list) {
46
+ return;
47
+ }
48
+ await nextTick();
49
+ list.updateListItem();
50
+ list.setActiveValue();
51
+ isEmptyResult.value = list.isNoVisibleItem();
52
+ }, 300, { edges: ["leading", "trailing"] });
53
+ const closeModal = debounce(() => {
54
+ modelValue.value = false;
55
+ filterKeyword.value = "";
56
+ emits("hide");
57
+ }, 500, { edges: ["leading"] });
58
+ function onShowModal() {
59
+ emits("show");
60
+ }
61
+ function onListItemSelect(ev, item) {
62
+ emits("select", ev, item);
63
+ if (props.closeOnSelectItem) {
64
+ closeModal();
65
+ }
66
+ }
67
+ provideCommandMenuContext({
68
+ filterKeyword,
69
+ filterKeywordRegex
70
+ });
71
+ </script>
72
+
73
+ <template>
74
+ <PModal
75
+ v-model="modelValue"
76
+ width="640px"
77
+ class="pxd-command-menu"
78
+ content-class="!p-0 overflow-hidden"
79
+ wrapper-class="sm:top-1/6 sm:translate-y-0"
80
+ :close-on-press-escape="closeOnPressEscape"
81
+ :close-on-click-overlay="closeOnClickOverlay"
82
+ @show="onShowModal"
83
+ @hide="closeModal"
84
+ >
85
+ <template #header>
86
+ <label :for="uniqueId" class="py-3 px-4 -mx-6 -my-4 gap-3 flex items-center border-b">
87
+ <input
88
+ :id="uniqueId"
89
+ :value="filterKeyword"
90
+ :placeholder="placeholder"
91
+ aria-autocomplete="list"
92
+ :aria-controls="uniqueId"
93
+ :aria-labelledby="uniqueId"
94
+ aria-expanded="true"
95
+ autocomplete="off"
96
+ autocorrect="off"
97
+ role="combobox"
98
+ spellcheck="false"
99
+ type="text"
100
+ name="command-menu-filter-input"
101
+ class="h-7 flex-1 appearance-none border-none bg-transparent text-foreground outline-none"
102
+ @input="onKeywordChange"
103
+ >
104
+
105
+ <PButton
106
+ v-if="closeOnPressEscape"
107
+ size="xs"
108
+ class="!px-0 text-xs shrink-0"
109
+ @click="closeModal"
110
+ >
111
+ Esc
112
+ </PButton>
113
+ </label>
114
+ </template>
115
+
116
+ <PList
117
+ ref="listRef"
118
+ :loop="false"
119
+ class="sm:h-auto sm:max-h-110 h-[70vh]"
120
+ :item-transition="false"
121
+ :key-listener="modelValue"
122
+ @select="onListItemSelect"
123
+ >
124
+ <slot />
125
+
126
+ <p v-if="isEmptyResult" class="py-8 text-sm text-center text-foreground-secondary">
127
+ {{ config.locale.empty.search }} <span class="text-foreground">"{{ filterKeyword }}"</span>
128
+ </p>
129
+ </PList>
130
+
131
+ <slot name="footer" />
132
+ </PModal>
133
+ </template>
@@ -0,0 +1,18 @@
1
+ <script setup>
2
+ defineOptions({
3
+ name: "PCommandMenuGroup"
4
+ });
5
+ defineProps({
6
+ label: { type: [String, Number, Array, null], required: false }
7
+ });
8
+ </script>
9
+
10
+ <template>
11
+ <div class="pxd-command-menu-group" role="presentation">
12
+ <div aria-hidden="true" class="h-10 px-2 flex items-center text-13px text-foreground-secondary only:hidden empty:hidden">
13
+ {{ label }}
14
+ </div>
15
+
16
+ <slot />
17
+ </div>
18
+ </template>
@@ -0,0 +1,23 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ import { useCommandMenuContext } from "../../contexts/command-menu";
4
+ import PListItem from "../list-item/index.vue";
5
+ defineOptions({
6
+ name: "PCommandMenuItem"
7
+ });
8
+ const props = defineProps({
9
+ as: { type: null, required: false },
10
+ type: { type: null, required: false },
11
+ label: { type: null, required: false },
12
+ disabled: { type: null, required: false },
13
+ description: { type: null, required: false }
14
+ });
15
+ const commandMenuContext = useCommandMenuContext();
16
+ const isVisible = computed(() => {
17
+ return !commandMenuContext?.filterKeyword.value || commandMenuContext?.filterKeywordRegex.value?.test(String(props.label));
18
+ });
19
+ </script>
20
+
21
+ <template>
22
+ <PListItem v-if="isVisible" v-bind="props" />
23
+ </template>
@@ -2,9 +2,8 @@
2
2
  import { computed, shallowRef, watch } from "vue";
3
3
  import { useFocusTrap } from "../../composables/use-focus-trap";
4
4
  import { useModelValue } from "../../composables/use-model-value";
5
- import { getCssUnitValue } from "../../utils/format";
5
+ import { getCssUnitValue, isTruthyProp } from "../../utils/format";
6
6
  import POverlay from "../overlay/index.vue";
7
- import PScrollable from "../scrollable/index.vue";
8
7
  defineOptions({
9
8
  name: "PDrawer",
10
9
  inheritAttrs: false,
@@ -23,11 +22,12 @@ const props = defineProps({
23
22
  appendToBody: { type: Boolean, required: false, default: true },
24
23
  headerStylize: { type: Boolean, required: false, default: false },
25
24
  footerStylize: { type: Boolean, required: false, default: true },
26
- drawerClass: { type: [String, Array, Object], required: false },
25
+ wrapperClass: { type: [String, Array, Object], required: false },
26
+ contentClass: { type: [String, Array, Object], required: false },
27
27
  closeOnPressEscape: { type: Boolean, required: false, default: true },
28
28
  closeOnClickOverlay: { type: Boolean, required: false, default: true }
29
29
  });
30
- const emits = defineEmits(["open", "close", "click-outside", "update:modelValue"]);
30
+ const emits = defineEmits(["show", "hide", "visible-change", "click-outside", "update:modelValue"]);
31
31
  const drawerRef = shallowRef();
32
32
  const isVisible = useModelValue(props, emits);
33
33
  useFocusTrap(drawerRef);
@@ -48,7 +48,7 @@ const computedStyle = computed(() => {
48
48
  });
49
49
  function onOverlayClick(ev) {
50
50
  emits("click-outside", ev);
51
- if (!props.closeOnClickOverlay || props.loading) {
51
+ if (!isTruthyProp(props.closeOnClickOverlay) || isTruthyProp(props.loading)) {
52
52
  return;
53
53
  }
54
54
  isVisible.value = false;
@@ -60,11 +60,12 @@ function onUpdateModelValue(visible) {
60
60
  isVisible.value = visible;
61
61
  }
62
62
  watch(() => isVisible.value, (visible) => {
63
+ emits("visible-change", visible);
63
64
  if (visible) {
64
- emits("open");
65
+ emits("show");
65
66
  return;
66
67
  }
67
- emits("close");
68
+ emits("hide");
68
69
  });
69
70
  </script>
70
71
 
@@ -84,7 +85,7 @@ watch(() => isVisible.value, (visible) => {
84
85
  role="dialog"
85
86
  tabindex="-1"
86
87
  class="pxd-drawer translate-z-0 sm:[--w:30vw] sm:[--h:30vw] fixed z-10 flex max-h-full max-w-full flex-col bg-background-100 shadow-border-modal outline-none"
87
- :class="drawerClass"
88
+ :class="wrapperClass"
88
89
  :style="computedStyle"
89
90
  :data-position="ensurePosition"
90
91
  >
@@ -92,28 +93,27 @@ watch(() => isVisible.value, (visible) => {
92
93
  class="pxd-drawer--header px-6 py-4 relative shrink-0 empty:py-3"
93
94
  :class="{ 'sm:pt-4 border-b bg-background-200 dark:bg-background-100': headerStylize }"
94
95
  >
95
- <h3 v-if="$slots.title || title" class="text-lg sm:text-xl font-semibold tracking-tight m-0">
96
- <slot name="title">
97
- {{ title }}
98
- </slot>
99
- </h3>
96
+ <slot name="header">
97
+ <h3 v-if="$slots.title || title" class="text-lg sm:text-xl font-semibold tracking-tight m-0">
98
+ <slot name="title">
99
+ {{ title }}
100
+ </slot>
101
+ </h3>
100
102
 
101
- <div v-if="$slots.subtitle || subtitle" class="mt-3 text-sm text-muted-foreground">
102
- <slot name="subtitle">
103
- {{ subtitle }}
104
- </slot>
105
- </div>
103
+ <div v-if="$slots.subtitle || subtitle" class="mt-3 text-sm text-muted-foreground">
104
+ <slot name="subtitle">
105
+ {{ subtitle }}
106
+ </slot>
107
+ </div>
108
+ </slot>
106
109
  </header>
107
110
 
108
- <PScrollable
109
- v-if="$slots.default"
110
- :data-header="headerStylize"
111
- class="pxd-drawer--content group flex-1"
112
- content-class="group-data-[header=true]:pt-5 px-6 pb-5"
111
+ <div
112
+ class="pxd-drawer--content group px-6 pb-5 flex-1 overflow-auto"
113
+ :class="[{ 'pt-5': headerStylize }, contentClass]"
113
114
  >
114
115
  <slot />
115
- </PScrollable>
116
- <div v-else class="flex-1" />
116
+ </div>
117
117
 
118
118
  <footer
119
119
  v-if="$slots.footer"
@@ -15,7 +15,7 @@ const props = defineProps({
15
15
  });
16
16
  const SIZES = {
17
17
  xs: "text-xs [--mt:2px]",
18
- sm: "text-[13px] [--mt:2px]",
18
+ sm: "text-13px [--mt:2px]",
19
19
  md: "text-sm [--mt:2px]",
20
20
  lg: "text-base [--mt:4px]"
21
21
  };
@@ -1,6 +1,7 @@
1
1
  <script setup>
2
2
  import { computed, onBeforeUnmount, shallowRef, watch } from "vue";
3
- import { off, on } from "../../utils/events";
3
+ import { useResizeObserver } from "../../composables/use-browser-observer";
4
+ import { off, on } from "../../utils/event";
4
5
  import { getCssUnitValue } from "../../utils/format";
5
6
  import { throttleByRaf } from "../../utils/throttle";
6
7
  defineOptions({
@@ -19,13 +20,13 @@ const fader = shallowRef({
19
20
  bottom: false
20
21
  });
21
22
  const computedStyle = computed(() => ({
22
- "--c": props.color,
23
- "--s": getCssUnitValue(props.size)
23
+ "--fader-color": props.color,
24
+ "--fader-size": getCssUnitValue(props.size)
24
25
  }));
25
26
  const DIFF_THRESHOLD = 1;
26
27
  const onContainerScroll = throttleByRaf(() => {
27
- const { size = 16 } = props;
28
- const { scrollLeft, scrollWidth, clientWidth, scrollTop, clientHeight, scrollHeight } = props.container;
28
+ const { size = 16, container } = props;
29
+ const { scrollLeft, scrollWidth, clientWidth, scrollTop, clientHeight, scrollHeight } = container;
29
30
  fader.value = {
30
31
  left: scrollLeft >= size,
31
32
  right: scrollLeft + clientWidth < scrollWidth - DIFF_THRESHOLD,
@@ -33,6 +34,7 @@ const onContainerScroll = throttleByRaf(() => {
33
34
  bottom: scrollTop + clientHeight < scrollHeight - DIFF_THRESHOLD
34
35
  };
35
36
  });
37
+ useResizeObserver(() => props.container, onContainerScroll);
36
38
  watch(() => props.container, (container, oldDom) => {
37
39
  if (oldDom) {
38
40
  off(oldDom, "scroll", onContainerScroll);
@@ -41,7 +43,6 @@ watch(() => props.container, (container, oldDom) => {
41
43
  if (!container) {
42
44
  return;
43
45
  }
44
- onContainerScroll();
45
46
  on(container, "scroll", onContainerScroll);
46
47
  });
47
48
  onBeforeUnmount(() => {
@@ -66,8 +67,8 @@ onBeforeUnmount(() => {
66
67
  content: '';
67
68
  position: absolute;
68
69
  border-radius: inherit;
69
- background: linear-gradient(var(--dir), transparent, var(--c, var(--color-gray-alpha-500)));
70
- mask-image: linear-gradient(var(--dir-revert), var(--c, var(--color-gray-alpha-500)) 50%, transparent);
70
+ background: linear-gradient(var(--dir), transparent, var(--fader-color, var(--color-gray-200)));
71
+ mask-image: linear-gradient(var(--dir-revert), var(--fader-color, var(--color-gray-200)) 50%, transparent);
71
72
  transition: opacity var(--default-transition-timing-function) var(--default-transition-duration);
72
73
  opacity: 0;
73
74
  }
@@ -83,7 +84,7 @@ onBeforeUnmount(() => {
83
84
  &::before,
84
85
  &::after {
85
86
  top: 0;
86
- width: var(--s, 16px);
87
+ width: var(--fader-size, 16px);
87
88
  height: 100%;
88
89
  }
89
90
 
@@ -105,7 +106,7 @@ onBeforeUnmount(() => {
105
106
  &::after {
106
107
  left: 0;
107
108
  width: 100%;
108
- height: var(--s, 16px);
109
+ height: var(--fader-size, 16px);
109
110
  }
110
111
 
111
112
  &::before {
@@ -7,8 +7,8 @@ defineOptions({
7
7
  });
8
8
  const props = defineProps({
9
9
  debug: { type: Boolean, required: false },
10
- rows: { type: null, required: false },
11
- columns: { type: null, required: false }
10
+ rows: { type: [String, Number, Object], required: false },
11
+ columns: { type: [String, Number, Object], required: false }
12
12
  });
13
13
  const presetGridRows = {
14
14
  "--xs-rows": "grid-rows-(--xs-rows) [--rows-count:var(--xs-rows-count)]",
@@ -5,8 +5,8 @@ defineOptions({
5
5
  name: "PGridItem"
6
6
  });
7
7
  const props = defineProps({
8
- row: { type: null, required: false },
9
- column: { type: null, required: false }
8
+ row: { type: [String, Number, Object], required: false },
9
+ column: { type: [String, Number, Object], required: false }
10
10
  });
11
11
  const presetGridRow = {
12
12
  "--xs-row": "row-(--xs-row)",
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { computed, onBeforeUnmount, shallowRef } from "vue";
3
- import { off, once } from "../../utils/events";
3
+ import { off, once } from "../../utils/event";
4
4
  import PButton from "../button/index.vue";
5
5
  defineOptions({
6
6
  name: "PHoldButton"
@@ -14,6 +14,9 @@ export { default as Choicebox } from './choicebox/index.vue';
14
14
  export { default as ChoiceboxGroup } from './choicebox-group/index.vue';
15
15
  export { default as Collapse } from './collapse/index.vue';
16
16
  export { default as CollapseGroup } from './collapse-group/index.vue';
17
+ export { default as CommandMenu } from './command-menu/index.vue';
18
+ export { default as CommandMenuGroup } from './command-menu-group/index.vue';
19
+ export { default as CommandMenuItem } from './command-menu-item/index.vue';
17
20
  export { default as ConfigProvider } from './config-provider/index.vue';
18
21
  export { default as Countdown } from './countdown/index.vue';
19
22
  export { default as Description } from './description/index.vue';
@@ -31,6 +34,7 @@ export { default as Kbd } from './kbd/index.vue';
31
34
  export { default as LinkButton } from './link-button/index.vue';
32
35
  export { default as List } from './list/index.vue';
33
36
  export { default as ListItem } from './list-item/index.vue';
37
+ export { default as LoadingBar } from './loading-bar/index.vue';
34
38
  export { default as LoadingDots } from './loading-dots/index.vue';
35
39
  export { default as Material } from './material/index.vue';
36
40
  export { default as Menu } from './menu/index.vue';
@@ -14,6 +14,9 @@ export { default as Choicebox } from "./choicebox/index.vue";
14
14
  export { default as ChoiceboxGroup } from "./choicebox-group/index.vue";
15
15
  export { default as Collapse } from "./collapse/index.vue";
16
16
  export { default as CollapseGroup } from "./collapse-group/index.vue";
17
+ export { default as CommandMenu } from "./command-menu/index.vue";
18
+ export { default as CommandMenuGroup } from "./command-menu-group/index.vue";
19
+ export { default as CommandMenuItem } from "./command-menu-item/index.vue";
17
20
  export { default as ConfigProvider } from "./config-provider/index.vue";
18
21
  export { default as Countdown } from "./countdown/index.vue";
19
22
  export { default as Description } from "./description/index.vue";
@@ -31,6 +34,7 @@ export { default as Kbd } from "./kbd/index.vue";
31
34
  export { default as LinkButton } from "./link-button/index.vue";
32
35
  export { default as List } from "./list/index.vue";
33
36
  export { default as ListItem } from "./list-item/index.vue";
37
+ export { default as LoadingBar } from "./loading-bar/index.vue";
34
38
  export { default as LoadingDots } from "./loading-dots/index.vue";
35
39
  export { default as Material } from "./material/index.vue";
36
40
  export { default as Menu } from "./menu/index.vue";
@@ -14,7 +14,7 @@ const props = defineProps({
14
14
  rootMargin: { type: String, required: false, default: "20%" },
15
15
  threshold: { type: [Number, Array], required: false, default: 0 }
16
16
  });
17
- const emits = defineEmits(["before-show", "before-hide", "change", "show", "hide"]);
17
+ const emits = defineEmits(["visible-change", "before-show", "before-hide", "show", "hide"]);
18
18
  const isVisible = shallowRef(false);
19
19
  const containerRef = shallowRef();
20
20
  const containerSize = shallowRef({
@@ -43,7 +43,7 @@ function onVisibleChange(isIntersecting) {
43
43
  emits("hide");
44
44
  });
45
45
  }
46
- emits("change", isIntersecting);
46
+ emits("visible-change", isIntersecting);
47
47
  }
48
48
  useIntersectionObserver(containerRef, ([{ isIntersecting }]) => {
49
49
  onVisibleChange(isIntersecting);
@@ -1,7 +1,10 @@
1
1
  <script setup>
2
+ import { useConfigProvider } from "pxd";
3
+ import { getFallbackValue } from "pxd/utils/get";
2
4
  import { computed } from "vue";
3
5
  defineOptions({
4
- name: "PKbd"
6
+ name: "PKbd",
7
+ inheritAttrs: false
5
8
  });
6
9
  const props = defineProps({
7
10
  meta: { type: Boolean, required: false },
@@ -9,14 +12,22 @@ const props = defineProps({
9
12
  alt: { type: Boolean, required: false },
10
13
  ctrl: { type: Boolean, required: false },
11
14
  small: { type: Boolean, required: false },
12
- label: { type: String, required: false }
15
+ label: { type: String, required: false },
16
+ size: { type: String, required: false }
13
17
  });
18
+ const SIZES = {
19
+ sm: "h-5 text-xs",
20
+ md: "h-6 text-sm",
21
+ lg: "h-7 text-sm"
22
+ };
14
23
  const INTERNAL_KEYS = {
15
24
  meta: "\u2318",
16
25
  shift: "\u21E7",
17
26
  alt: "\u2325",
18
27
  ctrl: "Ctrl"
19
28
  };
29
+ const config = useConfigProvider();
30
+ const computedSize = computed(() => getFallbackValue(props.size, SIZES, config.size));
20
31
  const internalKey = computed(() => {
21
32
  return Object.entries(INTERNAL_KEYS).filter(([k]) => {
22
33
  return props[k];
@@ -26,8 +37,9 @@ const internalKey = computed(() => {
26
37
 
27
38
  <template>
28
39
  <kbd
29
- class="pxd-keyboard px-1.5 font-sans ml-1 inline-flex items-center rounded-md border border-input bg-background-100 text-center text-gray-1000"
30
- :class="[small ? 'h-5 text-xs' : 'h-6 text-sm']"
40
+ class="pxd-keyboard px-1.5 font-sans ml-1 inline-flex items-center rounded-md border border-input bg-background-100 text-center text-nowrap whitespace-nowrap text-gray-1000"
41
+ :class="computedSize"
42
+ v-bind="$attrs"
31
43
  >
32
44
  {{ internalKey }}
33
45
  <slot>{{ label }}</slot>