@witchcraft/ui 0.0.1 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (224) hide show
  1. package/README.md +18 -28
  2. package/dist/module.d.mts +3 -1
  3. package/dist/module.json +3 -3
  4. package/dist/module.mjs +21 -12
  5. package/dist/runtime/assets/base.css +1 -1
  6. package/dist/runtime/assets/locales/en.json +2 -2
  7. package/dist/runtime/assets/tailwind.css +1 -1
  8. package/dist/runtime/assets/utils.css +1 -0
  9. package/dist/runtime/build/WitchcraftUiResolver.js +1 -1
  10. package/dist/runtime/components/Aria/Aria.vue +5 -9
  11. package/dist/runtime/components/Aria/Aria.vue.d.ts +5 -0
  12. package/dist/runtime/components/Icon/Icon.vue +12 -28
  13. package/dist/runtime/components/Icon/Icon.vue.d.ts +21 -0
  14. package/dist/runtime/components/LibButton/LibButton.vue +93 -117
  15. package/dist/runtime/components/LibButton/LibButton.vue.d.ts +36 -0
  16. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +53 -76
  17. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +42 -0
  18. package/dist/runtime/components/LibColorInput/LibColorInput.vue +131 -101
  19. package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +63 -0
  20. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue +326 -296
  21. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue.d.ts +61 -0
  22. package/dist/runtime/components/LibColorPicker/utils/safeConvertToHsva.d.ts +2 -0
  23. package/dist/runtime/components/LibColorPicker/utils/safeConvertToHsva.js +18 -0
  24. package/dist/runtime/components/LibColorPicker/utils/safeConvertToRgba.d.ts +2 -0
  25. package/dist/runtime/components/LibColorPicker/utils/safeConvertToRgba.js +17 -0
  26. package/dist/runtime/components/LibColorPicker/utils/toLowPrecisionRgbaString.d.ts +2 -0
  27. package/dist/runtime/components/LibColorPicker/utils/toLowPrecisionRgbaString.js +8 -0
  28. package/dist/runtime/components/LibColorPicker/utils/truncate.d.ts +1 -0
  29. package/dist/runtime/components/LibColorPicker/utils/truncate.js +5 -0
  30. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +42 -64
  31. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts +22 -0
  32. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue +20 -54
  33. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +40 -0
  34. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue +205 -173
  35. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue.d.ts +34 -0
  36. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue +215 -164
  37. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue.d.ts +34 -0
  38. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue +9 -10
  39. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue.d.ts +22 -0
  40. package/dist/runtime/components/LibDebug/LibDebug.vue +47 -65
  41. package/dist/runtime/components/LibDebug/LibDebug.vue.d.ts +32 -0
  42. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue +19 -34
  43. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue.d.ts +22 -0
  44. package/dist/runtime/components/LibFileInput/LibFileInput.vue +155 -173
  45. package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +43 -0
  46. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +352 -0
  47. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +165 -0
  48. package/dist/runtime/components/LibLabel/LibLabel.vue +30 -46
  49. package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +27 -0
  50. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +50 -66
  51. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue.d.ts +29 -0
  52. package/dist/runtime/components/LibNotifications/LibNotification.vue +48 -56
  53. package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +17 -0
  54. package/dist/runtime/components/LibNotifications/LibNotifications.vue +71 -83
  55. package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +13 -0
  56. package/dist/runtime/components/LibPagination/LibPagination.vue +86 -131
  57. package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +104 -0
  58. package/dist/runtime/components/LibPalette/LibPalette.vue +23 -26
  59. package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +14 -0
  60. package/dist/runtime/components/LibPopup/LibPopup.vue +326 -400
  61. package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +46 -0
  62. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +73 -93
  63. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue.d.ts +41 -0
  64. package/dist/runtime/components/LibRecorder/LibRecorder.vue +134 -179
  65. package/dist/runtime/components/LibRecorder/LibRecorder.vue.d.ts +77 -0
  66. package/dist/runtime/components/LibRoot/LibRoot.vue +75 -89
  67. package/dist/runtime/components/LibRoot/LibRoot.vue.d.ts +41 -0
  68. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue +51 -82
  69. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue.d.ts +35 -0
  70. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +147 -164
  71. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +94 -0
  72. package/dist/runtime/components/LibTable/LibTable.vue +69 -106
  73. package/dist/runtime/components/LibTable/LibTable.vue.d.ts +45 -0
  74. package/dist/runtime/components/Template/NAME.vue +15 -36
  75. package/dist/runtime/components/Template/NAME.vue.d.ts +17 -0
  76. package/dist/runtime/components/TestControls/TestControls.vue +7 -10
  77. package/dist/runtime/components/TestControls/TestControls.vue.d.ts +5 -0
  78. package/dist/runtime/components/index.d.ts +12 -11
  79. package/dist/runtime/components/index.js +12 -11
  80. package/dist/runtime/components/shared/props.d.ts +81 -16
  81. package/dist/runtime/components/shared/storyHelpers/playInput.js +5 -5
  82. package/dist/runtime/components/shared/storyHelpers/playSuggestions.js +15 -11
  83. package/dist/runtime/composables/index.d.ts +5 -0
  84. package/dist/runtime/composables/index.js +5 -0
  85. package/dist/runtime/composables/useDivideAttrs.js +1 -0
  86. package/dist/runtime/composables/useDragWithThreshold.d.ts +71 -0
  87. package/dist/runtime/composables/useDragWithThreshold.js +40 -0
  88. package/dist/runtime/composables/usePreHydrationValue.d.ts +12 -0
  89. package/dist/runtime/composables/usePreHydrationValue.js +15 -0
  90. package/dist/runtime/composables/useSetupI18n.d.ts +2 -0
  91. package/dist/runtime/composables/useSetupI18n.js +5 -1
  92. package/dist/runtime/composables/useSuggestions.d.ts +7 -5
  93. package/dist/runtime/composables/useSuggestions.js +94 -57
  94. package/dist/runtime/directives/vResizableCols.js +92 -84
  95. package/dist/runtime/helpers/NotificationHandler.d.ts +5 -0
  96. package/dist/runtime/helpers/index.d.ts +3 -1
  97. package/dist/runtime/helpers/index.js +3 -1
  98. package/dist/runtime/types/index.d.ts +6 -0
  99. package/dist/runtime/utils/notifyIfError.d.ts +14 -0
  100. package/dist/runtime/utils/notifyIfError.js +29 -0
  101. package/dist/types.d.mts +2 -6
  102. package/package.json +27 -29
  103. package/src/module.ts +31 -12
  104. package/src/runtime/assets/base.css +10 -1
  105. package/src/runtime/assets/locales/en.json +2 -2
  106. package/src/runtime/assets/tailwind.css +1 -1
  107. package/src/runtime/assets/{style.css → utils.css} +86 -4
  108. package/src/runtime/build/WitchcraftUiResolver.ts +1 -1
  109. package/src/runtime/components/Focus.stories.ts +3 -2
  110. package/src/runtime/components/Icon/Icon.vue +10 -6
  111. package/src/runtime/components/LibButton/LibButton.vue +41 -47
  112. package/src/runtime/components/LibCheckbox/LibCheckbox.vue +7 -4
  113. package/src/runtime/components/LibColorInput/LibColorInput.vue +111 -37
  114. package/src/runtime/components/LibColorPicker/LibColorPicker.stories.ts +25 -4
  115. package/src/runtime/components/LibColorPicker/LibColorPicker.vue +242 -131
  116. package/src/runtime/components/LibColorPicker/utils/safeConvertToHsva.ts +24 -0
  117. package/src/runtime/components/LibColorPicker/utils/safeConvertToRgba.ts +23 -0
  118. package/src/runtime/components/LibColorPicker/utils/toLowPrecisionRgbaString.ts +13 -0
  119. package/src/runtime/components/LibColorPicker/utils/truncate.ts +6 -0
  120. package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.ts +1 -1
  121. package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +11 -9
  122. package/src/runtime/components/LibDatePicker/LibDatePicker.vue +4 -17
  123. package/src/runtime/components/LibDatePicker/LibRangeDatePicker.vue +192 -131
  124. package/src/runtime/components/LibDatePicker/LibSingleDatePicker.vue +183 -115
  125. package/src/runtime/components/LibDatePicker/LibTimeZonePicker.vue +3 -3
  126. package/src/runtime/components/LibDebug/LibDebug.vue +15 -5
  127. package/src/runtime/components/LibDevOnly/LibDevOnly.vue +1 -3
  128. package/src/runtime/components/LibFileInput/LibFileInput.vue +54 -29
  129. package/src/runtime/components/{LibInput/LibInput.stories.ts → LibInputDeprecated/LibInputDeprecated.stories.ts} +64 -19
  130. package/{dist/runtime/components/LibInput/LibInput.vue → src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue} +40 -34
  131. package/src/runtime/components/LibLabel/LibLabel.vue +2 -2
  132. package/src/runtime/components/LibMultiValues/LibMultiValues.stories.ts +5 -4
  133. package/src/runtime/components/LibMultiValues/LibMultiValues.vue +11 -13
  134. package/src/runtime/components/LibNotifications/LibNotification.vue +19 -11
  135. package/src/runtime/components/LibNotifications/LibNotifications.stories.ts +2 -2
  136. package/src/runtime/components/LibNotifications/LibNotifications.vue +20 -12
  137. package/src/runtime/components/LibPagination/LibPagination.stories.ts +2 -2
  138. package/src/runtime/components/LibPagination/LibPagination.vue +19 -20
  139. package/src/runtime/components/LibPalette/LibPalette.vue +3 -3
  140. package/src/runtime/components/LibPopup/LibPopup.stories.ts +2 -2
  141. package/src/runtime/components/LibPopup/LibPopup.vue +30 -67
  142. package/src/runtime/components/LibProgressBar/LibProgressBar.vue +3 -2
  143. package/src/runtime/components/LibRecorder/LibRecorder.vue +2 -3
  144. package/src/runtime/components/LibRoot/LibRoot.vue +14 -1
  145. package/src/runtime/components/LibSimpleInput/LibSimpleInput.stories.ts +1 -1
  146. package/src/runtime/components/LibSimpleInput/LibSimpleInput.vue +5 -8
  147. package/src/runtime/components/LibSuggestions/LibSuggestions.vue +42 -26
  148. package/src/runtime/components/LibTable/LibTable.vue +8 -9
  149. package/src/runtime/components/Scrolling.stories.ts +58 -0
  150. package/src/runtime/components/Template/NAME.vue +1 -1
  151. package/src/runtime/components/TestControls/TestControls.vue +1 -1
  152. package/src/runtime/components/index.ts +12 -12
  153. package/src/runtime/components/shared/props.ts +82 -19
  154. package/src/runtime/components/shared/storyHelpers/playInput.ts +6 -5
  155. package/src/runtime/components/shared/storyHelpers/playSuggestions.ts +25 -11
  156. package/src/runtime/composables/index.ts +5 -0
  157. package/src/runtime/composables/useDarkMode.ts +2 -2
  158. package/src/runtime/composables/useDivideAttrs.ts +1 -0
  159. package/src/runtime/composables/useDragWithThreshold.ts +108 -0
  160. package/src/runtime/composables/usePreHydrationValue.ts +30 -0
  161. package/src/runtime/composables/useSetupI18n.ts +8 -2
  162. package/src/runtime/composables/useSuggestions.ts +92 -45
  163. package/src/runtime/directives/vResizableCols.ts +82 -74
  164. package/src/runtime/helpers/NotificationHandler.ts +5 -0
  165. package/src/runtime/helpers/index.ts +3 -1
  166. package/src/runtime/types/index.ts +5 -0
  167. package/src/runtime/utils/notifyIfError.ts +45 -0
  168. package/dist/module.cjs +0 -5
  169. package/dist/module.d.ts +0 -34
  170. package/dist/runtime/assets/style.css +0 -1
  171. package/dist/runtime/components/Focus.stories.d.ts +0 -11
  172. package/dist/runtime/components/Focus.stories.js +0 -53
  173. package/dist/runtime/components/LibButton/LibButton.stories.d.ts +0 -12
  174. package/dist/runtime/components/LibButton/LibButton.stories.js +0 -94
  175. package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.d.ts +0 -14
  176. package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.js +0 -29
  177. package/dist/runtime/components/LibColorInput/LibColorInput.stories.d.ts +0 -7
  178. package/dist/runtime/components/LibColorInput/LibColorInput.stories.js +0 -58
  179. package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.d.ts +0 -7
  180. package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.js +0 -51
  181. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.d.ts +0 -7
  182. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.js +0 -36
  183. package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.d.ts +0 -11
  184. package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.js +0 -98
  185. package/dist/runtime/components/LibDebug/LibDebug.stories.d.ts +0 -9
  186. package/dist/runtime/components/LibDebug/LibDebug.stories.js +0 -46
  187. package/dist/runtime/components/LibFileInput/LibFileInput.stories.d.ts +0 -10
  188. package/dist/runtime/components/LibFileInput/LibFileInput.stories.js +0 -63
  189. package/dist/runtime/components/LibInput/LibInput.stories.d.ts +0 -33
  190. package/dist/runtime/components/LibInput/LibInput.stories.js +0 -339
  191. package/dist/runtime/components/LibLabel/LibLabel.stories.d.ts +0 -6
  192. package/dist/runtime/components/LibLabel/LibLabel.stories.js +0 -25
  193. package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.d.ts +0 -23
  194. package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.js +0 -60
  195. package/dist/runtime/components/LibNotifications/LibNotification.stories.d.ts +0 -15
  196. package/dist/runtime/components/LibNotifications/LibNotification.stories.js +0 -126
  197. package/dist/runtime/components/LibNotifications/LibNotifications.stories.d.ts +0 -6
  198. package/dist/runtime/components/LibNotifications/LibNotifications.stories.js +0 -109
  199. package/dist/runtime/components/LibPagination/LibPagination.stories.d.ts +0 -6
  200. package/dist/runtime/components/LibPagination/LibPagination.stories.js +0 -40
  201. package/dist/runtime/components/LibPalette/LibPalette.stories.d.ts +0 -6
  202. package/dist/runtime/components/LibPalette/LibPalette.stories.js +0 -20
  203. package/dist/runtime/components/LibPopup/LibPopup.stories.d.ts +0 -14
  204. package/dist/runtime/components/LibPopup/LibPopup.stories.js +0 -147
  205. package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.d.ts +0 -10
  206. package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.js +0 -81
  207. package/dist/runtime/components/LibRecorder/LibRecorder.stories.d.ts +0 -19
  208. package/dist/runtime/components/LibRecorder/LibRecorder.stories.js +0 -63
  209. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.d.ts +0 -26
  210. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.js +0 -78
  211. package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.d.ts +0 -27
  212. package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.js +0 -112
  213. package/dist/runtime/components/LibTable/LibTable.stories.d.ts +0 -16
  214. package/dist/runtime/components/LibTable/LibTable.stories.js +0 -156
  215. package/dist/runtime/components/reset.stories.d.ts +0 -5
  216. package/dist/runtime/components/reset.stories.js +0 -19
  217. package/dist/runtime/composables/useScrollNearContainerEdges.stories.d.ts +0 -7
  218. package/dist/runtime/composables/useScrollNearContainerEdges.stories.js +0 -85
  219. package/dist/runtime/helpers/addValue.d.ts +0 -1
  220. package/dist/runtime/helpers/addValue.js +0 -8
  221. package/dist/types.d.ts +0 -7
  222. package/src/runtime/components/LibInput/LibInput.vue +0 -372
  223. package/src/runtime/helpers/addValue.ts +0 -10
  224. /package/src/runtime/components/{reset.stories.ts → Reset.stories.ts} +0 -0
