@witchcraft/ui 0.1.3 → 0.2.1-beta.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 (179) hide show
  1. package/README.md +3 -6
  2. package/dist/module.json +3 -3
  3. package/dist/module.mjs +15 -12
  4. package/dist/runtime/build/generateTheme.js +1 -1
  5. package/dist/runtime/components/Aria/Aria.vue +5 -9
  6. package/dist/runtime/components/Aria/Aria.vue.d.ts +5 -0
  7. package/dist/runtime/components/Icon/Icon.vue +10 -30
  8. package/dist/runtime/components/Icon/Icon.vue.d.ts +21 -0
  9. package/dist/runtime/components/LibButton/LibButton.vue +51 -72
  10. package/dist/runtime/components/LibButton/LibButton.vue.d.ts +36 -0
  11. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +43 -74
  12. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +42 -0
  13. package/dist/runtime/components/LibColorInput/LibColorInput.vue +63 -107
  14. package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +63 -0
  15. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue +272 -352
  16. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue.d.ts +61 -0
  17. package/dist/runtime/components/LibColorPicker/utils/safeConvertToHsva.js +1 -1
  18. package/dist/runtime/components/LibColorPicker/utils/safeConvertToRgba.js +1 -1
  19. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +35 -69
  20. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts +22 -0
  21. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue +17 -38
  22. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +40 -0
  23. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue +58 -82
  24. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue.d.ts +34 -0
  25. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue +55 -67
  26. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue.d.ts +34 -0
  27. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue +7 -8
  28. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue.d.ts +22 -0
  29. package/dist/runtime/components/LibDebug/LibDebug.vue +43 -70
  30. package/dist/runtime/components/LibDebug/LibDebug.vue.d.ts +32 -0
  31. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue +18 -31
  32. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue.d.ts +22 -0
  33. package/dist/runtime/components/LibFileInput/LibFileInput.vue +116 -156
  34. package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +43 -0
  35. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +211 -241
  36. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +165 -0
  37. package/dist/runtime/components/LibLabel/LibLabel.vue +25 -46
  38. package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +26 -0
  39. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +43 -58
  40. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue.d.ts +29 -0
  41. package/dist/runtime/components/LibNotifications/LibNotification.vue +34 -48
  42. package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +17 -0
  43. package/dist/runtime/components/LibNotifications/LibNotifications.vue +63 -83
  44. package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +13 -0
  45. package/dist/runtime/components/LibPagination/LibPagination.vue +67 -111
  46. package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +104 -0
  47. package/dist/runtime/components/LibPalette/LibPalette.vue +17 -23
  48. package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +14 -0
  49. package/dist/runtime/components/LibPopup/LibPopup.vue +314 -351
  50. package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +46 -0
  51. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +65 -91
  52. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue.d.ts +41 -0
  53. package/dist/runtime/components/LibRecorder/LibRecorder.vue +127 -177
  54. package/dist/runtime/components/LibRecorder/LibRecorder.vue.d.ts +77 -0
  55. package/dist/runtime/components/LibRoot/LibRoot.vue +75 -101
  56. package/dist/runtime/components/LibRoot/LibRoot.vue.d.ts +41 -0
  57. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue +42 -77
  58. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue.d.ts +35 -0
  59. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +118 -156
  60. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +94 -0
  61. package/dist/runtime/components/LibTable/LibTable.vue +63 -99
  62. package/dist/runtime/components/LibTable/LibTable.vue.d.ts +45 -0
  63. package/dist/runtime/components/Template/NAME.vue +15 -36
  64. package/dist/runtime/components/Template/NAME.vue.d.ts +17 -0
  65. package/dist/runtime/components/TestControls/TestControls.vue +6 -9
  66. package/dist/runtime/components/TestControls/TestControls.vue.d.ts +5 -0
  67. package/dist/runtime/components/shared/props.d.ts +0 -29
  68. package/dist/runtime/components/shared/props.js +0 -12
  69. package/dist/runtime/composables/useAccesibilityOutline.js +1 -1
  70. package/dist/runtime/composables/useDivideAttrs.js +1 -1
  71. package/dist/runtime/composables/useSuggestions.js +4 -4
  72. package/dist/runtime/directives/vDetectFlex.js +4 -4
  73. package/dist/runtime/directives/vExtractRootEl.d.ts +1 -1
  74. package/dist/runtime/directives/vResizableCols.d.ts +1 -1
  75. package/dist/runtime/directives/vResizableCols.js +4 -4
  76. package/dist/runtime/helpers/NotificationHandler.js +6 -6
  77. package/dist/runtime/helpers/base64ToImg.js +2 -2
  78. package/dist/runtime/nuxt/plugins/vue-plugin.js +1 -1
  79. package/dist/runtime/tailwind/themeConvertionOpts.d.ts +1 -1
  80. package/dist/runtime/theme.d.ts +1 -1
  81. package/dist/runtime/theme.js +1 -1
  82. package/dist/runtime/utils/notifyIfError.js +1 -1
  83. package/dist/runtime/vue/registerComponents.js +1 -1
  84. package/dist/types.d.mts +2 -6
  85. package/package.json +68 -90
  86. package/src/module.ts +19 -12
  87. package/src/runtime/build/generateTheme.ts +1 -1
  88. package/src/runtime/components/LibButton/LibButton.stories.ts +1 -1
  89. package/src/runtime/components/LibButton/LibButton.vue +3 -3
  90. package/src/runtime/components/LibCheckbox/LibCheckbox.vue +3 -7
  91. package/src/runtime/components/LibColorPicker/LibColorPicker.vue +6 -4
  92. package/src/runtime/components/LibColorPicker/utils/safeConvertToHsva.ts +1 -1
  93. package/src/runtime/components/LibColorPicker/utils/safeConvertToRgba.ts +1 -1
  94. package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +8 -15
  95. package/src/runtime/components/LibDatePicker/LibRangeDatePicker.vue +6 -0
  96. package/src/runtime/components/LibDatePicker/LibSingleDatePicker.vue +6 -0
  97. package/src/runtime/components/LibDebug/LibDebug.stories.ts +1 -1
  98. package/src/runtime/components/LibDebug/LibDebug.vue +2 -0
  99. package/src/runtime/components/LibFileInput/LibFileInput.vue +4 -0
  100. package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +7 -5
  101. package/src/runtime/components/LibLabel/LibLabel.vue +2 -3
  102. package/src/runtime/components/LibMultiValues/LibMultiValues.vue +5 -3
  103. package/src/runtime/components/LibNotifications/LibNotification.vue +3 -0
  104. package/src/runtime/components/LibNotifications/LibNotifications.vue +1 -1
  105. package/src/runtime/components/LibPalette/LibPalette.vue +3 -3
  106. package/src/runtime/components/LibPopup/LibPopup.vue +2 -2
  107. package/src/runtime/components/LibProgressBar/LibProgressBar.vue +2 -2
  108. package/src/runtime/components/LibRecorder/LibRecorder.vue +3 -3
  109. package/src/runtime/components/LibRoot/LibRoot.vue +3 -2
  110. package/src/runtime/components/LibSimpleInput/LibSimpleInput.vue +2 -2
  111. package/src/runtime/components/LibSuggestions/LibSuggestions.vue +2 -2
  112. package/src/runtime/components/LibTable/LibTable.vue +1 -1
  113. package/src/runtime/components/Template/NAME.vue +2 -2
  114. package/src/runtime/components/shared/props.ts +8 -12
  115. package/src/runtime/composables/useAccesibilityOutline.ts +1 -1
  116. package/src/runtime/composables/useDivideAttrs.ts +1 -1
  117. package/src/runtime/composables/useSuggestions.ts +4 -4
  118. package/src/runtime/directives/vDetectFlex.ts +4 -4
  119. package/src/runtime/directives/vExtractRootEl.ts +1 -1
  120. package/src/runtime/directives/vResizableCols.ts +5 -5
  121. package/src/runtime/helpers/NotificationHandler.ts +6 -6
  122. package/src/runtime/nuxt/plugins/vue-plugin.ts +1 -1
  123. package/src/runtime/tailwind/themeConvertionOpts.ts +1 -1
  124. package/src/runtime/theme.ts +2 -2
  125. package/src/runtime/utils/notifyIfError.ts +1 -1
  126. package/src/runtime/vue/registerComponents.ts +1 -1
  127. package/dist/module.cjs +0 -5
  128. package/dist/module.d.ts +0 -36
  129. package/dist/runtime/components/Focus.stories.d.ts +0 -11
  130. package/dist/runtime/components/Focus.stories.js +0 -53
  131. package/dist/runtime/components/LibButton/LibButton.stories.d.ts +0 -12
  132. package/dist/runtime/components/LibButton/LibButton.stories.js +0 -94
  133. package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.d.ts +0 -14
  134. package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.js +0 -29
  135. package/dist/runtime/components/LibColorInput/LibColorInput.stories.d.ts +0 -7
  136. package/dist/runtime/components/LibColorInput/LibColorInput.stories.js +0 -58
  137. package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.d.ts +0 -9
  138. package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.js +0 -68
  139. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.d.ts +0 -7
  140. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.js +0 -36
  141. package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.d.ts +0 -11
  142. package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.js +0 -98
  143. package/dist/runtime/components/LibDebug/LibDebug.stories.d.ts +0 -9
  144. package/dist/runtime/components/LibDebug/LibDebug.stories.js +0 -46
  145. package/dist/runtime/components/LibFileInput/LibFileInput.stories.d.ts +0 -10
  146. package/dist/runtime/components/LibFileInput/LibFileInput.stories.js +0 -63
  147. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.d.ts +0 -33
  148. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.js +0 -384
  149. package/dist/runtime/components/LibLabel/LibLabel.stories.d.ts +0 -6
  150. package/dist/runtime/components/LibLabel/LibLabel.stories.js +0 -25
  151. package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.d.ts +0 -23
  152. package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.js +0 -61
  153. package/dist/runtime/components/LibNotifications/LibNotification.stories.d.ts +0 -15
  154. package/dist/runtime/components/LibNotifications/LibNotification.stories.js +0 -126
  155. package/dist/runtime/components/LibNotifications/LibNotifications.stories.d.ts +0 -6
  156. package/dist/runtime/components/LibNotifications/LibNotifications.stories.js +0 -109
  157. package/dist/runtime/components/LibPagination/LibPagination.stories.d.ts +0 -6
  158. package/dist/runtime/components/LibPagination/LibPagination.stories.js +0 -40
  159. package/dist/runtime/components/LibPalette/LibPalette.stories.d.ts +0 -6
  160. package/dist/runtime/components/LibPalette/LibPalette.stories.js +0 -20
  161. package/dist/runtime/components/LibPopup/LibPopup.stories.d.ts +0 -14
  162. package/dist/runtime/components/LibPopup/LibPopup.stories.js +0 -147
  163. package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.d.ts +0 -10
  164. package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.js +0 -81
  165. package/dist/runtime/components/LibRecorder/LibRecorder.stories.d.ts +0 -19
  166. package/dist/runtime/components/LibRecorder/LibRecorder.stories.js +0 -63
  167. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.d.ts +0 -26
  168. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.js +0 -78
  169. package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.d.ts +0 -27
  170. package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.js +0 -112
  171. package/dist/runtime/components/LibTable/LibTable.stories.d.ts +0 -16
  172. package/dist/runtime/components/LibTable/LibTable.stories.js +0 -156
  173. package/dist/runtime/components/Reset.stories.d.ts +0 -5
  174. package/dist/runtime/components/Reset.stories.js +0 -19
  175. package/dist/runtime/components/Scrolling.stories.d.ts +0 -6
  176. package/dist/runtime/components/Scrolling.stories.js +0 -44
  177. package/dist/runtime/composables/useScrollNearContainerEdges.stories.d.ts +0 -7
  178. package/dist/runtime/composables/useScrollNearContainerEdges.stories.js +0 -85
  179. package/dist/types.d.ts +0 -7
