@witchcraft/ui 0.1.1 → 0.1.3

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 (122) hide show
  1. package/dist/module.cjs +5 -0
  2. package/dist/module.d.ts +36 -0
  3. package/dist/module.json +2 -2
  4. package/dist/module.mjs +2 -1
  5. package/dist/runtime/assets/utils.css +1 -1
  6. package/dist/runtime/components/Aria/Aria.vue +9 -5
  7. package/dist/runtime/components/Focus.stories.d.ts +11 -0
  8. package/dist/runtime/components/Focus.stories.js +53 -0
  9. package/dist/runtime/components/Icon/Icon.vue +30 -10
  10. package/dist/runtime/components/LibButton/LibButton.stories.d.ts +12 -0
  11. package/dist/runtime/components/LibButton/LibButton.stories.js +94 -0
  12. package/dist/runtime/components/LibButton/LibButton.vue +72 -58
  13. package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.d.ts +14 -0
  14. package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.js +29 -0
  15. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +74 -48
  16. package/dist/runtime/components/LibColorInput/LibColorInput.stories.d.ts +7 -0
  17. package/dist/runtime/components/LibColorInput/LibColorInput.stories.js +58 -0
  18. package/dist/runtime/components/LibColorInput/LibColorInput.vue +107 -63
  19. package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.d.ts +9 -0
  20. package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.js +68 -0
  21. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue +352 -271
  22. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.d.ts +7 -0
  23. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.js +36 -0
  24. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +56 -32
  25. package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.d.ts +11 -0
  26. package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.js +98 -0
  27. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue +38 -17
  28. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue +82 -53
  29. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue +67 -50
  30. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue +8 -7
  31. package/dist/runtime/components/LibDebug/LibDebug.stories.d.ts +9 -0
  32. package/dist/runtime/components/LibDebug/LibDebug.stories.js +46 -0
  33. package/dist/runtime/components/LibDebug/LibDebug.vue +70 -42
  34. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue +31 -18
  35. package/dist/runtime/components/LibFileInput/LibFileInput.stories.d.ts +10 -0
  36. package/dist/runtime/components/LibFileInput/LibFileInput.stories.js +63 -0
  37. package/dist/runtime/components/LibFileInput/LibFileInput.vue +156 -113
  38. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.d.ts +33 -0
  39. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.js +384 -0
  40. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +241 -215
  41. package/dist/runtime/components/LibLabel/LibLabel.stories.d.ts +6 -0
  42. package/dist/runtime/components/LibLabel/LibLabel.stories.js +25 -0
  43. package/dist/runtime/components/LibLabel/LibLabel.vue +46 -30
  44. package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.d.ts +23 -0
  45. package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.js +61 -0
  46. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +58 -44
  47. package/dist/runtime/components/LibNotifications/LibNotification.stories.d.ts +15 -0
  48. package/dist/runtime/components/LibNotifications/LibNotification.stories.js +126 -0
  49. package/dist/runtime/components/LibNotifications/LibNotification.vue +48 -32
  50. package/dist/runtime/components/LibNotifications/LibNotifications.stories.d.ts +6 -0
  51. package/dist/runtime/components/LibNotifications/LibNotifications.stories.js +109 -0
  52. package/dist/runtime/components/LibNotifications/LibNotifications.vue +83 -63
  53. package/dist/runtime/components/LibPagination/LibPagination.stories.d.ts +6 -0
  54. package/dist/runtime/components/LibPagination/LibPagination.stories.js +40 -0
  55. package/dist/runtime/components/LibPagination/LibPagination.vue +111 -67
  56. package/dist/runtime/components/LibPalette/LibPalette.stories.d.ts +6 -0
  57. package/dist/runtime/components/LibPalette/LibPalette.stories.js +20 -0
  58. package/dist/runtime/components/LibPalette/LibPalette.vue +23 -20
  59. package/dist/runtime/components/LibPopup/LibPopup.stories.d.ts +14 -0
  60. package/dist/runtime/components/LibPopup/LibPopup.stories.js +147 -0
  61. package/dist/runtime/components/LibPopup/LibPopup.vue +351 -314
  62. package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.d.ts +10 -0
  63. package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.js +81 -0
  64. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +91 -70
  65. package/dist/runtime/components/LibRecorder/LibRecorder.stories.d.ts +19 -0
  66. package/dist/runtime/components/LibRecorder/LibRecorder.stories.js +63 -0
  67. package/dist/runtime/components/LibRecorder/LibRecorder.vue +177 -133
  68. package/dist/runtime/components/LibRoot/LibRoot.vue +100 -73
  69. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.d.ts +26 -0
  70. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.js +78 -0
  71. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue +77 -49
  72. package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.d.ts +27 -0
  73. package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.js +112 -0
  74. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +156 -123
  75. package/dist/runtime/components/LibTable/LibTable.stories.d.ts +16 -0
  76. package/dist/runtime/components/LibTable/LibTable.stories.js +156 -0
  77. package/dist/runtime/components/LibTable/LibTable.vue +99 -63
  78. package/dist/runtime/components/Reset.stories.d.ts +5 -0
  79. package/dist/runtime/components/Reset.stories.js +19 -0
  80. package/dist/runtime/components/Scrolling.stories.d.ts +6 -0
  81. package/dist/runtime/components/Scrolling.stories.js +44 -0
  82. package/dist/runtime/components/Template/NAME.vue +36 -15
  83. package/dist/runtime/components/TestControls/TestControls.vue +9 -6
  84. package/dist/runtime/composables/useScrollNearContainerEdges.stories.d.ts +7 -0
  85. package/dist/runtime/composables/useScrollNearContainerEdges.stories.js +85 -0
  86. package/dist/types.d.mts +6 -2
  87. package/dist/types.d.ts +7 -0
  88. package/package.json +11 -5
  89. package/src/module.ts +2 -1
  90. package/src/runtime/assets/utils.css +5 -5
  91. package/src/runtime/components/LibButton/LibButton.vue +2 -6
  92. package/src/runtime/nuxt/plugins/vue-plugin.ts +1 -1
  93. package/dist/runtime/components/Aria/Aria.vue.d.ts +0 -5
  94. package/dist/runtime/components/Icon/Icon.vue.d.ts +0 -21
  95. package/dist/runtime/components/LibButton/LibButton.vue.d.ts +0 -36
  96. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +0 -42
  97. package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +0 -63
  98. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue.d.ts +0 -61
  99. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts +0 -22
  100. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +0 -40
  101. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue.d.ts +0 -34
  102. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue.d.ts +0 -34
  103. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue.d.ts +0 -22
  104. package/dist/runtime/components/LibDebug/LibDebug.vue.d.ts +0 -32
  105. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue.d.ts +0 -22
  106. package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +0 -43
  107. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +0 -165
  108. package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +0 -27
  109. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue.d.ts +0 -29
  110. package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +0 -17
  111. package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +0 -13
  112. package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +0 -104
  113. package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +0 -14
  114. package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +0 -46
  115. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue.d.ts +0 -41
  116. package/dist/runtime/components/LibRecorder/LibRecorder.vue.d.ts +0 -77
  117. package/dist/runtime/components/LibRoot/LibRoot.vue.d.ts +0 -41
  118. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue.d.ts +0 -35
  119. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +0 -94
  120. package/dist/runtime/components/LibTable/LibTable.vue.d.ts +0 -45
  121. package/dist/runtime/components/Template/NAME.vue.d.ts +0 -17
  122. package/dist/runtime/components/TestControls/TestControls.vue.d.ts +0 -5