@@ -0,0 +1,94 @@
1
+ import { type HTMLAttributes } from "vue";
2
+ import { type BaseInteractiveProps, type LabelProps, type LinkableByIdProps, type SuggestionsEmits, type SuggestionsProps, type WrapperProps } from "../shared/props.js.js";
3
+ type WrapperTypes = Partial<WrapperProps<"item", HTMLAttributes, {
4
+ /** Tailwind classes. */
5
+ class?: string;
6
+ }>>;
7
+ type RealProps = LinkableByIdProps & LabelProps & BaseInteractiveProps & {
8
+ /** Return true to prevent the keydown event from being handled. */
9
+ filterKeydown?: (e: KeyboardEvent) => boolean;
10
+ /** Return true to prevent the blur event from being handled. */
11
+ filterBlur?: (e: MouseEvent) => boolean;
12
+ /** Return true to prevent the focus event from being handled. */
13
+ filterFocus?: (e: FocusEvent) => boolean;
14
+ };
15
+ interface Props extends
16
+ /** @vue-ignore */
17
+ Partial<Omit<HTMLAttributes, "class" | "onSubmit"> & {
18
+ /** Tailwind classes. */
19
+ class?: string;
20
+ }>,
21
+ /** @vue-ignore */
22
+ WrapperTypes, RealProps {
23
+ }
24
+ declare const _default: <TSuggestion extends string | object, TValue extends string | string[]>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
25
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
26
+ readonly onSubmit?: ((val: string, suggestion?: any, wasRemoved?: boolean | undefined) => any) | undefined;
27
+ readonly "onUpdate:isOpen"?: ((val: boolean) => any) | undefined;
28
+ readonly "onUpdate:activeSuggestion"?: ((val: number) => any) | undefined;
29
+ readonly "onUpdate:modelValue"?: ((value: TValue) => any) | undefined;
30
+ readonly "onUpdate:inputValue"?: ((value: string) => any) | undefined;
31
+ readonly "onUpdate:open"?: ((value: boolean) => any) | undefined;
32
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onSubmit" | "onUpdate:modelValue" | "onUpdate:open" | "onUpdate:isOpen" | "onUpdate:activeSuggestion" | "onUpdate:inputValue"> & (Props & SuggestionsProps<TSuggestion> & {
33
+ /**
34
+ * The final valid value. This is *not* the value you want to share with the input. If `restrictToSuggestions` is true this will not update on any invalid values that `inputValue` might be set to.
35
+ *
36
+ * If suggestions are objects, this will be the string returned by the `suggestionLabel` prop.
37
+ */
38
+ modelValue: TValue;
39
+ /**
40
+ * If the element is bound to an input, this is the value that the input should be sharing.
41
+ *
42
+ * It allows the component to read even invalid output, and also to reset that invalid output when either modelValue is set to a new value, or when the component is closed via cancel.
43
+ */
44
+ inputValue?: string;
45
+ open?: boolean;
46
+ }) & Partial<{}>> & import("vue").PublicProps;
47
+ expose(exposed: import("vue").ShallowUnwrapRef<{
48
+ suggestions: {
49
+ list: any[] | undefined;
50
+ filtered: any[] | undefined;
51
+ active: number;
52
+ available: boolean;
53
+ moreThanOneAvailable: boolean;
54
+ hasExactlyMatching: TSuggestion | undefined;
55
+ hasValidSuggestion: boolean;
56
+ openable: boolean | undefined;
57
+ getLabel: (item: any) => string;
58
+ $open: boolean;
59
+ open: () => void;
60
+ close: () => void;
61
+ enterSelected: (doClose?: boolean) => void;
62
+ enterIndex: (num: number, doClose?: boolean) => void;
63
+ toggle: () => void;
64
+ cancel: () => void;
65
+ select: (num: number) => void;
66
+ prev: () => void;
67
+ next: () => void;
68
+ first: () => void;
69
+ last: () => void;
70
+ };
71
+ el: import("vue").Ref<HTMLElement | null, HTMLElement | null>;
72
+ /** A simple keydown handler that can be passed to an input to control the component while still focused inside it. */
73
+ inputKeydownHandler: (e: KeyboardEvent) => void;
74
+ /** A blur handler for the input that controls the component. This also takes care of making clicking on a suggestion work, since otherwise if canOpen is set to false in the blur handler, no click event will fire. */
75
+ inputBlurHandler: (e: MouseEvent) => void;
76
+ /** A focus handler for the input that controls the component. */
77
+ inputFocusHandler: (e: FocusEvent) => void;
78
+ }>): void;
79
+ attrs: any;
80
+ slots: {
81
+ item?: (props: {
82
+ item: any;
83
+ index: any;
84
+ isSelected: any;
85
+ }) => any;
86
+ };
87
+ emit: SuggestionsEmits<false> & (((evt: "update:modelValue", value: TValue) => void) & ((evt: "update:inputValue", value: string) => void) & ((evt: "update:open", value: boolean) => void));
88
+ }>) => import("vue").VNode & {
89
+ __ctx?: Awaited<typeof __VLS_setup>;
90
+ };
91
+ export default _default;
92
+ type __VLS_PrettifyLocal<T> = {
93
+ [K in keyof T as K]: T[K];
94
+ } & {};
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <!-- Assumes no scrollbars on children -->
3
- <table :class="twMerge(`table
3
+ <table :class="twMerge(
4
+ `table
4
5
  table-fixed
5
6
  border-separate
6
7
  border-spacing-0
@@ -16,12 +17,12 @@
16
17
  [&.resizable-cols-error]:cursor-not-allowed
17
18
  [&.resizable-cols-error]:user-select-none
18
19
  `,
