@witchcraft/ui 0.1.1 → 0.1.3
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.cjs +5 -0
- package/dist/module.d.ts +36 -0
- package/dist/module.json +2 -2
- package/dist/module.mjs +2 -1
- package/dist/runtime/assets/utils.css +1 -1
- package/dist/runtime/components/Aria/Aria.vue +9 -5
- package/dist/runtime/components/Focus.stories.d.ts +11 -0
- package/dist/runtime/components/Focus.stories.js +53 -0
- package/dist/runtime/components/Icon/Icon.vue +30 -10
- package/dist/runtime/components/LibButton/LibButton.stories.d.ts +12 -0
- package/dist/runtime/components/LibButton/LibButton.stories.js +94 -0
- package/dist/runtime/components/LibButton/LibButton.vue +72 -58
- package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.d.ts +14 -0
- package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.js +29 -0
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +74 -48
- package/dist/runtime/components/LibColorInput/LibColorInput.stories.d.ts +7 -0
- package/dist/runtime/components/LibColorInput/LibColorInput.stories.js +58 -0
- package/dist/runtime/components/LibColorInput/LibColorInput.vue +107 -63
- package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.d.ts +9 -0
- package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.js +68 -0
- package/dist/runtime/components/LibColorPicker/LibColorPicker.vue +352 -271
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.d.ts +7 -0
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.js +36 -0
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +56 -32
- package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.d.ts +11 -0
- package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.js +98 -0
- package/dist/runtime/components/LibDatePicker/LibDatePicker.vue +38 -17
- package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue +82 -53
- package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue +67 -50
- package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue +8 -7
- package/dist/runtime/components/LibDebug/LibDebug.stories.d.ts +9 -0
- package/dist/runtime/components/LibDebug/LibDebug.stories.js +46 -0
- package/dist/runtime/components/LibDebug/LibDebug.vue +70 -42
- package/dist/runtime/components/LibDevOnly/LibDevOnly.vue +31 -18
- package/dist/runtime/components/LibFileInput/LibFileInput.stories.d.ts +10 -0
- package/dist/runtime/components/LibFileInput/LibFileInput.stories.js +63 -0
- package/dist/runtime/components/LibFileInput/LibFileInput.vue +156 -113
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.d.ts +33 -0
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.js +384 -0
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +241 -215
- package/dist/runtime/components/LibLabel/LibLabel.stories.d.ts +6 -0
- package/dist/runtime/components/LibLabel/LibLabel.stories.js +25 -0
- package/dist/runtime/components/LibLabel/LibLabel.vue +46 -30
- package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.d.ts +23 -0
- package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.js +61 -0
- package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +58 -44
- package/dist/runtime/components/LibNotifications/LibNotification.stories.d.ts +15 -0
- package/dist/runtime/components/LibNotifications/LibNotification.stories.js +126 -0
- package/dist/runtime/components/LibNotifications/LibNotification.vue +48 -32
- package/dist/runtime/components/LibNotifications/LibNotifications.stories.d.ts +6 -0
- package/dist/runtime/components/LibNotifications/LibNotifications.stories.js +109 -0
- package/dist/runtime/components/LibNotifications/LibNotifications.vue +83 -63
- package/dist/runtime/components/LibPagination/LibPagination.stories.d.ts +6 -0
- package/dist/runtime/components/LibPagination/LibPagination.stories.js +40 -0
- package/dist/runtime/components/LibPagination/LibPagination.vue +111 -67
- package/dist/runtime/components/LibPalette/LibPalette.stories.d.ts +6 -0
- package/dist/runtime/components/LibPalette/LibPalette.stories.js +20 -0
- package/dist/runtime/components/LibPalette/LibPalette.vue +23 -20
- package/dist/runtime/components/LibPopup/LibPopup.stories.d.ts +14 -0
- package/dist/runtime/components/LibPopup/LibPopup.stories.js +147 -0
- package/dist/runtime/components/LibPopup/LibPopup.vue +351 -314
- package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.d.ts +10 -0
- package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.js +81 -0
- package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +91 -70
- package/dist/runtime/components/LibRecorder/LibRecorder.stories.d.ts +19 -0
- package/dist/runtime/components/LibRecorder/LibRecorder.stories.js +63 -0
- package/dist/runtime/components/LibRecorder/LibRecorder.vue +177 -133
- package/dist/runtime/components/LibRoot/LibRoot.vue +100 -73
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.d.ts +26 -0
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.js +78 -0
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue +77 -49
- package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.d.ts +27 -0
- package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.js +112 -0
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +156 -123
- package/dist/runtime/components/LibTable/LibTable.stories.d.ts +16 -0
- package/dist/runtime/components/LibTable/LibTable.stories.js +156 -0
- package/dist/runtime/components/LibTable/LibTable.vue +99 -63
- package/dist/runtime/components/Reset.stories.d.ts +5 -0
- package/dist/runtime/components/Reset.stories.js +19 -0
- package/dist/runtime/components/Scrolling.stories.d.ts +6 -0
- package/dist/runtime/components/Scrolling.stories.js +44 -0
- package/dist/runtime/components/Template/NAME.vue +36 -15
- package/dist/runtime/components/TestControls/TestControls.vue +9 -6
- package/dist/runtime/composables/useScrollNearContainerEdges.stories.d.ts +7 -0
- package/dist/runtime/composables/useScrollNearContainerEdges.stories.js +85 -0
- package/dist/types.d.mts +6 -2
- package/dist/types.d.ts +7 -0
- package/package.json +11 -5
- package/src/module.ts +2 -1
- package/src/runtime/assets/utils.css +5 -5
- package/src/runtime/components/LibButton/LibButton.vue +2 -6
- package/src/runtime/nuxt/plugins/vue-plugin.ts +1 -1
- package/dist/runtime/components/Aria/Aria.vue.d.ts +0 -5
- package/dist/runtime/components/Icon/Icon.vue.d.ts +0 -21
- package/dist/runtime/components/LibButton/LibButton.vue.d.ts +0 -36
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +0 -42
- package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +0 -63
- package/dist/runtime/components/LibColorPicker/LibColorPicker.vue.d.ts +0 -61
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts +0 -22
- package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +0 -40
- package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue.d.ts +0 -34
- package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue.d.ts +0 -34
- package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue.d.ts +0 -22
- package/dist/runtime/components/LibDebug/LibDebug.vue.d.ts +0 -32
- package/dist/runtime/components/LibDevOnly/LibDevOnly.vue.d.ts +0 -22
- package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +0 -43
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +0 -165
- package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +0 -27
- package/dist/runtime/components/LibMultiValues/LibMultiValues.vue.d.ts +0 -29
- package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +0 -17
- package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +0 -13
- package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +0 -104
- package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +0 -14
- package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +0 -46
- package/dist/runtime/components/LibProgressBar/LibProgressBar.vue.d.ts +0 -41
- package/dist/runtime/components/LibRecorder/LibRecorder.vue.d.ts +0 -77
- package/dist/runtime/components/LibRoot/LibRoot.vue.d.ts +0 -41
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue.d.ts +0 -35
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +0 -94
- package/dist/runtime/components/LibTable/LibTable.vue.d.ts +0 -45
- package/dist/runtime/components/Template/NAME.vue.d.ts +0 -17
- package/dist/runtime/components/TestControls/TestControls.vue.d.ts +0 -5
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
:style="`background-color: var(${color});`"
|
|
8
8
|
:class="`theme-palette--item h-10 rounded-sm flex items-center justify-center text-fg dark:text-bg`"
|
|
9
9
|
>
|
|
10
|
-
{{ [5, 16, 27, 38, 49].includes(i) ?
|
|
10
|
+
{{ [5, 16, 27, 38, 49].includes(i) ? 'Text':'' }}
|
|
11
11
|
</div>
|
|
12
12
|
</template>
|
|
13
13
|
</div>
|
|
@@ -22,25 +22,28 @@
|
|
|
22
22
|
</div>
|
|
23
23
|
</template>
|
|
24
24
|
|
|
25
|
-
<script>
|
|
26
|
-
export default { name: "lib-palette" }
|
|
25
|
+
<script lang="ts">
|
|
26
|
+
export default { name: "lib-palette" }
|
|
27
27
|
</script>
|
|
28
28
|
|
|
29
|
-
<script setup>
|
|
30
|
-
import { keys } from "@alanscodelog/utils/keys.js"
|
|
31
|
-
import {} from "metamorphosis"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
29
|
+
<script setup lang="ts">
|
|
30
|
+
import { keys } from "@alanscodelog/utils/keys.js"
|
|
31
|
+
import { type Theme } from "metamorphosis"
|
|
32
|
+
|
|
33
|
+
import { type BaseInteractiveProps, baseInteractivePropsDefaults,type LinkableByIdProps } from "../shared/props.js"
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
const props = withDefaults(defineProps<
|
|
37
|
+
& LinkableByIdProps
|
|
38
|
+
& BaseInteractiveProps
|
|
39
|
+
& {
|
|
40
|
+
theme: Theme
|
|
41
|
+
}>(), {
|
|
42
|
+
theme: () => ({} as any),
|
|
43
|
+
...baseInteractivePropsDefaults
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
const exclude = ["--color-bg", "--color-fg"]
|
|
47
|
+
const colors = keys(props.theme.css).filter(key => key.startsWith("--color") && !exclude.includes(key))
|
|
48
|
+
|
|
46
49
|
</script>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/vue3";
|
|
2
|
+
import LibPopup from "./LibPopup.vue.js";
|
|
3
|
+
declare const meta: Meta<typeof LibPopup>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof LibPopup>;
|
|
6
|
+
export declare const Primary: Story;
|
|
7
|
+
export declare const PopupNoShift: any;
|
|
8
|
+
/** When the popup is too wide, it's positioned to the left and overflow scroll is set with an invisible scrollbar. */
|
|
9
|
+
export declare const PopupTooBig: any;
|
|
10
|
+
export declare const PopupCenterScreen: any;
|
|
11
|
+
export declare const PopupRightBottomMost: any;
|
|
12
|
+
export declare const PopupLeftTopMost: any;
|
|
13
|
+
export declare const PopupCenterMost: any;
|
|
14
|
+
export declare const LeftMenuShapeExample: any;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { computed, ref, watch } from "vue";
|
|
2
|
+
import LibPopup from "./LibPopup.vue";
|
|
3
|
+
import { vExtractRootEl } from "../../directives/vExtractRootEl.js";
|
|
4
|
+
import * as components from "../index.js";
|
|
5
|
+
const meta = {
|
|
6
|
+
component: LibPopup,
|
|
7
|
+
title: "Components/Popup",
|
|
8
|
+
args: {}
|
|
9
|
+
};
|
|
10
|
+
export default meta;
|
|
11
|
+
export const Primary = {
|
|
12
|
+
render: (args) => ({
|
|
13
|
+
components,
|
|
14
|
+
directives: { extractRootEl: vExtractRootEl },
|
|
15
|
+
setup: () => {
|
|
16
|
+
const value = ref(false);
|
|
17
|
+
const buttonPositions = ["TL", "TC", "TR", "BL", "BC", "BR"];
|
|
18
|
+
const buttonPos = ref("TL");
|
|
19
|
+
const autoRotatePos = ref(true);
|
|
20
|
+
const buttonStyle = computed(() => {
|
|
21
|
+
switch (buttonPos.value) {
|
|
22
|
+
case "TL":
|
|
23
|
+
return `align-self: flex-start; justify-self: flex-start;`;
|
|
24
|
+
case "TC":
|
|
25
|
+
return `align-self: flex-start; justify-self: center;`;
|
|
26
|
+
case "TR":
|
|
27
|
+
return `align-self: flex-start; justify-self: flex-end;`;
|
|
28
|
+
case "BL":
|
|
29
|
+
return `align-self: flex-end; justify-self: flex-start;`;
|
|
30
|
+
case "BC":
|
|
31
|
+
return `align-self: flex-end; justify-self: center;`;
|
|
32
|
+
case "BR":
|
|
33
|
+
return `align-self: flex-end; justify-self: flex-end;`;
|
|
34
|
+
default:
|
|
35
|
+
return "";
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
watch(value, () => {
|
|
39
|
+
if (!value.value && autoRotatePos.value) {
|
|
40
|
+
const buttonI = buttonPositions.indexOf(buttonPos.value);
|
|
41
|
+
if (buttonI < 5) {
|
|
42
|
+
buttonPos.value = buttonPositions[buttonI + 1];
|
|
43
|
+
} else {
|
|
44
|
+
buttonPos.value = buttonPositions[0];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return {
|
|
49
|
+
args,
|
|
50
|
+
buttonPos,
|
|
51
|
+
autoRotatePos,
|
|
52
|
+
buttonStyle,
|
|
53
|
+
value
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
template: `
|
|
57
|
+
<lib-simple-input
|
|
58
|
+
:suggestions="['TL', 'TR', 'BL', 'BR']"
|
|
59
|
+
:restrict-to-suggestions="true"
|
|
60
|
+
:suggestions-filter="(_, items) => items"
|
|
61
|
+
:label="'Button Position'"
|
|
62
|
+
v-model="buttonPos"
|
|
63
|
+
>
|
|
64
|
+
</lib-simple-input>
|
|
65
|
+
<div>
|
|
66
|
+
<label>Auto Rotate Position</label>
|
|
67
|
+
<input type="checkbox" v-model="autoRotatePos">
|
|
68
|
+
</div>
|
|
69
|
+
<div class="test bg-transparency-squares" style="display:grid;height:80vh;padding:50px;border:1px solid black;">
|
|
70
|
+
|
|
71
|
+
<lib-popup v-model="value" v-bind="{ ...args, width:undefined, }" >
|
|
72
|
+
{{value}}
|
|
73
|
+
<template #button="{extractEl}">
|
|
74
|
+
<lib-button :style="buttonStyle" @click="value = !value" v-extract-root-el="extractEl">Toggle Popup</lib-button>
|
|
75
|
+
</template>
|
|
76
|
+
<template #popup="{position, extractEl}">
|
|
77
|
+
<lib-debug
|
|
78
|
+
v-extract-root-el="extractEl"
|
|
79
|
+
:style="(args.width ? \`width: \${args.width};\` : '') + (args.height ? \`height: \${args.height};\` : '')"
|
|
80
|
+
class="bg-bg dark:bg-fg w-[500px]"
|
|
81
|
+
>
|
|
82
|
+
{{ position }}
|
|
83
|
+
</lib-debug>
|
|
84
|
+
</template>
|
|
85
|
+
</lib-popup>
|
|
86
|
+
</div>
|
|
87
|
+
`
|
|
88
|
+
})
|
|
89
|
+
};
|
|
90
|
+
export const PopupNoShift = {
|
|
91
|
+
...Primary,
|
|
92
|
+
args: {
|
|
93
|
+
avoidRepositioning: true
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
export const PopupTooBig = {
|
|
97
|
+
...Primary,
|
|
98
|
+
args: {
|
|
99
|
+
width: "110vw"
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
export const PopupCenterScreen = {
|
|
103
|
+
...Primary,
|
|
104
|
+
args: {
|
|
105
|
+
width: "500px",
|
|
106
|
+
height: "500px",
|
|
107
|
+
preferredHorizontal: ["center-screen"],
|
|
108
|
+
preferredVertical: ["center-screen"]
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
export const PopupRightBottomMost = {
|
|
112
|
+
...Primary,
|
|
113
|
+
args: {
|
|
114
|
+
width: "500px",
|
|
115
|
+
height: "500px",
|
|
116
|
+
preferredHorizontal: ["right-most"],
|
|
117
|
+
preferredVertical: ["bottom-most"]
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
export const PopupLeftTopMost = {
|
|
121
|
+
...Primary,
|
|
122
|
+
args: {
|
|
123
|
+
width: "500px",
|
|
124
|
+
height: "500px",
|
|
125
|
+
preferredHorizontal: ["left-most"],
|
|
126
|
+
preferredVertical: ["top-most"]
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
export const PopupCenterMost = {
|
|
130
|
+
...Primary,
|
|
131
|
+
args: {
|
|
132
|
+
width: "500px",
|
|
133
|
+
height: "500px",
|
|
134
|
+
preferredHorizontal: ["center-most"],
|
|
135
|
+
preferredVertical: ["center-most"]
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
export const LeftMenuShapeExample = {
|
|
139
|
+
...Primary,
|
|
140
|
+
args: {
|
|
141
|
+
width: "300px",
|
|
142
|
+
height: "500px",
|
|
143
|
+
preferredHorizontal: ["left-most"],
|
|
144
|
+
preferredVertical: ["center-most"],
|
|
145
|
+
avoidRepositioning: true
|
|
146
|
+
}
|
|
147
|
+
};
|