@witchcraft/ui 0.0.1 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -28
- package/dist/module.d.mts +3 -1
- package/dist/module.json +3 -3
- package/dist/module.mjs +21 -12
- package/dist/runtime/assets/base.css +1 -1
- package/dist/runtime/assets/locales/en.json +2 -2
- package/dist/runtime/assets/tailwind.css +1 -1
- package/dist/runtime/assets/utils.css +1 -0
- package/dist/runtime/build/WitchcraftUiResolver.js +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 +12 -28
- package/dist/runtime/components/Icon/Icon.vue.d.ts +21 -0
- package/dist/runtime/components/LibButton/LibButton.vue +93 -117
- package/dist/runtime/components/LibButton/LibButton.vue.d.ts +36 -0
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +53 -76
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +42 -0
- package/dist/runtime/components/LibColorInput/LibColorInput.vue +131 -101
- package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +63 -0
- package/dist/runtime/components/LibColorPicker/LibColorPicker.vue +326 -296
- package/dist/runtime/components/LibColorPicker/LibColorPicker.vue.d.ts +61 -0
- package/dist/runtime/components/LibColorPicker/utils/safeConvertToHsva.d.ts +2 -0
- package/dist/runtime/components/LibColorPicker/utils/safeConvertToHsva.js +18 -0
- package/dist/runtime/components/LibColorPicker/utils/safeConvertToRgba.d.ts +2 -0
- package/dist/runtime/components/LibColorPicker/utils/safeConvertToRgba.js +17 -0
- package/dist/runtime/components/LibColorPicker/utils/toLowPrecisionRgbaString.d.ts +2 -0
- package/dist/runtime/components/LibColorPicker/utils/toLowPrecisionRgbaString.js +8 -0
- package/dist/runtime/components/LibColorPicker/utils/truncate.d.ts +1 -0
- package/dist/runtime/components/LibColorPicker/utils/truncate.js +5 -0
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +42 -64
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts +22 -0
- package/dist/runtime/components/LibDatePicker/LibDatePicker.vue +20 -54
- package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +40 -0
- package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue +205 -173
- package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue.d.ts +34 -0
- package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue +215 -164
- package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue.d.ts +34 -0
- package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue +9 -10
- package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue.d.ts +22 -0
- package/dist/runtime/components/LibDebug/LibDebug.vue +47 -65
- package/dist/runtime/components/LibDebug/LibDebug.vue.d.ts +32 -0
- package/dist/runtime/components/LibDevOnly/LibDevOnly.vue +19 -34
- package/dist/runtime/components/LibDevOnly/LibDevOnly.vue.d.ts +22 -0
- package/dist/runtime/components/LibFileInput/LibFileInput.vue +155 -173
- package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +43 -0
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +352 -0
- 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 +50 -66
- package/dist/runtime/components/LibMultiValues/LibMultiValues.vue.d.ts +29 -0
- package/dist/runtime/components/LibNotifications/LibNotification.vue +48 -56
- package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +17 -0
- package/dist/runtime/components/LibNotifications/LibNotifications.vue +71 -83
- package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +13 -0
- package/dist/runtime/components/LibPagination/LibPagination.vue +86 -131
- package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +104 -0
- package/dist/runtime/components/LibPalette/LibPalette.vue +23 -26
- package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +14 -0
- package/dist/runtime/components/LibPopup/LibPopup.vue +326 -400
- package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +46 -0
- package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +73 -93
- package/dist/runtime/components/LibProgressBar/LibProgressBar.vue.d.ts +41 -0
- package/dist/runtime/components/LibRecorder/LibRecorder.vue +134 -179
- package/dist/runtime/components/LibRecorder/LibRecorder.vue.d.ts +77 -0
- package/dist/runtime/components/LibRoot/LibRoot.vue +75 -89
- package/dist/runtime/components/LibRoot/LibRoot.vue.d.ts +41 -0
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue +51 -82
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue.d.ts +35 -0
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +147 -164
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +94 -0
- package/dist/runtime/components/LibTable/LibTable.vue +69 -106
- 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 +7 -10
- package/dist/runtime/components/TestControls/TestControls.vue.d.ts +5 -0
- package/dist/runtime/components/index.d.ts +12 -11
- package/dist/runtime/components/index.js +12 -11
- package/dist/runtime/components/shared/props.d.ts +81 -16
- package/dist/runtime/components/shared/storyHelpers/playInput.js +5 -5
- package/dist/runtime/components/shared/storyHelpers/playSuggestions.js +15 -11
- package/dist/runtime/composables/index.d.ts +5 -0
- package/dist/runtime/composables/index.js +5 -0
- package/dist/runtime/composables/useDivideAttrs.js +1 -0
- package/dist/runtime/composables/useDragWithThreshold.d.ts +71 -0
- package/dist/runtime/composables/useDragWithThreshold.js +40 -0
- package/dist/runtime/composables/usePreHydrationValue.d.ts +12 -0
- package/dist/runtime/composables/usePreHydrationValue.js +15 -0
- package/dist/runtime/composables/useSetupI18n.d.ts +2 -0
- package/dist/runtime/composables/useSetupI18n.js +5 -1
- package/dist/runtime/composables/useSuggestions.d.ts +7 -5
- package/dist/runtime/composables/useSuggestions.js +94 -57
- package/dist/runtime/directives/vResizableCols.js +92 -84
- package/dist/runtime/helpers/NotificationHandler.d.ts +5 -0
- package/dist/runtime/helpers/index.d.ts +3 -1
- package/dist/runtime/helpers/index.js +3 -1
- package/dist/runtime/types/index.d.ts +6 -0
- package/dist/runtime/utils/notifyIfError.d.ts +14 -0
- package/dist/runtime/utils/notifyIfError.js +29 -0
- package/dist/types.d.mts +2 -6
- package/package.json +27 -29
- package/src/module.ts +31 -12
- package/src/runtime/assets/base.css +10 -1
- package/src/runtime/assets/locales/en.json +2 -2
- package/src/runtime/assets/tailwind.css +1 -1
- package/src/runtime/assets/{style.css → utils.css} +86 -4
- package/src/runtime/build/WitchcraftUiResolver.ts +1 -1
- package/src/runtime/components/Focus.stories.ts +3 -2
- package/src/runtime/components/Icon/Icon.vue +10 -6
- package/src/runtime/components/LibButton/LibButton.vue +41 -47
- package/src/runtime/components/LibCheckbox/LibCheckbox.vue +7 -4
- package/src/runtime/components/LibColorInput/LibColorInput.vue +111 -37
- package/src/runtime/components/LibColorPicker/LibColorPicker.stories.ts +25 -4
- package/src/runtime/components/LibColorPicker/LibColorPicker.vue +242 -131
- package/src/runtime/components/LibColorPicker/utils/safeConvertToHsva.ts +24 -0
- package/src/runtime/components/LibColorPicker/utils/safeConvertToRgba.ts +23 -0
- package/src/runtime/components/LibColorPicker/utils/toLowPrecisionRgbaString.ts +13 -0
- package/src/runtime/components/LibColorPicker/utils/truncate.ts +6 -0
- package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.ts +1 -1
- package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +11 -9
- package/src/runtime/components/LibDatePicker/LibDatePicker.vue +4 -17
- package/src/runtime/components/LibDatePicker/LibRangeDatePicker.vue +192 -131
- package/src/runtime/components/LibDatePicker/LibSingleDatePicker.vue +183 -115
- package/src/runtime/components/LibDatePicker/LibTimeZonePicker.vue +3 -3
- package/src/runtime/components/LibDebug/LibDebug.vue +15 -5
- package/src/runtime/components/LibDevOnly/LibDevOnly.vue +1 -3
- package/src/runtime/components/LibFileInput/LibFileInput.vue +54 -29
- package/src/runtime/components/{LibInput/LibInput.stories.ts → LibInputDeprecated/LibInputDeprecated.stories.ts} +64 -19
- package/{dist/runtime/components/LibInput/LibInput.vue → src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue} +40 -34
- package/src/runtime/components/LibLabel/LibLabel.vue +2 -2
- package/src/runtime/components/LibMultiValues/LibMultiValues.stories.ts +5 -4
- package/src/runtime/components/LibMultiValues/LibMultiValues.vue +11 -13
- package/src/runtime/components/LibNotifications/LibNotification.vue +19 -11
- package/src/runtime/components/LibNotifications/LibNotifications.stories.ts +2 -2
- package/src/runtime/components/LibNotifications/LibNotifications.vue +20 -12
- package/src/runtime/components/LibPagination/LibPagination.stories.ts +2 -2
- package/src/runtime/components/LibPagination/LibPagination.vue +19 -20
- package/src/runtime/components/LibPalette/LibPalette.vue +3 -3
- package/src/runtime/components/LibPopup/LibPopup.stories.ts +2 -2
- package/src/runtime/components/LibPopup/LibPopup.vue +30 -67
- package/src/runtime/components/LibProgressBar/LibProgressBar.vue +3 -2
- package/src/runtime/components/LibRecorder/LibRecorder.vue +2 -3
- package/src/runtime/components/LibRoot/LibRoot.vue +14 -1
- package/src/runtime/components/LibSimpleInput/LibSimpleInput.stories.ts +1 -1
- package/src/runtime/components/LibSimpleInput/LibSimpleInput.vue +5 -8
- package/src/runtime/components/LibSuggestions/LibSuggestions.vue +42 -26
- package/src/runtime/components/LibTable/LibTable.vue +8 -9
- package/src/runtime/components/Scrolling.stories.ts +58 -0
- package/src/runtime/components/Template/NAME.vue +1 -1
- package/src/runtime/components/TestControls/TestControls.vue +1 -1
- package/src/runtime/components/index.ts +12 -12
- package/src/runtime/components/shared/props.ts +82 -19
- package/src/runtime/components/shared/storyHelpers/playInput.ts +6 -5
- package/src/runtime/components/shared/storyHelpers/playSuggestions.ts +25 -11
- package/src/runtime/composables/index.ts +5 -0
- package/src/runtime/composables/useDarkMode.ts +2 -2
- package/src/runtime/composables/useDivideAttrs.ts +1 -0
- package/src/runtime/composables/useDragWithThreshold.ts +108 -0
- package/src/runtime/composables/usePreHydrationValue.ts +30 -0
- package/src/runtime/composables/useSetupI18n.ts +8 -2
- package/src/runtime/composables/useSuggestions.ts +92 -45
- package/src/runtime/directives/vResizableCols.ts +82 -74
- package/src/runtime/helpers/NotificationHandler.ts +5 -0
- package/src/runtime/helpers/index.ts +3 -1
- package/src/runtime/types/index.ts +5 -0
- package/src/runtime/utils/notifyIfError.ts +45 -0
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -34
- package/dist/runtime/assets/style.css +0 -1
- 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 -7
- package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.js +0 -51
- 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/LibInput/LibInput.stories.d.ts +0 -33
- package/dist/runtime/components/LibInput/LibInput.stories.js +0 -339
- 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 -60
- 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/composables/useScrollNearContainerEdges.stories.d.ts +0 -7
- package/dist/runtime/composables/useScrollNearContainerEdges.stories.js +0 -85
- package/dist/runtime/helpers/addValue.d.ts +0 -1
- package/dist/runtime/helpers/addValue.js +0 -8
- package/dist/types.d.ts +0 -7
- package/src/runtime/components/LibInput/LibInput.vue +0 -372
- package/src/runtime/helpers/addValue.ts +0 -10
- /package/src/runtime/components/{reset.stories.ts → Reset.stories.ts} +0 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type HTMLAttributes } from "vue";
|
|
2
|
+
import { type LinkableByIdProps, type TailwindClassProp, type PopupProps } from "../shared/props.js.js";
|
|
3
|
+
import type { IPopupReference, PopupPositioner } from "../../types/index.js.js";
|
|
4
|
+
type RealProps = LinkableByIdProps & PopupProps;
|
|
5
|
+
interface Props extends
|
|
6
|
+
/** @vue-ignore */
|
|
7
|
+
Partial<Omit<HTMLAttributes, "class"> & TailwindClassProp>, RealProps {
|
|
8
|
+
}
|
|
9
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props & {
|
|
10
|
+
modelValue?: boolean;
|
|
11
|
+
}, {
|
|
12
|
+
recompute: (force?: boolean) => void;
|
|
13
|
+
setReference: (el: IPopupReference | null) => void;
|
|
14
|
+
setBackground: (el: IPopupReference | null) => void;
|
|
15
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
16
|
+
"update:modelValue": (value: boolean) => any;
|
|
17
|
+
} & {
|
|
18
|
+
close: () => any;
|
|
19
|
+
}, string, import("vue").PublicProps, Readonly<Props & {
|
|
20
|
+
modelValue?: boolean;
|
|
21
|
+
}> & Readonly<{
|
|
22
|
+
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
23
|
+
onClose?: (() => any) | undefined;
|
|
24
|
+
}>, {
|
|
25
|
+
canClose: boolean;
|
|
26
|
+
useDialogForBackdrop: false;
|
|
27
|
+
useBackdrop: boolean;
|
|
28
|
+
preferredHorizontal: ("center" | "right" | "left" | "either" | "center-screen" | "right-most" | "left-most" | "center-most")[] | PopupPositioner;
|
|
29
|
+
preferredVertical: ("top" | "bottom" | "center" | "either" | "center-screen" | "top-most" | "bottom-most" | "center-most")[] | PopupPositioner;
|
|
30
|
+
avoidRepositioning: boolean;
|
|
31
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
32
|
+
button?: (props: {
|
|
33
|
+
extractEl: (_: any) => any;
|
|
34
|
+
}) => any;
|
|
35
|
+
} & {
|
|
36
|
+
popup?: (props: {
|
|
37
|
+
position: any;
|
|
38
|
+
extractEl: (_: any) => any;
|
|
39
|
+
}) => any;
|
|
40
|
+
}>;
|
|
41
|
+
export default _default;
|
|
42
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
43
|
+
new (): {
|
|
44
|
+
$slots: S;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<div v-if="!hide"
|
|
4
4
|
:id="id ?? fallbackId"
|
|
5
5
|
:class="twMerge(`
|
|
6
|
+
progress-bar
|
|
6
7
|
w-[200px]
|
|
7
8
|
whitespace-nowrap
|
|
8
9
|
overflow-x-scroll
|
|
@@ -34,20 +35,20 @@
|
|
|
34
35
|
before:transition-all
|
|
35
36
|
before:z-1
|
|
36
37
|
before:duration-500
|
|
37
|
-
`,psuedoHide && `
|
|
38
|
+
`, psuedoHide && `
|
|
38
39
|
after:opacity-0
|
|
39
40
|
before:opacity-0
|
|
40
|
-
`,
|
|
41
|
+
`, $attrs.class)"
|
|
41
42
|
:data-value="progress"
|
|
42
43
|
:title="label"
|
|
43
44
|
role="progressbar"
|
|
44
45
|
:aria-valuenow="clampVal(progress, clamp[0] ?? 0, clamp[1] ?? 100)"
|
|
45
46
|
:aria-valuemin="clamp[0] ?? 0"
|
|
46
47
|
:aria-valuemax="clamp[1] ?? 100"
|
|
47
|
-
v-bind="{...$attrs, class:
|
|
48
|
+
v-bind="{ ...$attrs, class: void 0 }"
|
|
48
49
|
:style="`--progress: ${clampVal(progress, clamp[0] ?? 0, clamp[1] ?? 100)}%;`"
|
|
49
50
|
>
|
|
50
|
-
<div class="label-wrapper relative flex-1">
|
|
51
|
+
<div class="procgress-bar--label-wrapper relative flex-1">
|
|
51
52
|
<span class="before:content-vertical-holder"/>
|
|
52
53
|
<Transition>
|
|
53
54
|
<slot>
|
|
@@ -71,6 +72,7 @@
|
|
|
71
72
|
<label
|
|
72
73
|
v-if="!psuedoHide"
|
|
73
74
|
class="
|
|
75
|
+
progress-bar--label
|
|
74
76
|
contrast-label
|
|
75
77
|
pointer-events-none
|
|
76
78
|
absolute
|
|
@@ -91,102 +93,80 @@
|
|
|
91
93
|
</div>
|
|
92
94
|
</Transition>
|
|
93
95
|
</template>
|
|
94
|
-
<script setup lang="ts">
|
|
95
|
-
import { type HTMLAttributes,type PropType, ref, watch } from "vue"
|
|
96
|
-
|
|
97
|
-
import { twMerge } from "../../utils/twMerge.js"
|
|
98
|
-
import { type BaseInteractiveProps, baseInteractivePropsDefaults,getFallbackId,type LabelProps, type LinkableByIdProps, type TailwindClassProp } from "../shared/props.js"
|
|
99
|
-
|
|
100
|
-
// TODO move to utils
|
|
101
|
-
const clampVal = (n: number, min: number, max: number) => Math.min(Math.max(n, min), max)
|
|
102
96
|
|
|
97
|
+
<script setup>
|
|
98
|
+
import { ref, watch } from "vue";
|
|
99
|
+
import { twMerge } from "../../utils/twMerge.js";
|
|
100
|
+
import { baseInteractivePropsDefaults, getFallbackId } from "../shared/props.js";
|
|
101
|
+
const clampVal = (n, min, max) => Math.min(Math.max(n, min), max);
|
|
103
102
|
defineOptions({
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
})
|
|
107
|
-
const fallbackId = getFallbackId()
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
103
|
+
name: "lib-progress-bar",
|
|
104
|
+
inheritAttrs: false
|
|
105
|
+
});
|
|
106
|
+
const fallbackId = getFallbackId();
|
|
107
|
+
const props = defineProps(/* @__PURE__ */ _mergeDefaults({
|
|
108
|
+
id: { type: String, required: false },
|
|
109
|
+
disabled: { type: Boolean, required: false },
|
|
110
|
+
readonly: { type: Boolean, required: false },
|
|
111
|
+
border: { type: Boolean, required: false },
|
|
112
|
+
unstyle: { type: Boolean, required: false },
|
|
113
|
+
label: { type: String, required: false },
|
|
114
|
+
progress: { type: Number, required: true },
|
|
115
|
+
autohideOnComplete: { type: Number, required: false },
|
|
116
|
+
keepSpaceWhenHidden: { type: Boolean, required: false },
|
|
117
|
+
clamp: { type: Array, required: false }
|
|
118
|
+
}, {
|
|
119
|
+
autohideOnComplete: -1,
|
|
120
|
+
keepSpaceWhenHidden: false,
|
|
121
|
+
clamp: () => [0, 100],
|
|
122
|
+
...baseInteractivePropsDefaults
|
|
123
|
+
}));
|
|
124
|
+
const hide = ref(false);
|
|
125
|
+
const psuedoHide = ref(false);
|
|
126
|
+
let timeout;
|
|
127
|
+
let type;
|
|
119
128
|
if (props.autohideOnComplete > -1 && (props.progress >= 100 || props.progress < 0)) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
129
|
+
if (props.keepSpaceWhenHidden) {
|
|
130
|
+
hide.value = false;
|
|
131
|
+
psuedoHide.value = true;
|
|
132
|
+
} else {
|
|
133
|
+
hide.value = true;
|
|
134
|
+
psuedoHide.value = false;
|
|
135
|
+
}
|
|
127
136
|
}
|
|
128
|
-
|
|
129
137
|
watch([
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
138
|
+
() => props.progress,
|
|
139
|
+
() => props.keepSpaceWhenHidden,
|
|
140
|
+
() => props.autohideOnComplete
|
|
133
141
|
], () => {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}, { immediate: false })
|
|
160
|
-
|
|
142
|
+
if (props.autohideOnComplete > -1 && (props.progress >= 100 || props.progress < 0)) {
|
|
143
|
+
if (props.keepSpaceWhenHidden) {
|
|
144
|
+
if (type === 1) return;
|
|
145
|
+
clearTimeout(timeout);
|
|
146
|
+
type = 1;
|
|
147
|
+
timeout = setTimeout(() => {
|
|
148
|
+
type = 0;
|
|
149
|
+
hide.value = false;
|
|
150
|
+
psuedoHide.value = true;
|
|
151
|
+
}, props.autohideOnComplete);
|
|
152
|
+
} else {
|
|
153
|
+
if (type === 2) return;
|
|
154
|
+
clearTimeout(timeout);
|
|
155
|
+
type = 2;
|
|
156
|
+
timeout = setTimeout(() => {
|
|
157
|
+
type = 0;
|
|
158
|
+
hide.value = true;
|
|
159
|
+
psuedoHide.value = false;
|
|
160
|
+
}, props.autohideOnComplete);
|
|
161
|
+
}
|
|
162
|
+
} else {
|
|
163
|
+
clearTimeout(timeout);
|
|
164
|
+
hide.value = false;
|
|
165
|
+
psuedoHide.value = false;
|
|
166
|
+
}
|
|
167
|
+
}, { immediate: false });
|
|
161
168
|
</script>
|
|
162
|
-
<script lang="ts">
|
|
163
|
-
|
|
164
|
-
type RealProps =
|
|
165
|
-
& LinkableByIdProps
|
|
166
|
-
& BaseInteractiveProps
|
|
167
|
-
& LabelProps
|
|
168
|
-
& {
|
|
169
|
-
progress: number
|
|
170
|
-
/** Will auto hide after this given time if progress is 100% or more or less than 0% until progress is set to something else. Disabled (-1) by default. */
|
|
171
|
-
autohideOnComplete?: number
|
|
172
|
-
/**
|
|
173
|
-
* Do not actually hide the element, just leave an unstyled div,
|
|
174
|
-
* so the whole layout doesn't change on completion when autohideOnComplete is set.
|
|
175
|
-
*/
|
|
176
|
-
keepSpaceWhenHidden?: boolean
|
|
177
|
-
/**
|
|
178
|
-
* By default the progress bar is visually clamped to 0-100, even if the value might be something else.
|
|
179
|
-
* You can change what it's clamped to here, to for example,
|
|
180
|
-
* show at least a small sliver of the progress bar when it's still 0.
|
|
181
|
-
*/
|
|
182
|
-
clamp?: [start:number, end:number]
|
|
183
|
-
}
|
|
184
169
|
|
|
185
|
-
|
|
186
|
-
extends
|
|
187
|
-
/** @vue-ignore */
|
|
188
|
-
Partial<Omit<HTMLAttributes,"class"> & TailwindClassProp>,
|
|
189
|
-
RealProps
|
|
190
|
-
{ }
|
|
170
|
+
<script>
|
|
191
171
|
|
|
192
172
|
</script>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type HTMLAttributes } from "vue";
|
|
2
|
+
import { type BaseInteractiveProps, type LabelProps, type LinkableByIdProps, type TailwindClassProp } from "../shared/props.js.js";
|
|
3
|
+
type RealProps = LinkableByIdProps & BaseInteractiveProps & LabelProps & {
|
|
4
|
+
progress: number;
|
|
5
|
+
/** Will auto hide after this given time if progress is 100% or more or less than 0% until progress is set to something else. Disabled (-1) by default. */
|
|
6
|
+
autohideOnComplete?: number;
|
|
7
|
+
/**
|
|
8
|
+
* Do not actually hide the element, just leave an unstyled div,
|
|
9
|
+
* so the whole layout doesn't change on completion when autohideOnComplete is set.
|
|
10
|
+
*/
|
|
11
|
+
keepSpaceWhenHidden?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* By default the progress bar is visually clamped to 0-100, even if the value might be something else.
|
|
14
|
+
* You can change what it's clamped to here, to for example,
|
|
15
|
+
* show at least a small sliver of the progress bar when it's still 0.
|
|
16
|
+
*/
|
|
17
|
+
clamp?: [start: number, end: number];
|
|
18
|
+
};
|
|
19
|
+
interface Props extends
|
|
20
|
+
/** @vue-ignore */
|
|
21
|
+
Partial<Omit<HTMLAttributes, "class"> & TailwindClassProp>, RealProps {
|
|
22
|
+
}
|
|
23
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
24
|
+
disabled: boolean;
|
|
25
|
+
readonly: boolean;
|
|
26
|
+
border: boolean;
|
|
27
|
+
unstyle: boolean;
|
|
28
|
+
autohideOnComplete: number;
|
|
29
|
+
keepSpaceWhenHidden: boolean;
|
|
30
|
+
clamp: [start: number, end: number];
|
|
31
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
32
|
+
default?: (props: {}) => any;
|
|
33
|
+
} & {
|
|
34
|
+
default?: (props: {}) => any;
|
|
35
|
+
}>;
|
|
36
|
+
export default _default;
|
|
37
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
38
|
+
new (): {
|
|
39
|
+
$slots: S;
|
|
40
|
+
};
|
|
41
|
+
};
|