19
- cellBorder && `
20
+ cellBorder && `
20
21
  [&_td]:border-neutral-500
21
22
  [&_td:not(.last-row)]:border-b
22
23
  [&_td:not(.first-col)]:border-l
23
24
  `,
24
- border && `
25
+ border && `
25
26
  [&_thead_td]:bg-neutral-200
26
27
  [&_td]:border-neutral-500
27
28
  dark:[&_thead_td]:bg-neutral-800
@@ -31,55 +32,52 @@
31
32
  [&_td.last-col]:border-r
32
33
  [&_td.first-col]:border-l
33
34
  `,
34
- rounded &&`
35
+ rounded && `
35
36
  [&_td.br]:rounded-br-sm
36
37
  [&_td.bl]:rounded-bl-sm
37
38
  [&_td.tr]:rounded-tr-sm
38
39
  [&_td.tl]:rounded-tl-sm
39
- `
40
- , ($attrs as any).class)"
40
+ `,
41
+ $attrs.class
42
+ )"
41
43
  v-resizable-cols="resizableOptions"
42
44
  >
43
- <thead v-if="header">
44
- <tr>
45
+ <thead v-if="header" class="table--header">
46
+ <tr class="table--row">
45
47
  <template v-for="col,i of cols" :key="col">
46
48
  <slot :name="`header-${col.toString()}`"
