@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
package/README.md CHANGED
@@ -79,11 +79,11 @@ Most slots where possible are passed all properties needed to replace them excep
79
79
  ```ts
80
80
  import { defineConfig } from "vite"
81
81
 
82
- import { WitchcraftUiResolver } from "@witchcraft/ui/build/WitchcraftUiResolver.js"
82
+ import { WitchcraftUiResolver } from "@witchcraft/ui/build/WitchcraftUiResolver"
83
83
  import IconsResolver from "unplugin-icons/resolver"
84
84
  import Icons from "unplugin-icons/vite"
85
85
  import Components from "unplugin-vue-components/vite"
86
- import { unpluginIconViteOptions } from "@witchcraft/ui/build/unpluginIconViteOptions.js"
86
+ import { unpluginIconViteOptions } from "@witchcraft/ui/build/unpluginIconViteOptions"
87
87
 
88
88
  export default defineConfig({
89
89
  plugins: [
@@ -206,12 +206,9 @@ interface Props
206
206
  </script>
207
207
 
208
208
  <script lang="ts" setup>
209
- // eslint-disable-next-line no-duplicate-imports
210
- import { baseInteractivePropsDefaults } from "../shared/props.js"
211
-
212
209
  const props = withDefaults(defineProps<Props>(), {
213
210
  id: "",
214
- ...baseInteractivePropsDefaults
211
+ unstyle: false, disabled:false, readonly:false, border:true,
215
212
  })
216
213
  const $attrs = useAttrs()
217
214
  </script>
package/dist/module.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "witchcraftUi",
3
3
  "configKey": "witchcraftUi",
4
- "version": "0.1.3",
4
+ "version": "0.2.1-beta.1",
5
5
  "builder": {
6
- "@nuxt/module-builder": "0.8.4",
7
- "unbuild": "3.6.0"
6
+ "@nuxt/module-builder": "1.0.2",
7
+ "unbuild": "3.6.1"
8
8
  }
9
9
  }
package/dist/module.mjs CHANGED
@@ -1,8 +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 { addImportsCustom } from '@witchcraft/nuxt-utils/utils/addImportsCustom.js';
5
- import { globFiles } from '@witchcraft/nuxt-utils/utils/globFiles.js';
4
+ import { addImportsCustom } from '@witchcraft/nuxt-utils/utils/addImportsCustom';
5
+ import { globFiles } from '@witchcraft/nuxt-utils/utils/globFiles';
6
6
  import { defu } from 'defu';
7
7
  import fs from 'fs';
8
8
  import { themeAsTailwindCss } from 'metamorphosis/tailwind';
@@ -100,16 +100,19 @@ const module = defineNuxtModule({
100
100
  logger.info(`Adding unplugin-icons`);
101
101
  config.plugins ??= [];
102
102
  config.plugins = [
103
- // we must prepend or the custom style options don't work when the module is used
104
- ViteComponents({
105
- resolvers: [
106
- IconsResolver()
107
- // we don't need our resolver since we use nuxt instead
108
- ]
109
- }),
110
- Icons({
111
- ...unpluginIconViteOptions
112
- }),
103
+ ...options.includeUnpluginIconsPlugins ? [
104
+ // we must prepend or the custom style options don't work when the module is used
105
+ ViteComponents({
106
+ resolvers: [
107
+ IconsResolver({ prefix: "i" })
108
+ // we don't need our resolver since we use nuxt instead
109
+ ]
110
+ }),
111
+ Icons({
112
+ compiler: "vue3",
113
+ ...unpluginIconViteOptions
114
+ })
115
+ ] : [],
113
116
  tailwindcss(),
114
117
  ...config.plugins
115
118
  ];
@@ -1,4 +1,4 @@
1
- import { themeAsTailwindCss } from "metamorphosis/tailwind.js";
1
+ import { themeAsTailwindCss } from "metamorphosis/tailwind";
2
2
  import fs from "node:fs";
3
3
  import { resolve } from "path";
4
4
  import { themeConvertionOpts } from "../tailwind/themeConvertionOpts.js";
@@ -2,15 +2,11 @@
2
2
  <div tabindex="0">{{ value }}</div>
3
3
  </template>
4
4
 
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
- }>()
5
+ <script setup>
6
+ defineOptions({ name: "aria" });
7
+ defineProps({
8
+ value: { type: String, required: true }
9
+ });
14
10
  </script>
15
11
 
16
12
  <style scoped>
@@ -0,0 +1,5 @@
1
+ type __VLS_Props = {
2
+ value: string;
3
+ };
4
+ declare const _default: import("vue").DefineComponent<__VLS_Props, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
5
+ export default _default;
@@ -1,43 +1,23 @@
1
1
  <template>
2
2
  <div
3
3
  :class="twMerge('icon inline-block', $attrs?.class)"
4
- v-bind="{...$attrs, class:undefined}"
4
+ v-bind="{ ...$attrs, class: void 0 }"
5
5
  >
6
6
  <slot/>
7
7
  </div>
8
8
  </template>
9
9
 
10
- <script setup lang="ts">
11
- import { computed, type HTMLAttributes,useAttrs } from "vue"
12
-
13
- import { twMerge } from "../../utils/twMerge.js"
14
-
10
+ <script setup>
11
+ import { computed, useAttrs } from "vue";
12
+ import { twMerge } from "../../utils/twMerge.js";
15
13
  defineOptions({
16
- name: "icon",
17
- inheritAttrs: false,
18
- })
19
-
20
-
21
- const $attrs = useAttrs() as any
22
-
23
- const props = defineProps<Props>()
24
-
25
-
14
+ name: "icon",
15
+ inheritAttrs: false
16
+ });
17
+ const $attrs = useAttrs();
18
+ const props = defineProps({});
26
19
  </script>
27
20
 
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
- */
21
+ <script>
36
22
 
37
- interface Props
38
- extends
39
- /** @vue-ignore */
40
- Partial<Omit<HTMLAttributes, "class">
41
- > { }
42
23
  </script>
43
-
@@ -0,0 +1,21 @@
1
+ import { type HTMLAttributes } from "vue";
2
+ /**
3
+ * 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.
4
+ *
5
+ * ```vue
6
+ * <icon><i-...></icon>
7
+ * ``
8
+ */
9
+ interface Props extends
10
+ /** @vue-ignore */
11
+ Partial<Omit<HTMLAttributes, "class">> {
12
+ }
13
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
14
+ default?: (props: {}) => any;
15
+ }>;
16
+ export default _default;
17
+ type __VLS_WithSlots<T, S> = T & {
18
+ new (): {
19
+ $slots: S;
20
+ };
21
+ };
@@ -1,7 +1,8 @@
1
1
  <template>
