@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
@@ -0,0 +1,165 @@
1
+ import { type HTMLAttributes, type InputHTMLAttributes } from "vue";
2
+ import { type BaseInteractiveProps, type LabelProps, type LinkableByIdProps, type SuggestionsProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js.js";
3
+ type WrapperTypes = WrapperProps<"suggestions", HTMLAttributes> & WrapperProps<"wrapper", HTMLAttributes> & WrapperProps<"inner-wrapper", HTMLAttributes>;
4
+ type RealProps = SuggestionsProps & LinkableByIdProps & LabelProps & BaseInteractiveProps & {
5
+ suggestions?: SuggestionsProps["suggestions"];
6
+ valid?: boolean;
7
+ };
8
+ interface Props extends
9
+ /** @vue-ignore */
10
+ Partial<Omit<InputHTMLAttributes, "class" | "readonly" | "disabled" | "onSubmit"> & TailwindClassProp>,
11
+ /** @vue-ignore */
12
+ Partial<WrapperTypes>, RealProps {
13
+ }
14
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props & {
15
+ values?: string[] | undefined;
16
+ modelValue: string;
17
+ inputValue?: string;
18
+ }, {
19
+ suggestionsComponent: import("vue").Ref<{
20
+ suggestions: {
21
+ list: any[] | undefined;
22
+ filtered: any[] | undefined;
23
+ active: number;
24
+ available: boolean;
25
+ moreThanOneAvailable: boolean;
26
+ hasExactlyMatching: string | object | undefined;
27
+ hasValidSuggestion: boolean;
28
+ openable: boolean | undefined;
29
+ getLabel: (item: any) => string;
30
+ $open: boolean;
31
+ open: () => void;
32
+ close: () => void;
33
+ enterSelected: (doClose?: boolean) => void;
34
+ enterIndex: (num: number, doClose?: boolean) => void;
35
+ toggle: () => void;
36
+ cancel: () => void;
37
+ select: (num: number) => void;
38
+ prev: () => void;
39
+ next: () => void;
40
+ first: () => void;
41
+ last: () => void;
42
+ };
43
+ el: HTMLElement | null;
44
+ inputKeydownHandler: (e: KeyboardEvent) => void;
45
+ inputBlurHandler: (e: MouseEvent) => void;
46
+ inputFocusHandler: (e: FocusEvent) => void;
47
+ } | null, import("vue").ShallowUnwrapRef<{
48
+ suggestions: {
49
+ list: any[] | undefined;
50
+ filtered: any[] | undefined;
51
+ active: number;
52
+ available: boolean;
53
+ moreThanOneAvailable: boolean;
54
+ hasExactlyMatching: string | object | 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
+ inputKeydownHandler: (e: KeyboardEvent) => void;
73
+ inputBlurHandler: (e: MouseEvent) => void;
74
+ inputFocusHandler: (e: FocusEvent) => void;
75
+ }> | {
76
+ suggestions: {
77
+ list: any[] | undefined;
78
+ filtered: any[] | undefined;
79
+ active: number;
80
+ available: boolean;
81
+ moreThanOneAvailable: boolean;
82
+ hasExactlyMatching: string | object | undefined;
83
+ hasValidSuggestion: boolean;
84
+ openable: boolean | undefined;
85
+ getLabel: (item: any) => string;
86
+ $open: boolean;
87
+ open: () => void;
88
+ close: () => void;
89
+ enterSelected: (doClose?: boolean) => void;
90
+ enterIndex: (num: number, doClose?: boolean) => void;
91
+ toggle: () => void;
92
+ cancel: () => void;
93
+ select: (num: number) => void;
94
+ prev: () => void;
95
+ next: () => void;
96
+ first: () => void;
97
+ last: () => void;
98
+ };
99
+ el: HTMLElement | null;
100
+ inputKeydownHandler: (e: KeyboardEvent) => void;
101
+ inputBlurHandler: (e: MouseEvent) => void;
102
+ inputFocusHandler: (e: FocusEvent) => void;
103
+ } | null>;
104
+ el: import("vue").Ref<HTMLElement | null, HTMLElement | null>;
105
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
106
+ "update:modelValue": (value: string) => any;
107
+ "update:inputValue": (value: string) => any;
108
+ "update:values": (value: string[] | undefined) => any;
109
+ } & {
110
+ blur: (val: FocusEvent) => any;
111
+ input: (val: InputEvent) => any;
112
+ submit: (val: string, suggestion?: any) => any;
113
+ keydown: (val: KeyboardEvent) => any;
114
+ focus: (val: FocusEvent) => any;
115
+ indicatorClick: (val: MouseEvent) => any;
116
+ }, string, import("vue").PublicProps, Readonly<Props & {
117
+ values?: string[] | undefined;
118
+ modelValue: string;
119
+ inputValue?: string;
120
+ }> & Readonly<{
121
+ onBlur?: ((val: FocusEvent) => any) | undefined;
122
+ onInput?: ((val: InputEvent) => any) | undefined;
123
+ onSubmit?: ((val: string, suggestion?: any) => any) | undefined;
124
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
125
+ "onUpdate:inputValue"?: ((value: string) => any) | undefined;
126
+ "onUpdate:values"?: ((value: string[] | undefined) => any) | undefined;
127
+ onKeydown?: ((val: KeyboardEvent) => any) | undefined;
128
+ onFocus?: ((val: FocusEvent) => any) | undefined;
129
+ onIndicatorClick?: ((val: MouseEvent) => any) | undefined;
130
+ }>, {
131
+ disabled: boolean;
132
+ readonly: boolean;
133
+ border: boolean;
134
+ unstyle: boolean;
135
+ valid: boolean;
136
+ suggestions: any[];
137
+ updateOnlyOnSubmit: boolean;
138
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
139
+ label?: (props: any) => any;
140
+ } & {
141
+ default?: (props: any) => any;
142
+ } & {
143
+ left?: (props: any) => any;
144
+ } & {
145
+ input?: (props: any) => any;
146
+ } & {
147
+ indicator?: (props: {
148
+ isOpen: any;
149
+ suggestionsIndicatorClickHandler: any;
150
+ }) => any;
151
+ } & {
152
+ values?: (props: any) => any;
153
+ } & {
154
+ right?: (props: any) => any;
155
+ } & {
156
+ suggestions?: (props: any) => any;
157
+ } & {
158
+ 'suggestion-item'?: (props: any) => any;
159
+ }>;
160
+ export default _default;
161
+ type __VLS_WithSlots<T, S> = T & {
162
+ new (): {
163
+ $slots: S;
164
+ };
165
+ };
@@ -2,65 +2,44 @@
2
2
  <!-- we use data-disabled because labels have no disabled property technically -->
3
3
  <label
4
4
  :id="`label-${id ?? fallbackId}`"
5
- :class="!($attrs as any).unstyle && twMerge(`
5
+ :class="!$attrs.unstyle && twMerge(
6
+ `
6
7
  pr-0
7
8
  text-sm
8
9
  `,
9
- !valid && `text-danger-700`,
10
- ($attrs as any)?.class
11
- )"
10
+ !valid && `text-danger-700`,
11
+ $attrs?.class
12
+ )"
12
13
  :data-disabled="disabled"
