@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
|
@@ -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,49 @@
|
|
|
2
2
|
<!-- we use data-disabled because labels have no disabled property technically -->
|
|
3
3
|
<label
|
|
4
4
|
:id="`label-${id ?? fallbackId}`"
|
|
5
|
-
:class="
|
|
5
|
+
:class="!$attrs.unstyle && twMerge(
|
|
6
|
+
`
|
|
6
7
|
pr-0
|
|
7
8
|
text-sm
|
|
8
9
|
`,
|
|
9
|
-
|
|
10
|
-
|
|
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:
|
|
16
|
+
v-bind="{ ...$attrs, class: void 0 }"
|
|
16
17
|
>
|
|
17
18
|
<slot/>
|
|
18
19
|
</label>
|
|
19
20
|
</template>
|
|
20
21
|
|
|
21
|
-
<script setup
|
|
22
|
-
import
|
|
23
|
-
import {
|
|
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 { baseInteractivePropsDefaults, getFallbackId } from "../shared/props.js";
|
|
29
26
|
defineOptions({
|
|
30
|
-
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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(/* @__PURE__ */ _mergeDefaults({
|
|
31
|
+
id: { type: String, required: false },
|
|
32
|
+
label: { type: String, required: false },
|
|
33
|
+
disabled: { type: Boolean, required: false },
|
|
34
|
+
readonly: { type: Boolean, required: false },
|
|
35
|
+
border: { type: Boolean, required: false },
|
|
36
|
+
unstyle: { type: Boolean, required: false },
|
|
37
|
+
unstyled: { type: Boolean, required: false },
|
|
38
|
+
valid: { type: Boolean, required: false }
|
|
39
|
+
}, {
|
|
40
|
+
id: "",
|
|
41
|
+
unstyled: void 0,
|
|
42
|
+
valid: true,
|
|
43
|
+
...baseInteractivePropsDefaults
|
|
44
|
+
}));
|
|
45
|
+
const $attrs = useAttrs();
|
|
62
46
|
</script>
|
|
63
47
|
|
|
64
|
-
<script
|
|
48
|
+
<script>
|
|
65
49
|
|
|
66
50
|
</script>
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
unstyled: boolean;
|
|
18
|
+
valid: boolean;
|
|
19
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
20
|
+
default?: (props: {}) => any;
|
|
21
|
+
}>;
|
|
22
|
+
export default _default;
|
|
23
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
24
|
+
new (): {
|
|
25
|
+
$slots: S;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
3
|
v-if="$modelValue && $modelValue?.length > 0"
|
|
4
|
-
:class="
|
|
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
|
-
|
|
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:
|
|
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
|
-
|
|
42
|
+
!(disabled || readonly) && `
|
|
39
43
|
group-focus:text-accent-500
|
|
40
44
|
focus:text-accent-500`,
|
|
41
|
-
|
|
45
|
+
border && `
|
|
42
46
|
rounded-sm
|
|
43
47
|
border-neutral-400
|
|
44
48
|
border
|
|
45
49
|
focus:border-accent-400
|
|
46
50
|
`,
|
|
47
|
-
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
:tabindex="canEdit ? 0 :
|
|
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,56 +75,37 @@
|
|
|
71
75
|
</div>
|
|
72
76
|
</template>
|
|
73
77
|
|
|
74
|
-
<script setup
|
|
75
|
-
import { removeIfIn } from "@alanscodelog/utils/removeIfIn.js"
|
|
76
|
-
import { computed
|
|
77
|
-
|
|
78
|
-
import {
|
|
79
|
-
import {
|
|
80
|
-
import
|
|
81
|
-
import
|
|
82
|
-
import
|
|
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.js";
|
|
80
|
+
import { computed } from "vue";
|
|
81
|
+
import { useDivideAttrs } from "../../composables/useDivideAttrs.js";
|
|
82
|
+
import { copy } from "../../helpers/copy.js";
|
|
83
|
+
import { twMerge } from "../../utils/twMerge.js";
|
|
84
|
+
import Icon from "../Icon/Icon.vue";
|
|
85
|
+
import LibButton from "../LibButton/LibButton.vue";
|
|
86
|
+
import { baseInteractivePropsDefaults } from "../shared/props.js";
|
|
86
87
|
defineOptions({
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
88
|
+
name: "lib-multi-values",
|
|
89
|
+
inheritAttrs: false
|
|
90
|
+
});
|
|
91
|
+
const $ = useDivideAttrs(["item"]);
|
|
92
|
+
const props = defineProps(/* @__PURE__ */ _mergeDefaults({
|
|
93
|
+
label: { type: String, required: false },
|
|
94
|
+
disabled: { type: Boolean, required: false },
|
|
95
|
+
readonly: { type: Boolean, required: false },
|
|
96
|
+
border: { type: Boolean, required: false },
|
|
97
|
+
unstyle: { type: Boolean, required: false }
|
|
98
|
+
}, {
|
|
99
|
+
...baseInteractivePropsDefaults
|
|
100
|
+
}));
|
|
101
|
+
const canEdit = computed(() => !props.disabled && !props.readonly);
|
|
102
|
+
const $modelValue = defineModel({ type: Array, ...{ default: () => [] } });
|
|
103
|
+
const removeVal = (value) => {
|
|
104
|
+
if (!canEdit.value) return;
|
|
105
|
+
removeIfIn($modelValue.value, value);
|
|
106
|
+
};
|
|
105
107
|
</script>
|
|
106
108
|
|
|
107
|
-
<script
|
|
108
|
-
type WrapperTypes = Partial<WrapperProps<"item",HTMLAttributes>>
|
|
109
|
-
|
|
110
|
-
type RealProps =
|
|
111
|
-
& LabelProps
|
|
112
|
-
& BaseInteractiveProps
|
|
113
|
-
& {
|
|
114
|
-
border?: boolean
|
|
115
|
-
}
|
|
116
|
-
interface Props
|
|
117
|
-
extends
|
|
118
|
-
/** @vue-ignore */
|
|
119
|
-
Partial<Omit<HTMLAttributes,"class"> & TailwindClassProp>,
|
|
120
|
-
/** @vue-ignore */
|
|
121
|
-
WrapperTypes,
|
|
122
|
-
RealProps
|
|
123
|
-
{}
|
|
109
|
+
<script>
|
|
124
110
|
|
|
125
111
|
</script>
|
|
126
|
-
|
|
@@ -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(
|
|
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
|
-
|
|
17
|
-
|
|
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
|
-
|
|
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,53 +81,33 @@
|
|
|
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 { copy } from "../../helpers/copy.js";
|
|
88
|
+
import { NotificationHandler } from "../../helpers/NotificationHandler.js";
|
|
89
|
+
import { twMerge } from "../../utils/twMerge.js";
|
|
90
|
+
import Icon from "../Icon/Icon.vue";
|
|
91
|
+
import LibButton from "../LibButton/LibButton.vue";
|
|
92
92
|
defineOptions({
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
})
|
|
96
|
-
const $attrs = useAttrs()
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
/* Todo make this more flexible? */
|
|
106
|
-
// eslint-disable-next-line @stylistic/space-in-parens
|
|
107
|
-
const buttonColors = computed(() => props.notification.options.map((option: any /* what ??? */) => getColor(props.notification, option)))
|
|
108
|
-
|
|
109
|
-
const notificationEl = ref<null | HTMLElement>(null)
|
|
93
|
+
name: "lib-notification",
|
|
94
|
+
inheritAttrs: false
|
|
95
|
+
});
|
|
96
|
+
const $attrs = useAttrs();
|
|
97
|
+
const props = defineProps({
|
|
98
|
+
notification: { type: null, required: true },
|
|
99
|
+
handler: { type: Object, required: false, default: void 0 }
|
|
100
|
+
});
|
|
101
|
+
const getColor = (notification, option) => notification.default === option ? "primary" : notification.dangerous.includes(option) ? "danger" : "secondary";
|
|
102
|
+
const buttonColors = computed(() => props.notification.options.map((option) => getColor(props.notification, option)));
|
|
103
|
+
const notificationEl = ref(null);
|
|
110
104
|
defineExpose({
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
})
|
|
115
|
-
|
|
105
|
+
focus: () => {
|
|
106
|
+
notificationEl.value?.focus();
|
|
107
|
+
}
|
|
108
|
+
});
|
|
116
109
|
</script>
|
|
117
110
|
|
|
118
|
-
<script
|
|
119
|
-
type RealProps = {
|
|
120
|
-
notification: NotificationEntry
|
|
121
|
-
handler?: NotificationHandler
|
|
122
|
-
}
|
|
111
|
+
<script>
|
|
123
112
|
|
|
124
|
-
interface Props
|
|
125
|
-
extends
|
|
126
|
-
/** @vue-ignore */
|
|
127
|
-
Partial<Omit<HTMLAttributes,"class"> & TailwindClassProp>,
|
|
128
|
-
RealProps
|
|
129
|
-
{}
|
|
130
113
|
</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;
|