@@ -0,0 +1,5 @@
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)
@@ -0,0 +1,36 @@
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 };
package/dist/module.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "witchcraftUi",
3
3
  "configKey": "witchcraftUi",
4
- "version": "0.1.1",
4
+ "version": "0.1.3",
5
5
  "builder": {
6
- "@nuxt/module-builder": "1.0.2",
6
+ "@nuxt/module-builder": "0.8.4",
7
7
  "unbuild": "3.6.0"
8
8
  }
9
9
  }
package/dist/module.mjs CHANGED
@@ -1,7 +1,8 @@
1
1
  import { indent, crop } from '@alanscodelog/utils';
2
2
  import { createResolver, defineNuxtModule, useLogger, addTemplate, addComponent, addImports, installModule, addTypeTemplate } from '@nuxt/kit';
3
3
  import tailwindcss from '@tailwindcss/vite';
4
- import { globFiles, addImportsCustom } from '@witchcraft/nuxt-utils/utils';
4
+ import { addImportsCustom } from '@witchcraft/nuxt-utils/utils/addImportsCustom.js';
5
+ import { globFiles } from '@witchcraft/nuxt-utils/utils/globFiles.js';
5
6
  import { defu } from 'defu';
6
7
  import fs from 'fs';
7
8
  import { themeAsTailwindCss } from 'metamorphosis/tailwind';