47
49
  :class="[
48
- extraClasses[`-1-${i}`],
49
- 'cell',
50
- (colConfig as any)[col]?.resizable === false
51
- ? 'no-resize'
52
- : ''
53
- ].join(' ')"
50
+ extraClasses[`-1-${i}`],
51
+ 'cell table--header-cell',
52
+ colConfig[col]?.resizable === false ? 'no-resize' : ''
53
+ ].join(' ')"
54
54
  :style="`width:${widths.length > 0 ? widths[i] : ``}; `"
55
55
  :col-key="col"
56
56
  >
57
57
  <td :class="[
58
- extraClasses[`-1-${i}`] ,
59
- 'cell',
60
- (colConfig as any)[col]?.resizable === false
61
- ? 'no-resize'
62
- : ''
63
- ].join(' ')"
58
+ extraClasses[`-1-${i}`],
59
+ 'cell table--header-cell',
60
+ colConfig[col]?.resizable === false ? 'no-resize' : ''
61
+ ].join(' ')"
64
62
  :style="`width:${widths.length > 0 ? widths[i] : ``}; `"
65
63
  >
66
- {{ (colConfig as any)[col]?.name ?? col }}
64
+ {{ colConfig[col]?.name ?? col }}
67
65
  </td>
68
66
  </slot>
