@witchcraft/ui 0.2.1-beta.3 → 0.2.2

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 (203) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +20 -4
  3. package/dist/runtime/build/WitchcraftUiResolver.d.ts +2 -2
  4. package/dist/runtime/build/generateTheme.js +2 -2
  5. package/dist/runtime/components/Aria/Aria.d.vue.ts +5 -0
  6. package/dist/runtime/components/Aria/Aria.vue +4 -2
  7. package/dist/runtime/components/Aria/Aria.vue.d.ts +1 -1
  8. package/dist/runtime/components/Icon/Icon.d.vue.ts +21 -0
  9. package/dist/runtime/components/Icon/Icon.vue +3 -3
  10. package/dist/runtime/components/Icon/Icon.vue.d.ts +1 -1
  11. package/dist/runtime/components/LibButton/LibButton.d.vue.ts +36 -0
  12. package/dist/runtime/components/LibButton/LibButton.vue +9 -4
  13. package/dist/runtime/components/LibButton/LibButton.vue.d.ts +1 -1
  14. package/dist/runtime/components/LibCheckbox/LibCheckbox.d.vue.ts +42 -0
  15. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +3 -4
  16. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +1 -1
  17. package/dist/runtime/components/LibColorInput/LibColorInput.d.vue.ts +63 -0
  18. package/dist/runtime/components/LibColorInput/LibColorInput.vue +15 -8
  19. package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +1 -1
  20. package/dist/runtime/components/LibColorPicker/LibColorPicker.d.vue.ts +61 -0
  21. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue +10 -6
  22. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue.d.ts +1 -1
  23. package/dist/runtime/components/LibColorPicker/utils/truncate.js +1 -1
  24. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.d.vue.ts +22 -0
  25. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +5 -2
  26. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts +1 -1
  27. package/dist/runtime/components/LibDatePicker/LibDatePicker.d.vue.ts +40 -0
  28. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +1 -1
  29. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.d.vue.ts +34 -0
  30. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue +8 -6
  31. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue.d.ts +1 -1
  32. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.d.vue.ts +34 -0
  33. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue +7 -5
  34. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue.d.ts +1 -1
  35. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.d.vue.ts +22 -0
  36. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue.d.ts +1 -1
  37. package/dist/runtime/components/LibDebug/LibDebug.d.vue.ts +32 -0
  38. package/dist/runtime/components/LibDebug/LibDebug.vue +9 -4
  39. package/dist/runtime/components/LibDebug/LibDebug.vue.d.ts +1 -1
  40. package/dist/runtime/components/LibDevOnly/LibDevOnly.d.vue.ts +25 -0
  41. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue +2 -1
  42. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue.d.ts +4 -1
  43. package/dist/runtime/components/LibFileInput/LibFileInput.d.vue.ts +43 -0
  44. package/dist/runtime/components/LibFileInput/LibFileInput.vue +29 -13
  45. package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +2 -2
  46. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.d.vue.ts +165 -0
  47. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +42 -12
  48. package/dist/runtime/components/LibLabel/LibLabel.d.vue.ts +26 -0
  49. package/dist/runtime/components/LibLabel/LibLabel.vue +2 -2
  50. package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +3 -3
  51. package/dist/runtime/components/LibMultiValues/LibMultiValues.d.vue.ts +29 -0
  52. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +1 -2
  53. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue.d.ts +2 -2
  54. package/dist/runtime/components/LibNotifications/LibNotification.d.vue.ts +17 -0
  55. package/dist/runtime/components/LibNotifications/LibNotification.vue +19 -8
  56. package/dist/runtime/components/LibNotifications/LibNotifications.d.vue.ts +13 -0
  57. package/dist/runtime/components/LibNotifications/LibNotifications.vue +10 -6
  58. package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +2 -2
  59. package/dist/runtime/components/LibPagination/LibPagination.d.vue.ts +104 -0
  60. package/dist/runtime/components/LibPagination/LibPagination.vue +25 -12
  61. package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +2 -2
  62. package/dist/runtime/components/LibPalette/LibPalette.d.vue.ts +14 -0
  63. package/dist/runtime/components/LibPalette/LibPalette.vue +6 -5
  64. package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +5 -5
  65. package/dist/runtime/components/LibPopup/LibPopup.d.vue.ts +46 -0
  66. package/dist/runtime/components/LibPopup/LibPopup.vue +6 -4
  67. package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +3 -3
  68. package/dist/runtime/components/LibProgressBar/LibProgressBar.d.vue.ts +41 -0
  69. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +5 -3
  70. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue.d.ts +9 -9
  71. package/dist/runtime/components/LibRecorder/LibRecorder.d.vue.ts +77 -0
  72. package/dist/runtime/components/LibRecorder/LibRecorder.vue +1 -1
  73. package/dist/runtime/components/LibRecorder/LibRecorder.vue.d.ts +2 -2
  74. package/dist/runtime/components/LibRoot/LibRoot.d.vue.ts +41 -0
  75. package/dist/runtime/components/LibRoot/LibRoot.vue +11 -6
  76. package/dist/runtime/components/LibRoot/LibRoot.vue.d.ts +1 -1
  77. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.d.vue.ts +35 -0
  78. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue +1 -1
  79. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue.d.ts +1 -1
  80. package/dist/runtime/components/LibSuggestions/LibSuggestions.d.vue.ts +94 -0
  81. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +6 -4
  82. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +1 -1
  83. package/dist/runtime/components/LibTable/LibTable.d.vue.ts +45 -0
  84. package/dist/runtime/components/LibTable/LibTable.vue +23 -8
  85. package/dist/runtime/components/LibTable/LibTable.vue.d.ts +1 -1
  86. package/dist/runtime/components/Template/NAME.d.vue.ts +17 -0
  87. package/dist/runtime/components/Template/NAME.vue +2 -3
  88. package/dist/runtime/components/Template/NAME.vue.d.ts +1 -1
  89. package/dist/runtime/components/TestControls/TestControls.d.vue.ts +5 -0
  90. package/dist/runtime/components/TestControls/TestControls.vue +4 -2
  91. package/dist/runtime/components/TestControls/TestControls.vue.d.ts +1 -1
  92. package/dist/runtime/composables/useDragWithThreshold.d.ts +1 -1
  93. package/dist/runtime/composables/useInjectedI18n.d.ts +1 -1
  94. package/dist/runtime/composables/useScrollNearContainerEdges.d.ts +1 -1
  95. package/dist/runtime/composables/useSetupI18n.d.ts +1 -1
  96. package/dist/runtime/composables/useSuggestions.d.ts +2 -2
  97. package/dist/runtime/helpers/NotificationHandler.d.ts +1 -1
  98. package/dist/runtime/helpers/base64ToImg.js +2 -2
  99. package/dist/runtime/tailwind/themeConvertionOpts.d.ts +1 -1
  100. package/dist/runtime/types/index.d.ts +1 -1
  101. package/dist/runtime/utils/notifyIfError.d.ts +1 -1
  102. package/package.json +9 -10
  103. package/src/module.ts +41 -33
  104. package/src/runtime/build/WitchcraftUiResolver.ts +3 -3
  105. package/src/runtime/build/generateTheme.ts +3 -2
  106. package/src/runtime/build/unpluginIconViteOptions.ts +1 -1
  107. package/src/runtime/components/Aria/Aria.vue +5 -6
  108. package/src/runtime/components/Focus.stories.ts +11 -12
  109. package/src/runtime/components/Icon/Icon.vue +5 -9
  110. package/src/runtime/components/LibButton/LibButton.stories.ts +21 -22
  111. package/src/runtime/components/LibButton/LibButton.vue +23 -21
  112. package/src/runtime/components/LibCheckbox/LibCheckbox.stories.ts +6 -10
  113. package/src/runtime/components/LibCheckbox/LibCheckbox.vue +17 -19
  114. package/src/runtime/components/LibColorInput/LibColorInput.stories.ts +8 -13
  115. package/src/runtime/components/LibColorInput/LibColorInput.vue +49 -45
  116. package/src/runtime/components/LibColorPicker/LibColorPicker.stories.ts +14 -18
  117. package/src/runtime/components/LibColorPicker/LibColorPicker.vue +50 -52
  118. package/src/runtime/components/LibColorPicker/utils/safeConvertToHsva.ts +1 -2
  119. package/src/runtime/components/LibColorPicker/utils/safeConvertToRgba.ts +1 -2
  120. package/src/runtime/components/LibColorPicker/utils/truncate.ts +1 -2
  121. package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.ts +5 -8
  122. package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +11 -9
  123. package/src/runtime/components/LibDatePicker/LibDatePicker.stories.ts +14 -15
  124. package/src/runtime/components/LibDatePicker/LibDatePicker.vue +1 -2
  125. package/src/runtime/components/LibDatePicker/LibRangeDatePicker.vue +13 -13
  126. package/src/runtime/components/LibDatePicker/LibSingleDatePicker.vue +9 -8
  127. package/src/runtime/components/LibDatePicker/LibTimeZonePicker.vue +2 -1
  128. package/src/runtime/components/LibDatePicker/helpers.ts +0 -2
  129. package/src/runtime/components/LibDebug/LibDebug.stories.ts +11 -15
  130. package/src/runtime/components/LibDebug/LibDebug.vue +14 -11
  131. package/src/runtime/components/LibDevOnly/LibDevOnly.vue +8 -4
  132. package/src/runtime/components/LibFileInput/LibFileInput.stories.ts +12 -15
  133. package/src/runtime/components/LibFileInput/LibFileInput.vue +65 -47
  134. package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.ts +77 -84
  135. package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +73 -48
  136. package/src/runtime/components/LibLabel/LibLabel.stories.ts +4 -8
  137. package/src/runtime/components/LibLabel/LibLabel.vue +8 -8
  138. package/src/runtime/components/LibMultiValues/LibMultiValues.stories.ts +10 -15
  139. package/src/runtime/components/LibMultiValues/LibMultiValues.vue +14 -18
  140. package/src/runtime/components/LibNotifications/LibNotification.stories.ts +30 -34
  141. package/src/runtime/components/LibNotifications/LibNotification.vue +27 -17
  142. package/src/runtime/components/LibNotifications/LibNotifications.stories.ts +11 -15
  143. package/src/runtime/components/LibNotifications/LibNotifications.vue +21 -16
  144. package/src/runtime/components/LibPagination/LibPagination.stories.ts +5 -9
  145. package/src/runtime/components/LibPagination/LibPagination.vue +46 -32
  146. package/src/runtime/components/LibPalette/LibPalette.stories.ts +3 -7
  147. package/src/runtime/components/LibPalette/LibPalette.vue +13 -12
  148. package/src/runtime/components/LibPopup/LibPopup.stories.ts +19 -23
  149. package/src/runtime/components/LibPopup/LibPopup.vue +31 -35
  150. package/src/runtime/components/LibProgressBar/LibProgressBar.stories.ts +13 -17
  151. package/src/runtime/components/LibProgressBar/LibProgressBar.vue +36 -33
  152. package/src/runtime/components/LibRecorder/LibRecorder.stories.ts +11 -12
  153. package/src/runtime/components/LibRecorder/LibRecorder.vue +34 -34
  154. package/src/runtime/components/LibRoot/LibRoot.vue +16 -12
  155. package/src/runtime/components/LibSimpleInput/LibSimpleInput.stories.ts +20 -24
  156. package/src/runtime/components/LibSimpleInput/LibSimpleInput.vue +17 -21
  157. package/src/runtime/components/LibSuggestions/LibSuggestions.stories.ts +16 -19
  158. package/src/runtime/components/LibSuggestions/LibSuggestions.vue +28 -30
  159. package/src/runtime/components/LibTable/LibTable.stories.ts +30 -33
  160. package/src/runtime/components/LibTable/LibTable.vue +38 -24
  161. package/src/runtime/components/Reset.stories.ts +3 -6
  162. package/src/runtime/components/Scrolling.stories.ts +5 -8
  163. package/src/runtime/components/Template/NAME.vue +11 -11
  164. package/src/runtime/components/Template/TemplateStory.ts +9 -10
  165. package/src/runtime/components/TestControls/TestControls.vue +5 -5
  166. package/src/runtime/components/shared/props.ts +4 -6
  167. package/src/runtime/components/shared/storyHelpers/playInput.ts +2 -3
  168. package/src/runtime/components/shared/storyHelpers/playSuggestions.ts +5 -9
  169. package/src/runtime/composables/useAccesibilityOutline.ts +1 -1
  170. package/src/runtime/composables/useAriaLabel.ts +1 -1
  171. package/src/runtime/composables/useDarkMode.ts +15 -19
  172. package/src/runtime/composables/useDragWithThreshold.ts +6 -8
  173. package/src/runtime/composables/useGlobalResizeObserver.ts +0 -1
  174. package/src/runtime/composables/useInjectedDarkMode.ts +2 -2
  175. package/src/runtime/composables/useInjectedI18n.ts +1 -1
  176. package/src/runtime/composables/useInjectedLocale.ts +3 -4
  177. package/src/runtime/composables/useScrollNearContainerEdges.stories.ts +4 -4
  178. package/src/runtime/composables/useScrollNearContainerEdges.ts +12 -13
  179. package/src/runtime/composables/useSetupI18n.ts +4 -7
  180. package/src/runtime/composables/useSetupLocale.ts +3 -5
  181. package/src/runtime/composables/useSuggestions.ts +25 -30
  182. package/src/runtime/directives/vDetectFlex.ts +5 -8
  183. package/src/runtime/directives/vExtractRootEl.ts +1 -1
  184. package/src/runtime/directives/vResizableCols.ts +3 -7
  185. package/src/runtime/directives/vResizeObserver.ts +1 -2
  186. package/src/runtime/globalResizeObserver.ts +0 -1
  187. package/src/runtime/helpers/NotificationHandler.ts +8 -12
  188. package/src/runtime/helpers/base64ToImg.ts +2 -3
  189. package/src/runtime/helpers/createNoonUtcDate.ts +0 -1
  190. package/src/runtime/helpers/defaultTranslationFunction.ts +0 -1
  191. package/src/runtime/helpers/getTimeZoneList.ts +0 -1
  192. package/src/runtime/helpers/readFile.ts +2 -2
  193. package/src/runtime/helpers/resizeObserverWrapper.ts +0 -1
  194. package/src/runtime/helpers/storybook.ts +2 -3
  195. package/src/runtime/main.lib.ts +0 -2
  196. package/src/runtime/nuxt/plugins/vue-plugin.ts +4 -5
  197. package/src/runtime/tailwind/themeConvertionOpts.ts +3 -4
  198. package/src/runtime/theme.ts +0 -1
  199. package/src/runtime/types/index.ts +3 -4
  200. package/src/runtime/utils/notifyIfError.ts +2 -2
  201. package/src/runtime/utils/twMerge.ts +2 -2
  202. package/src/runtime/vue/VueComponentsPlugin.ts +1 -2
  203. package/src/runtime/vue/registerComponents.ts +0 -1