@@ -1 +1 @@
1
- @custom-variant dark (&:where(.dark, .dark *));@utility focus-outline-within{@apply outlined-within:outline-2 outlined-within:outline-accent-500 outlined-within:outline-offset-2}@utility focus-outline{@apply outlined:outline-2 outlined:outline-accent-500 outlined:outline-offset-2}@utility focus-outline-no-offset{@apply outlined:outline-2 outlined:outline-accent-500}@utility focus-outline-hidden{@apply outlined:outline-none}@utility bg-squares-gradient{--_square:var(--squareSize,5px);--_double_square:calc(var(--_square)*2);--_light_square:var(--lightSquare,var(--color-white));--_dark_square:var(--darkSquare,var(--color-black));background-color:var(--_light_square);background:repeating-conic-gradient(var(--_dark_square) 0 25%,var(--_light_square) 0 50%) 50% /var(--_double_square) var(--_double_square)}@utility square-light-*{--lightSquare:--value(--color- *)}@utility square-dark-*{--darkSquare:--value(--color- *)}@utility square-size-*{--squareSize:calc(--value(integer) * 1px)}@utility bg-bars-gradient{--_bg_color:var(--bars-bg-color,var(--color-accent-700));--_fg_color:var(--bars-fg-color,var(--color-accent-800));--_angle:var(--bars-angle,45deg);--_fg_width:var(--bars-fg-width,50%);--_bg_width:calc(100% - var(--_fg_width));background-color:var(--_bg_color);--_pos_1:calc(var(--_bg_width)/2);--_pos_2:calc(var(--_bg_width)/2 + var(--_fg_width)/2);--_pos_3:calc(var(--_bg_width) + var(--_fg_width)/2);background-image:repeating-linear-gradient(var(--_angle),var(--_bg_color),var(--_bg_color) var(--_pos_1),var(--_fg_color) var(--_pos_1),var(--_fg_color) var(--_pos_2),var(--_bg_color) var(--_pos_2),var(--_bg_color) var(--_pos_3),var(--_fg_color) var(--_pos_3),var(--_fg_color))}@utility bars-angle-*{--bars-angle:var(--value(integer) * 1deg)}@utility bars-fg-*{--bars-fg-color:--value(--color-*)}@utility bars-bg-*{--bars-bg-color:--value(--color-*)}@utility bars-w-*{--bars-fg-width:calc(--value(integer) * 1%, 50%)}@utility scrollbar-hidden{-ms-overflow-style:none;scrollbar-width:none;&::-webkit-scrollbar{display:none}}@utility styled-scrollbar{--_scrollbar_width:var(--scrollbar-width,calc(var(--spacing)*3));--_scrollbar_border_width:var(--scrollbar-border-width,calc(var(--spacing)/2));--_scrollbar_color:var(--scrollbar-color,--alpha(var(--color-accent-500)/40%));--_scrollbar_hover_color:var(--scrollbar-hover-color,--alpha(var(--color-accent-500)/80%));--_scrollbar_bg_color:var(--scrollbar-bg-color,var(--color-bg));.dark &{--_scrollbar_bg_color:var(--scrollbar-bg-color,var(--color-fg))}&::-webkit-scrollbar{height:var(--_scrollbar_width);width:var(--_scrollbar_width)}&::-webkit-scrollbar-corner,&::-webkit-scrollbar-track{background-color:transparent}&::-webkit-scrollbar-thumb,&::-webkit-scrollbar-track{border-radius:var(--_scrollbar_width)}&::-webkit-scrollbar-thumb{background-color:var(--_scrollbar_color);border:var(--_scrollbar_border_width) solid var(--_scrollbar_bg_color)}&::-webkit-scrollbar-thumb:hover{cursor:pointer}&::-webkit-scrollbar-thumb:active,&::-webkit-scrollbar-thumb:hover{background-color:var(--_scrollbar_hover_color);border-radius:var(--_scrollbar_width)}}@utility styled-scrollbar-w-*{--scrollbar-width:--value(integer)}@utility styled-scrollbar-border-w-*{--scrollbar-border-width:--value(integer)}@utility styled-scrollbar-*{--scrollbar-color:--value(--color-*)}@utility styled-scrollbar-bg-*{--scrollbar-bg-color:--value(--color-*)}@utility styled-resizer{--_resizer_width:var(--resizer-width,8px);--_resizer_color:var(--resizer-color,var(--color-neutral-300));.dark &{--_resizer_color:var(--resizer-color,var(--color-neutral-700))}&::-webkit-resizer{border-bottom-color:var(--_resizer_color);border-left-color:transparent;border-right-color:var(--_resizer_color);border-style:solid;border-top-color:transparent;border-width:var(--_resizer_width)}}@utility styled-resizer-w-*{--resizer-width:--value(integer)}@utility styled-resizer-color-*{--resizer-color:--value(--color-*)}@utility content-vertical-holder{--tw-content:"\200b";content:var(--tw-content)}@utility no-touch-action{touch-action:none}@utility bg-transparency-squares{@apply bg-squares-gradient square-light-white square-dark-neutral-300 square-size-6}@utility link-like{@apply cursor-pointer hover:text-accent-500}
1
+ @custom-variant dark (&:where(.dark, .dark *));@utility focus-outline-within{@reference outlined-within:outline-2 outlined-within:outline-accent-500 outlined-within:outline-offset-2}@utility focus-outline{@reference outlined:outline-2 outlined:outline-accent-500 outlined:outline-offset-2}@utility focus-outline-no-offset{@reference outlined:outline-2 outlined:outline-accent-500}@utility focus-outline-hidden{@reference outlined:outline-none}@utility bg-squares-gradient{--_square:var(--squareSize,5px);--_double_square:calc(var(--_square)*2);--_light_square:var(--lightSquare,var(--color-white));--_dark_square:var(--darkSquare,var(--color-black));background-color:var(--_light_square);background:repeating-conic-gradient(var(--_dark_square) 0 25%,var(--_light_square) 0 50%) 50% /var(--_double_square) var(--_double_square)}@utility square-light-*{--lightSquare:--value(--color- *)}@utility square-dark-*{--darkSquare:--value(--color- *)}@utility square-size-*{--squareSize:calc(--value(integer) * 1px)}@utility bg-bars-gradient{--_bg_color:var(--bars-bg-color,var(--color-accent-700));--_fg_color:var(--bars-fg-color,var(--color-accent-800));--_angle:var(--bars-angle,45deg);--_fg_width:var(--bars-fg-width,50%);--_bg_width:calc(100% - var(--_fg_width));background-color:var(--_bg_color);--_pos_1:calc(var(--_bg_width)/2);--_pos_2:calc(var(--_bg_width)/2 + var(--_fg_width)/2);--_pos_3:calc(var(--_bg_width) + var(--_fg_width)/2);background-image:repeating-linear-gradient(var(--_angle),var(--_bg_color),var(--_bg_color) var(--_pos_1),var(--_fg_color) var(--_pos_1),var(--_fg_color) var(--_pos_2),var(--_bg_color) var(--_pos_2),var(--_bg_color) var(--_pos_3),var(--_fg_color) var(--_pos_3),var(--_fg_color))}@utility bars-angle-*{--bars-angle:var(--value(integer) * 1deg)}@utility bars-fg-*{--bars-fg-color:--value(--color-*)}@utility bars-bg-*{--bars-bg-color:--value(--color-*)}@utility bars-w-*{--bars-fg-width:calc(--value(integer) * 1%, 50%)}@utility scrollbar-hidden{-ms-overflow-style:none;scrollbar-width:none;&::-webkit-scrollbar{display:none}}@utility styled-scrollbar{--_scrollbar_width:var(--scrollbar-width,calc(var(--spacing)*3));--_scrollbar_border_width:var(--scrollbar-border-width,calc(var(--spacing)/2));--_scrollbar_color:var(--scrollbar-color,--alpha(var(--color-accent-500)/40%));--_scrollbar_hover_color:var(--scrollbar-hover-color,--alpha(var(--color-accent-500)/80%));--_scrollbar_bg_color:var(--scrollbar-bg-color,var(--color-bg));.dark &{--_scrollbar_bg_color:var(--scrollbar-bg-color,var(--color-fg))}&::-webkit-scrollbar{height:var(--_scrollbar_width);width:var(--_scrollbar_width)}&::-webkit-scrollbar-corner,&::-webkit-scrollbar-track{background-color:transparent}&::-webkit-scrollbar-thumb,&::-webkit-scrollbar-track{border-radius:var(--_scrollbar_width)}&::-webkit-scrollbar-thumb{background-color:var(--_scrollbar_color);border:var(--_scrollbar_border_width) solid var(--_scrollbar_bg_color)}&::-webkit-scrollbar-thumb:hover{cursor:pointer}&::-webkit-scrollbar-thumb:active,&::-webkit-scrollbar-thumb:hover{background-color:var(--_scrollbar_hover_color);border-radius:var(--_scrollbar_width)}}@utility styled-scrollbar-w-*{--scrollbar-width:--value(integer)}@utility styled-scrollbar-border-w-*{--scrollbar-border-width:--value(integer)}@utility styled-scrollbar-*{--scrollbar-color:--value(--color-*)}@utility styled-scrollbar-bg-*{--scrollbar-bg-color:--value(--color-*)}@utility styled-resizer{--_resizer_width:var(--resizer-width,8px);--_resizer_color:var(--resizer-color,var(--color-neutral-300));.dark &{--_resizer_color:var(--resizer-color,var(--color-neutral-700))}&::-webkit-resizer{border-bottom-color:var(--_resizer_color);border-left-color:transparent;border-right-color:var(--_resizer_color);border-style:solid;border-top-color:transparent;border-width:var(--_resizer_width)}}@utility styled-resizer-w-*{--resizer-width:--value(integer)}@utility styled-resizer-color-*{--resizer-color:--value(--color-*)}@utility content-vertical-holder{--tw-content:"\200b";content:var(--tw-content)}@utility no-touch-action{touch-action:none}@utility bg-transparency-squares{@reference bg-squares-gradient square-light-white square-dark-neutral-300 square-size-6}@utility link-like{@apply cursor-pointer hover:text-accent-500}
@@ -2,11 +2,15 @@
2
2
  <div tabindex="0">{{ value }}</div>
