@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,339 +0,0 @@
1
- import { ref, watchEffect } from "vue";
2
- import LibInput from "./LibInput.vue";
3
- import IconFaChevronLeft from "~icons/fa6-solid/chevron-left";
4
- import IconFaChevronRight from "~icons/fa6-solid/chevron-right";
5
- import IconFaSolidKeyboard from "~icons/fa6-solid/keyboard";
6
- import IconFaSolidTags from "~icons/fa6-solid/tags";
7
- import { vExtractRootEl } from "../../directives/vExtractRootEl.js";
8
- import { createRecorderHandler, createRecorderWatchEffect } from "../../helpers/storybook.js";
9
- import Icon from "../Icon/Icon.vue";
10
- import * as components from "../index.js";
11
- import {
12
- playBasicVModel,
13
- playMultipleValues
14
- } from "../shared/storyHelpers/playInput.js";
15
- import {
16
- playBasicClickSelect,
17
- playBasicKeyboardSelect,
18
- playBasicSelect
19
- } from "../shared/storyHelpers/playSuggestions.js";
20
- const meta = {
21
- component: LibInput,
22
- title: "Components/Input",
23
- args: {
24
- border: true,
25
- label: "Some Label"
26
- }
27
- };
28
- export default meta;
29
- const allComponents = {
30
- ...components,
31
- LibInput,
32
- Icon,
33
- IconFaChevronRight,
34
- IconFaChevronLeft,
35
- IconFaSolidKeyboard,
36
- IconFaSolidTags
37
- };
38
- const playAutosuggestSelectLike = async (context) => {
39
- await playBasicSelect(context);
40
- await playBasicKeyboardSelect(context);
41
- await playBasicClickSelect(context);
42
- };
43
- const setupModelValue = (args) => ({
44
- modelValue: ref(args.modelValue ?? "")
45
- });
46
- const setupModelValues = (args) => ({
47
- values: ref(args.values ?? void 0)
48
- });
49
- const Base = {
50
- render: (args) => ({
51
- components: allComponents,
52
- setup: () => ({
53
- ...setupModelValue(args),
54
- ...setupModelValues(args),
55
- args: {
56
- ...args,
57
- updateOnlyOnSubmit: args.suggestions !== void 0
58
- }
59
- }),
60
- template: `
61
- Model Value: <span class="inline-block" data-testid="model-value">{{modelValue}}</span>
62
-
63
- <lib-input
64
- v-bind="args"
65
- v-model:values="values"
66
- v-model="modelValue"
67
- @submit="modelValue = $event"
68
- >
69
- </lib-input>
70
- `
71
- })
72
- };
73
- export const Primary = {
74
- ...Base,
75
- play: playBasicVModel
76
- };
77
- export const Disabled = {
78
- ...Base,
79
- args: {
80
- disabled: true
81
- }
82
- };
83
- export const Readonly = {
84
- ...Base,
85
- args: {
86
- readonly: true
87
- }
88
- };
89
- export const Invalid = {
90
- ...Base,
91
- args: {
92
- valid: false
93
- }
94
- };
95
- export const AttrsPassword = {
96
- ...Base,
97
- args: {
98
- type: "password"
99
- }
100
- };
101
- export const AttrsDate = {
102
- ...Base,
103
- args: {
104
- type: "date"
105
- }
106
- };
107
- export const AttrsNumber = {
108
- ...Base,
109
- args: {
110
- type: "number"
111
- }
112
- };
113
- export const Borderless = {
114
- ...Base,
115
- args: {
116
- border: false,
117
- suggestions: ["A", "AB", "ABC", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"]
118
- }
119
- };
120
- export const WithAutosuggest = {
121
- ...Base,
122
- args: {
123
- suggestions: ["A", "AB", "ABC", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"]
124
- },
125
- play: playAutosuggestSelectLike
126
- };
127
- export const WithInstantAutosuggest = {
128
- ...Base,
129
- args: {
130
- suggestions: ["A", "AB", "ABC", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"]
131
- }
132
- };
133
- export const AutosuggestRestricted = {
134
- ...WithAutosuggest,
135
- args: {
136
- ...WithAutosuggest.args,
137
- restrictToSuggestions: true
138
- },
139
- play: playAutosuggestSelectLike
140
- };
141
- export const AutosuggestSelectLikeShowAllUnrestricted = {
142
- ...WithAutosuggest,
143
- args: {
144
- ...WithAutosuggest.args,
145
- restrictToSuggestions: false,
146
- suggestionsFilter: (_input, items) => items
147
- },
148
- play: playAutosuggestSelectLike
149
- };
150
- export const AutosuggestObjectOptions = {
151
- ...WithAutosuggest,
152
- args: {
153
- ...WithAutosuggest.args,
154
- restrictToSuggestions: true,
155
- suggestions: [
156
- { label: "A", other: "some data A" },
157
- { label: "AB", other: "some data AB" },
158
- { label: "ABC", other: "some data ABC" },
159
- { label: "ABCDEFGHIJKLMNOPQRSTUVWXYZ", other: "some data ABCDEFGHIJKLMNOPQRSTUVWXYZ" }
160
- ],
161
- suggestionLabel: (item) => item.label
162
- },
163
- play: playAutosuggestSelectLike
164
- };
165
- export const Slots = {
166
- render: (args) => ({
167
- components: allComponents,
168
- setup: () => ({
169
- ...setupModelValue(args),
170
- ...setupModelValues(args),
171
- args: {
172
- ...args,
173
- updateOnlyOnSubmit: args.suggestions !== void 0
174
- }
175
- }),
176
- template: `
177
- Model Value: <span class="inline-block" data-testid="model-value">{{modelValue}}</span>
178
-
179
-
180
- <lib-input
181
- v-bind="args"
182
- v-model="modelValue"
183
- v-model:values="values"
184
- >
185
- <template #label>
186
- Custom Label Slot
187
- </template>
188
- <template #left>
189
- <lib-button class="px-0" :border="false" :label="'none'">
190
- <icon><icon-fa-chevron-left/></icon>
191
- </lib-button>
192
- </template>
193
- <template #right>
194
- <lib-button class="px-0" :border="false" :label="'none'">
195
- <icon><icon-fa-chevron-right/></icon>
196
- </lib-button>
197
- </template>
198
- </lib-input>
199
- `
200
- })
201
- };
202
- const MultipleValuesBase = {
203
- render: (args) => ({
204
- components: allComponents,
205
- setup: () => ({
206
- ...setupModelValue(args),
207
- ...setupModelValues(args),
208
- args
209
- }),
210
- template: `
211
- Model Value: <span class="inline-block" data-testid="model-value">{{modelValue}}</span>
212
-
213
- <br/>
214
- Values: <span class="inline-block" data-testid="values">{{values.join(", ")}}</span>
215
-
216
- <lib-input
217
- v-bind="args"
218
- v-model="modelValue"
219
- v-model:values="values"
220
- >
221
- <template #left>
222
- <lib-button class="px-0" :border="false">
223
- <icon><icon-fa-solid-tags/></icon>
224
- </lib-button>
225
- </template>
226
- </lib-input>
227
- `
228
- }),
229
- args: {
230
- values: ["A", "B", "C"]
231
- }
232
- };
233
- export const WithMultipleValues = {
234
- ...MultipleValuesBase,
235
- play: playMultipleValues
236
- };
237
- export const WithMultipleValuesWithSuggestions = {
238
- ...MultipleValuesBase,
239
- args: {
240
- ...MultipleValuesBase.args,
241
- suggestions: ["A", "AB", "ABC", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"]
242
- },
243
- play: playAutosuggestSelectLike
244
- };
245
- export const WithMultipleValuesDisabled = {
246
- ...MultipleValuesBase,
247
- args: {
248
- ...MultipleValuesBase.args,
249
- disabled: true
250
- }
251
- };
252
- export const WithMultipleValuesReadonly = {
253
- ...MultipleValuesBase,
254
- args: {
255
- ...MultipleValuesBase.args,
256
- readonly: true
257
- }
258
- };
259
- export const InputSlotReplacement = {
260
- render: (args) => ({
261
- components: allComponents,
262
- directives: { vExtractRootEl },
263
- setup: () => {
264
- const recording = ref(false);
265
- const recordingValue = ref("");
266
- const modelValue = ref("K E Y S");
267
- const values = ref(args.values ?? []);
268
- const recorderEl = ref(null);
269
- const recorder = createRecorderHandler(recordingValue, recording, modelValue, recorderEl);
270
- watchEffect(createRecorderWatchEffect(recordingValue, recording, modelValue, values));
271
- return {
272
- recorder,
273
- recording,
274
- recordingValue,
275
- recorderEl,
276
- modelValue,
277
- values,
278
- args
279
- };
280
- },
281
- template: `
282
- Model Value: <span class="inline-block" data-testid="model-value">{{modelValue}}</span>
283
-
284
- <br/>
285
- Values: <span class="inline-block" data-testid="values">{{values.join(", ")}}</span>
286
-
287
- <br/>
288
- Recording: <span class="inline-block" data-testid="recording">{{recording}}</span>
289
-
290
- <lib-input
291
- v-bind="args"
292
- v-model="modelValue"
293
- v-model:values="values"
294
- >
295
- <template #input >
296
- <lib-recorder
297
- class="p-0"
298
- v-extract-root-el="_ => recorderEl = _"
299
- :border="false"
300
- :recordingValue="recordingValue"
301
- :recorder="recorder"
302
- v-model:recording="recording"
303
- v-model="modelValue"
304
- @recorder:click="recording = !recording"
305
- @recorder:blur="recordingValue = modelValue; recording = false"
306
- />
307
- </template>
308
- <template #left>
309
- <icon><icon-fa-solid-keyboard/></icon>
310
- </template>
311
- </lib-input>
312
- `
313
- }),
314
- args: {
315
- values: ["A", "B", "C"]
316
- }
317
- };
318
- export const NextToButton = {
319
- render: (args) => ({
320
- components: allComponents,
321
- setup: () => ({
322
- ...setupModelValue(args),
323
- ...setupModelValues(args),
324
- args
325
- }),
326
- template: `
327
- <div class="flex gap-2 items-center">
328
- <lib-input
329
- v-bind="args"
330
- v-model:values="values"
331
- v-model="modelValue"
332
- :label="undefined"
333
- >
334
- </lib-input>
335
- <lib-button>Button</lib-button>
336
- </div>
337
- `
338
- })
339
- };
@@ -1,6 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/vue3";
2
- import Label from "./LibLabel.vue.js";
3
- declare const meta: Meta<typeof Label>;
4
- export default meta;
5
- type Story = StoryObj<typeof Label>;
6
- export declare const Primary: Story;
@@ -1,25 +0,0 @@
1
- import Label from "./LibLabel.vue";
2
- import * as components from "../index.js";
3
- const meta = {
4
- component: Label,
5
- title: "Components/Label",
6
- args: {
7
- slot: "label"
8
- }
9
- };
10
- export default meta;
11
- export const Primary = {
12
- render: (args) => ({
13
- components,
14
- setup: () => ({ args }),
15
- template: `
16
- <lib-label v-bind="args">{{args.slot}}</lib-label>
17
- <br/>
18
- In flex col with input:
19
- <div class="flex flex-col">
20
- <lib-label v-bind="args">{{args.slot}}</lib-label>
21
- <lib-simple-input modelValue="some input"></lib-simple-input>
22
- </div>
23
- `
24
- })
25
- };
@@ -1,23 +0,0 @@
1
- import type { StoryObj } from "@storybook/vue3";
2
- import LibMultiValues from "./LibMultiValues.vue.js";
3
- declare const meta: {
4
- component: any;
5
- title: string;
6
- args: {
7
- values: string[];
8
- border: boolean;
9
- };
10
- tags: string[];
11
- };
12
- export default meta;
13
- type Story = StoryObj<typeof LibMultiValues>;
14
- /**
15
- * The multi-value component is just the values part beneath the input.
16
- *
17
- * This is a simple example of how it can be combined with the simple-input component to create an input with multiple values.
18
- *
19
- * Note that setting the `disabled` or `readonly` props won't prevent the component from accepting an updated `values` prop. Disabling adding must be done separately from whatever is controlling the component (e.g. the input in this case).
20
- */
21
- export declare const Primary: Story;
22
- export declare const Disabled: any;
23
- export declare const Readonly: any;
@@ -1,60 +0,0 @@
1
- import { ref } from "vue";
2
- import LibMultiValues from "./LibMultiValues.vue";
3
- import * as components from "../index.js";
4
- const meta = {
5
- component: LibMultiValues,
6
- title: "Components/MultiValues",
7
- args: {
8
- values: ["A", "B", "C"],
9
- border: true
10
- },
11
- tags: ["!test"]
12
- };
13
- export default meta;
14
- export const Primary = {
15
- render: (args) => ({
16
- components: { ...components, LibMultiValues },
17
- setup: () => {
18
- const inputValue = ref("B");
19
- const multiValueEl = ref(null);
20
- const onKeydownEnter = (e) => {
21
- if (e.key === "Enter") args.values.push(inputValue.value);
22
- };
23
- return {
24
- args,
25
- inputValue,
26
- multiValueEl,
27
- onKeydownEnter
28
- };
29
- },
30
- template: `
31
- <p>Simple Input connected to multi-value.</p>
32
- <p> Press enter to add value:</p>
33
- <lib-simple-input
34
- v-model="inputValue"
35
- @keydown="onKeydownEnter"
36
- >
37
- </lib-simple-input>
38
- <p>Multi-value component: </p>
39
- <div class="flex justify-start">
40
- <lib-multi-values
41
- ref="multiValueEl"
42
- v-bind="args"
43
- v-model:values="args.values"
44
- />
45
- </div>
46
- `
47
- })
48
- };
49
- export const Disabled = {
50
- ...Primary,
51
- args: {
52
- disabled: true
53
- }
54
- };
55
- export const Readonly = {
56
- ...Primary,
57
- args: {
58
- readonly: true
59
- }
60
- };
@@ -1,15 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/vue3";
2
- import LibNotification from "./LibNotification.vue.js";
3
- declare const meta: Meta<typeof LibNotification>;
4
- export default meta;
5
- type Story = StoryObj<typeof LibNotification>;
6
- export declare const Primary: Story;
7
- export declare const WithoutTitle: Story;
8
- export declare const WithCode: Story;
9
- export declare const RequiresAction: Story;
10
- /** Should not have cancel cross in top corner. */
11
- export declare const Uncancellable: Story;
12
- export declare const CustomOptions: Story;
13
- export declare const CustomDefaultOption: Story;
14
- export declare const CustomDangerousOption: Story;
15
- export declare const CustomDefaultAndDangerousOption: Story;
@@ -1,126 +0,0 @@
1
- import LibNotification from "./LibNotification.vue";
2
- import { NotificationHandler } from "../../helpers/NotificationHandler.js";
3
- import * as components from "../index.js";
4
- const handler = new NotificationHandler();
5
- const meta = {
6
- component: LibNotification,
7
- title: "Components/Notification",
8
- args: {}
9
- };
10
- export default meta;
11
- export const Primary = {
12
- render: (args) => ({
13
- components: { ...components, LibNotification },
14
- setup() {
15
- return { args };
16
- },
17
- backgrounds: { disable: true },
18
- template: `
19
- <lib-notification v-bind="args"/>
20
- `
21
- }),
22
- args: {
23
- // @ts-expect-error calling protected method
24
- notification: {
25
- ...handler._createEntry({
26
- title: `Notification`,
27
- message: `This is a notification. Pick an option:`
28
- }),
29
- // eslint-disable-next-line @typescript-eslint/no-empty-function
30
- resolve: () => {
31
- }
32
- }
33
- }
34
- };
35
- export const WithoutTitle = {
36
- ...Primary,
37
- args: {
38
- ...Primary.args,
39
- // @ts-expect-error calling protected method
40
- notification: handler._createEntry({
41
- ...Primary.args.notification,
42
- title: void 0
43
- })
44
- }
45
- };
46
- export const WithCode = {
47
- ...Primary,
48
- args: {
49
- ...Primary.args,
50
- // @ts-expect-error calling protected method
51
- notification: handler._createEntry({
52
- ...Primary.args.notification,
53
- code: "0001"
54
- })
55
- }
56
- };
57
- export const RequiresAction = {
58
- ...Primary,
59
- args: {
60
- ...Primary.args,
61
- // @ts-expect-error calling protected method
62
- notification: handler._createEntry({
63
- ...Primary.args.notification,
64
- requiresAction: true
65
- })
66
- }
67
- };
68
- export const Uncancellable = {
69
- ...Primary,
70
- args: {
71
- ...Primary.args,
72
- // @ts-expect-error calling protected method
73
- notification: handler._createEntry({
74
- ...Primary.args.notification,
75
- options: ["Ok"],
76
- cancellable: false
77
- })
78
- }
79
- };
80
- export const CustomOptions = {
81
- ...Primary,
82
- args: {
83
- ...Primary.args,
84
- // @ts-expect-error calling protected method
85
- notification: handler._createEntry({
86
- ...Primary.args.notification,
87
- options: ["Ok", "Default Answer", "Cancel"]
88
- })
89
- }
90
- };
91
- export const CustomDefaultOption = {
92
- ...Primary,
93
- args: {
94
- ...Primary.args,
95
- // @ts-expect-error calling protected method
96
- notification: handler._createEntry({
97
- ...CustomOptions.args.notification,
98
- default: "Default Answer"
99
- })
100
- }
101
- };
102
- export const CustomDangerousOption = {
103
- ...Primary,
104
- args: {
105
- ...Primary.args,
106
- // @ts-expect-error calling protected method
107
- notification: handler._createEntry({
108
- ...CustomOptions.args.notification,
109
- options: ["Ok", "Dangerous Option", "Cancel"],
110
- dangerous: ["Dangerous Option"]
111
- })
112
- }
113
- };
114
- export const CustomDefaultAndDangerousOption = {
115
- ...Primary,
116
- args: {
117
- ...Primary.args,
118
- // @ts-expect-error calling protected method
119
- notification: handler._createEntry({
120
- ...CustomOptions.args.notification,
121
- options: ["Ok", "Default Answer", "Dangerous Option", "Cancel"],
122
- default: "Default Answer",
123
- dangerous: ["Dangerous Option"]
124
- })
125
- }
126
- };
@@ -1,6 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/vue3";
2
- import LibNotifications from "./LibNotifications.vue.js";
3
- declare const meta: Meta<typeof LibNotifications>;
4
- export default meta;
5
- type Story = StoryObj<typeof LibNotifications>;
6
- export declare const Primary: Story;