@@ -6,7 +6,6 @@ import { ref } from "vue"
6
6
  import LibDarkModeSwitcher from "./LibDarkModeSwitcher.vue"
7
7
 
8
8
  // todo, maybe don't do this for perf reasons
9
- // eslint-disable-next-line @typescript-eslint/no-restricted-imports
10
9
  import * as components from "../index.js"
11
10
 
12
11
  const meta: Meta<typeof LibDarkModeSwitcher> = {
@@ -14,13 +13,12 @@ const meta: Meta<typeof LibDarkModeSwitcher> = {
14
13
  title: "Components/DarkModeSwitcher",
15
14
  args: {
16
15
 
17
- },
16
+ }
18
17
  }
19
18
 
20
19
  export default meta
21
20
  type Story = StoryObj<typeof LibDarkModeSwitcher>
22
21
 
23
-
24
22
  export const Primary: Story = {
25
23
  render: args => ({
26
24
  components,
@@ -38,14 +36,13 @@ export const Primary: Story = {
38
36
  v-bind="{...args}"
39
37
  ></LibDarkModeSwitcher>
40
38
 
41
- `,
42
- }),
39
+ `
40
+ })
43
41
  }
44
42
  export const WithoutLabel: Story = {
45
43
  ...Primary,
46
44
  args: {
47
45
  ...Primary.args,
48
- showLabel: false,
49
- },
46
+ showLabel: false
47
+ }
50
48
  }