69
67
  </template>
70
68
  </tr>
71
69
  </thead>
72
- <tbody>
70
+ <tbody class="table--body">
73
71
  <template v-for="item, i of values" :key="typeof itemKey === 'function' ? itemKey(item) : item[itemKey]">
74
- <tr>
72
+ <tr class="table--row">
75
73
  <template v-for="col, j of cols" :key="(typeof itemKey === 'function' ? itemKey(item) : item[itemKey]) + col.toString()">
76
74
  <slot
77
75
  :name="col"
78
76
  :item="item"
79
77
  :value="item[col]"
80
- :class="extraClasses[`${i}-${j}`] + ' cell'"
78
+ :class="extraClasses[`${i}-${j}`] + 'table--cell cell'"
81
79
  >
82
- <td :class="extraClasses[`${i}-${j}`] + ' cell'">
80
+ <td :class="extraClasses[`${i}-${j}`] + 'table--cell cell'">
83
81
  {{ item[col] }}
84
82
  </td>
85
83
  </slot>
@@ -90,88 +88,53 @@
90
88
  </table>
91
89
  </template>
92
90
 
93
- <!-- generic="T extends Record<string, any> -->"
94
- <script setup lang="ts" generic="T">
95
- import type { MakeRequired } from "@alanscodelog/utils"
96
- import { keys } from "@alanscodelog/utils/keys.js"
97
- import { computed, type PropType, ref, type TableHTMLAttributes } from "vue"
98
-
99
- import { vResizableCols } from "../../directives/vResizableCols.js"
100
- import type { ResizableOptions, TableColConfig } from "../../types/index.js"
101
- import { twMerge } from "../../utils/twMerge.js"
102
- import type { TailwindClassProp } from "../shared/props.js"
103
-
104
-
91
+ <script setup>
92
+ import { keys } from "@alanscodelog/utils/keys.js";
93
+ import { computed, ref } from "vue";
94
+ import { vResizableCols } from "../../directives/vResizableCols.js";
95
+ import { twMerge } from "../../utils/twMerge.js";
105
96
  defineOptions({
106
- name: "lib-table",
107
- })
108
-
109
- // eslint-disable-next-line no-use-before-define
110
- const props = withDefaults(defineProps<Props>(), {
111
- resizable: () => ({}),
112
- values: () => [] as T[],
113
- itemKey: "",
114
- cols: () => [] as (keyof T)[],
115
- rounded: true,
116
- border: true,
117
- cellBorder: true,
118
- header: true,
119
- colConfig: () => ({}) ,
120
- })
121
-
122
- const widths = ref([])
123
- const resizableOptions = computed<MakeRequired<Partial<ResizableOptions>, "colCount" | "widths">>(() => ({
124
- colCount: props.cols.length,
125
- widths,
126
- selector: ".cell",
127
- ...props.resizable,
128
- }))
129
-
130
- /* props.values.length instead of `props.values.length - 1` because we're creating an artificial first row for the header */
131
- const getExtraClasses = (row: number, col: number, isHeader: boolean): string[] => {
132
- const res = {
133
- bl: !isHeader && row === props.values.length - 1 && col === 0,
134
- br: !isHeader && row === props.values.length - 1 && col === props.cols.length - 1,
135
- tr: (isHeader || !props.header) && row === 0 && col === props.cols.length - 1,
136
- tl: (isHeader || !props.header) && row === 0 && col === 0,
137
- "first-row": (isHeader || !props.header) && row === 0,
138
- "last-row": row === props.values.length - 1,
139
- "first-col": col === 0,
140
- "last-col": col === props.cols.length - 1,
141
- }
142
- return keys(res).filter(key => res[key])
143
- }
97
+ name: "lib-table"
98
+ });
99
+ const props = defineProps({
100
+ resizable: { type: Object, required: false, default: () => ({}) },
101
+ values: { type: Array, required: false, default: () => [] },
102
+ itemKey: { type: [String, Number, Symbol, Function], required: false, default: "" },
103
+ cols: { type: Array, required: false, default: () => [] },
104
+ rounded: { type: Boolean, required: false, default: true },
105
+ border: { type: Boolean, required: false, default: true },
106
+ cellBorder: { type: Boolean, required: false, default: true },
107
+ header: { type: Boolean, required: false, default: true },
108
+ colConfig: { type: null, required: false, default: () => ({}) }
109
+ });
110
+ const widths = ref([]);
111
+ const resizableOptions = computed(() => ({
112
+ colCount: props.cols.length,
113
+ widths,
114
+ selector: ".cell",
115
+ ...props.resizable
116
+ }));
117
+ const getExtraClasses = (row, col, isHeader) => {
118
+ const res = {
119
+ bl: !isHeader && row === props.values.length - 1 && col === 0,
120
+ br: !isHeader && row === props.values.length - 1 && col === props.cols.length - 1,
121
+ tr: (isHeader || !props.header) && row === 0 && col === props.cols.length - 1,
122
+ tl: (isHeader || !props.header) && row === 0 && col === 0,
123
+ "first-row": (isHeader || !props.header) && row === 0,
124
+ "last-row": row === props.values.length - 1,
125
+ "first-col": col === 0,
126
+ "last-col": col === props.cols.length - 1
127
+ };
128
+ return keys(res).filter((key) => res[key]);
129
+ };
130
+ const extraClasses = computed(() => Object.fromEntries(
131
+ [...Array(props.values.length + 1).keys()].map((row) => [...Array(props.cols.length).keys()].map((col) => [
132
+ `${row - 1}-${col}`,
133
+ getExtraClasses(row <= 0 ? 0 : row - 1, col, row === 0).join(" ")
134
+ ])).flat()
135
+ ));
136
+ </script>
144
137
 
