@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.
Files changed (224) hide show
  1. package/README.md +18 -28
  2. package/dist/module.d.mts +3 -1
  3. package/dist/module.json +3 -3
  4. package/dist/module.mjs +21 -12
  5. package/dist/runtime/assets/base.css +1 -1
  6. package/dist/runtime/assets/locales/en.json +2 -2
  7. package/dist/runtime/assets/tailwind.css +1 -1
  8. package/dist/runtime/assets/utils.css +1 -0
  9. package/dist/runtime/build/WitchcraftUiResolver.js +1 -1
  10. package/dist/runtime/components/Aria/Aria.vue +5 -9
  11. package/dist/runtime/components/Aria/Aria.vue.d.ts +5 -0
  12. package/dist/runtime/components/Icon/Icon.vue +12 -28
  13. package/dist/runtime/components/Icon/Icon.vue.d.ts +21 -0
  14. package/dist/runtime/components/LibButton/LibButton.vue +93 -117
  15. package/dist/runtime/components/LibButton/LibButton.vue.d.ts +36 -0
  16. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +53 -76
  17. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +42 -0
  18. package/dist/runtime/components/LibColorInput/LibColorInput.vue +131 -101
  19. package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +63 -0
  20. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue +326 -296
  21. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue.d.ts +61 -0
  22. package/dist/runtime/components/LibColorPicker/utils/safeConvertToHsva.d.ts +2 -0
  23. package/dist/runtime/components/LibColorPicker/utils/safeConvertToHsva.js +18 -0
  24. package/dist/runtime/components/LibColorPicker/utils/safeConvertToRgba.d.ts +2 -0
  25. package/dist/runtime/components/LibColorPicker/utils/safeConvertToRgba.js +17 -0
  26. package/dist/runtime/components/LibColorPicker/utils/toLowPrecisionRgbaString.d.ts +2 -0
  27. package/dist/runtime/components/LibColorPicker/utils/toLowPrecisionRgbaString.js +8 -0
  28. package/dist/runtime/components/LibColorPicker/utils/truncate.d.ts +1 -0
  29. package/dist/runtime/components/LibColorPicker/utils/truncate.js +5 -0
  30. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +42 -64
  31. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts +22 -0
  32. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue +20 -54
  33. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +40 -0
  34. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue +205 -173
  35. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue.d.ts +34 -0
  36. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue +215 -164
  37. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue.d.ts +34 -0
  38. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue +9 -10
  39. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue.d.ts +22 -0
  40. package/dist/runtime/components/LibDebug/LibDebug.vue +47 -65
  41. package/dist/runtime/components/LibDebug/LibDebug.vue.d.ts +32 -0
  42. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue +19 -34
  43. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue.d.ts +22 -0
  44. package/dist/runtime/components/LibFileInput/LibFileInput.vue +155 -173
  45. package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +43 -0
  46. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +352 -0
  47. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +165 -0
  48. package/dist/runtime/components/LibLabel/LibLabel.vue +30 -46
  49. package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +27 -0
  50. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +50 -66
  51. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue.d.ts +29 -0
  52. package/dist/runtime/components/LibNotifications/LibNotification.vue +48 -56
  53. package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +17 -0
  54. package/dist/runtime/components/LibNotifications/LibNotifications.vue +71 -83
  55. package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +13 -0
  56. package/dist/runtime/components/LibPagination/LibPagination.vue +86 -131
  57. package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +104 -0
  58. package/dist/runtime/components/LibPalette/LibPalette.vue +23 -26
  59. package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +14 -0
  60. package/dist/runtime/components/LibPopup/LibPopup.vue +326 -400
  61. package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +46 -0
  62. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +73 -93
  63. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue.d.ts +41 -0
  64. package/dist/runtime/components/LibRecorder/LibRecorder.vue +134 -179
  65. package/dist/runtime/components/LibRecorder/LibRecorder.vue.d.ts +77 -0
  66. package/dist/runtime/components/LibRoot/LibRoot.vue +75 -89
  67. package/dist/runtime/components/LibRoot/LibRoot.vue.d.ts +41 -0
  68. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue +51 -82
  69. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue.d.ts +35 -0
  70. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +147 -164
  71. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +94 -0
  72. package/dist/runtime/components/LibTable/LibTable.vue +69 -106
  73. package/dist/runtime/components/LibTable/LibTable.vue.d.ts +45 -0
  74. package/dist/runtime/components/Template/NAME.vue +15 -36
  75. package/dist/runtime/components/Template/NAME.vue.d.ts +17 -0
  76. package/dist/runtime/components/TestControls/TestControls.vue +7 -10
  77. package/dist/runtime/components/TestControls/TestControls.vue.d.ts +5 -0
  78. package/dist/runtime/components/index.d.ts +12 -11
  79. package/dist/runtime/components/index.js +12 -11
  80. package/dist/runtime/components/shared/props.d.ts +81 -16
  81. package/dist/runtime/components/shared/storyHelpers/playInput.js +5 -5
  82. package/dist/runtime/components/shared/storyHelpers/playSuggestions.js +15 -11
  83. package/dist/runtime/composables/index.d.ts +5 -0
  84. package/dist/runtime/composables/index.js +5 -0
  85. package/dist/runtime/composables/useDivideAttrs.js +1 -0
  86. package/dist/runtime/composables/useDragWithThreshold.d.ts +71 -0
  87. package/dist/runtime/composables/useDragWithThreshold.js +40 -0
  88. package/dist/runtime/composables/usePreHydrationValue.d.ts +12 -0
  89. package/dist/runtime/composables/usePreHydrationValue.js +15 -0
  90. package/dist/runtime/composables/useSetupI18n.d.ts +2 -0
  91. package/dist/runtime/composables/useSetupI18n.js +5 -1
  92. package/dist/runtime/composables/useSuggestions.d.ts +7 -5
  93. package/dist/runtime/composables/useSuggestions.js +94 -57
  94. package/dist/runtime/directives/vResizableCols.js +92 -84
  95. package/dist/runtime/helpers/NotificationHandler.d.ts +5 -0
  96. package/dist/runtime/helpers/index.d.ts +3 -1
  97. package/dist/runtime/helpers/index.js +3 -1
  98. package/dist/runtime/types/index.d.ts +6 -0
  99. package/dist/runtime/utils/notifyIfError.d.ts +14 -0
  100. package/dist/runtime/utils/notifyIfError.js +29 -0
  101. package/dist/types.d.mts +2 -6
  102. package/package.json +27 -29
  103. package/src/module.ts +31 -12
  104. package/src/runtime/assets/base.css +10 -1
  105. package/src/runtime/assets/locales/en.json +2 -2
  106. package/src/runtime/assets/tailwind.css +1 -1
  107. package/src/runtime/assets/{style.css → utils.css} +86 -4
  108. package/src/runtime/build/WitchcraftUiResolver.ts +1 -1
  109. package/src/runtime/components/Focus.stories.ts +3 -2
  110. package/src/runtime/components/Icon/Icon.vue +10 -6
  111. package/src/runtime/components/LibButton/LibButton.vue +41 -47
  112. package/src/runtime/components/LibCheckbox/LibCheckbox.vue +7 -4
  113. package/src/runtime/components/LibColorInput/LibColorInput.vue +111 -37
  114. package/src/runtime/components/LibColorPicker/LibColorPicker.stories.ts +25 -4
  115. package/src/runtime/components/LibColorPicker/LibColorPicker.vue +242 -131
  116. package/src/runtime/components/LibColorPicker/utils/safeConvertToHsva.ts +24 -0
  117. package/src/runtime/components/LibColorPicker/utils/safeConvertToRgba.ts +23 -0
  118. package/src/runtime/components/LibColorPicker/utils/toLowPrecisionRgbaString.ts +13 -0
  119. package/src/runtime/components/LibColorPicker/utils/truncate.ts +6 -0
  120. package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.ts +1 -1
  121. package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +11 -9
  122. package/src/runtime/components/LibDatePicker/LibDatePicker.vue +4 -17
  123. package/src/runtime/components/LibDatePicker/LibRangeDatePicker.vue +192 -131
  124. package/src/runtime/components/LibDatePicker/LibSingleDatePicker.vue +183 -115
  125. package/src/runtime/components/LibDatePicker/LibTimeZonePicker.vue +3 -3
  126. package/src/runtime/components/LibDebug/LibDebug.vue +15 -5
  127. package/src/runtime/components/LibDevOnly/LibDevOnly.vue +1 -3
  128. package/src/runtime/components/LibFileInput/LibFileInput.vue +54 -29
  129. package/src/runtime/components/{LibInput/LibInput.stories.ts → LibInputDeprecated/LibInputDeprecated.stories.ts} +64 -19
  130. package/{dist/runtime/components/LibInput/LibInput.vue → src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue} +40 -34
  131. package/src/runtime/components/LibLabel/LibLabel.vue +2 -2
  132. package/src/runtime/components/LibMultiValues/LibMultiValues.stories.ts +5 -4
  133. package/src/runtime/components/LibMultiValues/LibMultiValues.vue +11 -13
  134. package/src/runtime/components/LibNotifications/LibNotification.vue +19 -11
  135. package/src/runtime/components/LibNotifications/LibNotifications.stories.ts +2 -2
  136. package/src/runtime/components/LibNotifications/LibNotifications.vue +20 -12
  137. package/src/runtime/components/LibPagination/LibPagination.stories.ts +2 -2
  138. package/src/runtime/components/LibPagination/LibPagination.vue +19 -20
  139. package/src/runtime/components/LibPalette/LibPalette.vue +3 -3
  140. package/src/runtime/components/LibPopup/LibPopup.stories.ts +2 -2
  141. package/src/runtime/components/LibPopup/LibPopup.vue +30 -67
  142. package/src/runtime/components/LibProgressBar/LibProgressBar.vue +3 -2
  143. package/src/runtime/components/LibRecorder/LibRecorder.vue +2 -3
  144. package/src/runtime/components/LibRoot/LibRoot.vue +14 -1
  145. package/src/runtime/components/LibSimpleInput/LibSimpleInput.stories.ts +1 -1
  146. package/src/runtime/components/LibSimpleInput/LibSimpleInput.vue +5 -8
  147. package/src/runtime/components/LibSuggestions/LibSuggestions.vue +42 -26
  148. package/src/runtime/components/LibTable/LibTable.vue +8 -9
  149. package/src/runtime/components/Scrolling.stories.ts +58 -0
  150. package/src/runtime/components/Template/NAME.vue +1 -1
  151. package/src/runtime/components/TestControls/TestControls.vue +1 -1
  152. package/src/runtime/components/index.ts +12 -12
  153. package/src/runtime/components/shared/props.ts +82 -19
  154. package/src/runtime/components/shared/storyHelpers/playInput.ts +6 -5
  155. package/src/runtime/components/shared/storyHelpers/playSuggestions.ts +25 -11
  156. package/src/runtime/composables/index.ts +5 -0
  157. package/src/runtime/composables/useDarkMode.ts +2 -2
  158. package/src/runtime/composables/useDivideAttrs.ts +1 -0
  159. package/src/runtime/composables/useDragWithThreshold.ts +108 -0
  160. package/src/runtime/composables/usePreHydrationValue.ts +30 -0
  161. package/src/runtime/composables/useSetupI18n.ts +8 -2
  162. package/src/runtime/composables/useSuggestions.ts +92 -45
  163. package/src/runtime/directives/vResizableCols.ts +82 -74
  164. package/src/runtime/helpers/NotificationHandler.ts +5 -0
  165. package/src/runtime/helpers/index.ts +3 -1
  166. package/src/runtime/types/index.ts +5 -0
  167. package/src/runtime/utils/notifyIfError.ts +45 -0
  168. package/dist/module.cjs +0 -5
  169. package/dist/module.d.ts +0 -34
  170. package/dist/runtime/assets/style.css +0 -1
  171. package/dist/runtime/components/Focus.stories.d.ts +0 -11
  172. package/dist/runtime/components/Focus.stories.js +0 -53
  173. package/dist/runtime/components/LibButton/LibButton.stories.d.ts +0 -12
  174. package/dist/runtime/components/LibButton/LibButton.stories.js +0 -94
  175. package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.d.ts +0 -14
  176. package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.js +0 -29
  177. package/dist/runtime/components/LibColorInput/LibColorInput.stories.d.ts +0 -7
  178. package/dist/runtime/components/LibColorInput/LibColorInput.stories.js +0 -58
  179. package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.d.ts +0 -7
  180. package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.js +0 -51
  181. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.d.ts +0 -7
  182. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.js +0 -36
  183. package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.d.ts +0 -11
  184. package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.js +0 -98
  185. package/dist/runtime/components/LibDebug/LibDebug.stories.d.ts +0 -9
  186. package/dist/runtime/components/LibDebug/LibDebug.stories.js +0 -46
  187. package/dist/runtime/components/LibFileInput/LibFileInput.stories.d.ts +0 -10
  188. package/dist/runtime/components/LibFileInput/LibFileInput.stories.js +0 -63
  189. package/dist/runtime/components/LibInput/LibInput.stories.d.ts +0 -33
  190. package/dist/runtime/components/LibInput/LibInput.stories.js +0 -339
  191. package/dist/runtime/components/LibLabel/LibLabel.stories.d.ts +0 -6
  192. package/dist/runtime/components/LibLabel/LibLabel.stories.js +0 -25
  193. package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.d.ts +0 -23
  194. package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.js +0 -60
  195. package/dist/runtime/components/LibNotifications/LibNotification.stories.d.ts +0 -15
  196. package/dist/runtime/components/LibNotifications/LibNotification.stories.js +0 -126
  197. package/dist/runtime/components/LibNotifications/LibNotifications.stories.d.ts +0 -6
  198. package/dist/runtime/components/LibNotifications/LibNotifications.stories.js +0 -109
  199. package/dist/runtime/components/LibPagination/LibPagination.stories.d.ts +0 -6
  200. package/dist/runtime/components/LibPagination/LibPagination.stories.js +0 -40
  201. package/dist/runtime/components/LibPalette/LibPalette.stories.d.ts +0 -6
  202. package/dist/runtime/components/LibPalette/LibPalette.stories.js +0 -20
  203. package/dist/runtime/components/LibPopup/LibPopup.stories.d.ts +0 -14
  204. package/dist/runtime/components/LibPopup/LibPopup.stories.js +0 -147
  205. package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.d.ts +0 -10
  206. package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.js +0 -81
  207. package/dist/runtime/components/LibRecorder/LibRecorder.stories.d.ts +0 -19
  208. package/dist/runtime/components/LibRecorder/LibRecorder.stories.js +0 -63
  209. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.d.ts +0 -26
  210. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.js +0 -78
  211. package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.d.ts +0 -27
  212. package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.js +0 -112
  213. package/dist/runtime/components/LibTable/LibTable.stories.d.ts +0 -16
  214. package/dist/runtime/components/LibTable/LibTable.stories.js +0 -156
  215. package/dist/runtime/components/reset.stories.d.ts +0 -5
  216. package/dist/runtime/components/reset.stories.js +0 -19
  217. package/dist/runtime/composables/useScrollNearContainerEdges.stories.d.ts +0 -7
  218. package/dist/runtime/composables/useScrollNearContainerEdges.stories.js +0 -85
  219. package/dist/runtime/helpers/addValue.d.ts +0 -1
  220. package/dist/runtime/helpers/addValue.js +0 -8
  221. package/dist/types.d.ts +0 -7
  222. package/src/runtime/components/LibInput/LibInput.vue +0 -372
  223. package/src/runtime/helpers/addValue.ts +0 -10
  224. /package/src/runtime/components/{reset.stories.ts → Reset.stories.ts} +0 -0