3
3
  </template>
4
4
 
5
- <script setup>
6
- defineOptions({ name: "aria" });
7
- defineProps({
8
- value: { type: String, required: true }
9
- });
5
+ <script setup lang="ts">
6
+ import type { PropType } from "vue"
7
+
8
+
9
+ defineOptions({ name: "aria" })
10
+ defineProps<{
11
+ // eslint-disable-next-line vue/no-restricted-props
12
+ value: string
13
+ }>()
10
14
  </script>
11
15
 
12
16
  <style scoped>
@@ -0,0 +1,11 @@
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;
@@ -0,0 +1,53 @@
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,23 +1,43 @@
1
1
  <template>
2
2
  <div
3
3
  :class="twMerge('icon inline-block', $attrs?.class)"
4
- v-bind="{ ...$attrs, class: void 0 }"
4
+ v-bind="{...$attrs, class:undefined}"
5
5
  >
6
6
  <slot/>
7
7
  </div>
8
8
  </template>
9
9
 
10
- <script setup>
11
- import { computed, useAttrs } from "vue";
12
- import { twMerge } from "../../utils/twMerge.js";
10
+ <script setup lang="ts">
11
+ import { computed, type HTMLAttributes,useAttrs } from "vue"
12
+
13
+ import { twMerge } from "../../utils/twMerge.js"
14
+
13
15
  defineOptions({
14
- name: "icon",
15
- inheritAttrs: false
16
- });
17
- const $attrs = useAttrs();
18
- const props = defineProps({});
16
+ name: "icon",
17
+ inheritAttrs: false,
18
+ })
19
+
20
+
21
+ const $attrs = useAttrs() as any
22
+
23
+ const props = defineProps<Props>()
24
+
25
+
19
26
  </script>
