@privyid/persona 0.24.0 → 0.25.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 (171) hide show
  1. package/dist/components/accordion/Accordion.vue +1 -1
  2. package/dist/components/aspect-ratio/index.d.ts +1 -1
  3. package/dist/components/avatar/Avatar.vue.d.ts +2 -2
  4. package/dist/components/badge/Badge.vue.d.ts +3 -3
  5. package/dist/components/banner/Banner.vue.d.ts +2 -2
  6. package/dist/components/breadcrumbs/Breadcrumb.vue.d.ts +1 -1
  7. package/dist/components/breadcrumbs/BreadcrumbItem.vue.d.ts +1 -1
  8. package/dist/components/button/Button.vue +15 -3
  9. package/dist/components/button-group/ButtonGroup.vue.d.ts +1 -1
  10. package/dist/components/button-group/index.d.ts +2 -2
  11. package/dist/components/calendar/Calendar.vue.d.ts +2 -2
  12. package/dist/components/calendar/adapter/adapter.d.ts +1 -1
  13. package/dist/components/camera/Camera.vue.d.ts +2 -2
  14. package/dist/components/camera/adapter/adapter.d.ts +1 -1
  15. package/dist/components/camera/utils/motion.mjs +2 -2
  16. package/dist/components/caption/Caption.vue.d.ts +3 -3
  17. package/dist/components/card/Card.vue.d.ts +2 -2
  18. package/dist/components/carousel/Carousel.vue.d.ts +5 -5
  19. package/dist/components/carousel/index.d.ts +1 -1
  20. package/dist/components/chart/Chart.vue +20 -17
  21. package/dist/components/chart/Chart.vue.d.ts +3 -3
  22. package/dist/components/chart/adapter/adapter.d.ts +1 -1
  23. package/dist/components/chart/adapter/index.d.ts +1 -1
  24. package/dist/components/chart/index.d.ts +1 -1
  25. package/dist/components/checkbox/Checkbox.vue +3 -2
  26. package/dist/components/checkbox/index.d.ts +1 -1
  27. package/dist/components/contextual-bar/ContextualBar.vue.d.ts +5 -5
  28. package/dist/components/cropper/Cropper.vue.d.ts +2 -2
  29. package/dist/components/cropper/index.d.ts +2 -2
  30. package/dist/components/cropper/utils/use-pinch.d.ts +1 -1
  31. package/dist/components/cropper/utils/use-ratio.d.ts +1 -1
  32. package/dist/components/datepicker/Datepicker.vue +1 -0
  33. package/dist/components/datepicker/Datepicker.vue.d.ts +3 -3
  34. package/dist/components/dialog/Dialog.vue +8 -3
  35. package/dist/components/dialog/Dialog.vue.d.ts +1 -1
  36. package/dist/components/dialog/DialogFooter.vue.d.ts +1 -1
  37. package/dist/components/dialog/index.d.ts +19 -2
  38. package/dist/components/dialog/index.mjs +42 -0
  39. package/dist/components/dot/Dot.vue.d.ts +3 -3
  40. package/dist/components/dropdown/Dropdown.vue +25 -23
  41. package/dist/components/dropdown/DropdownItem.vue +2 -1
  42. package/dist/components/dropdown/DropdownItem.vue.d.ts +1 -1
  43. package/dist/components/dropdown/index.d.ts +1 -1
  44. package/dist/components/dropdown-subitem/index.d.ts +1 -1
  45. package/dist/components/dropzone/Dropzone.vue.d.ts +3 -3
  46. package/dist/components/filterbar/Filterbar.vue.d.ts +2 -2
  47. package/dist/components/filterbar/index.d.ts +4 -4
  48. package/dist/components/filterbar/pinned/PinnedDate.vue.d.ts +2 -2
  49. package/dist/components/filterbar/pinned/PinnedMultiselect.vue.d.ts +3 -3
  50. package/dist/components/filterbar/pinned/PinnedSelect.vue.d.ts +3 -3
  51. package/dist/components/filterbar/pinned/PinnedToggle.vue.d.ts +2 -2
  52. package/dist/components/form-group/FormGroup.vue +23 -10
  53. package/dist/components/global/store.d.ts +2 -2
  54. package/dist/components/global/use-singleton.d.ts +1 -1
  55. package/dist/components/heading/Heading.vue.d.ts +3 -3
  56. package/dist/components/input/Input.vue.d.ts +5 -4
  57. package/dist/components/input/index.d.ts +1 -1
  58. package/dist/components/input/utils/accept.d.ts +1 -1
  59. package/dist/components/input-file/InputFile.vue.d.ts +6 -6
  60. package/dist/components/input-group/InputGroup.vue.d.ts +2 -2
  61. package/dist/components/input-group/index.d.ts +2 -2
  62. package/dist/components/input-password/InputPassword.vue.d.ts +1 -1
  63. package/dist/components/input-password/index.d.ts +1 -1
  64. package/dist/components/input-pin/InputPin.vue +1 -1
  65. package/dist/components/input-pin/InputPin.vue.d.ts +3 -3
  66. package/dist/components/input-range/InputRange.vue.d.ts +1 -1
  67. package/dist/components/input-range/utils/use-drag.d.ts +1 -1
  68. package/dist/components/label/Label.vue.d.ts +4 -4
  69. package/dist/components/list-group/ListGroup.vue.d.ts +1 -1
  70. package/dist/components/list-group/ListGroupItem.vue.d.ts +2 -2
  71. package/dist/components/markdown/index.d.ts +1 -1
  72. package/dist/components/meta.json +21 -21
  73. package/dist/components/modal/Modal.vue +6 -6
  74. package/dist/components/modal/Modal.vue.d.ts +3 -3
  75. package/dist/components/nav/Nav.vue.d.ts +3 -3
  76. package/dist/components/nav/NavItem.vue.d.ts +1 -1
  77. package/dist/components/nav/NavItemDropdown.vue.d.ts +4 -4
  78. package/dist/components/navbar/Navbar.vue.d.ts +3 -3
  79. package/dist/components/navbar/NavbarNav.vue.d.ts +2 -2
  80. package/dist/components/navbar/index.d.ts +2 -2
  81. package/dist/components/navbar-menu/NavbarNavMenu.vue.d.ts +2 -2
  82. package/dist/components/page/Page.vue.d.ts +3 -3
  83. package/dist/components/pagination/Pagination.vue +3 -2
  84. package/dist/components/pagination/Pagination.vue.d.ts +3 -3
  85. package/dist/components/pdf-helipad/utils/use-drag.d.ts +2 -2
  86. package/dist/components/pdf-object/PdfObject.vue.d.ts +1 -1
  87. package/dist/components/pdf-object/PdfObjectAddon.vue.d.ts +2 -2
  88. package/dist/components/pdf-object/index.d.ts +3 -3
  89. package/dist/components/pdf-object/utils/use-drag.d.ts +1 -1
  90. package/dist/components/pdf-object/utils/use-drop.d.ts +1 -1
  91. package/dist/components/pdf-object/utils/use-resize.d.ts +2 -2
  92. package/dist/components/pdf-object/utils/use-selector.d.ts +2 -2
  93. package/dist/components/pdf-text/PdfText.vue.d.ts +4 -4
  94. package/dist/components/pdf-viewer/PdfError.vue.d.ts +1 -1
  95. package/dist/components/pdf-viewer/PdfNavigation.vue +2 -0
  96. package/dist/components/pdf-viewer/PdfNavigation.vue.d.ts +1 -1
  97. package/dist/components/pdf-viewer/PdfViewer.vue.d.ts +2 -2
  98. package/dist/components/pdf-viewer/index.d.ts +1 -1
  99. package/dist/components/pdf-viewer/utils/use-idle.d.ts +1 -1
  100. package/dist/components/pdf-viewer/utils/use-sticky.d.ts +2 -2
  101. package/dist/components/pdf-viewer/utils/use-viewer.d.ts +21 -0
  102. package/dist/components/pdf-viewer/utils/use-viewer.mjs +3 -2
  103. package/dist/components/progress/Progress.vue.d.ts +1 -1
  104. package/dist/components/progress-indicator/ProgressIndicator.vue.d.ts +2 -2
  105. package/dist/components/radio/Radio.vue.d.ts +1 -1
  106. package/dist/components/ringbar/Ringbar.vue.d.ts +1 -1
  107. package/dist/components/select/Select.vue +22 -12
  108. package/dist/components/select/SelectInput.vue +14 -3
  109. package/dist/components/select/SelectTags.vue +3 -2
  110. package/dist/components/select/adapter/adapter.d.ts +2 -2
  111. package/dist/components/select/adapter/async-adapter.d.ts +2 -2
  112. package/dist/components/select/adapter/async-adapter.mjs +2 -2
  113. package/dist/components/select/utils/use-on-scroll.d.ts +1 -1
  114. package/dist/components/select/utils/use-on-typing.d.ts +1 -1
  115. package/dist/components/sheet/Sheet.vue +3 -3
  116. package/dist/components/sidebar/Sidebar.vue +5 -4
  117. package/dist/components/sidebar/SidebarContent.vue +19 -25
  118. package/dist/components/sidebar/SidebarContent.vue.d.ts +16 -0
  119. package/dist/components/sidebar/SidebarNav.vue +1 -1
  120. package/dist/components/sidebar/index.d.ts +2 -2
  121. package/dist/components/sidebar-menu/SidebarMenu.vue +5 -5
  122. package/dist/components/sidebar-menu/SidebarMenuItem.vue +2 -2
  123. package/dist/components/sidebar-menu/index.d.ts +4 -4
  124. package/dist/components/signature-draw/SignatureDraw.vue.d.ts +3 -3
  125. package/dist/components/signature-draw/SignatureDrawDesktop.vue.d.ts +3 -3
  126. package/dist/components/signature-draw/SignatureDrawMobile.vue.d.ts +3 -3
  127. package/dist/components/signature-draw/utils/smooth-line.d.ts +1 -1
  128. package/dist/components/signature-draw/utils/straight-line.d.ts +1 -1
  129. package/dist/components/signature-draw/utils/use-draw.d.ts +1 -1
  130. package/dist/components/signature-text/SignatureText.vue.d.ts +3 -3
  131. package/dist/components/steps/Step.vue.d.ts +2 -2
  132. package/dist/components/steps/Steps.vue.d.ts +4 -4
  133. package/dist/components/steps/index.d.ts +1 -1
  134. package/dist/components/subheading/Subheading.vue.d.ts +3 -3
  135. package/dist/components/table/Table.vue.d.ts +2 -2
  136. package/dist/components/table/index.d.ts +2 -2
  137. package/dist/components/table-flex/TableFlex.vue +7 -3
  138. package/dist/components/table-static/TableStatic.vue +34 -6
  139. package/dist/components/table-static/TableStaticRoot.vue +1 -1
  140. package/dist/components/tabs/TabContent.vue +1 -1
  141. package/dist/components/tabs/Tabs.vue +5 -3
  142. package/dist/components/text/Text.vue.d.ts +4 -4
  143. package/dist/components/textarea/Textarea.vue.d.ts +4 -3
  144. package/dist/components/toast/Toast.vue +75 -5
  145. package/dist/components/toast/Toast.vue.d.ts +16 -2
  146. package/dist/components/toast/ToastContainer.vue +6 -12
  147. package/dist/components/toast/ToastContainer.vue.d.ts +6 -134
  148. package/dist/components/toast/ToastRoot.vue +1 -3
  149. package/dist/components/toast/ToastRoot.vue.d.ts +2 -2
  150. package/dist/components/toast/index.d.ts +3 -1
  151. package/dist/components/toggle/Toggle.vue.d.ts +1 -1
  152. package/dist/components/tooltip/Tooltip.vue.d.ts +3 -3
  153. package/dist/components/tooltip/TooltipContainer.vue.d.ts +1 -1
  154. package/dist/components/tooltip/index.d.ts +1 -1
  155. package/dist/components/tooltip/utils/parse-bindings.d.ts +2 -2
  156. package/dist/components/tour/TourDialog.vue.d.ts +1 -1
  157. package/dist/components/tour/TourHighlight.vue.d.ts +1 -1
  158. package/dist/components/tour/core/step/conditional.d.ts +2 -2
  159. package/dist/components/tour/core/tour.d.ts +2 -1
  160. package/dist/components/tour/index.d.ts +1 -1
  161. package/dist/components/truncate/Truncate.vue +1 -8
  162. package/dist/components/utils/date.d.ts +2 -1
  163. package/dist/components/utils/vnode.d.ts +1 -1
  164. package/dist/components/wizard/Wizard.vue.d.ts +2 -2
  165. package/dist/components/wizard/WizardBody.vue.d.ts +1 -1
  166. package/dist/components/wizard/WizardStep.vue.d.ts +2 -2
  167. package/dist/core/index.d.ts +2 -1
  168. package/dist/core/index.mjs +3 -0
  169. package/dist/module.json +1 -1
  170. package/dist/module.mjs +1 -1
  171. package/package.json +7 -7