@@ -1,109 +0,0 @@
1
- import { reactive, ref } from "vue";
2
- import LibNotifications from "./LibNotifications.vue";
3
- import { NotificationHandler } from "../../helpers/NotificationHandler.js";
4
- import * as components from "../index.js";
5
- const meta = {
6
- component: LibNotifications,
7
- title: "Components/Notifications",
8
- args: {
9
- // @ts-expect-error story only arg
10
- withTitle: true
11
- }
12
- };
13
- export default meta;
14
- export const Primary = {
15
- render: (args) => ({
16
- components,
17
- setup() {
18
- const handler = reactive(new NotificationHandler());
19
- let count = 0;
20
- const withTitle = ref(args.withTitle);
21
- const disableTimeout = ref(false);
22
- const notifyRequiresAction = () => {
23
- count++;
24
- void handler.notify({
25
- title: withTitle.value ? `Notification(${count})` : void 0,
26
- message: `This is a notification that requires action. Pick an option:`,
27
- requiresAction: true,
28
- options: ["Ok", "Default Answer", "Cancel"],
29
- default: "Default Answer"
30
- });
31
- };
32
- const notifyWithDangerousOption = () => {
33
- count++;
34
- void handler.notify({
35
- title: withTitle.value ? `Notification(${count})` : void 0,
36
- message: `This is a notification that has a dangerous option. Pick an option:`,
37
- options: ["Ok", "Default Answer", "Dangerous Option", "Cancel"],
38
- default: "Default Answer",
39
- dangerous: ["Dangerous Option"]
40
- });
41
- };
42
- const notifyNonCancellable = () => {
43
- count++;
44
- void handler.notify({
45
- title: withTitle.value ? `Notification(${count})` : void 0,
46
- message: `This is a non-cancellable notification. Pick an option:`,
47
- options: ["Ok", "Default Answer"],
48
- default: "Default Answer",
49
- cancellable: false
50
- });
51
- };
52
- const notifyNonCancellableRequiresAction = () => {
53
- count++;
54
- void handler.notify({
55
- title: withTitle.value ? `Notification(${count})` : void 0,
56
- message: `This is a non-cancellable notification. Pick an option:`,
57
- requiresAction: true,
58
- options: ["Ok", "Default Answer"],
59
- default: "Default Answer",
60
- cancellable: false
61
- });
62
- };
63
- const notifyTimeoutable = () => {
64
- count++;
65
- void handler.notify({
66
- title: withTitle.value ? `Notification(${count})` : void 0,
67
- message: `This is a notification. No action required.`,
68
- timeout: disableTimeout.value ? false : 2e3
69
- });
70
- };
71
- return {
72
- notifyRequiresAction,
73
- notifyTimeoutable,
74
- notifyNonCancellable,
75
- notifyWithDangerousOption,
76
- notifyNonCancellableRequiresAction,
77
- handler,
78
- withTitle,
79
- disableTimeout,
80
- args: {
81
- outline: false,
82
- ...args
83
- }
84
- };
85
- },
86
- backgrounds: { disable: true },
87
- // <lib-debug>{{args.handler}}</lib-debug>
88
- template: `
89
- <test-wrapper :outline="args.outline">
90
- <lib-button :label="'Notify Timeoutable'" @click="notifyTimeoutable()"></lib-button>
91
- <lib-button :label="'Notify RequiresAction'" @click="notifyRequiresAction()"></lib-button>
92
- <lib-button :label="'Notify Non-Cancellable that RequiresAction'" @click="notifyNonCancellableRequiresAction()"></lib-button>
93
- <lib-button :label="'Notify With Dangerous Option'" @click="notifyWithDangerousOption()"></lib-button>
94
- <lib-button :label="'Notify Non-Cancellable'" @click="notifyNonCancellable()"></lib-button>
95
- <input type="checkbox" v-model="withTitle"/> With Title
96
- <input type="checkbox" v-model="disableTimeout"/> Disable Timeout
97
- <lib-notifications :handler="handler" />
98
- History:
99
- <lib-debug>
100
- <template v-for="entry in handler.history">
101
- Message: {{entry.message}}
102
- Resolution: {{entry.resolution}}
103
- <br>
104
- </template>
105
- </lib-debug>
106
- </test-wrapper>
107
- `
108
- })
109
- };
@@ -1,6 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/vue3";
2
- import LibPagination from "./LibPagination.vue.js";
3
- declare const meta: Meta<typeof LibPagination>;
4
- export default meta;
5
- type Story = StoryObj<typeof LibPagination>;
6
- export declare const Primary: Story;
@@ -1,40 +0,0 @@
1
- import { ref } from "vue";
2
- import LibPagination from "./LibPagination.vue";
3
- import * as components from "../index.js";
4
- const meta = {
5
- component: LibPagination,
6
- title: "Components/Pagination",
7
- args: {
8
- total: 10
9
- }
10
- };
11
- export default meta;
12
- export const Primary = {
13
- render: (args) => ({
14
- components,
15
- setup() {
16
- const num = ref(1);
17
- const changePage = ($event, i) => {
18
- $event.preventDefault();
19
- if (i >= 10) num.value = 10;
20
- if (i <= 1) num.value = 1;
21
- num.value = i;
22
- };
23
- return {
24
- changePage,
25
- args,
26
- num
27
- };
28
- },
29
- template: `
30
- <lib-pagination v-bind="{...args, current: num, route:'#'}">
31
- <template #link="linkProps">
32
- <a v-bind="linkProps" @click="changePage($event, linkProps.i)">{{ linkProps.text ?? linkProps.i }}</a>
33
- </template>
34
- </lib-pagination>
35
- <lib-input :label="'Change Page'" :modelValue="num.toString()" @update:modelValue="num = parseInt($event)" type="number" min="0" :max="args.total">
36
-
37
- </lib-input>
38
- `
39
- })
40
- };
@@ -1,6 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/vue3";
2
- import LibPalette from "./LibPalette.vue.js";
3
- declare const meta: Meta<typeof LibPalette>;
4
- export default meta;
5
- type Story = StoryObj<typeof LibPalette>;
6
- export declare const Primary: Story;
@@ -1,20 +0,0 @@
1
- import LibPalette from "./LibPalette.vue";
2
- import { theme } from "../../theme.js";
3
- import * as components from "../index.js";
4
- const meta = {
5
- component: LibPalette,
6
- title: "Components/Palette",
7
- args: {
8
- // theme,
9
- }
10
- };
11
- export default meta;
12
- export const Primary = {
13
- render: (args) => ({
14
- components: { ...components, LibPalette },
15
- setup: () => ({ args: { ...args, theme } }),
16
- template: `
17
- <LibPalette v-bind="{...args}">{{args.value}}</LibPalette>
18
- `
19
- })
20
- };
@@ -1,14 +0,0 @@
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;
@@ -1,147 +0,0 @@
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-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-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
- };
@@ -1,10 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/vue3";
2
- import LibProgressBar from "./LibProgressBar.vue.js";
3
- declare const meta: Meta<typeof LibProgressBar>;
4
- export default meta;
5
- type Story = StoryObj<typeof LibProgressBar>;
6
- export declare const Primary: Story;
7
- export declare const Secondary: Story;
8
- export declare const ReallyLongLabel: Story;
9
- export declare const Static: Story;
10
- export declare const AutoHiding: Story;
@@ -1,81 +0,0 @@
1
- import { onUnmounted, ref } from "vue";
2
- import LibProgressBar from "./LibProgressBar.vue";
3
- import * as components from "../index.js";
4
- const meta = {
5
- component: LibProgressBar,
6
- title: "Components/ProgressBar",
7
- args: {
8
- label: "Label",
9
- // @ts-expect-error .
10
- _timeout: 1e3,
11
- _add: 10,
12
- _start: 50
13
- }
14
- };
15
- export default meta;
16
- export const Primary = {
17
- render: (args) => ({
18
- components,
19
- setup: () => {
20
- const progress = ref(args._start);
21
- if (args.progress) {
22
- progress.value = args.progress;
23
- } else {
24
- const interval = setInterval(() => {
25
- if (progress.value >= 100) {
26
- progress.value = 0;
27
- } else {
28
- progress.value += args._add;
29
- }
30
- }, args._timeout);
31
- onUnmounted(() => {
32
- clearInterval(interval);
33
- });
34
- }
35
- return {
36
- args: { ...args },
37
- progress
38
- };
39
- },
40
- template: `
41
- <lib-progress-bar class="flex-1" v-bind="args" :progress="progress"></lib-progress-bar>
42
- <br/>
43
- Stretched in flexbox:
44
- <div class="flex w-full">
45
- <lib-progress-bar class="flex-1" v-bind="args" :progress="progress"></lib-progress-bar>
46
- </div>
47
- `
48
- })
49
- };
50
- export const Secondary = {
51
- ...Primary,
52
- args: {
53
- ...Primary.args
54
- }
55
- };
56
- export const ReallyLongLabel = {
57
- ...Primary,
58
- args: {
59
- ...Primary.args,
60
- label: "Really Long Label Label to See Effect Really Long Label Label to See Effect Really Long Label Label to See Effect Really Long Label Label to See Effect"
61
- }
62
- };
63
- export const Static = {
64
- ...Primary,
65
- args: {
66
- ...Primary.args,
67
- progress: 50
68
- }
69
- };
70
- export const AutoHiding = {
71
- ...Primary,
72
- args: {
73
- ...Primary.args,
74
- autohideOnComplete: 500,
75
- clamp: [10, 100],
76
- _start: 0,
77
- // keepSpaceWhenHidden: true,
78
- _timeout: 1e3,
79
- _add: 10
80
- }
81
- };
@@ -1,19 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/vue3";
2
- import * as components from "../index.js.js";
3
- /**
4
- * This is a special input component designed to record any type of event.
5
- *
6
- * It requires additional setup to actually work since what and how anything is recorded is up to the needs of the application.
7
- *
8
- * This basic implementation just lists the keys. Enter accepts the recording, escape cancels back to the initial value.
9
- */
10
- declare const meta: Meta<typeof components.LibRecorder>;
11
- export default meta;
12
- type Story = StoryObj<typeof components.LibRecorder>;
13
- export declare const Primary: Story;
14
- /** Should not be tabbable or recordable. */
15
- export declare const Disabled: Story;
16
- /** *Should* be tabbable but not recordable. */
17
- export declare const Readonly: Story;
18
- /** Height should not shrink. */
19
- export declare const EmptyInitialValue: Story;
@@ -1,63 +0,0 @@
1
- import { ref, watchEffect } from "vue";
2
- import { createRecorderHandler, createRecorderWatchEffect } from "../../helpers/storybook.js";
3
- import * as components from "../index.js";
4
- const meta = {
5
- component: components.LibRecorder,
6
- title: "Components/Recorder",
7
- args: {
8
- label: "Some Label",
9
- recordingTitle: "Recording. Press enter or click away to accept. Press escape to cancel.",
10
- modelValue: "K E Y S"
11
- }
12
- };
13
- export default meta;
14
- export const Primary = {
15
- render: (args) => ({
16
- components,
17
- setup: () => {
18
- const recording = ref(false);
19
- const recordingValue = ref("");
20
- const modelValue = ref(args.modelValue);
21
- const recorderEl = ref(null);
22
- const recorder = createRecorderHandler(recordingValue, recording, modelValue, recorderEl);
23
- watchEffect(createRecorderWatchEffect(recordingValue, recording, modelValue));
24
- return {
25
- args,
26
- modelValue,
27
- recorder,
28
- recording,
29
- recordingValue,
30
- recorderEl
31
- };
32
- },
33
- template: `
34
- <lib-recorder
35
- v-bind="args"
36
- v-extract-root-el="_ => recorderEl = _"
37
- :recordingValue="recordingValue"
38
- :recorder="recorder"
39
- v-model:recording="recording"
40
- v-model="modelValue"
41
- @recorder:click="recording = !recording"
42
- />
43
- `
44
- })
45
- };
46
- export const Disabled = {
47
- ...Primary,
48
- args: {
49
- disabled: true
50
- }
51
- };
52
- export const Readonly = {
53
- ...Primary,
54
- args: {
55
- readonly: true
56
- }
57
- };
58
- export const EmptyInitialValue = {
59
- ...Primary,
60
- args: {
61
- modelValue: ""
62
- }
63
- };
@@ -1,26 +0,0 @@
1
- import type { StoryObj } from "@storybook/vue3";
2
- import * as components from "../index.js.js";
3
- declare const meta: {
4
- component: any;
5
- title: string;
6
- args: {
7
- modelValue: string;
8
- placeholder: string;
9
- };
10
- };
11
- export default meta;
12
- type Story = StoryObj<typeof components.LibSimpleInput>;
13
- /** Input */
14
- export declare const Primary: Story;
15
- /** Has more reasonable min-width inside a flexbox. */
16
- export declare const InsideAFlexbox: Story;
17
- export declare const Disabled: any;
18
- export declare const Readonly: any;
19
- export declare const Invalid: any;
20
- /**
21
- * Intended for being wrapped.
22
- * Should not have any border or focus outline styles.
23
- */
24
- export declare const Borderless: any;
25
- export declare const Numerical: any;
26
- export declare const NumericalInsideAFlexbox: any;
@@ -1,78 +0,0 @@
1
- import * as components from "../index.js";
2
- const meta = {
3
- component: components.LibSimpleInput,
4
- title: "Components/SimpleInput",
5
- args: {
6
- modelValue: "Value",
7
- placeholder: "Placeholder"
8
- }
9
- };
10
- export default meta;
11
- export const Primary = {
12
- args: {
13
- modelValue: "some value"
14
- },
15
- render: (args) => ({
16
- components,
17
- // eslint-disable-next-line no-console
18
- setup: () => ({ args, test: () => console.log("Enter") }),
19
- template: `
20
- <lib-simple-input
21
- @keydown="test"
22
- class="m-2" v-bind="args" v-model="args.modelValue" ></lib-simple-input>
23
- <lib-simple-input class="m-2" v-bind="{...args, modelValue:''}" ></lib-simple-input>
24
- `
25
- })
26
- };
27
- export const InsideAFlexbox = {
28
- render: (args) => ({
29
- components,
30
- setup: () => ({ args }),
31
- template: `
32
- Inside a flexbox:
33
- <div class="flex flex-wrap">
34
- <lib-simple-input v-bind="args" v-model="args.modelValue"></lib-simple-input>
35
- <div class="border-1 border-danger-500 flex-1 whitespace-nowrap">Flex Grow: 1</div>
36
- </div>
37
- `
38
- }),
39
- args: {
40
- stretch: true
41
- }
42
- };
43
- export const Disabled = {
44
- ...Primary,
45
- args: {
46
- disabled: true
47
- }
48
- };
49
- export const Readonly = {
50
- ...Primary,
51
- args: {
52
- readonly: true
53
- }
54
- };
55
- export const Invalid = {
56
- ...Primary,
57
- args: {
58
- valid: false
59
- }
60
- };
61
- export const Borderless = {
62
- ...Primary,
63
- args: {
64
- border: false
65
- }
66
- };
67
- export const Numerical = {
68
- ...Primary,
69
- args: {
70
- type: "number"
71
- }
72
- };
73
- export const NumericalInsideAFlexbox = {
74
- ...InsideAFlexbox,
75
- args: {
76
- type: "number"
77
- }
78
- };
@@ -1,27 +0,0 @@
1
- import type { StoryObj } from "@storybook/vue3";
2
- import LibSuggestions from "./LibSuggestions.vue.js";
3
- declare const meta: {
4
- component: any;
5
- title: string;
6
- args: {
7
- id: string;
8
- modelValue: string;
9
- label: string;
10
- border: boolean;
11
- suggestions: string[];
12
- };
13
- };
14
- export default meta;
15
- type Story = StoryObj<typeof LibSuggestions>;
16
- /**
17
- * The suggestions component is just the dropdown part.
18
- *
19
- * Here it is decoupled from the input.
20
- *
21
- * More examples can be found in the input component.
22
- */
23
- export declare const Primary: Story;
24
- export declare const RestrictToSuggestions: Story;
25
- export declare const AlwaysShowAllSuggestions: any;
26
- export declare const AlwaysShowAllSuggestionsAndNoRestrictToSuggestions: any;
27
- export declare const CustomSuggestionsObject: any;