13
14
  :data-invalid="!valid"
14
15
  :for="id"
15
- v-bind="{...$attrs, class:undefined}"
16
+ v-bind="{ ...$attrs, class: void 0 }"
16
17
  >
17
18
  <slot/>
18
19
  </label>
19
20
  </template>
20
21
 
21
- <script setup lang="ts">
22
- import type { MakeRequired } from "@alanscodelog/utils/types"
23
- import { type LabelHTMLAttributes,toRef,useAttrs } from "vue"
24
-
25
- import { twMerge } from "../../utils/twMerge.js"
26
- import { type BaseInteractiveProps, baseInteractivePropsDefaults, getFallbackId, type LabelProps, type LinkableByIdProps, type TailwindClassProp } from "../shared/props.js"
27
-
28
-
22
+ <script setup>
23
+ import { toRef, useAttrs } from "vue";
24
+ import { twMerge } from "../../utils/twMerge.js";
25
+ import { getFallbackId } from "../shared/props.js";
29
26
  defineOptions({
30
- name: "lib-label",
31
- })
32
-
33
- const fallbackId = getFallbackId()
34
-
35
- // eslint-disable-next-line no-undef
36
- withDefaults(defineProps<Props>(), {
37
- id: "",
38
- unstyled: undefined,
39
- valid: true,
40
- ...baseInteractivePropsDefaults,
41
- })
42
-
43
- const $attrs = useAttrs()
44
- </script>
45
-
46
- <script lang="ts">
47
- type RealProps =
48
- & LinkableByIdProps
49
- & LabelProps
50
- & BaseInteractiveProps
51
- & {
52
- unstyled?: boolean
53
- valid?: boolean
54
- }
55
-
56
- interface Props
57
- extends
58
- /** @vue-ignore */
59
- Partial<Omit<LabelHTMLAttributes,"class"> & TailwindClassProp>,
60
- RealProps
61
- { }
27
+ name: "lib-label"
28
+ });
29
+ const fallbackId = getFallbackId();
30
+ defineProps({
31
+ id: { type: String, required: false, default: "" },
32
+ label: { type: String, required: false },
33
+ disabled: { type: Boolean, required: false, default: false },
34
+ readonly: { type: Boolean, required: false, default: false },
35
+ border: { type: Boolean, required: false, default: true },
36
+ unstyle: { type: Boolean, required: false, default: false },
37
+ unstyled: { type: Boolean, required: false },
38
+ valid: { type: Boolean, required: false, default: true }
39
+ });
40
+ const $attrs = useAttrs();
62
41
  </script>