51
-
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <lib-button
3
- v-bind="{...$attrs, class:undefined}"
3
+ v-bind="{ ...$attrs, class: undefined }"
4
4
  :class="!($attrs as any).unstyle && twMerge(`
5
5
  dark-mode-switcher
6
6
  rounded-full
@@ -19,15 +19,19 @@
19
19
  <component :is="darkModeState==='dark' ? IFaSolidMoon : darkModeState==='light' ? IPhSunBold : IFa6SolidCircleHalfStroke"/>
20
20
  </icon>
21
21
  </template>
22
- <template #default v-if="showLabel">
22
+ <template
23
+ #default
24
+ v-if="showLabel"
25
+ >
23
26
  <div class="dark-mode-switcher--label pr-[2px]">
24
27
  {{ t(`dark-mode-switcher.${darkModeState}`) }}
25
28
  </div>
26
29
  </template>
27
30
  </lib-button>
28
31
  </template>
32
+
29
33
  <script lang="ts" setup>
30
- import { type ButtonHTMLAttributes,onMounted,useAttrs, watch } from "vue"
34
+ import { type ButtonHTMLAttributes, onMounted, useAttrs, watch } from "vue"
31
35
 
32
36
  import IFaSolidMoon from "~icons/fa-solid/moon"
33
37
  import IFa6SolidCircleHalfStroke from "~icons/fa6-solid/circle-half-stroke"