2
2
  <button
3
3
  :id="id ?? fallbackId"
4
- :class="!($attrs as any).unstyle && twMerge(`
4
+ :class="!$attrs.unstyle && twMerge(
5
+ `
5
6
  button
6
7
  flex
7
8
  cursor-pointer
@@ -22,8 +23,8 @@
22
23
  dark:disabled:text-neutral-500
23
24
  dark:disabled:hover:text-neutral-500
24
25
  `,
25
- !color && `active:text-neutral-800` /* todo for colors */,
26
- border && `
26
+ !color && `active:text-neutral-800`,
27
+ border && `
27
28
  transition-all
28
29
  bg-neutral-100
29
30
  dark:bg-neutral-900
@@ -60,37 +61,37 @@
60
61
  dark:disabled:border-neutral-800
61
62
  dark:disabled:bg-neutral-900
62
63
  `,
63
- border && ( !color || color === `secondary` ) && `
64
+ border && (!color || color === `secondary`) && `
64
65
  after:shadow-bg/90
65
66
  hover:after:shadow-bg
66
67
  dark:after:shadow-bg/20
67
68
  dark:hover:after:shadow-bg/90
68
69
  `,
69
- !border && color === `primary` && `
70
+ !border && color === `primary` && `
70
71
  font-bold
71
72
  hover:text-accent-50
72
73
  `,
73
- !border && color === `ok` && `
74
+ !border && color === `ok` && `
74
75
  text-ok-600 hover:text-ok-500
75
76
  dark:text-ok-600 dark:hover:text-ok-500
76
77
  `,
77
- !border && color === `warning` && `
78
+ !border && color === `warning` && `
78
79
  text-warning-500 hover:text-warning-300
79
80
  dark:text-warning-600 dark:hover:text-warning-400
80
81
  `,
81
- !border && color === `danger` && `
82
+ !border && color === `danger` && `
82
83
  text-danger-500 hover:text-danger-300
83
84
  dark:text-danger-600 dark:hover:text-danger-400
84
85
  `,
85
- !border && color === `secondary` && `
86
+ !border && color === `secondary` && `
86
87
  text-accent-700 hover:text-accent-500
87
88
  dark:text-accent-600 dark:hover:text-accent-400
88
89
  `,
89
- !border && color === `primary` && `
90
+ !border && color === `primary` && `
90
91
  text-accent-700 hover:text-accent-500
91
92
  dark:text-accent-600 dark:hover:text-accent-400
92
93
  `,
93
- border && color === `ok` && `
94
+ border && color === `ok` && `
94
95
  text-ok-950