145
- const extraClasses = computed(() => Object.fromEntries([...Array(props.values.length + 1).keys()]
146
- .map(row => [...Array(props.cols.length).keys()]
147
- .map(col =>
148
- [
149
- `${row - 1}-${col}`,
150
- getExtraClasses(row <= 0 ? 0 : row - 1, col, row === 0).join(" "),
151
- ]))
152
- .flat(),
153
- ))
138
+ <script>
154
139
 
155
140
  </script>
156
- <script lang="ts">
157
- // generic isn't working here :/
158
- type T = any
159
-
160
- type RealProps = {
161
- resizable?: Partial<ResizableOptions>
162
- values?: T[]
163
- itemKey?: keyof T | ((item: T) => string)
164
- /** Let's the table know the shape of the data since values might be empty. */
165
- cols?: (keyof T)[]
166
- rounded?: boolean
167
- border?: boolean
168
- cellBorder?: boolean
169
- header?: boolean
170
- colConfig?: TableColConfig<T>
171
- }
172
- interface Props
173
- extends
174
- /** @vue-ignore */
175
- Partial<Omit<TableHTMLAttributes,"class" | "readonly" | "disabled"> & TailwindClassProp>,
176
- RealProps { }
177
- </script>
@@ -0,0 +1,45 @@
1
+ import { type TableHTMLAttributes } from "vue";
2
+ import type { ResizableOptions, TableColConfig } from "../../types/index.js.js";
3
+ import type { TailwindClassProp } from "../shared/props.js.js";
4
+ type T = any;
5
+ type RealProps = {
6
+ resizable?: Partial<ResizableOptions>;
7
+ values?: T[];
8
+ itemKey?: keyof T | ((item: T) => string);
9
+ /** Let's the table know the shape of the data since values might be empty. */
10
+ cols?: (keyof T)[];
11
+ rounded?: boolean;
12
+ border?: boolean;
13
+ cellBorder?: boolean;
14
+ header?: boolean;
15
+ colConfig?: TableColConfig<T>;
16
+ };
17
+ interface Props extends
18
+ /** @vue-ignore */
19
+ Partial<Omit<TableHTMLAttributes, "class" | "readonly" | "disabled"> & TailwindClassProp>, RealProps {
20
+ }
21
+ declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
22
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & Props & Partial<{}>> & import("vue").PublicProps;
23
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
24
+ attrs: any;
25
+ slots: {
26
+ [x: string]: ((props: {
27
+ colKey: any;
28
+ style: string;
29
+ class: string;
30
+ }) => any) | undefined;
31
+ } & {
32
+ [x: string]: ((props: {
33
+ class: string;
34
+ item: any;
35
+ value: any;
36
+ }) => any) | undefined;
37
+ };
38
+ emit: {};
39
+ }>) => import("vue").VNode & {
40
+ __ctx?: Awaited<typeof __VLS_setup>;
41
+ };
42
+ export default _default;
43
+ type __VLS_PrettifyLocal<T> = {
44
+ [K in keyof T as K]: T[K];
45
+ } & {};
@@ -1,49 +1,28 @@
1
- <!-- eslint-disable -->
2
1
  <template>