@@ -19,8 +19,8 @@
19
19
  <script lang="ts" setup>
20
20
  import { useVModel } from '@vueuse/core'
21
21
  import { type AccordionItem, ACCORDION_CONTEXT } from '.'
22
+ import type { PropType } from 'vue-demi'
22
23
  import {
23
- PropType,
24
24
  computed,
25
25
  provide,
26
26
  readonly,
@@ -1,3 +1,3 @@
1
- import { Directive } from 'vue-demi';
1
+ import type { Directive } from 'vue-demi';
2
2
  export declare const pAspectRatio: Directive<HTMLElement, number>;
3
3
  export declare const vPAspectRatio: import("vue-demi").ObjectDirective<HTMLElement, number>;
@@ -1,5 +1,5 @@
1
- import { PropType } from 'vue-demi';
2
- import { TypeVariant, SizeVariant } from '.';
1
+ import type { PropType } from 'vue-demi';
2
+ import type { TypeVariant, SizeVariant } from '.';
3
3
  declare const _default: import("vue-demi").DefineComponent<{
4
4
  variant: {
5
5
  type: PropType<TypeVariant>;
@@ -1,6 +1,6 @@
1
- import { PropType } from 'vue-demi';
2
- import { StyleVariant } from '.';
3
- import { ColorVariant } from '../button';
1
+ import type { PropType } from 'vue-demi';
2
+ import type { StyleVariant } from '.';
3
+ import type { ColorVariant } from '../button';
4
4
  declare const _default: import("vue-demi").DefineComponent<{
5
5
  color: {
6
6
  type: PropType<ColorVariant>;
@@ -1,5 +1,5 @@
1
- import { PropType } from 'vue-demi';
2
- import { StyleVariant } from '.';
1
+ import type { PropType } from 'vue-demi';
2
+ import type { StyleVariant } from '.';
3
3
  declare const _default: import("vue-demi").DefineComponent<{
4
4
  variant: {
5
5
  type: PropType<StyleVariant>;
@@ -1,4 +1,4 @@
1
- import { BreadcrumbItems } from '.';
1
+ import type { BreadcrumbItems } from '.';
2
2
  declare const _default: import("vue-demi").DefineComponent<{
3
3
  items: {
4
4
  type: {
@@ -1,4 +1,4 @@
1
- import { TagVariant } from '.';
1
+ import type { TagVariant } from '.';
2
2
  declare const _default: import("vue-demi").DefineComponent<{
3
3
  href: {
4
4
  type: StringConstructor;
@@ -6,19 +6,26 @@
6
6
  data-testid="btn"
7
7
  :class="classNames"
8
8
  :disabled="loading || disabled">
9
- <spinner v-if="loading" />
9
+ <slot
10
+ v-if="loading"
11
+ name="loading">
12
+ <spinner />
13
+ </slot>
10
14
  <slot v-else />
11
15
  </component>
12
16
  </template>
13
17
 
14
18
  <script lang="ts" setup>
19
+ import type {
20
+ PropType,
21
+ VNode,
22
+ } from 'vue-demi'
15
23
  import {
16
24
  computed,
17
- PropType,
18
25
  inject,
19
26
  } from 'vue-demi'
20
27
  import type { RouteLocationRaw } from 'vue-router'
21
- import {
28
+ import type {
22
29
  ColorVariant,
23
30
  SizeVariant,
24
31
  StyleVariant,
@@ -106,6 +113,11 @@ const tagName = computed(() => {
106
113
  ? 'nuxt-link'
107
114
  : 'button'
108
115
  })
116
+
117
+ defineSlots<{
118
+ loading(): VNode[],
119
+ default(): VNode[],
120
+ }>()
109
121
  </script>
110
122
 
111
123
  <style lang="postcss">
@@ -1,4 +1,4 @@
1
- import { PropType } from 'vue-demi';
1
+ import type { PropType } from 'vue-demi';
2
2
  import type { SizeVariant } from '../button';
3
3
  declare const _default: import("vue-demi").DefineComponent<{
4
4
  size: {
@@ -1,5 +1,5 @@
1
- import { InjectionKey, Ref } from 'vue-demi';
2
- import { SizeVariant } from '../button';
1
+ import type { InjectionKey, Ref } from 'vue-demi';
2
+ import type { SizeVariant } from '../button';
3
3
  export interface ButtonGroupSetting {
4
4
  size?: Ref<SizeVariant>;
5
5
  }
@@ -1,5 +1,5 @@
1
- import { PropType } from 'vue-demi';
2
- import { CalendarItem } from './adapter/adapter';
1
+ import type { PropType } from 'vue-demi';
2
+ import type { CalendarItem } from './adapter/adapter';
3
3
  type TransitionMode = 'slide-left' | 'slide-right' | 'zoom-in' | 'zoom-out';
4
4
  declare const _default: import("vue-demi").DefineComponent<{
5
5
  modelValue: {
@@ -1,4 +1,4 @@
1
- import { Ref } from 'vue-demi';
1
+ import type { Ref } from 'vue-demi';
2
2
  import { type Duration } from 'date-fns';
3
3
  export interface CalendarItem {
4
4
  value: Date;
@@ -1,5 +1,5 @@
1
- import { ComputedRef, PropType } from 'vue-demi';
2
- import { Adapter, MaskVariant, ModelModifier } from './adapter/adapter';
1
+ import type { ComputedRef, PropType } from 'vue-demi';
2
+ import type { Adapter, MaskVariant, ModelModifier } from './adapter/adapter';
3
3
  declare const _default: import("vue-demi").DefineComponent<{
4
4
  modelValue: {
5
5
  type: PropType<string | string[] | File | File[]>;
@@ -1,4 +1,4 @@
1
- import { ComputedRef, Ref } from 'vue-demi';
1
+ import type { ComputedRef, Ref } from 'vue-demi';
2
2
  export type MaskVariant = 'square' | 'round' | 'card' | 'none';
3
3
  export type MirrorMode = boolean | 'preview' | 'all';
4
4
  export interface ModelModifier {
@@ -77,10 +77,10 @@ export function motionDetection(imageData, template) {
77
77
  }
78
78
  const distX = bestHitX - template.xPos;
79
79
  const distY = bestHitY - template.yPos;
80
- const movementDiff = Math.sqrt(distX * distX + distY * distY);
80
+ const movementDiff = Math.hypot(distX, distY);
81
81
  const maxDistX = searchWidth - template.width / 2;
82
82
  const maxDistY = searchHeight - template.height / 2;
83
- const maximumMovement = Math.sqrt(maxDistX * maxDistX + maxDistY * maxDistY);
83
+ const maximumMovement = Math.hypot(maxDistX, maxDistY);
84
84
  let movementPercentage = movementDiff / maximumMovement * 100;
85
85
  if (movementPercentage > 100)
86
86
  movementPercentage = 100;
@@ -1,6 +1,6 @@
1
- import { PropType } from 'vue-demi';
2
- import { WeightVariant, TransformVariant } from '../heading';
3
- import { SizeVariant } from '.';
1
+ import type { PropType } from 'vue-demi';
2
+ import type { WeightVariant, TransformVariant } from '../heading';
3
+ import type { SizeVariant } from '.';
4
4
  declare const _default: import("vue-demi").DefineComponent<{
5
5
  weight: {
6
6
  type: PropType<WeightVariant>;
@@ -1,5 +1,5 @@
1
- import { PropType } from 'vue-demi';
2
- import { ElementVariant } from '.';
1
+ import type { PropType } from 'vue-demi';
2
+ import type { ElementVariant } from '.';
3
3
  declare const _default: import("vue-demi").DefineComponent<{
4
4
  element: {
5
5
  type: PropType<ElementVariant>;
@@ -1,7 +1,7 @@
1
- import { PropType } from 'vue-demi';
2
- import { DirectionVariant } from '../steps';
1
+ import type { PropType } from 'vue-demi';
2
+ import type { DirectionVariant } from '../steps';
3
3
  import '@splidejs/splide/css/core';
4
- import { AlignmentVariant } from '.';
4
+ import type { AlignmentVariant } from '.';
5
5
  import type { Options } from '@splidejs/splide';
6
6
  declare const _default: import("vue-demi").DefineComponent<{
7
7
  modelValue: {
@@ -98,11 +98,11 @@ declare const _default: import("vue-demi").DefineComponent<{
98
98
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
99
99
  }, {
100
100
  modelValue: number;
101
- direction: DirectionVariant;
102
101
  align: AlignmentVariant;
103
102
  width: string | number;
104
- height: string | number;
105
103
  loop: boolean;
104
+ height: string | number;
105
+ direction: DirectionVariant;
106
106
  autoplay: boolean;
107
107
  autoplayInterval: string | number;
108
108
  splideOptions: Options;
@@ -1,4 +1,4 @@
1
1
  import type { Splide } from '@splidejs/splide';
2
- import { InjectionKey, Ref } from 'vue-demi';
2
+ import type { InjectionKey, Ref } from 'vue-demi';
3
3
  export type AlignmentVariant = 'start' | 'end';
4
4
  export declare const CAROUSEL_INSTANCE: InjectionKey<Ref<Splide>>;
@@ -55,6 +55,25 @@ export default defineComponent({
55
55
  const data = computed(() => {
56
56
  return getAdapter(variant.value).getDatasets(slots.default());
57
57
  });
58
+ const options = computed(() => {
59
+ return {
60
+ plugins: {
61
+ legend: {
62
+ display: legend.value !== "none",
63
+ position: legend.value === "none" ? void 0 : legend.value,
64
+ labels: {
65
+ color: "#9CA3AF",
66
+ font: {
67
+ family: "DM Sans",
68
+ size: 12,
69
+ weight: "600"
70
+ }
71
+ }
72
+ }
73
+ },
74
+ ...getAdapter(variant.value).getStyle()
75
+ };
76
+ });
58
77
  async function initChart() {
59
78
  if (instance.value)
60
79
  instance.value.destroy();
@@ -62,23 +81,7 @@ export default defineComponent({
62
81
  canvas.value,
63
82
  variant.value,
64
83
  data.value,
65
- {
66
- plugins: {
67
- legend: {
68
- display: legend.value !== "none",
69
- position: legend.value === "none" ? void 0 : legend.value,
70
- labels: {
71
- color: "#9CA3AF",
72
- font: {
73
- family: "DM Sans",
74
- size: 12,
75
- weight: "600"
76
- }
77
- }
78
- }
79
- },
80
- ...getAdapter(variant.value).getStyle()
81
- }
84
+ options.value
82
85
  );
83
86
  }
84
87
  const dataWatcher = watchPausable(data, (newData) => {
@@ -1,6 +1,6 @@
1
- import { PropType } from 'vue-demi';
2
- import { ChartType } from './adapter/index';
3
- import { LegendPosition } from '.';
1
+ import type { PropType } from 'vue-demi';
2
+ import type { ChartType } from './adapter/index';
3
+ import type { LegendPosition } from '.';
4
4
  declare const _default: import("vue-demi").DefineComponent<{
5
5
  variant: {
6
6
  type: PropType<ChartType>;
@@ -1,5 +1,5 @@
1
1
  import type { ChartData, ChartOptions } from 'chart.js/auto';
2
- import { VNode } from 'vue-demi';
2
+ import type { VNode } from 'vue-demi';
3
3
  export interface ChartAdapter {
4
4
  getStyle: () => ChartOptions;
5
5
  getDatasets: (vnodes: VNode[]) => ChartData;
@@ -1,3 +1,3 @@
1
- import { ChartAdapter } from './adapter';
1
+ import type { ChartAdapter } from './adapter';
2
2
  export type ChartType = 'line' | 'bar' | 'pie';
3
3
  export default function getAdapter(type: ChartType): ChartAdapter;
@@ -1,2 +1,2 @@
1
- import { LayoutPosition } from 'chart.js';
1
+ import type { LayoutPosition } from 'chart.js';
2
2
  export type LegendPosition = 'none' | LayoutPosition;
@@ -23,7 +23,8 @@
23
23
 
24
24
  <script lang="ts" setup>
25
25
  import { useVModel } from '.'
26
- import { PropType, computed } from 'vue-demi'
26
+ import type { PropType } from 'vue-demi'
27
+ import { computed } from 'vue-demi'
27
28
  import IconCheckbox from './icon/IconCheckbox.vue'
28
29
  import IconInderteminate from './icon/IconInderteminate.vue'
29
30
 
@@ -117,7 +118,7 @@ function toggle () {
117
118
  * with custom icon
118
119
  */
119
120
  &__icon {
120
- @apply w-5 h-5 inline-flex shrink-0 border rounded-tn border-subtle items-center justify-center bg-default;
121
+ @apply w-4 h-4 inline-flex shrink-0 border rounded-tn border-subtle items-center justify-center bg-default;
121
122
  @apply dark:border-dark-subtle dark:bg-dark-default;
122
123
 
123
124
  > svg {
@@ -1,4 +1,4 @@
1
- import { InputProps } from '../input';
1
+ import type { InputProps } from '../input';
2
2
  export interface CheckboxProps extends InputProps<unknown> {
3
3
  checked: boolean;
4
4
  value: unknown;
@@ -1,6 +1,6 @@
1
- import { PropType } from 'vue-demi';
2
- import { AlignVariant } from '../nav';
3
- import { StyleVariant } from '.';
1
+ import type { PropType } from 'vue-demi';
2
+ import type { AlignVariant } from '../nav';
3
+ import type { StyleVariant } from '.';
4
4
  declare const _default: import("vue-demi").DefineComponent<{
5
5
  state: {
6
6
  type: PropType<StyleVariant>;
@@ -36,7 +36,7 @@ declare const _default: import("vue-demi").DefineComponent<{
36
36
  close: (event: Event) => void;
37
37
  onEnter: (target: HTMLDivElement) => void;
38
38
  onLeave: (target: HTMLDivElement) => void;
39
- }, unknown, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, ("show" | "close" | "update:modelValue" | "hide")[], "show" | "close" | "update:modelValue" | "hide", import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<import("vue-demi").ExtractPropTypes<{
39
+ }, unknown, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, ("close" | "show" | "update:modelValue" | "hide")[], "close" | "show" | "update:modelValue" | "hide", import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<import("vue-demi").ExtractPropTypes<{
40
40
  state: {
41
41
  type: PropType<StyleVariant>;
42
42
  default: string;
@@ -67,8 +67,8 @@ declare const _default: import("vue-demi").DefineComponent<{
67
67
  };
68
68
  }>> & {
69
69
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
70
- onShow?: ((...args: any[]) => any) | undefined;
71
70
  onClose?: ((...args: any[]) => any) | undefined;
71
+ onShow?: ((...args: any[]) => any) | undefined;
72
72
  onHide?: ((...args: any[]) => any) | undefined;
73
73
  }, {
74
74
  dismissable: boolean;
@@ -1,5 +1,5 @@
1
- import { PropType, StyleValue } from 'vue-demi';
2
- import { ModelModifier } from '../camera/adapter/adapter';
1
+ import type { PropType, StyleValue } from 'vue-demi';
2
+ import type { ModelModifier } from '../camera/adapter/adapter';
3
3
  declare const _default: import("vue-demi").DefineComponent<{
4
4
  modelValue: {
5
5
  type: (StringConstructor | {
@@ -1,3 +1,3 @@
1
- import { MaybeRef } from '@vueuse/core';
2
- import { Ref } from 'vue-demi';
1
+ import type { MaybeRef } from '@vueuse/core';
2
+ import type { Ref } from 'vue-demi';
3
3
  export declare function usePreview(file: MaybeRef<string | globalThis.File>, fallback?: string): Ref<string>;
@@ -1,4 +1,4 @@
1
- import { Ref } from 'vue-demi';
1
+ import type { Ref } from 'vue-demi';
2
2
  import type { InteractEvent, GestureEvent } from '@interactjs/types';
3
3
  export interface EventHooks {
4
4
  onstart?: (event: InteractEvent) => void;
@@ -1,4 +1,4 @@
1
- import { ComputedRef } from 'vue-demi';
1
+ import type { ComputedRef } from 'vue-demi';
2
2
  export interface RatioProp {
3
3
  width?: number | string;
4
4
  height?: number | string;
@@ -197,6 +197,7 @@ export default defineComponent({
197
197
  }
198
198
 
199
199
  > .dropdown__menu {
200
+ --p-dropdown-size: auto;
200
201
  --p-dropdown-max-height: 100%;
201
202
 
202
203
  @apply min-w-max max-h-min;
@@ -1,5 +1,5 @@
1
- import { PropType } from 'vue-demi';
2
- import { SizeVariant } from '../button';
1
+ import type { PropType } from 'vue-demi';
2
+ import type { SizeVariant } from '../button';
3
3
  declare const _default: import("vue-demi").DefineComponent<{
4
4
  modelValue: {
5
5
  type: PropType<Date | [Date, Date]>;
@@ -148,7 +148,7 @@ declare const _default: import("vue-demi").DefineComponent<{
148
148
  range: boolean;
149
149
  minRange: string;
150
150
  maxRange: string;
151
- format: string;
152
151
  placeholder: string;
152
+ format: string;
153
153
  }, {}>;
154
154
  export default _default;
@@ -17,7 +17,12 @@
17
17
  element="h6" />
18
18
  </template>
19
19
  <template #default>
20
- <span v-p-md.inline="context.text" />
20
+ <template v-if="(typeof context.content === 'function')">
21
+ <component :is="context.content" />
22
+ </template>
23
+ <template v-else>
24
+ <span v-p-md.inline="context.text" />
25
+ </template>
21
26
  </template>
22
27
  <template #footer>
23
28
  <dialog-footer
@@ -51,8 +56,8 @@ import { pMd } from "../markdown";
51
56
  export default defineComponent({
52
57
  components: {
53
58
  Modal,
54
- DialogFooter,
55
- Heading
59
+ Heading,
60
+ DialogFooter
56
61
  },
57
62
  directives: { pMd },
58
63
  setup() {
@@ -1,4 +1,4 @@
1
- import { DialogContext } from '.';
1
+ import type { DialogContext } from '.';
2
2
  declare const _default: import("vue-demi").DefineComponent<{}, {
3
3
  id: import("vue-demi").Ref<symbol | undefined>;
4
4
  modal: import("vue-demi").Ref<boolean>;
@@ -1,4 +1,4 @@
1
- import { PropType } from 'vue-demi';
1
+ import type { PropType } from 'vue-demi';
2
2
  import type { StyleVariant as FooterButtonStyleVariant, ColorVariant as FooterButtonColorVariant } from '../button';
3
3
  export type FooterAlignVariant = 'start' | 'end';
4
4
  export type { StyleVariant as FooterButtonStyleVariant, ColorVariant as FooterButtonColorVariant, } from '../button';
@@ -1,5 +1,8 @@
1
1
  import type { FooterAlignVariant, FooterButtonColorVariant, FooterButtonStyleVariant } from './DialogFooter.vue';
2
2
  import type { SizeVariant } from '../modal';
3
+ import type { SizeVariant as InputSizeVariant } from '../button';
4
+ import type { VNode } from 'vue-demi';
5
+ import type { AcceptVariant } from '../input';
3
6
  interface DialogButton {
4
7
  text?: string;
5
8
  visible?: boolean;
@@ -19,10 +22,24 @@ export interface DialogOptions {
19
22
  cancel?: DialogButton;
20
23
  confirm?: DialogButton;
21
24
  }
25
+ export type DialogConfirmOption = DialogOptions;
26
+ export type DialogAlertOption = Omit<DialogOptions, 'cancel'>;
27
+ export interface DialogPromptOption extends DialogOptions {
28
+ value?: string;
29
+ input?: {
30
+ type?: string;
31
+ placeholder?: string;
32
+ size?: InputSizeVariant;
33
+ clearable?: boolean;
34
+ accept?: AcceptVariant;
35
+ };
36
+ }
22
37
  export interface DialogContext extends DialogOptions {
23
38
  onConfirm: () => void;
24
39
  onCancel: () => void;
40
+ content?: () => VNode;
25
41
  }
26
- export declare function confirm(options: DialogOptions): Promise<boolean>;
27
- export declare function alert(options: Omit<DialogOptions, 'cancel'>): Promise<void>;
42
+ export declare function confirm(options: DialogConfirmOption): Promise<boolean>;
43
+ export declare function alert(options: DialogConfirmOption): Promise<void>;
44
+ export declare function prompt(options: DialogPromptOption): Promise<string>;
28
45
  export {};
@@ -1,5 +1,11 @@
1
1
  import { useSingleton } from "../global/use-singleton.mjs";
2
2
  import defu from "defu";
3
+ import {
4
+ ref,
5
+ h
6
+ } from "vue-demi";
7
+ import pInput from "../input/Input.vue";
8
+ import pFormGroup from "../form-group/FormGroup.vue";
3
9
  export async function confirm(options) {
4
10
  const { default: Dialog } = await import("./Dialog.vue");
5
11
  const modal = await useSingleton(Dialog);
@@ -30,3 +36,39 @@ export async function alert(options) {
30
36
  }
31
37
  ));
32
38
  }
39
+ export async function prompt(options) {
40
+ const { default: Dialog } = await import("./Dialog.vue");
41
+ const model = ref(options.value);
42
+ const modal = await useSingleton(Dialog);
43
+ const result = await new Promise((resolve) => {
44
+ modal.show(defu(
45
+ {
46
+ content: () => {
47
+ return h(pFormGroup, { label: options.text }, () => [
48
+ h(pInput, {
49
+ "type": options.input?.type,
50
+ "placeholder": options.input?.placeholder,
51
+ "size": options.input?.size,
52
+ "clearable": options.input?.clearable,
53
+ "accept": options.input?.accept,
54
+ "modelValue": model.value,
55
+ "onUpdate:modelValue": (value) => {
56
+ model.value = value;
57
+ }
58
+ })
59
+ ]);
60
+ },
61
+ onConfirm: () => resolve(model.value),
62
+ onCancel: () => resolve("")
63
+ },
64
+ options,
65
+ {
66
+ title: "Question",
67
+ confirm: { text: "Submit" },
68
+ cancel: {},
69
+ centered: true
70
+ }
71
+ ));
72
+ });
73
+ return result;
74
+ }
@@ -1,6 +1,6 @@
1
- import { PropType } from 'vue-demi';
2
- import { StyleVariant } from '.';
3
- import { ColorVariant } from '../button';
1
+ import type { PropType } from 'vue-demi';
2
+ import type { StyleVariant } from '.';
3
+ import type { ColorVariant } from '../button';
4
4
  declare const _default: import("vue-demi").DefineComponent<{
5
5
  color: {
6
6
  type: PropType<ColorVariant>;
@@ -67,15 +67,17 @@
67
67
  </template>
68
68
 
69
69
  <script lang="ts" setup>
70
- import {
70
+ import type {
71
71
  PropType,
72
+ VNode,
73
+ } from 'vue-demi'
74
+ import {
72
75
  provide,
73
76
  watch,
74
77
  toRef,
75
78
  watchEffect,
76
79
  computed,
77
80
  ref,
78
- VNode,
79
81
  } from 'vue-demi'
80
82
  import {
81
83
  onClickOutside,
@@ -84,8 +86,8 @@ import {
84
86
  import Button from '../button/Button.vue'
85
87
  import DropdownGroup from '../dropdown-subitem/DropdownSubitem.vue'
86
88
  import { useFocus } from './utils/use-focus'
89
+ import type { Placement } from '@floating-ui/dom'
87
90
  import {
88
- Placement,
89
91
  autoUpdate,
90
92
  computePosition,
91
93
  offset,
@@ -216,15 +218,15 @@ const classNames = computed(() => {
216
218
  if (props.divider)
217
219
  result.push('dropdown--divider')
218
220
 
221
+ if (props.menuSize)
222
+ result.push(`dropdown--menu-${props.menuSize}`)
223
+
219
224
  return result
220
225
  })
221
226
 
222
227
  const containerSize = computed(() => {
223
228
  const result: string[] = ['']
224
229
 
225
- if (props.menuSize)
226
- result.push(`dropdown__menu--${props.menuSize}`)
227
-
228
230
  if (slots.prepend)
229
231
  result.push('dropdown__menu--has-prepend')
230
232
 
@@ -360,8 +362,24 @@ defineExpose({
360
362
 
361
363
  @apply inline-flex;
362
364
 
365
+ &--menu-xl {
366
+ --p-dropdown-size: var(--p-dropdown-size-xl);
367
+ }
368
+
369
+ &--menu-lg {
370
+ --p-dropdown-size: var(--p-dropdown-size-lg);
371
+ }
372
+
373
+ &--menu-md {
374
+ --p-dropdown-size: var(--p-dropdown-size-md);
375
+ }
376
+
377
+ &--menu-sm {
378
+ --p-dropdown-size: var(--p-dropdown-size-sm);
379
+ }
380
+
363
381
  &__menu {
364
- @apply border rounded bg-default z-[var(--p-dropdown-z-index)] border-default shadow-xl absolute flex flex-col overflow-hidden;
382
+ @apply border rounded bg-default z-[var(--p-dropdown-z-index)] border-default shadow-xl absolute flex flex-col overflow-hidden w-[var(--p-dropdown-size)];
365
383
  @apply dark:bg-dark-default dark:border-dark-default;
366
384
 
367
385
  &__prepend,
@@ -390,22 +408,6 @@ defineExpose({
390
408
  }
391
409
  }
392
410
  }
393
-
394
- &--xl {
395
- @apply w-[var(--p-dropdown-size-xl)];
396
- }
397
-
398
- &--lg {
399
- @apply w-[var(--p-dropdown-size-lg)];
400
- }
401
-
402
- &--md {
403
- @apply w-[var(--p-dropdown-size-md)];
404
- }
405
-
406
- &--sm {
407
- @apply w-[var(--p-dropdown-size-sm)];
408
- }
409
411
  }
410
412
 
411
413
  &__activator > &__caret {