@@ -1,7 +1,7 @@
1
- import { castType } from "@alanscodelog/utils/castType.js"
2
- import { override } from "@alanscodelog/utils/override.js"
3
- import { throttle } from "@alanscodelog/utils/throttle.js"
4
- import { unreachable } from "@alanscodelog/utils/unreachable.js"
1
+ import { castType } from "@alanscodelog/utils/castType"
2
+ import { override } from "@alanscodelog/utils/override"
3
+ import { throttle } from "@alanscodelog/utils/throttle"
4
+ import { unreachable } from "@alanscodelog/utils/unreachable"
5
5
  import type { Directive, Ref } from "vue"
6
6
 
7
7
  import { globalResizeObserver } from "../globalResizeObserver.js"
@@ -50,7 +50,7 @@ const throttledCallback = throttle(callback)
50
50
  * </div>
51
51
  * </template>
52
52
  * <script setup>
53
- * import {vResizeCols} from "@witchcraft/ui/directives/vResizableCols.js"
53
+ * import {vResizeCols} from "@witchcraft/ui/directives/vResizableCols"
54
54
  * </script>
55
55
  * ```
56
56
  *
@@ -1,10 +1,10 @@
1
1
  import type { AnyFunction, MakeRequired } from "@alanscodelog/utils"
2
- import { castType } from "@alanscodelog/utils/castType.js"
3
- import { crop } from "@alanscodelog/utils/crop.js"
4
- import { indent } from "@alanscodelog/utils/indent.js"
5
- import { isBlank } from "@alanscodelog/utils/isBlank.js"
6
- import { pretty } from "@alanscodelog/utils/pretty.js"
7
- import { setReadOnly } from "@alanscodelog/utils/setReadOnly.js"
2
+ import { castType } from "@alanscodelog/utils/castType"
3
+ import { crop } from "@alanscodelog/utils/crop"
4
+ import { indent } from "@alanscodelog/utils/indent"
5
+ import { isBlank } from "@alanscodelog/utils/isBlank"
6
+ import { pretty } from "@alanscodelog/utils/pretty"
7
+ import { setReadOnly } from "@alanscodelog/utils/setReadOnly"
8
8
 
9
9
 
10
10
  export class NotificationHandler<
@@ -1,4 +1,4 @@
1
- import { isArray } from "@alanscodelog/utils/isArray.js"
1
+ import { isArray } from "@alanscodelog/utils/isArray"
2
2
 
3
3
  import { defineNuxtPlugin, useRuntimeConfig } from "#imports"
4
4
 
@@ -1,4 +1,4 @@
1
- import { type themeAsTailwindCss } from "metamorphosis/tailwind.js"
1
+ import { type themeAsTailwindCss } from "metamorphosis/tailwind"
2
2
 
3
3
 
4
4
  export const themeConvertionOpts: Parameters<typeof themeAsTailwindCss>[1] = {
@@ -1,5 +1,5 @@
1
- import { baseTheme } from "metamorphosis/BaseTheme.js"
2
- import type { Theme } from "metamorphosis/Theme.js"
1
+ import { baseTheme } from "metamorphosis/BaseTheme"
2
+ import type { Theme } from "metamorphosis/Theme"
3
3
 
4
4
 
5
5
  export const theme = baseTheme as Theme
@@ -1,4 +1,4 @@
1
- import { TypedError } from "@alanscodelog/utils/TypedError.js"
1
+ import { TypedError } from "@alanscodelog/utils/TypedError"
2
2
 
3
3
  import { useNotificationHandler } from "../composables/useNotificationHandler.js"
4
4
 
@@ -1,4 +1,4 @@
1
- import { capitalize } from "@alanscodelog/utils/capitalize.js"
1
+ import { capitalize } from "@alanscodelog/utils/capitalize"
2
2
  import type { App } from "vue"
3
3
 
4
4
  /**
package/dist/module.cjs DELETED
@@ -1,5 +0,0 @@
1
- module.exports = function(...args) {
2
- return import('./module.mjs').then(m => m.default.call(this, ...args))
3
- }
4
- const _meta = module.exports.meta = require('./module.json')
5
- module.exports.getMeta = () => Promise.resolve(_meta)
package/dist/module.d.ts DELETED
@@ -1,36 +0,0 @@
1
- import * as _nuxt_schema from '@nuxt/schema';
2
-
3
- declare const knownDirectives: readonly ["vExtractRootEl", "vResizableCols", "vResizeObserver", "vResizableCols"];
4
- declare module "@nuxt/schema" {
5
- interface PublicRuntimeConfig {
6
- witchcraftUi: Pick<ModuleOptions, "directives">;
7
- }
8
- }
9
- interface ModuleOptions {
10
- /**
11
- * Whether to include the vite unplugin-icons plugins (pre-configured with the ui module's defaults.
12
- *
13
- * @default true
14
- */
15
- includeUnpluginIconsPlugins?: boolean;
16
- directives: (typeof knownDirectives[number])[];
17
- /**
18
- * Which components (without a prefix) to register for auto-importing globally.
19
- */
20
- globalComponents: string[];
21
- /**
22
- * @default "W"
23
- */
24
- componentPrefix: string;
25
- debug?: boolean;
26
- /**
27
- * @default "~/assets/css/tailwind.css" if it exists.
28
- */
29
- mainCssFile?: string;
30
- /** @internal */
31
- _playgroundWorkaround?: boolean;
32
- }
33
- declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
34
-
35
- export { _default as default };
36
- export type { ModuleOptions };
@@ -1,11 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/vue3";
2
- /**
3
- * For testing the focus styles. The (still WIP) idea is that normally the outlined class is set by whether the user is using the keyboard or not. When true, outlines generated by the focus-outline-* or outlined-* utilities are allowed (they might not always appear since most components have focus-visible styles), when false, they are not allowed, but components can still set custom focus styles that will always appear. Either or is usually not a good idea unless all components set custom focus styles. For something like a web app, focus-visible should be allowed. For an app, this setup allows that to be configurable.
4
- */
5
- declare const meta: Meta;
6
- export default meta;
7
- type Story = StoryObj<{}>;
8
- export declare const Primary: Story;
9
- export declare const OutlineForcedTrue: Story;
10
- export declare const OutlineFalse: Story;
11
- export declare const AlwaysAllowFocusVisible: Story;
@@ -1,53 +0,0 @@
1
- import { onMounted, ref } from "vue";
2
- import * as components from "./index.js";
3
- const meta = {
4
- title: "Other/Focus",
5
- args: {
6
- outline: true
7
- }
8
- };
9
- const template = `
10
- <div class="focus-outline-no-offset border border-accent-600" tabindex="0">focus-outline-no-offset (outlined i.e. outlined-focus-visible)</div>
11
- <div class="focus-outline border border-accent-600" tabindex="0">focus-outline (outlined i.e. outlined-focus-visible)</div>
12
- <div class="outline-hidden outlined-focus:border-danger-500 border border-accent-600" tabindex="0">outlined-focus</div>
13
- <div class="outline-hidden outlined-within:border-danger-500 border border-accent-600" >
14
- outlined-within<div tabindex="0">Inner</div>
15
- </div>
16
- <div class="outline-hidden focus:border-danger-500 border border-accent-600" tabindex="0">Has Manual Focus Classes</div>
17
- `;
18
- export default meta;
19
- export const Primary = {
20
- render: (args) => ({
21
- components,
22
- setup: () => {
23
- const el = ref(null);
24
- onMounted(() => {
25
- });
26
- return { ...args, el };
27
- },
28
- template
29
- })
30
- };
31
- export const OutlineForcedTrue = {
32
- ...Primary,
33
- args: {
34
- ...Primary.args,
35
- forceOutline: true
36
- }
37
- };
38
- export const OutlineFalse = {
39
- ...Primary,
40
- args: {
41
- ...Primary.args,
42
- outline: false
43
- }
44
- };
45
- export const AlwaysAllowFocusVisible = {
46
- render: (args) => ({
47
- components,
48
- setup: () => args,
49
- template: `
50
- <div class="outlined-visible group">${template}</div>
51
- `
52
- })
53
- };
@@ -1,12 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/vue3";
2
- import * as components from "../index.js.js";
3
- declare const meta: Meta<typeof components.LibButton>;
4
- export default meta;
5
- type Story = StoryObj<typeof components.LibButton>;
6
- export declare const Primary: Story;
7
- export declare const IconAfter: Story;
8
- export declare const OnlyIcon: Story;
9
- export declare const Disabled: Story;
10
- export declare const Borderless: Story;
11
- export declare const BorderlessDisabled: Story;
12
- export declare const WithDivInside: Story;
@@ -1,94 +0,0 @@
1
- import { capitalize } from "@alanscodelog/utils/capitalize.js";
2
- import IconFaSolidBell from "~icons/fa-solid/bell";
3
- import * as components from "../index.js";
4
- const meta = {
5
- component: components.LibButton,
6
- title: "Components/Button",
7
- args: {
8
- label: "Label",
9
- // @ts-expect-error - custom prop for story
10
- _iconAfter: true
11
- }
12
- };
13
- export default meta;
14
- export const Primary = {
15
- render: (args) => ({
16
- components: {
17
- ...components,
18
- IconFaSolidBell
19
- },
20
- setup: () => ({ args, capitalize }),
21
- template: `
22
- <div class="flex gap-4 justify-center">
23
- <template v-for="type of [false, 'ok', 'warning', 'danger', 'primary', 'secondary' ]">
24
- <lib-button v-bind="{...args, color: type, label: !args.label ? undefined : args.label + ' ' + capitalize(type || 'false')}">
25
- <template #icon>
26
- <icon class="w-[1em]"><icon-fa-solid-bell /></icon>
27
- </template>
28
- </lib-button>
29
- </template>
30
- </div>
31
- <div class="flex flex-col gap-4 pt-10">
32
- <template v-for="type of [false, 'ok', 'warning', 'danger', 'primary', 'secondary']">
33
- <lib-button v-bind="{...args, color: type , label: !args.label ? undefined : args.label + ' ' + capitalize(type || 'false') }">
34
- ${args._iconAfter ? `
35
- <template #icon-after>
36
- <icon class="w-[1em]"><icon-fa-solid-bell /></icon>
37
- </template>
38
- ` : ``}
39
- </lib-button>
40
- </template>
41
- </div>
42
- `
43
- })
44
- };
45
- export const IconAfter = {
46
- ...Primary,
47
- args: {
48
- ...Primary.args,
49
- // @ts-expect-error - .
50
- _iconAfter: true
51
- }
52
- };
53
- export const OnlyIcon = {
54
- ...Primary,
55
- args: {
56
- ...Primary.args,
57
- label: void 0
58
- }
59
- };
60
- export const Disabled = {
61
- ...Primary,
62
- args: {
63
- ...Primary.args,
64
- disabled: true
65
- }
66
- };
67
- export const Borderless = {
68
- ...Primary,
69
- args: {
70
- ...Primary.args,
71
- border: false
72
- }
73
- };
74
- export const BorderlessDisabled = {
75
- ...Primary,
76
- args: {
77
- ...Primary.args,
78
- border: false,
79
- disabled: true
80
- }
81
- };
82
- export const WithDivInside = {
83
- render: (args) => ({
84
- components,
85
- setup: () => ({ args }),
86
- template: `
87
- <div class="flex gap-4 justify-center">
88
- <lib-button v-bind="{...args}">
89
- <div>Div inside button still has a pointer cursor.</div>
90
- </lib-button>
91
- </div>
92
- `
93
- })
94
- };
@@ -1,14 +0,0 @@
1
- import type { StoryObj } from "@storybook/vue3";
2
- import * as components from "../index.js.js";
3
- declare const meta: {
4
- component: any;
5
- title: string;
6
- args: {
7
- modelValue: boolean;
8
- label: string;
9
- };
10
- };
11
- export default meta;
12
- type Story = StoryObj<typeof components.LibCheckbox>;
13
- export declare const Primary: Story;
14
- export declare const Disabled: any;
@@ -1,29 +0,0 @@
1
- import * as components from "../index.js";
2
- const meta = {
3
- component: components.LibCheckbox,
4
- title: "Components/Checkbox",
5
- args: {
6
- modelValue: true,
7
- label: "Label"
8
- }
9
- };
10
- export default meta;
11
- export const Primary = {
12
- render: (args) => ({
13
- components,
14
- setup: () => ({ args }),
15
- template: `
16
- <lib-checkbox v-bind="args" v-model="args.modelValue"></lib-checkbox>
17
- <br>
18
- Opposite State:
19
- <br>
20
- <lib-checkbox v-bind="args" :modelValue="!args.modelValue" @update:modelValue="args.modelValue = !$event"></lib-checkbox>
21
- `
22
- })
23
- };
24
- export const Disabled = {
25
- ...Primary,
26
- args: {
27
- disabled: true
28
- }
29
- };
@@ -1,7 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/vue3";
2
- import LibColorInput from "./LibColorInput.vue.js";
3
- declare const meta: Meta<typeof LibColorInput>;
4
- export default meta;
5
- type Story = StoryObj<typeof LibColorInput>;
6
- export declare const Primary: Story;
7
- export declare const DoesNotAllowAlpha: Story;
@@ -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,9 +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;
8
- export declare const WithExistingValue: Story;
9
- export declare const CustomStringRepresentation: Story;
@@ -1,68 +0,0 @@
1
- import Color from "colorjs.io";
2
- import { ref } from "vue";
3
- import LibColorPicker from "./LibColorPicker.vue";
4
- import * as components from "../index.js";
5
- const meta = {
6
- component: LibColorPicker,
7
- title: "Components/ColorPicker",
8
- args: {}
9
- };
10
- export default meta;
11
- export const Primary = {
12
- render: (args) => ({
13
- components,
14
- setup: () => {
15
- const color = ref({ r: 0, g: 0, b: 0, ...args.modelValue });
16
- delete args.modelValue;
17
- const handleChange = (e) => {
18
- color.value = { ...e };
19
- };
20
- return {
21
- args: {
22
- outline: false,
23
- color,
24
- allowAlpha: true,
25
- ...args
26
- },
27
- handleChange
28
- };
29
- },
30
- template: `
31
- <lib-root :outline="args.outline">
32
- {{args.color}}
33
- <lib-color-picker
34
- :modelValue="args.color.value"
35
- v-bind="args"
36
- @update:modelValue="handleChange"
37
- >
38
- </lib-color-picker>
39
- </lib-root>
40
- `
41
- })
42
- };
43
- export const DoesNotAllowAlpha = {
44
- ...Primary,
45
- args: {
46
- allowAlpha: false
47
- }
48
- };
49
- export const WithExistingValue = {
50
- ...Primary,
51
- args: {
52
- modelValue: { r: 255, g: 0, b: 0 }
53
- }
54
- };
55
- export const CustomStringRepresentation = {
56
- ...Primary,
57
- args: {
58
- allowAlpha: false,
59
- customRepresentation: {
60
- fromHsvaToString: (hsva, includeAlpha) => new Color(
61
- "hsv",
62
- [hsva.h, hsva.s, hsva.v],
63
- includeAlpha ? hsva.a : 1
64
- // this takes care of the correct hex format
65
- ).toString({ format: "hex" })
66
- }
67
- }
68
- };
@@ -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
- showLabel: 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;