95
96
  hover:text-ok-800
96
97
  bg-ok-400
@@ -105,7 +106,7 @@
105
106
  dark:hover:border-ok-900
106
107
  dark:hover:shadow-ok-900/30
107
108
  `,
108
- border && color === `warning` && `
109
+ border && color === `warning` && `
109
110
  text-warning-950
110
111
  hover:text-warning-900
111
112
  bg-warning-300
@@ -119,7 +120,7 @@
119
120
  dark:border-warning-700
120
121
  dark:hover:shadow-warning-900/25
121
122
  `,
122
- border && color === `danger` && `
123
+ border && color === `danger` && `
123
124
  text-danger-950
124
125
  hover:text-danger-900
125
126
  bg-danger-400
@@ -133,11 +134,11 @@
133
134
  dark:border-danger-950
134
135
  dark:hover:shadow-ranger-500/10
135
136
  `,
136
- border && color === `secondary` && `
137
+ border && color === `secondary` && `
137
138
  text-accent-800
138
139
  dark:text-accent-400
139
140
  `,
140
- border && color === `primary` && `
141
+ border && color === `primary` && `
141
142
  text-bg
142
143
  hover:text-bg
143
144
  bg-accent-600
@@ -152,28 +153,28 @@
152
153
  dark:hover:border-accent-700
153
154
  dark:hover:shadow-accent-900/50
154
155
  `,
155
- ($attrs as any)?.class
156
- )"
157
- :type="$attrs.type as any"
156
+ $attrs?.class
157
+ )"
158
+ :type="$attrs.type"
158
159
  :tabindex="0"
159
160
  :disabled="disabled"
160
161
  :data-border="border"
161
162
  :data-color="color"
162
163
  :aria-disabled="disabled"
163
164
  v-bind="{
164
- ...autoTitle,
165
- ...$attrs,
166
- class: undefined,
167
- ...ariaLabel,
168
- }"
165
+ ...autoTitle,
166
+ ...$attrs,
167
+ class: void 0,
168
+ ...ariaLabel
169
+ }"
169
170
  >
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'}">
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' }">
171
172
  <label :id="`label-${id ?? fallbackId}`" class="button--label pointer-events-none flex flex-1 items-center justify-center gap-1">
172
173
  <slot name="icon"/>
173
174
  <slot
174
- v-bind="{ label}"
175
+ v-bind="{ label }"
175
176
  >
176
- <span v-if="label && !isBlank(label!)">
177
+ <span v-if="label && !isBlank(label)">
177
178
  {{ label }}
178
179
  </span>
179
180
  </slot>
@@ -183,55 +184,33 @@
183
184
  </button>
184
185
  </template>
185
186
 
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
-
187
+ <script setup>
188
+ import { isBlank } from "@alanscodelog/utils/isBlank";
189
+ import { computed, useAttrs } from "vue";
190
+ import { useAriaLabel } from "../../composables/useAriaLabel.js";
191
+ import { twMerge } from "../../utils/twMerge.js";
192
+ import { getFallbackId } from "../shared/props.js";
193
+ const $attrs = useAttrs();
198
194
  defineOptions({
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)
195
+ name: "lib-button"
196
+ });
197
+ const fallbackId = getFallbackId();
198
+ const props = defineProps({
199
+ id: { type: String, required: false },
200
+ label: { type: String, required: false, default: "" },
201
+ disabled: { type: Boolean, required: false, default: false },
202
+ readonly: { type: Boolean, required: false, default: false },
203
+ border: { type: Boolean, required: false, default: true },
204
+ unstyle: { type: Boolean, required: false, default: false },
205
+ color: { type: [String, Boolean], required: false, default: false },
206
+ autoTitleFromAria: { type: Boolean, required: false }
207
+ });
208
+ const ariaLabel = useAriaLabel(props, fallbackId);
212
209
  const autoTitle = computed(() => ({
213
- title: props.autoTitleFromAria
214
- ? ($attrs["aria-label"] ?? props.label) as string
215
- : undefined,
216
- }))
217
-
210
+ title: props.autoTitleFromAria ? $attrs["aria-label"] ?? props.label : void 0
211
+ }));
218
212
  </script>
219
213
 
220
- <script lang="ts">
221
- type RealProps =
222
- & LinkableByIdProps
223
- & LabelProps
224
- & BaseInteractiveProps
225
- & ButtonProps
214
+ <script>
226
215
 
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 {}
237
216
  </script>
@@ -0,0 +1,36 @@
1
+ import { type ButtonHTMLAttributes } from "vue";
2
+ import { type BaseInteractiveProps, type ButtonProps, type LabelProps, type LinkableByIdProps, type TailwindClassProp } from "../shared/props.js.js";
3
+ type RealProps = LinkableByIdProps & LabelProps & BaseInteractiveProps & ButtonProps;
4
+ interface Props extends
5
+ /** @vue-ignore */
6
+ Partial<Omit<ButtonHTMLAttributes, "class" | "color" | "disabled"> & TailwindClassProp & {
7
+ "aria-label": string;
8
+ }>, RealProps {
9
+ }
10
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
11
+ color: "warning" | "ok" | "danger" | "primary" | "secondary" | false;
12
+ label: string;
13
+ disabled: boolean;
14
+ readonly: boolean;
15
+ border: boolean;
16
+ unstyle: boolean;
17
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
18
+ label?: (props: {
19
+ id: string;
20
+ classes: string;
21
+ }) => any;
22
+ } & {
23
+ icon?: (props: {}) => any;
24
+ } & {
25
+ default?: (props: {
26
+ label: any;
27
+ }) => any;
28
+ } & {
29
+ 'icon-after'?: (props: {}) => any;
30
+ }>;
31
+ export default _default;
32
+ type __VLS_WithSlots<T, S> = T & {
33
+ new (): {
34
+ $slots: S;
35
+ };
36
+ };
@@ -1,32 +1,35 @@
1
1
  <template>
2
2
  <div
3
- :class="twMerge(`
3
+ :class="twMerge(
4
+ `
4
5
  checkbox--wrapper
5
6
  flex
6
7
  items-center
7
8
  gap-1
8
9
  `,