63
42
 
64
- <script lang="ts">
43
+ <script>
65
44
 
66
45
  </script>
@@ -0,0 +1,26 @@
1
+ import { type LabelHTMLAttributes } from "vue";
2
+ import { type BaseInteractiveProps, type LabelProps, type LinkableByIdProps, type TailwindClassProp } from "../shared/props.js.js";
3
+ type RealProps = LinkableByIdProps & LabelProps & BaseInteractiveProps & {
4
+ unstyled?: boolean;
5
+ valid?: boolean;
6
+ };
7
+ interface Props extends
8
+ /** @vue-ignore */
9
+ Partial<Omit<LabelHTMLAttributes, "class"> & TailwindClassProp>, RealProps {
10
+ }
11
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
12
+ id: string;
13
+ disabled: boolean;
14
+ readonly: boolean;
15
+ border: boolean;
16
+ unstyle: boolean;
17
+ valid: boolean;
18
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
19
+ default?: (props: {}) => any;
20
+ }>;
21
+ export default _default;
22
+ type __VLS_WithSlots<T, S> = T & {
23
+ new (): {
24
+ $slots: S;
25
+ };
26
+ };
@@ -1,7 +1,9 @@
1
1
  <template>
2
2
  <div
3
3
  v-if="$modelValue && $modelValue?.length > 0"
4
- :class="twMerge(`
4
+ :class="
5
+ twMerge(
6
+ `
5
7
  multivalues
6
8
  group
7
9
  flex
@@ -12,17 +14,19 @@
12
14
  overflow-x-scroll
13
15
  scrollbar-hidden
14
16
  `,
15
- ($.attrs as any)?.class)
16
- "
17
+ $.attrs?.class
18
+ )
19
+ "
17
20
  :data-disabled="disabled"
18
21
  :data-read-only="readonly"
19
22
  :aria-label="`Values for ${label}`"
20
23
  :tabindex="disabled ? -1 : 0"
