@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.
Files changed (122) hide show
  1. package/dist/module.cjs +5 -0
  2. package/dist/module.d.ts +36 -0
  3. package/dist/module.json +2 -2
  4. package/dist/module.mjs +2 -1
  5. package/dist/runtime/assets/utils.css +1 -1
  6. package/dist/runtime/components/Aria/Aria.vue +9 -5
  7. package/dist/runtime/components/Focus.stories.d.ts +11 -0
  8. package/dist/runtime/components/Focus.stories.js +53 -0
  9. package/dist/runtime/components/Icon/Icon.vue +30 -10
  10. package/dist/runtime/components/LibButton/LibButton.stories.d.ts +12 -0
  11. package/dist/runtime/components/LibButton/LibButton.stories.js +94 -0
  12. package/dist/runtime/components/LibButton/LibButton.vue +72 -58
  13. package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.d.ts +14 -0
  14. package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.js +29 -0
  15. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +74 -48
  16. package/dist/runtime/components/LibColorInput/LibColorInput.stories.d.ts +7 -0
  17. package/dist/runtime/components/LibColorInput/LibColorInput.stories.js +58 -0
  18. package/dist/runtime/components/LibColorInput/LibColorInput.vue +107 -63
  19. package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.d.ts +9 -0
  20. package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.js +68 -0
  21. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue +352 -271
  22. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.d.ts +7 -0
  23. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.js +36 -0
  24. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +56 -32
  25. package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.d.ts +11 -0
  26. package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.js +98 -0
  27. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue +38 -17
  28. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue +82 -53
  29. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue +67 -50
  30. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue +8 -7
  31. package/dist/runtime/components/LibDebug/LibDebug.stories.d.ts +9 -0
  32. package/dist/runtime/components/LibDebug/LibDebug.stories.js +46 -0
  33. package/dist/runtime/components/LibDebug/LibDebug.vue +70 -42
  34. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue +31 -18
  35. package/dist/runtime/components/LibFileInput/LibFileInput.stories.d.ts +10 -0
  36. package/dist/runtime/components/LibFileInput/LibFileInput.stories.js +63 -0
  37. package/dist/runtime/components/LibFileInput/LibFileInput.vue +156 -113
  38. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.d.ts +33 -0
  39. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.js +384 -0
  40. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +241 -215
  41. package/dist/runtime/components/LibLabel/LibLabel.stories.d.ts +6 -0
  42. package/dist/runtime/components/LibLabel/LibLabel.stories.js +25 -0
  43. package/dist/runtime/components/LibLabel/LibLabel.vue +46 -30
  44. package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.d.ts +23 -0
  45. package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.js +61 -0
  46. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +58 -44
  47. package/dist/runtime/components/LibNotifications/LibNotification.stories.d.ts +15 -0
  48. package/dist/runtime/components/LibNotifications/LibNotification.stories.js +126 -0
  49. package/dist/runtime/components/LibNotifications/LibNotification.vue +48 -32
  50. package/dist/runtime/components/LibNotifications/LibNotifications.stories.d.ts +6 -0
  51. package/dist/runtime/components/LibNotifications/LibNotifications.stories.js +109 -0
  52. package/dist/runtime/components/LibNotifications/LibNotifications.vue +83 -63
  53. package/dist/runtime/components/LibPagination/LibPagination.stories.d.ts +6 -0
  54. package/dist/runtime/components/LibPagination/LibPagination.stories.js +40 -0
  55. package/dist/runtime/components/LibPagination/LibPagination.vue +111 -67
  56. package/dist/runtime/components/LibPalette/LibPalette.stories.d.ts +6 -0
  57. package/dist/runtime/components/LibPalette/LibPalette.stories.js +20 -0
  58. package/dist/runtime/components/LibPalette/LibPalette.vue +23 -20
  59. package/dist/runtime/components/LibPopup/LibPopup.stories.d.ts +14 -0
  60. package/dist/runtime/components/LibPopup/LibPopup.stories.js +147 -0
  61. package/dist/runtime/components/LibPopup/LibPopup.vue +351 -314
  62. package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.d.ts +10 -0
  63. package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.js +81 -0
  64. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +91 -70
  65. package/dist/runtime/components/LibRecorder/LibRecorder.stories.d.ts +19 -0
  66. package/dist/runtime/components/LibRecorder/LibRecorder.stories.js +63 -0
  67. package/dist/runtime/components/LibRecorder/LibRecorder.vue +177 -133
  68. package/dist/runtime/components/LibRoot/LibRoot.vue +100 -73
  69. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.d.ts +26 -0
  70. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.js +78 -0
  71. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue +77 -49
  72. package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.d.ts +27 -0
  73. package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.js +112 -0
  74. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +156 -123
  75. package/dist/runtime/components/LibTable/LibTable.stories.d.ts +16 -0
  76. package/dist/runtime/components/LibTable/LibTable.stories.js +156 -0
  77. package/dist/runtime/components/LibTable/LibTable.vue +99 -63
  78. package/dist/runtime/components/Reset.stories.d.ts +5 -0
  79. package/dist/runtime/components/Reset.stories.js +19 -0
  80. package/dist/runtime/components/Scrolling.stories.d.ts +6 -0
  81. package/dist/runtime/components/Scrolling.stories.js +44 -0
  82. package/dist/runtime/components/Template/NAME.vue +36 -15
  83. package/dist/runtime/components/TestControls/TestControls.vue +9 -6
  84. package/dist/runtime/composables/useScrollNearContainerEdges.stories.d.ts +7 -0
  85. package/dist/runtime/composables/useScrollNearContainerEdges.stories.js +85 -0
  86. package/dist/types.d.mts +6 -2
  87. package/dist/types.d.ts +7 -0
  88. package/package.json +11 -5
  89. package/src/module.ts +2 -1
  90. package/src/runtime/assets/utils.css +5 -5
  91. package/src/runtime/components/LibButton/LibButton.vue +2 -6
  92. package/src/runtime/nuxt/plugins/vue-plugin.ts +1 -1
  93. package/dist/runtime/components/Aria/Aria.vue.d.ts +0 -5
  94. package/dist/runtime/components/Icon/Icon.vue.d.ts +0 -21
  95. package/dist/runtime/components/LibButton/LibButton.vue.d.ts +0 -36
  96. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +0 -42
  97. package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +0 -63
  98. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue.d.ts +0 -61
  99. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts +0 -22
  100. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +0 -40
  101. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue.d.ts +0 -34
  102. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue.d.ts +0 -34
  103. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue.d.ts +0 -22
  104. package/dist/runtime/components/LibDebug/LibDebug.vue.d.ts +0 -32
  105. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue.d.ts +0 -22
  106. package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +0 -43
  107. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +0 -165
  108. package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +0 -27
  109. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue.d.ts +0 -29
  110. package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +0 -17
  111. package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +0 -13
  112. package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +0 -104
  113. package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +0 -14
  114. package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +0 -46
  115. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue.d.ts +0 -41
  116. package/dist/runtime/components/LibRecorder/LibRecorder.vue.d.ts +0 -77
  117. package/dist/runtime/components/LibRoot/LibRoot.vue.d.ts +0 -41
  118. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue.d.ts +0 -35
  119. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +0 -94
  120. package/dist/runtime/components/LibTable/LibTable.vue.d.ts +0 -45
  121. package/dist/runtime/components/Template/NAME.vue.d.ts +0 -17
  122. package/dist/runtime/components/TestControls/TestControls.vue.d.ts +0 -5
