@witchcraft/ui 0.0.1 → 0.1.1

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 (224) hide show
  1. package/README.md +18 -28
  2. package/dist/module.d.mts +3 -1
  3. package/dist/module.json +3 -3
  4. package/dist/module.mjs +21 -12
  5. package/dist/runtime/assets/base.css +1 -1
  6. package/dist/runtime/assets/locales/en.json +2 -2
  7. package/dist/runtime/assets/tailwind.css +1 -1
  8. package/dist/runtime/assets/utils.css +1 -0
  9. package/dist/runtime/build/WitchcraftUiResolver.js +1 -1
  10. package/dist/runtime/components/Aria/Aria.vue +5 -9
  11. package/dist/runtime/components/Aria/Aria.vue.d.ts +5 -0
  12. package/dist/runtime/components/Icon/Icon.vue +12 -28
  13. package/dist/runtime/components/Icon/Icon.vue.d.ts +21 -0
  14. package/dist/runtime/components/LibButton/LibButton.vue +93 -117
  15. package/dist/runtime/components/LibButton/LibButton.vue.d.ts +36 -0
  16. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +53 -76
  17. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +42 -0
  18. package/dist/runtime/components/LibColorInput/LibColorInput.vue +131 -101
  19. package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +63 -0
  20. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue +326 -296
  21. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue.d.ts +61 -0
  22. package/dist/runtime/components/LibColorPicker/utils/safeConvertToHsva.d.ts +2 -0
  23. package/dist/runtime/components/LibColorPicker/utils/safeConvertToHsva.js +18 -0
  24. package/dist/runtime/components/LibColorPicker/utils/safeConvertToRgba.d.ts +2 -0
  25. package/dist/runtime/components/LibColorPicker/utils/safeConvertToRgba.js +17 -0
  26. package/dist/runtime/components/LibColorPicker/utils/toLowPrecisionRgbaString.d.ts +2 -0
  27. package/dist/runtime/components/LibColorPicker/utils/toLowPrecisionRgbaString.js +8 -0
  28. package/dist/runtime/components/LibColorPicker/utils/truncate.d.ts +1 -0
  29. package/dist/runtime/components/LibColorPicker/utils/truncate.js +5 -0
  30. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +42 -64
  31. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts +22 -0
  32. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue +20 -54
  33. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +40 -0
  34. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue +205 -173
  35. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue.d.ts +34 -0
  36. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue +215 -164
  37. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue.d.ts +34 -0
  38. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue +9 -10
  39. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue.d.ts +22 -0
  40. package/dist/runtime/components/LibDebug/LibDebug.vue +47 -65
  41. package/dist/runtime/components/LibDebug/LibDebug.vue.d.ts +32 -0
  42. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue +19 -34
  43. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue.d.ts +22 -0
  44. package/dist/runtime/components/LibFileInput/LibFileInput.vue +155 -173
  45. package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +43 -0
  46. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +352 -0
  47. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +165 -0
  48. package/dist/runtime/components/LibLabel/LibLabel.vue +30 -46
  49. package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +27 -0
  50. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +50 -66
  51. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue.d.ts +29 -0
  52. package/dist/runtime/components/LibNotifications/LibNotification.vue +48 -56
  53. package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +17 -0
  54. package/dist/runtime/components/LibNotifications/LibNotifications.vue +71 -83
  55. package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +13 -0
  56. package/dist/runtime/components/LibPagination/LibPagination.vue +86 -131
  57. package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +104 -0
  58. package/dist/runtime/components/LibPalette/LibPalette.vue +23 -26
  59. package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +14 -0
  60. package/dist/runtime/components/LibPopup/LibPopup.vue +326 -400
  61. package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +46 -0
  62. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +73 -93
  63. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue.d.ts +41 -0
  64. package/dist/runtime/components/LibRecorder/LibRecorder.vue +134 -179
  65. package/dist/runtime/components/LibRecorder/LibRecorder.vue.d.ts +77 -0
  66. package/dist/runtime/components/LibRoot/LibRoot.vue +75 -89
  67. package/dist/runtime/components/LibRoot/LibRoot.vue.d.ts +41 -0
  68. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue +51 -82
  69. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue.d.ts +35 -0
  70. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +147 -164
  71. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +94 -0
  72. package/dist/runtime/components/LibTable/LibTable.vue +69 -106
  73. package/dist/runtime/components/LibTable/LibTable.vue.d.ts +45 -0
  74. package/dist/runtime/components/Template/NAME.vue +15 -36
  75. package/dist/runtime/components/Template/NAME.vue.d.ts +17 -0
  76. package/dist/runtime/components/TestControls/TestControls.vue +7 -10
  77. package/dist/runtime/components/TestControls/TestControls.vue.d.ts +5 -0
  78. package/dist/runtime/components/index.d.ts +12 -11
  79. package/dist/runtime/components/index.js +12 -11
  80. package/dist/runtime/components/shared/props.d.ts +81 -16
  81. package/dist/runtime/components/shared/storyHelpers/playInput.js +5 -5
  82. package/dist/runtime/components/shared/storyHelpers/playSuggestions.js +15 -11
  83. package/dist/runtime/composables/index.d.ts +5 -0
  84. package/dist/runtime/composables/index.js +5 -0
  85. package/dist/runtime/composables/useDivideAttrs.js +1 -0
  86. package/dist/runtime/composables/useDragWithThreshold.d.ts +71 -0
  87. package/dist/runtime/composables/useDragWithThreshold.js +40 -0
  88. package/dist/runtime/composables/usePreHydrationValue.d.ts +12 -0
  89. package/dist/runtime/composables/usePreHydrationValue.js +15 -0
  90. package/dist/runtime/composables/useSetupI18n.d.ts +2 -0
  91. package/dist/runtime/composables/useSetupI18n.js +5 -1
  92. package/dist/runtime/composables/useSuggestions.d.ts +7 -5
  93. package/dist/runtime/composables/useSuggestions.js +94 -57
  94. package/dist/runtime/directives/vResizableCols.js +92 -84
  95. package/dist/runtime/helpers/NotificationHandler.d.ts +5 -0
  96. package/dist/runtime/helpers/index.d.ts +3 -1
  97. package/dist/runtime/helpers/index.js +3 -1
  98. package/dist/runtime/types/index.d.ts +6 -0
  99. package/dist/runtime/utils/notifyIfError.d.ts +14 -0
  100. package/dist/runtime/utils/notifyIfError.js +29 -0
  101. package/dist/types.d.mts +2 -6
  102. package/package.json +27 -29
  103. package/src/module.ts +31 -12
  104. package/src/runtime/assets/base.css +10 -1
  105. package/src/runtime/assets/locales/en.json +2 -2
  106. package/src/runtime/assets/tailwind.css +1 -1
  107. package/src/runtime/assets/{style.css → utils.css} +86 -4
  108. package/src/runtime/build/WitchcraftUiResolver.ts +1 -1
  109. package/src/runtime/components/Focus.stories.ts +3 -2
  110. package/src/runtime/components/Icon/Icon.vue +10 -6
  111. package/src/runtime/components/LibButton/LibButton.vue +41 -47
  112. package/src/runtime/components/LibCheckbox/LibCheckbox.vue +7 -4
  113. package/src/runtime/components/LibColorInput/LibColorInput.vue +111 -37
  114. package/src/runtime/components/LibColorPicker/LibColorPicker.stories.ts +25 -4
  115. package/src/runtime/components/LibColorPicker/LibColorPicker.vue +242 -131
  116. package/src/runtime/components/LibColorPicker/utils/safeConvertToHsva.ts +24 -0
  117. package/src/runtime/components/LibColorPicker/utils/safeConvertToRgba.ts +23 -0
  118. package/src/runtime/components/LibColorPicker/utils/toLowPrecisionRgbaString.ts +13 -0
  119. package/src/runtime/components/LibColorPicker/utils/truncate.ts +6 -0
  120. package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.ts +1 -1
  121. package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +11 -9
  122. package/src/runtime/components/LibDatePicker/LibDatePicker.vue +4 -17
  123. package/src/runtime/components/LibDatePicker/LibRangeDatePicker.vue +192 -131
  124. package/src/runtime/components/LibDatePicker/LibSingleDatePicker.vue +183 -115
  125. package/src/runtime/components/LibDatePicker/LibTimeZonePicker.vue +3 -3
  126. package/src/runtime/components/LibDebug/LibDebug.vue +15 -5
  127. package/src/runtime/components/LibDevOnly/LibDevOnly.vue +1 -3
  128. package/src/runtime/components/LibFileInput/LibFileInput.vue +54 -29
  129. package/src/runtime/components/{LibInput/LibInput.stories.ts → LibInputDeprecated/LibInputDeprecated.stories.ts} +64 -19
  130. package/{dist/runtime/components/LibInput/LibInput.vue → src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue} +40 -34
  131. package/src/runtime/components/LibLabel/LibLabel.vue +2 -2
  132. package/src/runtime/components/LibMultiValues/LibMultiValues.stories.ts +5 -4
  133. package/src/runtime/components/LibMultiValues/LibMultiValues.vue +11 -13
  134. package/src/runtime/components/LibNotifications/LibNotification.vue +19 -11
  135. package/src/runtime/components/LibNotifications/LibNotifications.stories.ts +2 -2
  136. package/src/runtime/components/LibNotifications/LibNotifications.vue +20 -12
  137. package/src/runtime/components/LibPagination/LibPagination.stories.ts +2 -2
  138. package/src/runtime/components/LibPagination/LibPagination.vue +19 -20
  139. package/src/runtime/components/LibPalette/LibPalette.vue +3 -3
  140. package/src/runtime/components/LibPopup/LibPopup.stories.ts +2 -2
  141. package/src/runtime/components/LibPopup/LibPopup.vue +30 -67
  142. package/src/runtime/components/LibProgressBar/LibProgressBar.vue +3 -2
  143. package/src/runtime/components/LibRecorder/LibRecorder.vue +2 -3
  144. package/src/runtime/components/LibRoot/LibRoot.vue +14 -1
  145. package/src/runtime/components/LibSimpleInput/LibSimpleInput.stories.ts +1 -1
  146. package/src/runtime/components/LibSimpleInput/LibSimpleInput.vue +5 -8
  147. package/src/runtime/components/LibSuggestions/LibSuggestions.vue +42 -26
  148. package/src/runtime/components/LibTable/LibTable.vue +8 -9
  149. package/src/runtime/components/Scrolling.stories.ts +58 -0
  150. package/src/runtime/components/Template/NAME.vue +1 -1
  151. package/src/runtime/components/TestControls/TestControls.vue +1 -1
  152. package/src/runtime/components/index.ts +12 -12
  153. package/src/runtime/components/shared/props.ts +82 -19
  154. package/src/runtime/components/shared/storyHelpers/playInput.ts +6 -5
  155. package/src/runtime/components/shared/storyHelpers/playSuggestions.ts +25 -11
  156. package/src/runtime/composables/index.ts +5 -0
  157. package/src/runtime/composables/useDarkMode.ts +2 -2
  158. package/src/runtime/composables/useDivideAttrs.ts +1 -0
  159. package/src/runtime/composables/useDragWithThreshold.ts +108 -0
  160. package/src/runtime/composables/usePreHydrationValue.ts +30 -0
  161. package/src/runtime/composables/useSetupI18n.ts +8 -2
  162. package/src/runtime/composables/useSuggestions.ts +92 -45
  163. package/src/runtime/directives/vResizableCols.ts +82 -74
  164. package/src/runtime/helpers/NotificationHandler.ts +5 -0
  165. package/src/runtime/helpers/index.ts +3 -1
  166. package/src/runtime/types/index.ts +5 -0
  167. package/src/runtime/utils/notifyIfError.ts +45 -0
  168. package/dist/module.cjs +0 -5
  169. package/dist/module.d.ts +0 -34
  170. package/dist/runtime/assets/style.css +0 -1
  171. package/dist/runtime/components/Focus.stories.d.ts +0 -11
  172. package/dist/runtime/components/Focus.stories.js +0 -53
  173. package/dist/runtime/components/LibButton/LibButton.stories.d.ts +0 -12
  174. package/dist/runtime/components/LibButton/LibButton.stories.js +0 -94
  175. package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.d.ts +0 -14
  176. package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.js +0 -29
  177. package/dist/runtime/components/LibColorInput/LibColorInput.stories.d.ts +0 -7
  178. package/dist/runtime/components/LibColorInput/LibColorInput.stories.js +0 -58
  179. package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.d.ts +0 -7
  180. package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.js +0 -51
  181. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.d.ts +0 -7
  182. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.js +0 -36
  183. package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.d.ts +0 -11
  184. package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.js +0 -98
  185. package/dist/runtime/components/LibDebug/LibDebug.stories.d.ts +0 -9
  186. package/dist/runtime/components/LibDebug/LibDebug.stories.js +0 -46
  187. package/dist/runtime/components/LibFileInput/LibFileInput.stories.d.ts +0 -10
  188. package/dist/runtime/components/LibFileInput/LibFileInput.stories.js +0 -63
  189. package/dist/runtime/components/LibInput/LibInput.stories.d.ts +0 -33
  190. package/dist/runtime/components/LibInput/LibInput.stories.js +0 -339
  191. package/dist/runtime/components/LibLabel/LibLabel.stories.d.ts +0 -6
  192. package/dist/runtime/components/LibLabel/LibLabel.stories.js +0 -25
  193. package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.d.ts +0 -23
  194. package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.js +0 -60
  195. package/dist/runtime/components/LibNotifications/LibNotification.stories.d.ts +0 -15
  196. package/dist/runtime/components/LibNotifications/LibNotification.stories.js +0 -126
  197. package/dist/runtime/components/LibNotifications/LibNotifications.stories.d.ts +0 -6
  198. package/dist/runtime/components/LibNotifications/LibNotifications.stories.js +0 -109
  199. package/dist/runtime/components/LibPagination/LibPagination.stories.d.ts +0 -6
  200. package/dist/runtime/components/LibPagination/LibPagination.stories.js +0 -40
  201. package/dist/runtime/components/LibPalette/LibPalette.stories.d.ts +0 -6
  202. package/dist/runtime/components/LibPalette/LibPalette.stories.js +0 -20
  203. package/dist/runtime/components/LibPopup/LibPopup.stories.d.ts +0 -14
  204. package/dist/runtime/components/LibPopup/LibPopup.stories.js +0 -147
  205. package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.d.ts +0 -10
  206. package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.js +0 -81
  207. package/dist/runtime/components/LibRecorder/LibRecorder.stories.d.ts +0 -19
  208. package/dist/runtime/components/LibRecorder/LibRecorder.stories.js +0 -63
  209. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.d.ts +0 -26
  210. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.js +0 -78
  211. package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.d.ts +0 -27
  212. package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.js +0 -112
  213. package/dist/runtime/components/LibTable/LibTable.stories.d.ts +0 -16
  214. package/dist/runtime/components/LibTable/LibTable.stories.js +0 -156
  215. package/dist/runtime/components/reset.stories.d.ts +0 -5
  216. package/dist/runtime/components/reset.stories.js +0 -19
  217. package/dist/runtime/composables/useScrollNearContainerEdges.stories.d.ts +0 -7
  218. package/dist/runtime/composables/useScrollNearContainerEdges.stories.js +0 -85
  219. package/dist/runtime/helpers/addValue.d.ts +0 -1
  220. package/dist/runtime/helpers/addValue.js +0 -8
  221. package/dist/types.d.ts +0 -7
  222. package/src/runtime/components/LibInput/LibInput.vue +0 -372
  223. package/src/runtime/helpers/addValue.ts +0 -10
  224. /package/src/runtime/components/{reset.stories.ts → Reset.stories.ts} +0 -0