21
- v-bind="{...$.attrs, class:undefined}"
24
+ v-bind="{ ...$.attrs, class: void 0 }"
22
25
  >
23
26
  <div
24
27
  :data-border="border"
25
- :class="twMerge(`
28
+ :class="twMerge(
29
+ `
26
30
  multivalues--item
27
31
  flex-basis-0
28
32
  min-w-2
@@ -35,24 +39,24 @@
35
39
  px-1
36
40
  text-xs
37
41
  leading-none`,
38
- !(disabled || readonly) && `
42
+ !(disabled || readonly) && `
39
43
  group-focus:text-accent-500
40
44
  focus:text-accent-500`,
41
- border && `
45
+ border && `
42
46
  rounded-sm
43
47
  border-neutral-400
44
48
  border
45
49
  focus:border-accent-400
46
50
  `,
47
- border && (disabled || readonly) && `
51
+ border && (disabled || readonly) && `
48
52
  border-neutral-200
49
53
  focus:border-neutral-200
50
54
  dark:border-neutral-800
51
55
  dark:focus:border-neutral-800
52
56
  `,
53
- ($.itemAttrs as any)?.class
54
- )"
55
- :tabindex="canEdit ? 0 : undefined"
57
+ $.itemAttrs?.class
58
+ )"
59
+ :tabindex="canEdit ? 0 : void 0"
56
60
  v-for="(value) of $modelValue"
57
61
  :key="value"
58
62
  @keydown.ctrl.c.prevent="copy(value.toString())"
@@ -71,55 +75,36 @@
71
75
  </div>
72
76
  </template>
73
77
 
74
- <script setup lang="ts" generic="T extends string | number">
75
- import { removeIfIn } from "@alanscodelog/utils/removeIfIn.js"
76
- import { computed, type HTMLAttributes } from "vue"
77
-
78
- import { useDivideAttrs } from "../../composables/useDivideAttrs.js"
79
- import { copy } from "../../helpers/copy.js"
80
- import { twMerge } from "../../utils/twMerge.js"
81
- import Icon from "../Icon/Icon.vue"
82
- import LibButton from "../LibButton/LibButton.vue"
83
- import { type BaseInteractiveProps, baseInteractivePropsDefaults,type LabelProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js"
84
-
85
-
78
+ <script setup>
79
+ import { removeIfIn } from "@alanscodelog/utils/removeIfIn";
80
+ import { computed } from "vue";
81
+ import IFa6SolidXmark from "~icons/fa6-solid/xmark";
82
+ import { useDivideAttrs } from "../../composables/useDivideAttrs.js";
83
+ import { copy } from "../../helpers/copy.js";
84
+ import { twMerge } from "../../utils/twMerge.js";
85
+ import Icon from "../Icon/Icon.vue";
86
+ import LibButton from "../LibButton/LibButton.vue";
87
+ import {} from "../shared/props.js";
86
88
  defineOptions({
87
- name: "lib-multi-values",
88
- inheritAttrs: false,
89
- })
90
-
91
- const $ = useDivideAttrs(["item"] as const)
92
- const props = withDefaults(defineProps<Props>(), {
93
- ...baseInteractivePropsDefaults
94
- })
95
-
96
-
97
- const canEdit = computed(() => !props.disabled && !props.readonly)
98
- const $modelValue = defineModel<T[]>({ default: () => []})
99
-
100
- const removeVal = (value: T) => {
101
- if (!canEdit.value) return
102
- removeIfIn($modelValue.value, value)
103
- }
89
+ name: "lib-multi-values",
90
+ inheritAttrs: false
91
+ });
92
+ const $ = useDivideAttrs(["item"]);
93
+ const props = defineProps({
94
+ label: { type: String, required: false },
95
+ disabled: { type: Boolean, required: false, default: false },
96
+ readonly: { type: Boolean, required: false, default: false },
97
+ border: { type: Boolean, required: false, default: true },
98
+ unstyle: { type: Boolean, required: false, default: false }
99
+ });
100
+ const canEdit = computed(() => !props.disabled && !props.readonly);
101
+ const $modelValue = defineModel({ type: Array, ...{ default: () => [] } });
102
+ const removeVal = (value) => {
103
+ if (!canEdit.value) return;
104
+ removeIfIn($modelValue.value, value);
105
+ };
104
106
  </script>
105
107
 
106
- <script lang="ts">
107
- type WrapperTypes = Partial<WrapperProps<"item",HTMLAttributes>>
108
-
109
- type RealProps =
110
- & LabelProps
111
- & BaseInteractiveProps
112
- & {
113
- border?: boolean
114
- }
115
- interface Props
116
- extends
117
- /** @vue-ignore */
118
- Partial<Omit<HTMLAttributes,"class"> & TailwindClassProp>,
119
- /** @vue-ignore */
120
- WrapperTypes,
121
- RealProps
122
- {}
108
+ <script>
123
109
 
124
110
  </script>
125
-
@@ -0,0 +1,29 @@
1
+ import { type HTMLAttributes } from "vue";
2
+ import { type BaseInteractiveProps, type LabelProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js.js";
3
+ type WrapperTypes = Partial<WrapperProps<"item", HTMLAttributes>>;
4
+ type RealProps = LabelProps & BaseInteractiveProps & {
5
+ border?: boolean;
6
+ };
7
+ interface Props extends
8
+ /** @vue-ignore */
9
+ Partial<Omit<HTMLAttributes, "class"> & TailwindClassProp>,
10
+ /** @vue-ignore */
11
+ WrapperTypes, RealProps {
12
+ }
13
+ declare const _default: <T extends string | number>(__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<{
14
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
15
+ readonly "onUpdate:modelValue"?: ((value: T[]) => any) | undefined;
16
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onUpdate:modelValue"> & (Props & {
17
+ modelValue?: T[];
18
+ }) & Partial<{}>> & import("vue").PublicProps;
19
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
20
+ attrs: any;
21
+ slots: {};
22
+ emit: (evt: "update:modelValue", value: T[]) => void;
23
+ }>) => import("vue").VNode & {
24
+ __ctx?: Awaited<typeof __VLS_setup>;
25
+ };
26
+ export default _default;
27
+ type __VLS_PrettifyLocal<T> = {
28
+ [K in keyof T as K]: T[K];
29
+ } & {};
@@ -1,5 +1,6 @@
1
1
  <template>
2
- <div :class="twMerge(`notification
2
+ <div :class="twMerge(
3
+ `notification
3
4
  max-w-700px
4
5
  bg-neutral-50
5
6
  dark:bg-neutral-900
@@ -13,8 +14,9 @@
13
14
  gap-2
14
15
  p-2 m-2
15
16
  `,