20
27
 
21
- <script>
28
+ <script lang="ts">
29
+ /**
30
+ * Just a very simple wrapper for wrapping unplugin-icons in an inline-block div so the icon in the slot take's up a normal line height when it's alone.
31
+ *
32
+ * ```vue
33
+ * <icon><i-...></icon>
34
+ * ``
35
+ */
22
36
 
37
+ interface Props
38
+ extends
39
+ /** @vue-ignore */
40
+ Partial<Omit<HTMLAttributes, "class">
41
+ > { }
23
42
  </script>
43
+
@@ -0,0 +1,12 @@
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;
@@ -0,0 +1,94 @@
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,8 +1,7 @@
1
1
  <template>
2
2
  <button
3
3
  :id="id ?? fallbackId"
4
- :class="!$attrs.unstyle && twMerge(
5
- `
4
+ :class="!($attrs as any).unstyle && twMerge(`
6
5
  button
7
6
  flex
8
7
  cursor-pointer
@@ -23,8 +22,8 @@
23
22
  dark:disabled:text-neutral-500
24
23
  dark:disabled:hover:text-neutral-500
25
24
  `,
26
- !color && `active:text-neutral-800`,
27
- border && `
25
+ !color && `active:text-neutral-800` /* todo for colors */,
26
+ border && `
28
27
  transition-all
29
28
  bg-neutral-100
30
29
  dark:bg-neutral-900
@@ -61,37 +60,37 @@
61
60
  dark:disabled:border-neutral-800
62
61
  dark:disabled:bg-neutral-900
63
62
  `,