@@ -1,58 +0,0 @@
1
- import { ref } from "vue";
2
- import LibColorInput from "./LibColorInput.vue";
3
- import * as components from "../index.js";
4
- const meta = {
5
- component: LibColorInput,
6
- title: "Components/ColorInput",
7
- args: {}
8
- };
9
- export default meta;
10
- export const Primary = {
11
- render: (args) => ({
12
- components,
13
- setup: () => {
14
- const color = ref({
15
- r: 0,
16
- g: 0,
17
- b: 0
18
- /* , a: 0.5 */
19
- });
20
- const handleChange = (e) => {
21
- color.value = { ...e };
22
- };
23
- return {
24
- args: {
25
- outline: false,
26
- color,
27
- allowAlpha: true,
28
- ...args
29
- },
30
- handleChange
31
- };
32
- },
33
- template: `
34
- <lib-color-Input
35
- :allowAlpha="args.allowAlpha"
36
- :modelValue="args.color.value"
37
- @update:modelValue="handleChange"
38
- >
39
- </lib-color-Input>
40
- Stretched:
41
- <div class="flex-1 flex">
42
- <lib-color-Input
43
- class="flex-1"
44
- :allowAlpha="args.allowAlpha"
45
- :modelValue="args.color.value"
46
- @update:modelValue="handleChange"
47
- >
48
- </lib-color-Input>
49
- </div>
50
- `
51
- })
52
- };
53
- export const DoesNotAllowAlpha = {
54
- ...Primary,
55
- args: {
56
- allowAlpha: false
57
- }
58
- };
@@ -1,7 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/vue3";
2
- import LibColorPicker from "./LibColorPicker.vue.js";
3
- declare const meta: Meta<typeof LibColorPicker>;
4
- export default meta;
5
- type Story = StoryObj<typeof LibColorPicker>;
6
- export declare const Primary: Story;
7
- export declare const DoesNotAllowAlpha: Story;
@@ -1,51 +0,0 @@
1
- import { ref } from "vue";
2
- import LibColorPicker from "./LibColorPicker.vue";
3
- import * as components from "../index.js";
4
- const meta = {
5
- component: LibColorPicker,
6
- title: "Components/ColorPicker",
7
- args: {}
8
- };
9
- export default meta;
10
- export const Primary = {
11
- render: (args) => ({
12
- components,
13
- setup: () => {
14
- const color = ref({
15
- r: 0,
16
- g: 0,
17
- b: 0
18
- /* , a: 0.5 */
19
- });
20
- const handleChange = (e) => {
21
- color.value = { ...e };
22
- };
23
- return {
24
- args: {
25
- outline: false,
26
- color,
27
- allowAlpha: true,
28
- ...args
29
- },
30
- handleChange
31
- };
32
- },
33
- template: `
34
- <test-wrapper :outline="args.outline">
35
- {{args.color}}
36
- <lib-color-picker
37
- :allowAlpha="args.allowAlpha"
38
- :modelValue="args.color.value"
39
- @update:modelValue="handleChange"
40
- >
41
- </lib-color-picker>
42
- </test-wrapper>
43
- `
44
- })
45
- };
46
- export const DoesNotAllowAlpha = {
47
- ...Primary,
48
- args: {
49
- allowAlpha: false
50
- }
51
- };
@@ -1,7 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/vue3";
2
- import LibDarkModeSwitcher from "./LibDarkModeSwitcher.vue.js";
3
- declare const meta: Meta<typeof LibDarkModeSwitcher>;
4
- export default meta;
5
- type Story = StoryObj<typeof LibDarkModeSwitcher>;
6
- export declare const Primary: Story;
7
- export declare const WithoutLabel: Story;
@@ -1,36 +0,0 @@
1
- import { ref } from "vue";
2
- import LibDarkModeSwitcher from "./LibDarkModeSwitcher.vue";
3
- import * as components from "../index.js";
4
- const meta = {
5
- component: LibDarkModeSwitcher,
6
- title: "Components/DarkModeSwitcher",
7
- args: {}
8
- };
9
- export default meta;
10
- export const Primary = {
11
- render: (args) => ({
12
- components,
13
- setup: () => {
14
- const darkMode = ref(false);
15
- return {
16
- args,
17
- darkMode
18
- };
19
- },
20
- template: `
21
- Value: {{darkMode}}
22
- <LibDarkModeSwitcher
23
- @update:darkMode="darkMode = $event"
24
- v-bind="{...args}"
25
- ></LibDarkModeSwitcher>
26
-
27
- `
28
- })
29
- };
30
- export const WithoutLabel = {
31
- ...Primary,
32
- args: {
33
- ...Primary.args,
34
- autoLabel: false
35
- }
36
- };
@@ -1,11 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/vue3";
2
- import * as components from "../index.js.js";
3
- declare const singleMeta: Meta<typeof components.LibDatePicker>;
4
- export default singleMeta;
5
- type Story = StoryObj<typeof components.LibDatePicker>;
6
- export declare const Primary: Story;
7
- export declare const DateRange: Story;
8
- export declare const IconTriggerFirst: Story;
9
- export declare const BottomSlot: Story;
10
- export declare const DateWithTime: Story;
11
- export declare const WithDifferentFallbackDate: Story;
@@ -1,98 +0,0 @@
1
- import { CalendarDate, fromDate, getLocalTimeZone, toTimeZone } from "@internationalized/date";
2
- import { computed, ref } from "vue";
3
- import { createNoonUtcDate } from "../../helpers/createNoonUtcDate.js";
4
- import * as components from "../index.js";
5
- function html(strings, ...values) {
6
- return String.raw(strings, ...values);
7
- }
8
- const singleMeta = {
9
- component: components.LibDatePicker,
10
- title: "Components/DatePicker",
11
- args: {
12
- // @ts-expect-error custom prop just for story
13
- slot: "",
14
- timeZone: getLocalTimeZone()
15
- }
16
- };
17
- export default singleMeta;
18
- function toUTC(m, timeZone) {
19
- return toTimeZone(fromDate(m, timeZone), "UTC").toAbsoluteString();
20
- }
21
- export const Primary = {
22
- render: (args) => ({
23
- components: {
24
- ...components
25
- },
26
- setup: () => {
27
- const modelValue = ref(args.modelValue);
28
- const timeZone = ref(args.timeZone);
29
- const debugUtcDate = computed(() => {
30
- const m = modelValue.value;
31
- const z = timeZone.value;
32
- return m instanceof Date ? toUTC(m, z) : typeof m === "object" ? `Start: ${m.start ? toUTC(m.start, z) : "undefined"}, End: ${m.end ? toUTC(m.end, z) : "undefined"}` : "undefined";
33
- });
34
- return { args, getLocalTimeZone, modelValue, timeZone, debugUtcDate };
35
- },
36
- template: `
37
- <div>Date: {{modelValue ?? "undefined"}}</div>
38
- <div>Date UTC: {{debugUtcDate}}</div>
39
- <div>Detected timezone (via @internationalized/date): {{getLocalTimeZone()}}</div>
40
- <LibTimeZonePicker
41
- v-model="timeZone"
42
- label="Override Time Zone"
43
- wrapper-class="[&_.suggestions]:max-h-[200px] [&_.suggestions]:overflow-y-auto"
44
- />
45
- <div>
46
- This component has no border, added here to see it's size.
47
- </div>
48
- <div class="border border-neutral-500">
49
- <LibDatePicker v-bind="args" v-model="modelValue" :time-zone="timeZone">
50
- ${args.slot}
51
- </LibDatePicker>
52
- </div>
53
- `
54
- })
55
- };
56
- export const DateRange = {
57
- ...Primary,
58
- args: {
59
- modelValue: { start: void 0, end: void 0 }
60
- }
61
- };
62
- export const IconTriggerFirst = {
63
- ...Primary,
64
- args: {
65
- ...Primary.args,
66
- class: "[&_.trigger]:order-first"
67
- }
68
- };
69
- export const BottomSlot = {
70
- ...Primary,
71
- args: {
72
- // @ts-expect-error see above
73
- slot: html`
74
- <template #default="slotProps">
75
- <LibButton>Custom content can be added here.</LibButton>
76
- <p class="break-all">
77
- Content has access to the internal temporary/suggested date value and can change it (e.g. set it to today).
78
- </p>
79
- <p>Temp value:</p>
80
- {{ slotProps.tempValue }}
81
- </template>
82
- `
83
- }
84
- };
85
- export const DateWithTime = {
86
- ...Primary,
87
- args: {
88
- ...Primary.args,
89
- showTime: true
90
- }
91
- };
92
- export const WithDifferentFallbackDate = {
93
- ...Primary,
94
- args: {
95
- ...Primary.args,
96
- fallbackDate: createNoonUtcDate(new CalendarDate(2e3, 1, 1)).toDate()
97
- }
98
- };
@@ -1,9 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/vue3";
2
- import LibDebug from "./LibDebug.vue.js";
3
- declare const meta: Meta<typeof LibDebug>;
4
- export default meta;
5
- type Story = StoryObj<typeof LibDebug>;
6
- export declare const Primary: Story;
7
- export declare const WithCustomTab: Story;
8
- export declare const NoValue: Story;
9
- export declare const StringWithWhitespace: Story;
@@ -1,46 +0,0 @@
1
- import { crop } from "@alanscodelog/utils/crop.js";
2
- import LibDebug from "./LibDebug.vue";
3
- import * as components from "../index.js";
4
- const meta = {
5
- component: LibDebug,
6
- title: "Components/Debug",
7
- args: {
8
- value: { any: ["any", { value: "any" }] }
9
- }
10
- };
11
- export default meta;
12
- export const Primary = {
13
- render: (args) => ({
14
- components,
15
- setup: () => ({ args }),
16
- template: `
17
- <lib-debug v-bind="args" />
18
- `
19
- })
20
- };
21
- export const WithCustomTab = {
22
- ...Primary,
23
- args: {
24
- ...Primary.args,
25
- value: { any: ["any", { value: "any" }] },
26
- tab: 2
27
- }
28
- };
29
- export const NoValue = {
30
- ...Primary,
31
- args: {
32
- ...Primary.args,
33
- value: void 0
34
- }
35
- };
36
- export const StringWithWhitespace = {
37
- ...Primary,
38
- args: {
39
- ...Primary.args,
40
- value: crop`
41
- Manually
42
- Indented
43
- String
44
- `
45
- }
46
- };
@@ -1,10 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/vue3";
2
- import LibFileInput from "./LibFileInput.vue.js";
3
- declare const meta: Meta<typeof LibFileInput>;
4
- export default meta;
5
- type Story = StoryObj<typeof LibFileInput>;
6
- export declare const SingleFile: Story;
7
- export declare const MultipleFile: Story;
8
- export declare const AnyFormat: Story;
9
- export declare const Compact: Story;
10
- export declare const ErrorHandling: Story;
@@ -1,63 +0,0 @@
1
- import { ref } from "vue";
2
- import LibFileInput from "./LibFileInput.vue";
3
- import * as components from "../index.js";
4
- const meta = {
5
- component: LibFileInput,
6
- title: "Components/FileInput",
7
- args: {}
8
- };
9
- export default meta;
10
- export const SingleFile = {
11
- render: (args) => ({
12
- components,
13
- setup: () => {
14
- function errorHandler(e) {
15
- console.log(e);
16
- }
17
- return { args, errorHandler };
18
- },
19
- template: `
20
- <lib-file-input v-bind="{...args}" @errors="errorHandler"></lib-file-input>
21
- `
22
- })
23
- };
24
- export const MultipleFile = {
25
- ...SingleFile,
26
- args: {
27
- ...SingleFile.args,
28
- multiple: true
29
- }
30
- };
31
- export const AnyFormat = {
32
- ...SingleFile,
33
- args: {
34
- ...SingleFile.args,
35
- multiple: true,
36
- formats: []
37
- }
38
- };
39
- export const Compact = {
40
- ...SingleFile,
41
- args: {
42
- ...SingleFile.args,
43
- compact: true
44
- }
45
- };
46
- export const ErrorHandling = {
47
- render: (args) => ({
48
- components,
49
- setup: () => {
50
- const errors = ref([]);
51
- const errorHandler = (e) => errors.value = e;
52
- return {
53
- args,
54
- errors,
55
- errorHandler
56
- };
57
- },
58
- template: `
59
- <lib-debug :title="'Errors'">{{errors}}</lib-debug>
60
- <lib-file-input v-bind="{...args}" @errors="errorHandler"></lib-file-input>
61
- `
62
- })
63
- };
@@ -1,33 +0,0 @@
1
- import type { StoryObj } from "@storybook/vue3";
2
- import LibInput from "./LibInput.vue.js";
3
- declare const meta: {
4
- component: any;
5
- title: string;
6
- args: {
7
- border: boolean;
8
- label: string;
9
- };
10
- };
11
- export default meta;
12
- type Story = StoryObj<typeof LibInput>;
13
- export declare const Primary: Story;
14
- export declare const Disabled: Story;
15
- export declare const Readonly: Story;
16
- export declare const Invalid: Story;
17
- export declare const AttrsPassword: Story;
18
- export declare const AttrsDate: Story;
19
- export declare const AttrsNumber: Story;
20
- export declare const Borderless: any;
21
- export declare const WithAutosuggest: any;
22
- export declare const WithInstantAutosuggest: any;
23
- export declare const AutosuggestRestricted: any;
24
- export declare const AutosuggestSelectLikeShowAllUnrestricted: any;
25
- export declare const AutosuggestObjectOptions: any;
26
- export declare const Slots: Story;
27
- /** Press enter to add a value. */
28
- export declare const WithMultipleValues: Story;
29
- export declare const WithMultipleValuesWithSuggestions: any;
30
- export declare const WithMultipleValuesDisabled: any;
31
- export declare const WithMultipleValuesReadonly: any;
32
- export declare const InputSlotReplacement: Story;
33
- export declare const NextToButton: Story;