@@ -0,0 +1,384 @@
1
+ import { ref, watchEffect } from "vue";
2
+ import LibInputDeprecated from "./LibInputDeprecated.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: LibInputDeprecated,
22
+ title: "Components/Combobox",
23
+ args: {
24
+ border: true,
25
+ label: "Some Label",
26
+ ...{
27
+ _template: void 0
28
+ }
29
+ }
30
+ };
31
+ export default meta;
32
+ const allComponents = {
33
+ ...components,
34
+ LibInputDeprecated,
35
+ Icon,
36
+ IconFaChevronRight,
37
+ IconFaChevronLeft,
38
+ IconFaSolidKeyboard,
39
+ IconFaSolidTags
40
+ };
41
+ const playAutosuggestSelectLike = async (context) => {
42
+ await playBasicSelect(context);
43
+ await playBasicKeyboardSelect(context);
44
+ await playBasicClickSelect(context);
45
+ };
46
+ const setupModelValue = (args) => ({
47
+ modelValue: ref(args.modelValue ?? ""),
48
+ inputValue: ref(args.inputValue ?? "")
49
+ });
50
+ const setupModelValues = (args) => ({
51
+ values: ref(args.values ?? void 0)
52
+ });
53
+ const Base = {
54
+ render: (args) => ({
55
+ components: allComponents,
56
+ setup: () => ({
57
+ ...setupModelValue(args),
58
+ ...setupModelValues(args),
59
+ args: {
60
+ ...args,
61
+ updateOnlyOnSubmit: args.suggestions !== void 0
62
+ }
63
+ }),
64
+ template: args._template ?? `
65
+ Model Value: <span class="inline-block" data-testid="model-value">{{modelValue}}</span>
66
+
67
+ <lib-simple-input-deprecated
68
+ v-bind="args"
69
+ v-model:values="values"
70
+ v-model:inputValue="inputValue"
71
+ v-model="modelValue"
72
+ @submit="modelValue = $event"
73
+ >
74
+ </lib-simple-input-deprecated>
75
+ `
76
+ })
77
+ };
78
+ export const Primary = {
79
+ ...Base,
80
+ play: playBasicVModel
81
+ };
82
+ export const Disabled = {
83
+ ...Base,
84
+ args: {
85
+ disabled: true
86
+ }
87
+ };
88
+ export const Readonly = {
89
+ ...Base,
90
+ args: {
91
+ readonly: true
92
+ }
93
+ };
94
+ export const Invalid = {
95
+ ...Base,
96
+ args: {
97
+ valid: false
98
+ }
99
+ };
100
+ export const AttrsPassword = {
101
+ ...Base,
102
+ args: {
103
+ type: "password"
104
+ }
105
+ };
106
+ export const AttrsDate = {
107
+ ...Base,
108
+ args: {
109
+ type: "date"
110
+ }
111
+ };
112
+ export const AttrsNumber = {
113
+ ...Base,
114
+ args: {
115
+ type: "number"
116
+ }
117
+ };
118
+ export const Borderless = {
119
+ ...Base,
120
+ args: {
121
+ border: false,
122
+ suggestions: ["A", "AB", "ABC", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"]
123
+ }
124
+ };
125
+ export const WithAutosuggest = {
126
+ ...Base,
127
+ args: {
128
+ suggestions: ["A", "AB", "ABC", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"]
129
+ },
130
+ play: playAutosuggestSelectLike
131
+ };
132
+ export const WithAutosuggestNoLabel = {
133
+ ...Base,
134
+ args: {
135
+ label: void 0,
136
+ suggestions: ["A", "AB", "ABC", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"]
137
+ },
138
+ play: playAutosuggestSelectLike
139
+ };
140
+ export const WithInstantAutosuggest = {
141
+ ...Base,
142
+ args: {
143
+ suggestions: ["A", "AB", "ABC", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"]
144
+ }
145
+ };
146
+ export const AutosuggestRestricted = {
147
+ ...WithAutosuggest,
148
+ args: {
149
+ ...WithAutosuggest.args,
150
+ restrictToSuggestions: true
151
+ },
152
+ play: playAutosuggestSelectLike
153
+ };
154
+ export const AutosuggestRestrictedWithClearOnClick = {
155
+ ...WithAutosuggest,
156
+ args: {
157
+ ...WithAutosuggest.args,
158
+ restrictToSuggestions: true,
159
+ _template: `
160
+ Model Value: <span class="inline-block" data-testid="model-value">{{modelValue}}</span>
161
+
162
+ Temp Value: <span class="inline-block" data-testid="temp-value">{{inputValue}}</span>
163
+
164
+ <lib-simple-input-deprecated
165
+ v-bind="args"
166
+ v-model:values="values"
167
+ v-model:inputValue="inputValue"
168
+ v-model="modelValue"
169
+ @submit="modelValue = $event"
170
+ @click="inputValue = ''"
171
+ >
172
+ </lib-simple-input-deprecated>
173
+ `
174
+ },
175
+ play: null
176
+ };
177
+ export const AutosuggestSelectLikeShowAllUnrestricted = {
178
+ ...WithAutosuggest,
179
+ args: {
180
+ ...WithAutosuggest.args,
181
+ restrictToSuggestions: false,
182
+ suggestionsFilter: (_input, items) => items
183
+ },
184
+ play: playAutosuggestSelectLike
185
+ };
186
+ export const AutosuggestObjectOptions = {
187
+ ...WithAutosuggest,
188
+ args: {
189
+ ...WithAutosuggest.args,
190
+ restrictToSuggestions: true,
191
+ suggestions: [
192
+ { label: "A", other: "some data A" },
193
+ { label: "AB", other: "some data AB" },
194
+ { label: "ABC", other: "some data ABC" },
195
+ { label: "ABCDEFGHIJKLMNOPQRSTUVWXYZ", other: "some data ABCDEFGHIJKLMNOPQRSTUVWXYZ" }
196
+ ],
197
+ suggestionLabel: (item) => item.label
198
+ },
199
+ play: playAutosuggestSelectLike
200
+ };
201
+ export const Slots = {
202
+ render: (args) => ({
203
+ components: allComponents,
204
+ setup: () => ({
205
+ ...setupModelValue(args),
206
+ ...setupModelValues(args),
207
+ args: {
208
+ ...args,
209
+ updateOnlyOnSubmit: args.suggestions !== void 0
210
+ }
211
+ }),
212
+ template: `
213
+ Model Value: <span class="inline-block" data-testid="model-value">{{modelValue}}</span>
214
+
215
+
216
+ <lib-simple-input-deprecated
217
+ v-bind="args"
218
+ v-model="modelValue"
219
+ v-model:values="values"
220
+ >
221
+ <template #label>
222
+ Custom Label Slot
223
+ </template>
224
+ <template #left>
225
+ <lib-button class="px-0" :border="false" :label="'none'">
226
+ <icon><icon-fa-chevron-left/></icon>
227
+ </lib-button>
228
+ </template>
229
+ <template #right>
230
+ <lib-button class="px-0" :border="false" :label="'none'">
231
+ <icon><icon-fa-chevron-right/></icon>
232
+ </lib-button>
233
+ </template>
234
+ </lib-simple-input-deprecated>
235
+ `
236
+ })
237
+ };
238
+ const MultipleValuesBase = {
239
+ render: (args) => ({
240
+ components: allComponents,
241
+ setup: () => ({
242
+ ...setupModelValue(args),
243
+ ...setupModelValues(args),
244
+ args
245
+ }),
246
+ template: `
247
+ Model Value: <span class="inline-block" data-testid="model-value">{{modelValue}}</span>
248
+
249
+ <br/>
250
+ Values: <span class="inline-block" data-testid="values">{{values.join(", ")}}</span>
251
+
252
+ <lib-simple-input-deprecated
253
+ v-bind="args"
254
+ v-model="modelValue"
255
+ v-model:values="values"
256
+ >
257
+ <template #left>
258
+ <lib-button class="px-0" :border="false" :disabled="args.disabled || args.readonly">
259
+ <icon><icon-fa-solid-tags/></icon>
260
+ </lib-button>
261
+ </template>
262
+ </lib-simple-input-deprecated>
263
+ `
264
+ }),
265
+ args: {
266
+ values: ["A", "B", "C"]
267
+ }
268
+ };
269
+ export const WithMultipleValues = {
270
+ ...MultipleValuesBase,
271
+ play: playMultipleValues
272
+ };
273
+ export const WithMultipleValuesWithSuggestions = {
274
+ ...MultipleValuesBase,
275
+ args: {
276
+ ...MultipleValuesBase.args,
277
+ suggestions: ["A", "AB", "ABC", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"]
278
+ },
279
+ play: playAutosuggestSelectLike
280
+ };
281
+ export const WithMultipleValuesWithSuggestionsNoSelected = {
282
+ ...MultipleValuesBase,
283
+ args: {
284
+ ...MultipleValuesBase.args,
285
+ suggestions: ["A", "AB", "ABC", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"],
286
+ showSelectedValues: false
287
+ },
288
+ play: playAutosuggestSelectLike
289
+ };
290
+ export const WithMultipleValuesDisabled = {
291
+ ...MultipleValuesBase,
292
+ args: {
293
+ ...MultipleValuesBase.args,
294
+ disabled: true
295
+ }
296
+ };
297
+ export const WithMultipleValuesReadonly = {
298
+ ...MultipleValuesBase,
299
+ args: {
300
+ ...MultipleValuesBase.args,
301
+ readonly: true
302
+ }
303
+ };
304
+ export const InputSlotReplacement = {
305
+ render: (args) => ({
306
+ components: allComponents,
307
+ directives: { vExtractRootEl },
308
+ setup: () => {
309
+ const recording = ref(false);
310
+ const recordingValue = ref("");
311
+ const modelValue = ref("K E Y S");
312
+ const values = ref(args.values ?? []);
313
+ const recorderEl = ref(null);
314
+ const recorder = createRecorderHandler(recordingValue, recording, modelValue, recorderEl);
315
+ watchEffect(createRecorderWatchEffect(recordingValue, recording, modelValue, values));
316
+ return {
317
+ recorder,
318
+ recording,
319
+ recordingValue,
320
+ recorderEl,
321
+ modelValue,
322
+ values,
323
+ args
324
+ };
325
+ },
326
+ template: `
327
+ Model Value: <span class="inline-block" data-testid="model-value">{{modelValue}}</span>
328
+
329
+ <br/>
330
+ Values: <span class="inline-block" data-testid="values">{{values.join(", ")}}</span>
331
+
332
+ <br/>
333
+ Recording: <span class="inline-block" data-testid="recording">{{recording}}</span>
334
+
335
+ <lib-simple-input-deprecated
336
+ v-bind="args"
337
+ v-model="modelValue"
338
+ v-model:values="values"
339
+ >
340
+ <template #input >
341
+ <lib-recorder
342
+ class="p-0"
343
+ v-extract-root-el="_ => recorderEl = _"
344
+ :border="false"
345
+ :recordingValue="recordingValue"
346
+ :recorder="recorder"
347
+ v-model:recording="recording"
348
+ v-model="modelValue"
349
+ @recorder:click="recording = !recording"
350
+ @recorder:blur="recordingValue = modelValue; recording = false"
351
+ />
352
+ </template>
353
+ <template #left>
354
+ <icon><icon-fa-solid-keyboard/></icon>
355
+ </template>
356
+ </lib-simple-input-deprecated>
357
+ `
358
+ }),
359
+ args: {
360
+ values: ["A", "B", "C"]
361
+ }
362
+ };
363
+ export const NextToButton = {
364
+ render: (args) => ({
365
+ components: allComponents,
366
+ setup: () => ({
367
+ ...setupModelValue(args),
368
+ ...setupModelValues(args),
369
+ args
370
+ }),
371
+ template: `
372
+ <div class="flex gap-2 items-center">
373
+ <lib-simple-input-deprecated
374
+ v-bind="args"
375
+ v-model:values="values"
376
+ v-model="modelValue"
377
+ :label="undefined"
378
+ >
379
+ </lib-simple-input-deprecated>
380
+ <lib-button>Button</lib-button>
381
+ </div>
382
+ `
383
+ })
384
+ };