64
- border && (!color || color === `secondary`) && `
63
+ border && ( !color || color === `secondary` ) && `
65
64
  after:shadow-bg/90
66
65
  hover:after:shadow-bg
67
66
  dark:after:shadow-bg/20
68
67
  dark:hover:after:shadow-bg/90
69
68
  `,
70
- !border && color === `primary` && `
69
+ !border && color === `primary` && `
71
70
  font-bold
72
71
  hover:text-accent-50
73
72
  `,
74
- !border && color === `ok` && `
73
+ !border && color === `ok` && `
75
74
  text-ok-600 hover:text-ok-500
76
75
  dark:text-ok-600 dark:hover:text-ok-500
77
76
  `,
78
- !border && color === `warning` && `
77
+ !border && color === `warning` && `
79
78
  text-warning-500 hover:text-warning-300
80
79
  dark:text-warning-600 dark:hover:text-warning-400
81
80
  `,
82
- !border && color === `danger` && `
81
+ !border && color === `danger` && `
83
82
  text-danger-500 hover:text-danger-300
84
83
  dark:text-danger-600 dark:hover:text-danger-400
85
84
  `,
86
- !border && color === `secondary` && `
85
+ !border && color === `secondary` && `
87
86
  text-accent-700 hover:text-accent-500
88
87
  dark:text-accent-600 dark:hover:text-accent-400
89
88
  `,
