@witchcraft/ui 0.1.0 → 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.
- package/dist/module.json +2 -2
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/Aria/Aria.vue +5 -9
- package/dist/runtime/components/Aria/Aria.vue.d.ts +5 -0
- package/dist/runtime/components/Icon/Icon.vue +10 -31
- package/dist/runtime/components/Icon/Icon.vue.d.ts +21 -0
- package/dist/runtime/components/LibButton/LibButton.vue +58 -77
- package/dist/runtime/components/LibButton/LibButton.vue.d.ts +36 -0
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +48 -75
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +42 -0
- package/dist/runtime/components/LibColorInput/LibColorInput.vue +63 -108
- package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +63 -0
- package/dist/runtime/components/LibColorPicker/LibColorPicker.vue +271 -352
- package/dist/runtime/components/LibColorPicker/LibColorPicker.vue.d.ts +61 -0
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +32 -57
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts +22 -0
- package/dist/runtime/components/LibDatePicker/LibDatePicker.vue +17 -38
- package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +40 -0
- package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue +53 -82
- package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue.d.ts +34 -0
- package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue +50 -67
- package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue.d.ts +34 -0
- package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue +7 -8
- package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue.d.ts +22 -0
- package/dist/runtime/components/LibDebug/LibDebug.vue +42 -70
- package/dist/runtime/components/LibDebug/LibDebug.vue.d.ts +32 -0
- package/dist/runtime/components/LibDevOnly/LibDevOnly.vue +18 -31
- package/dist/runtime/components/LibDevOnly/LibDevOnly.vue.d.ts +22 -0
- package/dist/runtime/components/LibFileInput/LibFileInput.vue +113 -157
- package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +43 -0
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +215 -242
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +165 -0
- package/dist/runtime/components/LibLabel/LibLabel.vue +30 -46
- package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +27 -0
- package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +44 -59
- package/dist/runtime/components/LibMultiValues/LibMultiValues.vue.d.ts +29 -0
- package/dist/runtime/components/LibNotifications/LibNotification.vue +32 -49
- package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +17 -0
- package/dist/runtime/components/LibNotifications/LibNotifications.vue +63 -84
- package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +13 -0
- package/dist/runtime/components/LibPagination/LibPagination.vue +67 -112
- package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +104 -0
- package/dist/runtime/components/LibPalette/LibPalette.vue +20 -23
- package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +14 -0
- package/dist/runtime/components/LibPopup/LibPopup.vue +314 -352
- package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +46 -0
- package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +70 -92
- package/dist/runtime/components/LibProgressBar/LibProgressBar.vue.d.ts +41 -0
- package/dist/runtime/components/LibRecorder/LibRecorder.vue +133 -178
- package/dist/runtime/components/LibRecorder/LibRecorder.vue.d.ts +77 -0
- package/dist/runtime/components/LibRoot/LibRoot.vue +73 -100
- package/dist/runtime/components/LibRoot/LibRoot.vue.d.ts +41 -0
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue +49 -78
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue.d.ts +35 -0
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +123 -157
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +94 -0
- package/dist/runtime/components/LibTable/LibTable.vue +63 -100
- package/dist/runtime/components/LibTable/LibTable.vue.d.ts +45 -0
- package/dist/runtime/components/Template/NAME.vue +15 -36
- package/dist/runtime/components/Template/NAME.vue.d.ts +17 -0
- package/dist/runtime/components/TestControls/TestControls.vue +6 -9
- package/dist/runtime/components/TestControls/TestControls.vue.d.ts +5 -0
- package/dist/runtime/directives/vResizableCols.js +89 -83
- package/dist/types.d.mts +2 -6
- package/package.json +11 -11
- package/src/runtime/components/Focus.stories.ts +3 -2
- package/src/runtime/components/Icon/Icon.vue +0 -1
- package/src/runtime/components/LibButton/LibButton.vue +0 -1
- package/src/runtime/components/LibCheckbox/LibCheckbox.vue +0 -1
- package/src/runtime/components/LibColorInput/LibColorInput.vue +0 -1
- package/src/runtime/components/LibColorPicker/utils/safeConvertToHsva.ts +0 -1
- package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +0 -1
- package/src/runtime/components/LibFileInput/LibFileInput.vue +0 -1
- package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +0 -1
- package/src/runtime/components/LibMultiValues/LibMultiValues.vue +0 -1
- package/src/runtime/components/LibNotifications/LibNotification.vue +0 -1
- package/src/runtime/components/LibNotifications/LibNotifications.vue +0 -1
- package/src/runtime/components/LibPagination/LibPagination.vue +0 -1
- package/src/runtime/components/LibPopup/LibPopup.vue +0 -1
- package/src/runtime/components/LibProgressBar/LibProgressBar.vue +0 -1
- package/src/runtime/components/LibRecorder/LibRecorder.vue +0 -1
- package/src/runtime/components/LibSimpleInput/LibSimpleInput.vue +0 -1
- package/src/runtime/components/LibSuggestions/LibSuggestions.vue +0 -1
- package/src/runtime/components/LibTable/LibTable.vue +0 -1
- package/src/runtime/directives/vResizableCols.ts +79 -73
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -36
- package/dist/runtime/components/Focus.stories.d.ts +0 -11
- package/dist/runtime/components/Focus.stories.js +0 -53
- package/dist/runtime/components/LibButton/LibButton.stories.d.ts +0 -12
- package/dist/runtime/components/LibButton/LibButton.stories.js +0 -94
- package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.d.ts +0 -14
- package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.js +0 -29
- package/dist/runtime/components/LibColorInput/LibColorInput.stories.d.ts +0 -7
- package/dist/runtime/components/LibColorInput/LibColorInput.stories.js +0 -58
- package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.d.ts +0 -9
- package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.js +0 -68
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.d.ts +0 -7
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.js +0 -36
- package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.d.ts +0 -11
- package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.js +0 -98
- package/dist/runtime/components/LibDebug/LibDebug.stories.d.ts +0 -9
- package/dist/runtime/components/LibDebug/LibDebug.stories.js +0 -46
- package/dist/runtime/components/LibFileInput/LibFileInput.stories.d.ts +0 -10
- package/dist/runtime/components/LibFileInput/LibFileInput.stories.js +0 -63
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.d.ts +0 -33
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.js +0 -384
- package/dist/runtime/components/LibLabel/LibLabel.stories.d.ts +0 -6
- package/dist/runtime/components/LibLabel/LibLabel.stories.js +0 -25
- package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.d.ts +0 -23
- package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.js +0 -61
- package/dist/runtime/components/LibNotifications/LibNotification.stories.d.ts +0 -15
- package/dist/runtime/components/LibNotifications/LibNotification.stories.js +0 -126
- package/dist/runtime/components/LibNotifications/LibNotifications.stories.d.ts +0 -6
- package/dist/runtime/components/LibNotifications/LibNotifications.stories.js +0 -109
- package/dist/runtime/components/LibPagination/LibPagination.stories.d.ts +0 -6
- package/dist/runtime/components/LibPagination/LibPagination.stories.js +0 -40
- package/dist/runtime/components/LibPalette/LibPalette.stories.d.ts +0 -6
- package/dist/runtime/components/LibPalette/LibPalette.stories.js +0 -20
- package/dist/runtime/components/LibPopup/LibPopup.stories.d.ts +0 -14
- package/dist/runtime/components/LibPopup/LibPopup.stories.js +0 -147
- package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.d.ts +0 -10
- package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.js +0 -81
- package/dist/runtime/components/LibRecorder/LibRecorder.stories.d.ts +0 -19
- package/dist/runtime/components/LibRecorder/LibRecorder.stories.js +0 -63
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.d.ts +0 -26
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.js +0 -78
- package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.d.ts +0 -27
- package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.js +0 -112
- package/dist/runtime/components/LibTable/LibTable.stories.d.ts +0 -16
- package/dist/runtime/components/LibTable/LibTable.stories.js +0 -156
- package/dist/runtime/components/Reset.stories.d.ts +0 -5
- package/dist/runtime/components/Reset.stories.js +0 -19
- package/dist/runtime/components/Scrolling.stories.d.ts +0 -6
- package/dist/runtime/components/Scrolling.stories.js +0 -44
- package/dist/runtime/composables/useScrollNearContainerEdges.stories.d.ts +0 -7
- package/dist/runtime/composables/useScrollNearContainerEdges.stories.js +0 -85
- package/dist/types.d.ts +0 -7
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
4
|
import { globFiles, addImportsCustom } from '@witchcraft/nuxt-utils/utils';
|
|
@@ -2,15 +2,11 @@
|
|
|
2
2
|
<div tabindex="0">{{ value }}</div>
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
|
-
<script
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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,44 +1,23 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
3
|
:class="twMerge('icon inline-block', $attrs?.class)"
|
|
4
|
-
v-bind="{...$attrs, class:
|
|
4
|
+
v-bind="{ ...$attrs, class: void 0 }"
|
|
5
5
|
>
|
|
6
6
|
<slot/>
|
|
7
7
|
</div>
|
|
8
8
|
</template>
|
|
9
9
|
|
|
10
|
-
<script setup
|
|
11
|
-
import { computed,
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const $attrs = useAttrs() as any
|
|
22
|
-
|
|
23
|
-
// eslint-disable-next-line no-use-before-define
|
|
24
|
-
const props = defineProps<Props>()
|
|
25
|
-
|
|
26
|
-
|
|
14
|
+
name: "icon",
|
|
15
|
+
inheritAttrs: false
|
|
16
|
+
});
|
|
17
|
+
const $attrs = useAttrs();
|
|
18
|
+
const props = defineProps({});
|
|
27
19
|
</script>
|
|
28
20
|
|
|
29
|
-
<script
|
|
30
|
-
/**
|
|
31
|
-
* 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.
|
|
32
|
-
*
|
|
33
|
-
* ```vue
|
|
34
|
-
* <icon><i-...></icon>
|
|
35
|
-
* ``
|
|
36
|
-
*/
|
|
21
|
+
<script>
|
|
37
22
|
|
|
38
|
-
interface Props
|
|
39
|
-
extends
|
|
40
|
-
/** @vue-ignore */
|
|
41
|
-
Partial<Omit<HTMLAttributes, "class">
|
|
42
|
-
> { }
|
|
43
23
|
</script>
|
|
44
|
-
|
|
@@ -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="
|
|
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
|
-
|
|
26
|
-
|
|
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
|
-
|
|
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
|
-
|
|
70
|
+
!border && color === `primary` && `
|
|
70
71
|
font-bold
|
|
71
72
|
hover:text-accent-50
|
|
72
73
|
`,
|
|
73
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
137
|
+
border && color === `secondary` && `
|
|
137
138
|
text-accent-800
|
|
138
139
|
dark:text-accent-400
|
|
139
140
|
`,
|
|
140
|
-
|
|
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
|
-
|
|
156
|
-
|
|
157
|
-
:type="$attrs.type
|
|
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
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
165
|
+
...autoTitle,
|
|
166
|
+
...$attrs,
|
|
167
|
+
class: void 0,
|
|
168
|
+
...ariaLabel
|
|
169
|
+
}"
|
|
169
170
|
>
|
|
170
|
-
<slot name="label" v-bind="{id
|
|
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,60 +184,40 @@
|
|
|
183
184
|
</button>
|
|
184
185
|
</template>
|
|
185
186
|
|
|
186
|
-
<script setup
|
|
187
|
-
import { isBlank } from "@alanscodelog/utils/isBlank.js"
|
|
188
|
-
import { keys } from "@alanscodelog/utils/keys.js"
|
|
189
|
-
import { pick } from "@alanscodelog/utils/pick.js"
|
|
190
|
-
import
|
|
191
|
-
import {
|
|
192
|
-
|
|
193
|
-
import {
|
|
194
|
-
import {
|
|
195
|
-
|
|
196
|
-
import { type BaseInteractiveProps, baseInteractiveProps, baseInteractivePropsDefaults, type ButtonProps,getFallbackId, type LabelProps, type LinkableByIdProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js"
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
const $attrs = useAttrs()
|
|
200
|
-
|
|
201
|
-
|
|
187
|
+
<script setup>
|
|
188
|
+
import { isBlank } from "@alanscodelog/utils/isBlank.js";
|
|
189
|
+
import { keys } from "@alanscodelog/utils/keys.js";
|
|
190
|
+
import { pick } from "@alanscodelog/utils/pick.js";
|
|
191
|
+
import { computed, useAttrs } from "vue";
|
|
192
|
+
import { useAriaLabel } from "../../composables/useAriaLabel.js";
|
|
193
|
+
import { useDivideAttrs } from "../../composables/useDivideAttrs.js";
|
|
194
|
+
import { twMerge } from "../../utils/twMerge.js";
|
|
195
|
+
import { baseInteractiveProps, baseInteractivePropsDefaults, getFallbackId } from "../shared/props.js";
|
|
196
|
+
const $attrs = useAttrs();
|
|
202
197
|
defineOptions({
|
|
203
|
-
|
|
204
|
-
})
|
|
205
|
-
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
198
|
+
name: "lib-button"
|
|
199
|
+
});
|
|
200
|
+
const fallbackId = getFallbackId();
|
|
201
|
+
const props = defineProps(/* @__PURE__ */ _mergeDefaults({
|
|
202
|
+
id: { type: String, required: false },
|
|
203
|
+
label: { type: String, required: false },
|
|
204
|
+
disabled: { type: Boolean, required: false },
|
|
205
|
+
readonly: { type: Boolean, required: false },
|
|
206
|
+
border: { type: Boolean, required: false },
|
|
207
|
+
unstyle: { type: Boolean, required: false },
|
|
208
|
+
color: { type: [String, Boolean], required: false },
|
|
209
|
+
autoTitleFromAria: { type: Boolean, required: false }
|
|
210
|
+
}, {
|
|
211
|
+
color: false,
|
|
212
|
+
label: "",
|
|
213
|
+
...baseInteractivePropsDefaults
|
|
214
|
+
}));
|
|
215
|
+
const ariaLabel = useAriaLabel(props, fallbackId);
|
|
217
216
|
const autoTitle = computed(() => ({
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
: undefined,
|
|
221
|
-
}))
|
|
222
|
-
|
|
217
|
+
title: props.autoTitleFromAria ? $attrs["aria-label"] ?? props.label : void 0
|
|
218
|
+
}));
|
|
223
219
|
</script>
|
|
224
220
|
|
|
225
|
-
<script
|
|
226
|
-
type RealProps =
|
|
227
|
-
& LinkableByIdProps
|
|
228
|
-
& LabelProps
|
|
229
|
-
& BaseInteractiveProps
|
|
230
|
-
& ButtonProps
|
|
221
|
+
<script>
|
|
231
222
|
|
|
232
|
-
interface Props
|
|
233
|
-
extends
|
|
234
|
-
/** @vue-ignore */
|
|
235
|
-
Partial<Omit<ButtonHTMLAttributes,"class" | "color" | "disabled">
|
|
236
|
-
& TailwindClassProp
|
|
237
|
-
& {
|
|
238
|
-
// why is this not already a part of button?
|
|
239
|
-
"aria-label": string
|
|
240
|
-
}>,
|
|
241
|
-
RealProps {}
|
|
242
223
|
</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
|
-
|
|
10
|
-
|
|
11
|
-
v-bind="{ ...$.wrapperAttrs, class:
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
v-bind="{ ...$.labelAttrs, class:
|
|
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="
|
|
31
|
+
:class="!$attrs.unstyle && twMerge(
|
|
32
|
+
`
|
|
30
33
|
checkbox
|
|
31
34
|
focus-outline-no-offset
|
|
32
35
|
m-0
|
|
@@ -53,84 +56,54 @@
|
|
|
53
56
|
checked:after:bg-accent-700
|
|
54
57
|
disabled:border-neutral-500
|
|
55
58
|
disabled:checked:after:bg-neutral-700
|
|
56
|
-
`,
|
|
57
|
-
|
|
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:
|
|
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 { keys } from "@alanscodelog/utils/keys.js";
|
|
76
|
+
import { omit } from "@alanscodelog/utils/omit.js";
|
|
77
|
+
import { pick } from "@alanscodelog/utils/pick.js";
|
|
78
|
+
import { computed, ref, useAttrs, useSlots } from "vue";
|
|
79
|
+
import { useDivideAttrs } from "../../composables/useDivideAttrs.js";
|
|
80
|
+
import { usePreHydrationValue } from "../../composables/usePreHydrationValue.js";
|
|
81
|
+
import { twMerge } from "../../utils/twMerge.js";
|
|
82
|
+
import { baseInteractivePropsDefaults, getFallbackId } from "../shared/props.js";
|
|
81
83
|
defineOptions({
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
})
|
|
85
|
-
|
|
86
|
-
const $ =
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
const inputEl = ref<null | HTMLElement>(null)
|
|
104
|
-
const $value = defineModel<boolean>("modelValue", { default: false })
|
|
105
|
-
|
|
106
|
-
usePreHydrationValue(props.id ?? fallbackId, $value)
|
|
84
|
+
name: "lib-checkbox",
|
|
85
|
+
inheritAttrs: false
|
|
86
|
+
});
|
|
87
|
+
const $ = useDivideAttrs(["label", "wrapper"]);
|
|
88
|
+
const $slots = useSlots();
|
|
89
|
+
const fallbackId = getFallbackId();
|
|
90
|
+
const props = defineProps(/* @__PURE__ */ _mergeDefaults({
|
|
91
|
+
id: { type: String, required: false },
|
|
92
|
+
label: { type: String, required: false },
|
|
93
|
+
disabled: { type: Boolean, required: false },
|
|
94
|
+
readonly: { type: Boolean, required: false },
|
|
95
|
+
border: { type: Boolean, required: false },
|
|
96
|
+
unstyle: { type: Boolean, required: false }
|
|
97
|
+
}, {
|
|
98
|
+
...baseInteractivePropsDefaults
|
|
99
|
+
}));
|
|
100
|
+
const emits = defineEmits(["submit"]);
|
|
101
|
+
const el = ref(null);
|
|
102
|
+
const inputEl = ref(null);
|
|
103
|
+
const $value = defineModel("modelValue", { type: Boolean, ...{ default: false } });
|
|
104
|
+
usePreHydrationValue(props.id ?? fallbackId, $value);
|
|
107
105
|
</script>
|
|
108
106
|
|
|
109
|
-
<script
|
|
110
|
-
|
|
111
|
-
type WrapperTypes = Partial<WrapperProps<"label",HTMLAttributes, {
|
|
112
|
-
/** Tailwind classes. */
|
|
113
|
-
class?: string
|
|
114
|
-
}>>
|
|
115
|
-
|
|
116
|
-
type RealProps =
|
|
117
|
-
|
|
118
|
-
& LinkableByIdProps
|
|
119
|
-
& LabelProps
|
|
120
|
-
& BaseInteractiveProps
|
|
121
|
-
& {
|
|
122
|
-
unstyle?: boolean
|
|
123
|
-
}
|
|
107
|
+
<script>
|
|
124
108
|
|
|
125
|
-
interface Props
|
|
126
|
-
extends
|
|
127
|
-
/** @vue-ignore */
|
|
128
|
-
Partial<Omit<
|
|
129
|
-
InputHTMLAttributes,
|
|
130
|
-
"class" | "readonly" | "disabled" | "onSumbit"
|
|
131
|
-
> & TailwindClassProp>,
|
|
132
|
-
/** @vue-ignore */
|
|
133
|
-
WrapperTypes,
|
|
134
|
-
RealProps
|
|
135
|
-
{}
|
|
136
109
|
</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
|
+
};
|