3
2
  <div :class="twMerge(`
4
3
 
5
- `, ($attrs as any).class)"
6
- v-bind="{...$attrs, class:undefined}"
4
+ `, $attrs.class)"
5
+ v-bind="{ ...$attrs, class: void 0 }"
7
6
  >
8
7
  <slot/>
9
8
  </div>
10
9
  </template>
11
- <script setup lang="ts">
12
-
13
- import { computed, getCurrentInstance, type HTMLAttributes, onBeforeUnmount, onMounted, type PropType, reactive, type Ref, ref, watch } from "vue"
14
-
15
- import { twMerge } from "../../utils/twMerge.js"
16
- import { baseInteractiveProps, type TailwindClassProp } from "../shared/props.js"
17
-
18
10
 
11
+ <script setup>
12
+ import { computed, onBeforeUnmount, onMounted, reactive, ref, watch } from "vue";
13
+ import { twMerge } from "../../utils/twMerge.js";
14
+ import { baseInteractiveProps } from "../shared/props.js";
19
15
  defineOptions({
20
- name: "lib-name", /* todo */
21
- inheritAttrs: false,
22
- })
23
-
24
-
25
- // const props = defineProps<{}>({ })
26
-
27
- const el = ref<null | HTMLElement>(null)
28
-
29
- const modelValue = defineModel<string>({ required: true })
30
-
31
-
16
+ name: "lib-name",
17
+ /* todo */
18
+ inheritAttrs: false
19
+ });
20
+ const el = ref(null);
21
+ const modelValue = defineModel({ type: String, ...{ required: true } });
32
22
  </script>
33
23
 
34
- <script lang="ts">
24
+ <script>
35
25
  export default {
36
- name: "lib-name",
37
- }
38
-
39
- type RealProps = {
40
- }
41
-
42
- interface Props
43
- extends
44
- /** @vue-ignore */
45
- Partial<Omit<HTMLAttributes, "class">
46
- & TailwindClassProp
47
- & RealProps
48
- > { }
26
+ name: "lib-name"
27
+ };
49
28
  </script>
@@ -0,0 +1,17 @@
1
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
2
+ modelValue: string;
3
+ }, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
4
+ "update:modelValue": (value: string) => any;
5
+ }, string, import("vue").PublicProps, Readonly<{
6
+ modelValue: string;
7
+ }> & Readonly<{
8
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
9
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
10
+ default?: (props: {}) => any;
11
+ }>;
12
+ export default _default;
13
+ type __VLS_WithSlots<T, S> = T & {
14
+ new (): {
15
+ $slots: S;
16
+ };
17
+ };
@@ -1,19 +1,16 @@
1
1
  <template>
2
2
  <!-- Width 100% + 2xmargin in combination with the margins in LibRoot is a bit of a hack so that it looks like there's padding around the content in test mode (for storybook). We can't just absolutely position these controls or they make the container scroll. -->
3
- <div class="flex gap-2 p-1 pb-10 -ml-10 w-[calc(100%_+_var(--spacing)*20)]">
3
+ <div class="test-controls flex gap-2 p-1 pb-10 -ml-10 w-[calc(100%_+_var(--spacing)*20)]">
4
4
  <div class="flex-grow"/>
5
5
  <div class="outline-indicator">{{ showOutline ? "Outline Enabled" : "Outline Disabled" }}</div>
6
6
  <lib-dark-mode-switcher/>
7
7
  </div>
8
8
  </template>
9
9
 
10
- <script setup lang="ts">
11
- import LibDarkModeSwitcher from "../LibDarkModeSwitcher/LibDarkModeSwitcher.vue"
12
-
13
- defineOptions({ name: "test-controls" })
14
- defineProps< {
15
- showOutline: boolean
16
- }>()
17
-
10
+ <script setup>
11
+ import LibDarkModeSwitcher from "../LibDarkModeSwitcher/LibDarkModeSwitcher.vue";
12
+ defineOptions({ name: "test-controls" });
13
+ defineProps({
14
+ showOutline: { type: Boolean, required: true }
15
+ });
18
16
  </script>