90
- !border && color === `primary` && `
89
+ !border && color === `primary` && `
91
90
  text-accent-700 hover:text-accent-500
92
91
  dark:text-accent-600 dark:hover:text-accent-400
93
92
  `,
94
- border && color === `ok` && `
93
+ border && color === `ok` && `
95
94
  text-ok-950
96
95
  hover:text-ok-800
97
96
  bg-ok-400
@@ -106,7 +105,7 @@
106
105
  dark:hover:border-ok-900
107
106
  dark:hover:shadow-ok-900/30
108
107
  `,
109
- border && color === `warning` && `
108
+ border && color === `warning` && `
110
109
  text-warning-950
111
110
  hover:text-warning-900
112
111
  bg-warning-300
@@ -120,7 +119,7 @@
120
119
  dark:border-warning-700
121
120
  dark:hover:shadow-warning-900/25
122
121
  `,
123
- border && color === `danger` && `
122
+ border && color === `danger` && `
124
123
  text-danger-950
125
124
  hover:text-danger-900
126
125
  bg-danger-400
@@ -134,11 +133,11 @@
134
133
  dark:border-danger-950
135
134
  dark:hover:shadow-ranger-500/10
136
135
  `,
137
- border && color === `secondary` && `
136
+ border && color === `secondary` && `
138
137
  text-accent-800
139
138
  dark:text-accent-400
140
139
  `,
141
- border && color === `primary` && `
140
+ border && color === `primary` && `
142
141
  text-bg
143
142
  hover:text-bg
144
143
  bg-accent-600
@@ -153,28 +152,28 @@
153
152
  dark:hover:border-accent-700
154
153
  dark:hover:shadow-accent-900/50
155
154
  `,
156
- $attrs?.class
157
- )"
158
- :type="$attrs.type"
155
+ ($attrs as any)?.class
156
+ )"
157
+ :type="$attrs.type as any"
159
158
  :tabindex="0"
160
159
  :disabled="disabled"
161
160
  :data-border="border"
162
161
  :data-color="color"
163
162
  :aria-disabled="disabled"
164
163
  v-bind="{
165
- ...autoTitle,
166
- ...$attrs,
167
- class: void 0,
168
- ...ariaLabel
169
- }"
164
+ ...autoTitle,
165
+ ...$attrs,
166
+ class: undefined,
167
+ ...ariaLabel,
168
+ }"
170
169
  >
171
- <slot name="label" v-bind="{ id: `label-${id ?? fallbackId}`, classes: 'button--label pointer-events-none flex flex-1 items-center justify-center gap-1' }">
170
+ <slot name="label" v-bind="{id:`label-${id ?? fallbackId}`, classes:'button--label pointer-events-none flex flex-1 items-center justify-center gap-1'}">
172
171
  <label :id="`label-${id ?? fallbackId}`" class="button--label pointer-events-none flex flex-1 items-center justify-center gap-1">
173
172
  <slot name="icon"/>
174
173
  <slot
175
- v-bind="{ label }"
174
+ v-bind="{ label}"
176
175
  >