9
- ($.wrapperAttrs as any)?.class
10
- )"
11
- v-bind="{ ...$.wrapperAttrs, class: undefined }"
10
+ $.wrapperAttrs?.class
11
+ )"
12
+ v-bind="{ ...$.wrapperAttrs, class: void 0 }"
12
13
  ref="el"
13
14
  >
14
15
  <slot name="left"/>
15
16
  <label
16
- :class="twMerge(`
17
+ :class="twMerge(
18
+ `
17
19
  checkbox--label
18
20
  flex
19
21
  items-center
20
22
  gap-1
21
23
  `,
22
- ($.labelAttrs as any)?.class
23
- )"
24
- v-bind="{ ...$.labelAttrs, class: undefined }"
24
+ $.labelAttrs?.class
25
+ )"
26
+ v-bind="{ ...$.labelAttrs, class: void 0 }"
25
27
  :for="id ?? fallbackId"
26
28
  >
27
29
  <input
28
30
  :id="id ?? fallbackId"
29
- :class="!($attrs as any).unstyle && twMerge(`
31
+ :class="!$attrs.unstyle && twMerge(
32
+ `
30
33
  checkbox
31
34
  focus-outline-no-offset
32
35
  m-0
@@ -53,83 +56,49 @@
53
56
  checked:after:bg-accent-700
54
57
  disabled:border-neutral-500
55
58
  disabled:checked:after:bg-neutral-700
56
- `, !disabled && `cursor-pointer`,
57
- ($.attrs as any).class
58
- )"
59
+ `,
60
+ !disabled && `cursor-pointer`,
61
+ $.attrs.class
62
+ )"
59
63
  type="checkbox"
60
64
  :disabled="disabled"
61
65
  ref="inputEl"
62
66
  v-model="$value"
63
- v-bind="{...$.attrs, class: undefined}"
67
+ v-bind="{ ...$.attrs, class: void 0 }"
64
68
  >
65
69
  <slot/> {{ label }}
66
70
  </label>
67
71
  </div>
68
72
  </template>
69
- <script setup lang="ts">
70
- import { keys } from "@alanscodelog/utils/keys.js"
71
- import { omit } from "@alanscodelog/utils/omit.js"
72
- import { pick } from "@alanscodelog/utils/pick.js"
73
- import type { MakeRequired } from "@alanscodelog/utils/types"
74
- import { computed, type HTMLAttributes, type InputHTMLAttributes,type PropType, ref, useAttrs, useSlots } from "vue"
75
-
76
- import { useDivideAttrs } from "../../composables/useDivideAttrs.js"
77
- import { usePreHydrationValue } from "../../composables/usePreHydrationValue.js"
78
- import { twMerge } from "../../utils/twMerge.js"
79
- import { type BaseInteractiveProps, baseInteractivePropsDefaults, getFallbackId,type LabelProps, type LinkableByIdProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js"
80
73
 
74
+ <script setup>
75
+ import { ref, useSlots } from "vue";
76
+ import { useDivideAttrs } from "../../composables/useDivideAttrs.js";
77
+ import { usePreHydrationValue } from "../../composables/usePreHydrationValue.js";
78
+ import { twMerge } from "../../utils/twMerge.js";
79
+ import { getFallbackId } from "../shared/props.js";
81
80
  defineOptions({
82
- name: "lib-checkbox",
83
- inheritAttrs: false,
84
- })
85
-
86
- const $ = useDivideAttrs(["label", "wrapper"])
87
- const $slots = useSlots()
88
- /* todo multi states */
89
-
90
- const fallbackId = getFallbackId()
91
- const props = withDefaults(defineProps<Props>(), {
92
- ...baseInteractivePropsDefaults,
93
- })
94
-
95
-
96
- const emits = defineEmits<{
97
- /* User presses enter.*/
98
- (e: "submit", val: boolean): void
99
- }>()
100
-
101
- const el = ref<null | HTMLElement>(null)
102
- const inputEl = ref<null | HTMLElement>(null)
103
- const $value = defineModel<boolean>("modelValue", { default: false })
104
-
105
- usePreHydrationValue(props.id ?? fallbackId, $value)
81
+ name: "lib-checkbox",
82
+ inheritAttrs: false
83
+ });
84
+ const $ = useDivideAttrs(["label", "wrapper"]);
85
+ const $slots = useSlots();
86
+ const fallbackId = getFallbackId();
87
+ const props = defineProps({
88
+ id: { type: String, required: false },
89
+ label: { type: String, required: false },
90
+ disabled: { type: Boolean, required: false, default: false },
91
+ readonly: { type: Boolean, required: false, default: false },
92
+ border: { type: Boolean, required: false, default: true },
93
+ unstyle: { type: Boolean, required: false, default: false }
94
+ });
95
+ const emits = defineEmits(["submit"]);
96
+ const el = ref(null);
97
+ const inputEl = ref(null);
98
+ const $value = defineModel("modelValue", { type: Boolean, ...{ default: false } });
99
+ usePreHydrationValue(props.id ?? fallbackId, $value);
106
100
  </script>
107
101
 
108
- <script lang="ts">
109
-
110
- type WrapperTypes = Partial<WrapperProps<"label",HTMLAttributes, {
111
- /** Tailwind classes. */
112
- class?: string
113
- }>>
114
-
115
- type RealProps =
116
-
117
- & LinkableByIdProps
118
- & LabelProps
119
- & BaseInteractiveProps
120
- & {
121
- unstyle?: boolean
122
- }
102
+ <script>
123
103
 
124
- interface Props
125
- extends
126
- /** @vue-ignore */
127
- Partial<Omit<
128
- InputHTMLAttributes,
129
- "class" | "readonly" | "disabled" | "onSumbit"
130
- > & TailwindClassProp>,
131
- /** @vue-ignore */
132
- WrapperTypes,
133
- RealProps
134
- {}
135
104
  </script>
@@ -0,0 +1,42 @@
1
+ import { type HTMLAttributes, type InputHTMLAttributes } from "vue";
2
+ import { type BaseInteractiveProps, type LabelProps, type LinkableByIdProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js.js";
3
+ type WrapperTypes = Partial<WrapperProps<"label", HTMLAttributes, {
4
+ /** Tailwind classes. */
5
+ class?: string;
6
+ }>>;
7
+ type RealProps = LinkableByIdProps & LabelProps & BaseInteractiveProps & {
8
+ unstyle?: boolean;
9
+ };
10
+ interface Props extends
11
+ /** @vue-ignore */
12
+ Partial<Omit<InputHTMLAttributes, "class" | "readonly" | "disabled" | "onSumbit"> & TailwindClassProp>,
13
+ /** @vue-ignore */
14
+ WrapperTypes, RealProps {
15
+ }
16
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props & {
17
+ modelValue?: boolean;
18
+ }, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
19
+ "update:modelValue": (value: boolean) => any;
20
+ } & {
21
+ submit: (val: boolean) => any;
22
+ }, string, import("vue").PublicProps, Readonly<Props & {
23
+ modelValue?: boolean;
24
+ }> & Readonly<{
25
+ onSubmit?: ((val: boolean) => any) | undefined;
26
+ "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
27
+ }>, {
28
+ disabled: boolean;
29
+ readonly: boolean;
30
+ border: boolean;
31
+ unstyle: boolean;
32
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
33
+ left?: (props: {}) => any;
34
+ } & {
35
+ default?: (props: {}) => any;
36
+ }>;
37
+ export default _default;
38
+ type __VLS_WithSlots<T, S> = T & {
39
+ new (): {
40
+ $slots: S;
41
+ };
42
+ };