19
-
@@ -0,0 +1,5 @@
1
+ type __VLS_Props = {
2
+ showOutline: boolean;
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,19 +1,20 @@
1
- export { default as LibTimeZonePicker } from "./LibDatePicker/LibTimeZonePicker.vue.js";
2
1
  export { default as aria } from "./Aria/Aria.vue.js";
3
2
  export { default as LibButton } from "./LibButton/LibButton.vue.js";
3
+ export { default as LibCheckbox } from "./LibCheckbox/LibCheckbox.vue.js";
4
+ export { default as LibColorInput } from "./LibColorInput/LibColorInput.vue.js";
5
+ export { default as LibColorPicker } from "./LibColorPicker/LibColorPicker.vue.js";
6
+ export { default as LibDarkModeSwitcher } from "./LibDarkModeSwitcher/LibDarkModeSwitcher.vue.js";
4
7
  export { default as LibDatePicker } from "./LibDatePicker/LibDatePicker.vue.js";
5
8
  export { default as LibDebug } from "./LibDebug/LibDebug.vue.js";
6
- export { default as LibDarkModeSwitcher } from "./LibDarkModeSwitcher/LibDarkModeSwitcher.vue.js";
7
- export { default as LibInput } from "./LibInput/LibInput.vue.js";
9
+ export { default as LibFileInput } from "./LibFileInput/LibFileInput.vue.js";
10
+ export { default as LibInputDeprecated } from "./LibInputDeprecated/LibInputDeprecated.vue.js";
11
+ export { default as LibLabel } from "./LibLabel/LibLabel.vue.js";
8
12
  export { default as LibNotifications } from "./LibNotifications/LibNotifications.vue.js";
9
13
  export { default as LibPagination } from "./LibPagination/LibPagination.vue.js";
10
- export { default as LibTable } from "./LibTable/LibTable.vue.js";
11
- export { default as LibColorPicker } from "./LibColorPicker/LibColorPicker.vue.js";
12
- export { default as LibColorInput } from "./LibColorInput/LibColorInput.vue.js";
13
14
  export { default as LibPopup } from "./LibPopup/LibPopup.vue.js";
14
- export { default as LibSimpleInput } from "./LibSimpleInput/LibSimpleInput.vue.js";
15
- export { default as LibRecorder } from "./LibRecorder/LibRecorder.vue.js";
16
- export { default as LibLabel } from "./LibLabel/LibLabel.vue.js";
17
- export { default as LibCheckbox } from "./LibCheckbox/LibCheckbox.vue.js";
18
- export { default as LibFileInput } from "./LibFileInput/LibFileInput.vue.js";
19
15
  export { default as LibProgressBar } from "./LibProgressBar/LibProgressBar.vue.js";
16
+ export { default as LibRecorder } from "./LibRecorder/LibRecorder.vue.js";
17
+ export { default as LibRoot } from "./LibRoot/LibRoot.vue.js";
18
+ export { default as LibSimpleInput } from "./LibSimpleInput/LibSimpleInput.vue.js";
19
+ export { default as LibTable } from "./LibTable/LibTable.vue.js";
20
+ export { default as LibTimeZonePicker } from "./LibDatePicker/LibTimeZonePicker.vue.js";
@@ -1,19 +1,20 @@
1
- export { default as LibTimeZonePicker } from "./LibDatePicker/LibTimeZonePicker.vue";
2
1
  export { default as aria } from "./Aria/Aria.vue";
3
2
  export { default as LibButton } from "./LibButton/LibButton.vue";
3
+ export { default as LibCheckbox } from "./LibCheckbox/LibCheckbox.vue";
4
+ export { default as LibColorInput } from "./LibColorInput/LibColorInput.vue";
5
+ export { default as LibColorPicker } from "./LibColorPicker/LibColorPicker.vue";
6
+ export { default as LibDarkModeSwitcher } from "./LibDarkModeSwitcher/LibDarkModeSwitcher.vue";
4
7
  export { default as LibDatePicker } from "./LibDatePicker/LibDatePicker.vue";
5
8
  export { default as LibDebug } from "./LibDebug/LibDebug.vue";
6
- export { default as LibDarkModeSwitcher } from "./LibDarkModeSwitcher/LibDarkModeSwitcher.vue";
7
- export { default as LibInput } from "./LibInput/LibInput.vue";
9
+ export { default as LibFileInput } from "./LibFileInput/LibFileInput.vue";
10
+ export { default as LibInputDeprecated } from "./LibInputDeprecated/LibInputDeprecated.vue";
11
+ export { default as LibLabel } from "./LibLabel/LibLabel.vue";
8
12
  export { default as LibNotifications } from "./LibNotifications/LibNotifications.vue";
9
13
  export { default as LibPagination } from "./LibPagination/LibPagination.vue";
10
- export { default as LibTable } from "./LibTable/LibTable.vue";
11
- export { default as LibColorPicker } from "./LibColorPicker/LibColorPicker.vue";
12
- export { default as LibColorInput } from "./LibColorInput/LibColorInput.vue";
13
14
  export { default as LibPopup } from "./LibPopup/LibPopup.vue";
14
- export { default as LibSimpleInput } from "./LibSimpleInput/LibSimpleInput.vue";
15
- export { default as LibRecorder } from "./LibRecorder/LibRecorder.vue";
16
- export { default as LibLabel } from "./LibLabel/LibLabel.vue";
17
- export { default as LibCheckbox } from "./LibCheckbox/LibCheckbox.vue";
18
- export { default as LibFileInput } from "./LibFileInput/LibFileInput.vue";
19
15
  export { default as LibProgressBar } from "./LibProgressBar/LibProgressBar.vue";
16
+ export { default as LibRecorder } from "./LibRecorder/LibRecorder.vue";
17
+ export { default as LibRoot } from "./LibRoot/LibRoot.vue";
18
+ export { default as LibSimpleInput } from "./LibSimpleInput/LibSimpleInput.vue";
19
+ export { default as LibTable } from "./LibTable/LibTable.vue";
20
+ export { default as LibTimeZonePicker } from "./LibDatePicker/LibTimeZonePicker.vue";