16
- ($attrs as any).class)"
17
- v-bind="{ ...$attrs, class: undefined }"
17
+ $attrs.class
18
+ )"
19
+ v-bind="{ ...$attrs, class: void 0 }"
18
20
  tabindex="0"
19
21
  ref="notificationEl"
20
22
  @keydown.enter.self="NotificationHandler.resolveToDefault(notification)"
@@ -63,11 +65,12 @@
63
65
  "
64
66
  >
65
67
  <lib-button :label="option"
66
- :class="twMerge(`
68
+ :class="twMerge(
69
+ `
67
70
  notification--option-button
68
71
  `,
69
- buttonColors[i] == 'secondary' && 'p-0'
70
- )"
72
+ buttonColors[i] == 'secondary' && 'p-0'
73
+ )"
71
74
  :border="buttonColors[i] !== 'secondary'"
72
75
  :color="buttonColors[i]"
73
76
  v-for="option, i in notification.options"
@@ -78,52 +81,35 @@
78
81
  </div>
79
82
  </div>
80
83
  </template>
81
- <script setup lang="ts">
82
- import { computed, type HTMLAttributes,ref, useAttrs } from "vue"
83
-
84
- import { copy } from "../../helpers/copy.js"
85
- import { type NotificationEntry, NotificationHandler } from "../../helpers/NotificationHandler.js"
86
- import { twMerge } from "../../utils/twMerge.js"
87
- import Icon from "../Icon/Icon.vue"
88
- import LibButton from "../LibButton/LibButton.vue"
89
- import type { TailwindClassProp } from "../shared/props.js"
90
-
91
84
 