177
- <span v-if="label && !isBlank(label)">
176
+ <span v-if="label && !isBlank(label!)">
178
177
  {{ label }}
179
178
  </span>
180
179
  </slot>
@@ -184,40 +183,55 @@
184
183
  </button>
185
184
  </template>
186
185
 
187
- <script setup>
188
- import { isBlank } from "@alanscodelog/utils/isBlank.js";
189
- import { keys } from "@alanscodelog/utils/keys.js";
190
- import { pick } from "@alanscodelog/utils/pick.js";
191
- import { computed, useAttrs } from "vue";
192
- import { useAriaLabel } from "../../composables/useAriaLabel.js";
193
- import { useDivideAttrs } from "../../composables/useDivideAttrs.js";
194
- import { twMerge } from "../../utils/twMerge.js";
195
- import { baseInteractiveProps, baseInteractivePropsDefaults, getFallbackId } from "../shared/props.js";
196
- const $attrs = useAttrs();
186
+ <script setup lang="ts">
187
+ import { isBlank } from "@alanscodelog/utils/isBlank.js"
188
+ import { type ButtonHTMLAttributes,computed, useAttrs } from "vue"
189
+
190
+ import { useAriaLabel } from "../../composables/useAriaLabel.js"
191
+ import { twMerge } from "../../utils/twMerge.js"
192
+ import { type BaseInteractiveProps, baseInteractivePropsDefaults, type ButtonProps,getFallbackId, type LabelProps, type LinkableByIdProps, type TailwindClassProp } from "../shared/props.js"
193
+
194
+
195
+ const $attrs = useAttrs()
196
+
197
+
197
198
  defineOptions({
198
- name: "lib-button"
199
- });
200
- const fallbackId = getFallbackId();
201
- const props = defineProps(/* @__PURE__ */ _mergeDefaults({
202
- id: { type: String, required: false },
203
- label: { type: String, required: false },
204
- disabled: { type: Boolean, required: false },
205
- readonly: { type: Boolean, required: false },
206
- border: { type: Boolean, required: false },
207
- unstyle: { type: Boolean, required: false },
208
- color: { type: [String, Boolean], required: false },
209
- autoTitleFromAria: { type: Boolean, required: false }
210
- }, {
211
- color: false,
212
- label: "",
213
- ...baseInteractivePropsDefaults
214
- }));
215
- const ariaLabel = useAriaLabel(props, fallbackId);
199
+ name: "lib-button",
200
+ })
201
+
202
+ const fallbackId = getFallbackId()
203
+
204
+ const props = withDefaults(defineProps<Props>(), {
205
+ color: false,
206
+ label: "",
207
+ ...baseInteractivePropsDefaults
208
+ })
209
+
210
+
211
+ const ariaLabel = useAriaLabel(props, fallbackId)
216
212
  const autoTitle = computed(() => ({
217
- title: props.autoTitleFromAria ? $attrs["aria-label"] ?? props.label : void 0
218
- }));
213
+ title: props.autoTitleFromAria
214
+ ? ($attrs["aria-label"] ?? props.label) as string
215
+ : undefined,
216
+ }))
217
+
219
218
  </script>
220
219
 
221
- <script>
220
+ <script lang="ts">
221
+ type RealProps =
222
+ & LinkableByIdProps
223
+ & LabelProps
224
+ & BaseInteractiveProps
225
+ & ButtonProps
222
226
 
227
+ interface Props
228
+ extends
229
+ /** @vue-ignore */
230
+ Partial<Omit<ButtonHTMLAttributes,"class" | "color" | "disabled">
231
+ & TailwindClassProp
232
+ & {
233
+ // why is this not already a part of button?
234
+ "aria-label": string
235
+ }>,
236
+ RealProps {}
223
237
  </script>
@@ -0,0 +1,14 @@
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;
@@ -0,0 +1,29 @@
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
+ };