@@ -40,7 +44,6 @@ import Icon from "../Icon/Icon.vue"
40
44
  import LibButton from "../LibButton/LibButton.vue"
41
45
  import type { TailwindClassProp } from "../shared/props.js"
42
46
 
43
-
44
47
  const t = useInjectedI18n()
45
48
 
46
49
  const emit = defineEmits<{
@@ -53,14 +56,12 @@ const $attrs = useAttrs()
53
56
 
54
57
  withDefaults(defineProps<Props>(), { showLabel: true })
55
58
 
56
-
57
59
  const {
58
60
  darkMode,
59
61
  cycleDarkMode,
60
- darkModeState,
62
+ darkModeState
61
63
  } = useInjectedDarkMode()
62
64
 
63
-
64
65
  watch(darkMode, value => emit("update:darkMode", value))
65
66
  watch(darkModeState, value => emit("update:darkModeState", value))
66
67
 
@@ -68,9 +69,10 @@ onMounted(() => {
68
69
  emit("update:darkMode", darkMode.value)
69
70
  })
70
71
  </script>
72
+
71
73
  <script lang="ts">
72
74
  export default {
73
- name: "lib-dark-mode-switcher"
75
+ name: "LibDarkModeSwitcher"
74
76
  }
75
77
  type RealProps = {
76
78
  showLabel?: boolean
@@ -79,7 +81,7 @@ type RealProps = {
79
81
  interface Props
80
82
  extends
81
83
  /** @vue-ignore */
82
- Partial<Omit<ButtonHTMLAttributes,"class" | "color" | "disabled">
84
+ Partial<Omit<ButtonHTMLAttributes, "class" | "color" | "disabled">
83
85
  & TailwindClassProp
84
86
  & {
85
87
  disabled?: boolean
@@ -1,10 +1,9 @@
1
1
  /* eslint-disable @typescript-eslint/naming-convention */
2
- import { CalendarDate,fromDate, getLocalTimeZone, toTimeZone } from "@internationalized/date"
2
+ import { CalendarDate, fromDate, getLocalTimeZone, toTimeZone } from "@internationalized/date"
3
3
  import type { Meta, StoryObj } from "@storybook/vue3"
4
- import { computed,ref } from "vue"
4
+ import { computed, ref } from "vue"
5
5
 
6
6
  import { createNoonUtcDate } from "../../helpers/createNoonUtcDate.js"
7
- // eslint-disable-next-line @typescript-eslint/no-restricted-imports
8
7
  import * as components from "../index.js"
9
8
 
10
9
  function html(strings: TemplateStringsArray, ...values: any[]): string {
@@ -16,21 +15,20 @@ const singleMeta: Meta<typeof components.LibDatePicker> = {
16
15
  args: {
17
16
  // @ts-expect-error custom prop just for story
18
17
  slot: "",
19
- timeZone: getLocalTimeZone(),
18
+ timeZone: getLocalTimeZone()
20
19
  }
21
20
  }
22
21
 
23
22
  export default singleMeta
24
23
  type Story = StoryObj<typeof components.LibDatePicker>
25
24
 
26
-
27
25
  function toUTC(m: Date, timeZone: string) {
28
26
  return toTimeZone(fromDate(m, timeZone), "UTC").toAbsoluteString()
29
27
  }
30
28
  export const Primary: Story = {
31
29
  render: (args: any) => ({
32
30
  components: {
33
- ...components,
31
+ ...components
34
32
  },
35
33
  setup: () => {
36
34
  const modelValue = ref(args.modelValue)
@@ -41,10 +39,11 @@ export const Primary: Story = {
41
39
  return m instanceof Date
42
40
  ? toUTC(m, z)
43
41
  : typeof m === "object"
44
- ? `Start: ${m.start ? toUTC(m.start, z) : "undefined"}, End: ${m.end ? toUTC(m.end, z) : "undefined"}`
45
- : "undefined"
42
+ ? `Start: ${m.start ? toUTC(m.start, z) : "undefined"}, End: ${m.end ? toUTC(m.end, z) : "undefined"}`
43
+ : "undefined"
46
44
  })
47
- return { args, getLocalTimeZone, modelValue, timeZone, debugUtcDate } },
45
+ return { args, getLocalTimeZone, modelValue, timeZone, debugUtcDate }
46
+ },
48
47
  template: `
49
48
  <div>Date: {{modelValue ?? "undefined"}}</div>
50
49
  <div>Date UTC: {{debugUtcDate}}</div>
@@ -62,15 +61,15 @@ export const Primary: Story = {
62
61
  ${args.slot}
63
62
  </LibDatePicker>
64
63
  </div>
65
- `,
66
- }),
64
+ `
65
+ })
67
66
  }
68
67
 
69
68
  export const DateRange: Story = {
70
69
  ...Primary,
71
70
  args: {
72
- modelValue: { start: undefined, end: undefined },
73
- },
71
+ modelValue: { start: undefined, end: undefined }
72
+ }
74
73
  }
75
74
 
76
75
  export const IconTriggerFirst: Story = {
@@ -78,7 +77,7 @@ export const IconTriggerFirst: Story = {
78
77
  args: {
79
78
  ...Primary.args,
80
79
  class: "[&_.trigger]:order-first"
81
- },
80
+ }
82
81
  }
83
82
 
84
83
  export const BottomSlot: Story = {
@@ -102,7 +101,7 @@ export const DateWithTime: Story = {
102
101
  ...Primary,
103
102
  args: {
104
103
  ...Primary.args,
105
- showTime: true,
104
+ showTime: true
106
105
  }
107
106
  }
108
107
  export const WithDifferentFallbackDate: Story = {
@@ -5,7 +5,7 @@ import { computed, useAttrs } from "vue"
5
5
  import LibRangeDatePicker from "./LibRangeDatePicker.vue"
6
6
  import LibSingleDatePicker from "./LibSingleDatePicker.vue"
7
7
 
8
- import type { RangeDate,SingleDate } from "../../types/index.js"
8
+ import type { RangeDate, SingleDate } from "../../types/index.js"
9
9
  import { getFallbackId } from "../shared/props.js"
10
10
 
11
11
  const attrs = useAttrs()
@@ -34,7 +34,6 @@ const fallbackId = getFallbackId()
34
34
  */
35
35
  const date = defineModel<SingleDate | RangeDate>({ required: true })
36
36
  const isRange = computed(() => date.value !== undefined && !(date.value instanceof Date))
37
-
38
37
  </script>
39
38
 
40
39
  <template>
@@ -1,10 +1,11 @@
1
1
  <script setup lang="ts">
2
- import { CalendarDate, type DateValue, getLocalTimeZone, ZonedDateTime } from "@internationalized/date"
2
+ import type { CalendarDate, DateValue, ZonedDateTime } from "@internationalized/date"
3
+ import { getLocalTimeZone } from "@internationalized/date"
3
4
  import type { DateRange } from "reka-ui"
4
- import { DateRangePickerArrow, DateRangePickerCalendar, DateRangePickerCell, DateRangePickerCellTrigger, DateRangePickerContent, DateRangePickerField, DateRangePickerGrid, DateRangePickerGridBody, DateRangePickerGridHead, DateRangePickerGridRow, DateRangePickerHeadCell,DateRangePickerHeader, DateRangePickerHeading, DateRangePickerInput, DateRangePickerNext, DateRangePickerPrev, DateRangePickerRoot, DateRangePickerTrigger } from "reka-ui"
5
+ import { DateRangePickerArrow, DateRangePickerCalendar, DateRangePickerCell, DateRangePickerCellTrigger, DateRangePickerContent, DateRangePickerField, DateRangePickerGrid, DateRangePickerGridBody, DateRangePickerGridHead, DateRangePickerGridRow, DateRangePickerHeadCell, DateRangePickerHeader, DateRangePickerHeading, DateRangePickerInput, DateRangePickerNext, DateRangePickerPrev, DateRangePickerRoot, DateRangePickerTrigger } from "reka-ui"
5
6
  import { onBeforeUnmount, ref, toRaw, useAttrs, watch } from "vue"
6
7
 
7
- import { convertDateWithFallback, getNow,toEmittableDate } from "./helpers.js"
8
+ import { convertDateWithFallback, getNow, toEmittableDate } from "./helpers.js"
8
9
 
9
10
  import IRadixIconsCalendar from "~icons/radix-icons/calendar"
10
11
  import IRadixIconsChevronLeft from "~icons/radix-icons/chevron-left"
@@ -16,6 +17,7 @@ import { useInjectedLocale } from "../../composables/useInjectedLocale.js"
16
17
  import type { RangeDate } from "../../types/index.js"
17
18
  import { twMerge } from "../../utils/twMerge.js"
18
19
  import Icon from "../Icon/Icon.vue"
20
+
19
21
  const attrs = useAttrs()
20
22
 
21
23
  const props = withDefaults(defineProps<{
@@ -33,7 +35,6 @@ const props = withDefaults(defineProps<{
33
35
 
34
36
  const date = defineModel<RangeDate>({ required: true })
35
37
 
36
-
37
38
  let justSet = false
38
39
 
39
40
  const tempDate = ref<{
@@ -71,7 +72,6 @@ watch(() => props.timeZone, () => {
71
72
  updateTempDate()
72
73
  })
73
74
 
74
-
75
75
  const interval = setInterval(() => {
76
76
  // update suggested date if none is set
77
77
  if (!date.value.start) updateTempDate(["start"])
@@ -83,8 +83,6 @@ onBeforeUnmount(() => {
83
83
  })
84
84
 
85
85
  const locale = useInjectedLocale().timeLocale
86
-
87
-
88
86
  </script>
89
87
 
90
88
  <template>
@@ -106,7 +104,8 @@ const locale = useInjectedLocale().timeLocale
106
104
  `, (attrs as any).class)"
107
105
  >
108
106
  <div class="date-range-picker--segments-input flex items-center flex-1 overflow-scroll scrollbar-hidden whitespace-nowrap">
109
- <div :class="twMerge(`
107
+ <div
108
+ :class="twMerge(`
110
109
  date-range-picker--start-segment
111
110
  flex
112
111
  items-center
@@ -153,7 +152,8 @@ const locale = useInjectedLocale().timeLocale
153
152
  <div class="date-range-picker--range-separator text-center px-1">
154
153
 
155
154
  </div>
156
- <div :class="twMerge(`
155
+ <div
156
+ :class="twMerge(`
157
157
  date-range-picker--end-segment
158
158
  flex
159
159
  items-center
@@ -219,13 +219,12 @@ const locale = useInjectedLocale().timeLocale
219
219
  </DateRangePickerField>
220
220
 
221
221
  <!-- side=bottom makes months easier to click through -->
222
- <!-- @vue-expect-error to exists-->
223
222
  <DateRangePickerContent
224
223
  :side-offset="4"
225
224
  :avoid-collisions="true"
226
225
  :prioritize-position="true"
227
226
  side="bottom"
228
- to="#root"
227
+ :portal="{ to: '#root' }"
229
228
  class="
230
229
  date-range-picker--content
231
230
  z-100
@@ -343,7 +342,8 @@ const locale = useInjectedLocale().timeLocale
343
342
  :key="month.value.toString()"
344
343
  >
345
344
  <DateRangePickerGridHead class="date-range-picker--grid-head">
346
- <DateRangePickerGridRow class="
345
+ <DateRangePickerGridRow
346
+ class="
347
347
  date-range-picker--grid-row
348
348
  mb-1
349
349
  flex
@@ -430,7 +430,7 @@ const locale = useInjectedLocale().timeLocale
430
430
  </DateRangePickerGridBody>
431
431
  </DateRangePickerGrid>
432
432
  </div>
433
- <slot v-bind="{tempValue: tempDate}"/>
433
+ <slot v-bind="{ tempValue: tempDate }"/>
434
434
  </DateRangePickerCalendar>
435
435
  </DateRangePickerContent>
436
436
  </DateRangePickerRoot>
@@ -3,7 +3,7 @@ import { type DateValue, getLocalTimeZone } from "@internationalized/date"
3
3
  import { DatePickerArrow, DatePickerCalendar, DatePickerCell, DatePickerCellTrigger, DatePickerContent, DatePickerField, DatePickerGrid, DatePickerGridBody, DatePickerGridHead, DatePickerGridRow, DatePickerHeadCell, DatePickerHeader, DatePickerHeading, DatePickerInput, DatePickerNext, DatePickerPrev, DatePickerRoot, DatePickerTrigger } from "reka-ui"
4
4
  import { onBeforeUnmount, ref, toRaw, useAttrs, watch } from "vue"
5
5
 
6
- import { convertDateWithFallback, getNow,toEmittableDate } from "./helpers.js"
6
+ import { convertDateWithFallback, getNow, toEmittableDate } from "./helpers.js"
7
7
 
8
8
  import IRadixIconsCalendar from "~icons/radix-icons/calendar"
9
9
  import IRadixIconsChevronLeft from "~icons/radix-icons/chevron-left"
@@ -69,7 +69,6 @@ const interval = setInterval(() => {
69
69
  onBeforeUnmount(() => {
70
70
  clearInterval(interval)
71
71
  })
72
-
73
72
  </script>
74
73
 
75
74
  <template>
@@ -92,7 +91,8 @@ onBeforeUnmount(() => {
92
91
  (attrs as any).class)
93
92
  "
94
93
  >
95
- <div :class="twMerge(`
94
+ <div
95
+ :class="twMerge(`
96
96
  date-picker--segment
97
97
  flex
98
98
  items-center
@@ -157,13 +157,12 @@ onBeforeUnmount(() => {
157
157
  </Icon>
158
158
  </DatePickerTrigger>
159
159
  </DatePickerField>
160
- <!-- @vue-expect-error to exists-->
161
160
  <DatePickerContent
162
161
  :side-offset="4"
163
162
  :avoid-collisions="true"
164
163
  :prioritize-position="true"
165
164
  side="bottom"
166
- to="#root"
165
+ :portal="{ to: '#root' }"
167
166
  class="
168
167
  date-picker--content
169
168
  z-100
@@ -196,7 +195,8 @@ onBeforeUnmount(() => {
196
195
  max-w-[calc(1.2em*4+var(--spacing)*8+14ch)]
197
196
  "
198
197
  >
199
- <DatePickerHeader class="
198
+ <DatePickerHeader
199
+ class="
200
200
  date-picker--header
201
201
  flex
202
202
  items-center
@@ -294,7 +294,8 @@ onBeforeUnmount(() => {
294
294
  :key="month.value.toString()"
295
295
  >
296
296
  <DatePickerGridHead class="date-picker--grid-head">
297
- <DatePickerGridRow class="
297
+ <DatePickerGridRow
298
+ class="
298
299
  date-picker--grid-row
299
300
  mb-1
300
301
  flex
@@ -381,7 +382,7 @@ onBeforeUnmount(() => {
381
382
  </DatePickerGridBody>
382
383
  </DatePickerGrid>
383
384
  </div>
384
- <slot v-bind="{tempValue: tempDate}"/>
385
+ <slot v-bind="{ tempValue: tempDate }"/>
385
386
  </DatePickerCalendar>
386
387
  </DatePickerContent>
387
388
  </DatePickerRoot>
@@ -3,9 +3,11 @@ import { getLocalTimeZone } from "@internationalized/date"
3
3
 
4
4
  import { getTimeZoneList } from "../../helpers/getTimeZoneList.js"
5
5
  import LibInputDeprecated from "../LibInputDeprecated/LibInputDeprecated.vue"
6
+
6
7
  const timeZone = defineModel<string>({ default: getLocalTimeZone() })
7
8
  const label = defineModel<string>("label", { default: "Time Zone" })
8
9
  </script>
10
+
9
11
  <template>
10
12
  <LibInputDeprecated
11
13
  :restrict-to-suggestions="true"
@@ -24,4 +26,3 @@ const label = defineModel<string>("label", { default: "Time Zone" })
24
26
  </template>
25
27
  </LibInputDeprecated>
26
28
  </template>
27
-
@@ -40,7 +40,6 @@ export function toEmittableDate(date: ZonedDateTime | CalendarDate): Date {
40
40
  : toZoned(toCalendarDateTime(date, new Time(12, 0, 0)), "UTC").toDate()
41
41
  }
42
42
 
43
-
44
43
  /**
45
44
  * @internal
46
45
  *
@@ -52,4 +51,3 @@ export function getNow(opts: { withTime: boolean }): ZonedDateTime | CalendarDat
52
51
  }
53
52
  return today(getLocalTimeZone())
54
53
  }
55
-
@@ -4,45 +4,42 @@ import type { Meta, StoryObj } from "@storybook/vue3"
4
4
 
5
5
  import LibDebug from "./LibDebug.vue"
6
6
 
7
- // eslint-disable-next-line @typescript-eslint/no-restricted-imports
8
7
  import * as components from "../index.js"
9
8
 
10
-
11
9
  const meta: Meta<typeof LibDebug> = {
12
10
  component: LibDebug,
13
11
  title: "Components/Debug",
14
12
  args: {
15
- value: { any: ["any", { value: "any" }]},
16
- },
13
+ value: { any: ["any", { value: "any" }] }
14
+ }
17
15
  }
18
16
 
19
17
  export default meta
20
18
  type Story = StoryObj<typeof LibDebug>
21
19
 
22
-
23
20
  export const Primary: Story = {
24
21
  render: args => ({
25
22
  components,
26
23
  setup: () => ({ args }),
27
24
  template: `
28
25
  <lib-debug v-bind="args" />
29
- `,
30
- }),
26
+ `
27
+ })
31
28
  }
32
29
  export const WithCustomTab: Story = {
33
30
  ...Primary,
34
31
  args: {
35
32
  ...Primary.args,
36
- value: { any: ["any", { value: "any" }]},
37
- tab: 2,
38
- },
33
+ value: { any: ["any", { value: "any" }] },
34
+ tab: 2
35
+ }
39
36
  }
40
37
  export const NoValue: Story = {
41
38
  ...Primary,
42
39
  args: {
43
40
  ...Primary.args,
44
- value: undefined,
45
- },
41
+ value: undefined
42
+ }
46
43
  }
47
44
  export const StringWithWhitespace: Story = {
48
45
  ...Primary,
@@ -52,7 +49,6 @@ export const StringWithWhitespace: Story = {
52
49
  Manually
53
50
  Indented
54
51
  String
55
- `,
56
- },
52
+ `
53
+ }
57
54
  }
58
-
@@ -1,5 +1,6 @@
1
1
  <template>
2
- <div class="debug--wrapper
2
+ <div
3
+ class="debug--wrapper
3
4
  text-fg
4
5
  dark:text-bg
5
6
  flex
@@ -13,11 +14,15 @@
13
14
  >
14
15
  <div class="debug--header flex justify-between">
15
16
  <span class="debug--title font-bold">{{ title }}</span>
16
- <LibButton class="debug--copy-button w-min-content" @click="copy()">
17
+ <LibButton
18
+ class="debug--copy-button w-min-content"
19
+ @click="copy()"
20
+ >
17
21
  <icon><i-fa6-regular-copy/></icon>
18
22
  </LibButton>
19
23
  </div>
20
- <pre v-if="value"
24
+ <pre
25
+ v-if="value"
21
26
  :class="`
22
27
  debug--value
23
28
  [tab-size:${tab}]
@@ -28,9 +33,8 @@
28
33
  </div>
29
34
  </template>
30
35
 
31
-
32
36
  <script setup lang="ts">
33
- import { type PropType, useSlots } from "vue"
37
+ import { useSlots } from "vue"
34
38
 
35
39
  import IFa6RegularCopy from "~icons/fa-regular/copy"
36
40
 
@@ -41,7 +45,7 @@ const $slots = useSlots()
41
45
 
42
46
  const props = withDefaults(defineProps<{
43
47
  /** The value to debug, can be anything. */
44
- // eslint-disable-next-line vue/no-restricted-props
48
+
45
49
  value?: any
46
50
  /** Sets the tab size in css. Defaults to 3. */
47
51
  tab?: number
@@ -49,7 +53,7 @@ const props = withDefaults(defineProps<{
49
53
  }>(), {
50
54
  tab: 3,
51
55
  title: "Debug",
52
- value: undefined,
56
+ value: undefined
53
57
  })
54
58
 
55
59
  const getStringValue = (value: any): string => value === undefined
@@ -75,8 +79,8 @@ const copy = (): void => {
75
79
  const text = props.value
76
80
  ? getStringValue(props.value)
77
81
  : $slots.default?.()?.[0]?.children
78
- ? findText([...$slots.default()[0]!.children as any[]])
79
- : undefined
82
+ ? findText([...$slots.default()[0]!.children as any[]])
83
+ : undefined
80
84
  if (text === undefined) {
81
85
  // eslint-disable-next-line no-console
82
86
  console.warn("Cannot copy text, can't generate string value from `getStringValue` or `the default slot`.")
@@ -88,7 +92,6 @@ const copy = (): void => {
88
92
  </script>
89
93
 
90
94
  <script lang="ts">
91
-
92
95
  /**
93
96
  * Simple debug component for displaying objects and strings with whitespace.
94
97
  *
@@ -97,7 +100,7 @@ const copy = (): void => {
97
100
  * The value can be undefined, it will just display undefined.
98
101
  */
99
102
  export default {
100
- name: "lib-debug",
103
+ name: "LibDebug"
101
104
  // https://v3.vuejs.org/guide/typescript-support.html#annotating-props
102
105
  }
103
106
  </script>
@@ -1,7 +1,8 @@
1
1
  <template>
2
2
  <DevOnly>
3
3
  <slot v-if="doShow && $attrs?.['as-child'] !== undefined"/>
4
- <div v-else-if="doShow"
4
+ <div
5
+ v-else-if="doShow"
5
6
  :class="twMerge(`
6
7
  dev-only
7
8
  border
@@ -13,17 +14,19 @@
13
14
  `,
14
15
  ($attrs.class as string)
15
16
  )"
16
- v-bind="{...$attrs, class: undefined}"
17
+ v-bind="{ ...$attrs, class: undefined }"
17
18
  >
18
19
  <slot/>
19
20
  </div>
20
21
  </DevOnly>
21
22
  </template>
23
+
22
24
  <script lang="ts" setup>
23
25
  import { computed, inject, ref, useAttrs } from "vue"
24
26
 
25
27
  import { showDevOnlyInjectionKey } from "../../composables/useShowDevOnlyKey.js"
26
28
  import { twMerge } from "../../utils/twMerge.js"
29
+
27
30
  const $attrs = useAttrs()
28
31
 
29
32
  const props = withDefaults(defineProps<{
@@ -34,10 +37,10 @@ const props = withDefaults(defineProps<{
34
37
 
35
38
  const injectedShow = inject(showDevOnlyInjectionKey, ref(false))
36
39
  const doShow = computed(() => props.show || injectedShow.value)
37
-
38
40
  </script>
41
+
39
42
  <script lang="ts">
40
- interface Props {
43
+ export interface Props {
41
44
  show?: boolean
42
45
  }
43
46
 
@@ -45,6 +48,7 @@ interface Props {
45
48
  // This should be enough to bypass the type lint error.
46
49
  declare module "vue" {
47
50
  export interface GlobalComponents {
51
+ // eslint-disable-next-line @typescript-eslint/naming-convention
48
52
  DevOnly: any
49
53
  }
50
54
  }