85
+ <script setup>
86
+ import { computed, ref, useAttrs } from "vue";
87
+ import IFa6RegularCopy from "~icons/fa6-regular/copy";
88
+ import IFa6SolidXmark from "~icons/fa6-solid/xmark";
89
+ import { copy } from "../../helpers/copy.js";
90
+ import { NotificationHandler } from "../../helpers/NotificationHandler.js";
91
+ import { twMerge } from "../../utils/twMerge.js";
92
+ import Icon from "../Icon/Icon.vue";
93
+ import LibButton from "../LibButton/LibButton.vue";
92
94
  defineOptions({
93
- name: "lib-notification",
94
- inheritAttrs: false,
95
- })
96
- const $attrs = useAttrs()
97
-
98
- const props = withDefaults(defineProps<Props>(), {
99
- handler: undefined,
100
- })
101
-
102
- const getColor = (notification: NotificationEntry, option: string): "ok" | "primary" | "danger" | "secondary" => notification.default === option ? "primary" : notification.dangerous.includes(option) ? "danger" : "secondary"
103
-
104
- /* Todo make this more flexible? */
105
- // eslint-disable-next-line @stylistic/space-in-parens
106
- const buttonColors = computed(() => props.notification.options.map((option: any /* what ??? */) => getColor(props.notification, option)))
107
-
108
- const notificationEl = ref<null | HTMLElement>(null)
95
+ name: "lib-notification",
96
+ inheritAttrs: false
97
+ });
98
+ const $attrs = useAttrs();
99
+ const props = defineProps({
100
+ notification: { type: null, required: true },
101
+ handler: { type: Object, required: false, default: void 0 }
102
+ });
103
+ const getColor = (notification, option) => notification.default === option ? "primary" : notification.dangerous.includes(option) ? "danger" : "secondary";
104
+ const buttonColors = computed(() => props.notification.options.map((option) => getColor(props.notification, option)));
105
+ const notificationEl = ref(null);
109
106
  defineExpose({
110
- focus: () => {
111
- notificationEl.value?.focus()
112
- },
113
- })
114
-
107
+ focus: () => {
108
+ notificationEl.value?.focus();
109
+ }
110
+ });
115
111
  </script>
116
112
 
117
- <script lang="ts">
118
- type RealProps = {
119
- notification: NotificationEntry
120
- handler?: NotificationHandler
121
- }
113
+ <script>
122
114
 
123
- interface Props
124
- extends
125
- /** @vue-ignore */
126
- Partial<Omit<HTMLAttributes,"class"> & TailwindClassProp>,
127
- RealProps
128
- {}
129
115
  </script>
@@ -0,0 +1,17 @@
1
+ import { type HTMLAttributes } from "vue";
2
+ import { type NotificationEntry, NotificationHandler } from "../../helpers/NotificationHandler.js.js";
3
+ import type { TailwindClassProp } from "../shared/props.js.js";
4
+ type RealProps = {
5
+ notification: NotificationEntry;
6
+ handler?: NotificationHandler;
7
+ };
8
+ interface Props extends
9
+ /** @vue-ignore */
10
+ Partial<Omit<HTMLAttributes, "class"> & TailwindClassProp>, RealProps {
11
+ }
12
+ declare const _default: import("vue").DefineComponent<Props, {
13
+ focus: () => void;
14
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
15
+ handler: NotificationHandler;
16
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
+ export default _default;