@witchcraft/ui 0.1.0 → 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 (138) hide show
  1. package/dist/module.json +2 -2
  2. package/dist/module.mjs +1 -1
  3. package/dist/runtime/components/Aria/Aria.vue +5 -9
  4. package/dist/runtime/components/Aria/Aria.vue.d.ts +5 -0
  5. package/dist/runtime/components/Icon/Icon.vue +10 -31
  6. package/dist/runtime/components/Icon/Icon.vue.d.ts +21 -0
  7. package/dist/runtime/components/LibButton/LibButton.vue +58 -77
  8. package/dist/runtime/components/LibButton/LibButton.vue.d.ts +36 -0
  9. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +48 -75
  10. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +42 -0
  11. package/dist/runtime/components/LibColorInput/LibColorInput.vue +63 -108
  12. package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +63 -0
  13. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue +271 -352
  14. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue.d.ts +61 -0
  15. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +32 -57
  16. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts +22 -0
  17. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue +17 -38
  18. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +40 -0
  19. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue +53 -82
  20. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue.d.ts +34 -0
  21. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue +50 -67
  22. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue.d.ts +34 -0
  23. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue +7 -8
  24. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue.d.ts +22 -0
  25. package/dist/runtime/components/LibDebug/LibDebug.vue +42 -70
  26. package/dist/runtime/components/LibDebug/LibDebug.vue.d.ts +32 -0
  27. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue +18 -31
  28. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue.d.ts +22 -0
  29. package/dist/runtime/components/LibFileInput/LibFileInput.vue +113 -157
  30. package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +43 -0
  31. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +215 -242
  32. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +165 -0
  33. package/dist/runtime/components/LibLabel/LibLabel.vue +30 -46
  34. package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +27 -0
  35. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +44 -59
  36. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue.d.ts +29 -0
  37. package/dist/runtime/components/LibNotifications/LibNotification.vue +32 -49
  38. package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +17 -0
  39. package/dist/runtime/components/LibNotifications/LibNotifications.vue +63 -84
  40. package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +13 -0
  41. package/dist/runtime/components/LibPagination/LibPagination.vue +67 -112
  42. package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +104 -0
  43. package/dist/runtime/components/LibPalette/LibPalette.vue +20 -23
  44. package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +14 -0
  45. package/dist/runtime/components/LibPopup/LibPopup.vue +314 -352
  46. package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +46 -0
  47. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +70 -92
  48. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue.d.ts +41 -0
  49. package/dist/runtime/components/LibRecorder/LibRecorder.vue +133 -178
  50. package/dist/runtime/components/LibRecorder/LibRecorder.vue.d.ts +77 -0
  51. package/dist/runtime/components/LibRoot/LibRoot.vue +73 -100
  52. package/dist/runtime/components/LibRoot/LibRoot.vue.d.ts +41 -0
  53. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue +49 -78
  54. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue.d.ts +35 -0
  55. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +123 -157
  56. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +94 -0
  57. package/dist/runtime/components/LibTable/LibTable.vue +63 -100
  58. package/dist/runtime/components/LibTable/LibTable.vue.d.ts +45 -0
  59. package/dist/runtime/components/Template/NAME.vue +15 -36
  60. package/dist/runtime/components/Template/NAME.vue.d.ts +17 -0
  61. package/dist/runtime/components/TestControls/TestControls.vue +6 -9
  62. package/dist/runtime/components/TestControls/TestControls.vue.d.ts +5 -0
  63. package/dist/runtime/directives/vResizableCols.js +89 -83
  64. package/dist/types.d.mts +2 -6
  65. package/package.json +11 -11
  66. package/src/runtime/components/Focus.stories.ts +3 -2
  67. package/src/runtime/components/Icon/Icon.vue +0 -1
  68. package/src/runtime/components/LibButton/LibButton.vue +0 -1
  69. package/src/runtime/components/LibCheckbox/LibCheckbox.vue +0 -1
  70. package/src/runtime/components/LibColorInput/LibColorInput.vue +0 -1
  71. package/src/runtime/components/LibColorPicker/utils/safeConvertToHsva.ts +0 -1
  72. package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +0 -1
  73. package/src/runtime/components/LibFileInput/LibFileInput.vue +0 -1
  74. package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +0 -1
  75. package/src/runtime/components/LibMultiValues/LibMultiValues.vue +0 -1
  76. package/src/runtime/components/LibNotifications/LibNotification.vue +0 -1
  77. package/src/runtime/components/LibNotifications/LibNotifications.vue +0 -1
  78. package/src/runtime/components/LibPagination/LibPagination.vue +0 -1
  79. package/src/runtime/components/LibPopup/LibPopup.vue +0 -1
  80. package/src/runtime/components/LibProgressBar/LibProgressBar.vue +0 -1
  81. package/src/runtime/components/LibRecorder/LibRecorder.vue +0 -1
  82. package/src/runtime/components/LibSimpleInput/LibSimpleInput.vue +0 -1
  83. package/src/runtime/components/LibSuggestions/LibSuggestions.vue +0 -1
  84. package/src/runtime/components/LibTable/LibTable.vue +0 -1
  85. package/src/runtime/directives/vResizableCols.ts +79 -73
  86. package/dist/module.cjs +0 -5
  87. package/dist/module.d.ts +0 -36
  88. package/dist/runtime/components/Focus.stories.d.ts +0 -11
  89. package/dist/runtime/components/Focus.stories.js +0 -53
  90. package/dist/runtime/components/LibButton/LibButton.stories.d.ts +0 -12
  91. package/dist/runtime/components/LibButton/LibButton.stories.js +0 -94
  92. package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.d.ts +0 -14
  93. package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.js +0 -29
  94. package/dist/runtime/components/LibColorInput/LibColorInput.stories.d.ts +0 -7
  95. package/dist/runtime/components/LibColorInput/LibColorInput.stories.js +0 -58
  96. package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.d.ts +0 -9
  97. package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.js +0 -68
  98. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.d.ts +0 -7
  99. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.js +0 -36
  100. package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.d.ts +0 -11
  101. package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.js +0 -98
  102. package/dist/runtime/components/LibDebug/LibDebug.stories.d.ts +0 -9
  103. package/dist/runtime/components/LibDebug/LibDebug.stories.js +0 -46
  104. package/dist/runtime/components/LibFileInput/LibFileInput.stories.d.ts +0 -10
  105. package/dist/runtime/components/LibFileInput/LibFileInput.stories.js +0 -63
  106. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.d.ts +0 -33
  107. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.js +0 -384
  108. package/dist/runtime/components/LibLabel/LibLabel.stories.d.ts +0 -6
  109. package/dist/runtime/components/LibLabel/LibLabel.stories.js +0 -25
  110. package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.d.ts +0 -23
  111. package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.js +0 -61
  112. package/dist/runtime/components/LibNotifications/LibNotification.stories.d.ts +0 -15
  113. package/dist/runtime/components/LibNotifications/LibNotification.stories.js +0 -126
  114. package/dist/runtime/components/LibNotifications/LibNotifications.stories.d.ts +0 -6
  115. package/dist/runtime/components/LibNotifications/LibNotifications.stories.js +0 -109
  116. package/dist/runtime/components/LibPagination/LibPagination.stories.d.ts +0 -6
  117. package/dist/runtime/components/LibPagination/LibPagination.stories.js +0 -40
  118. package/dist/runtime/components/LibPalette/LibPalette.stories.d.ts +0 -6
  119. package/dist/runtime/components/LibPalette/LibPalette.stories.js +0 -20
  120. package/dist/runtime/components/LibPopup/LibPopup.stories.d.ts +0 -14
  121. package/dist/runtime/components/LibPopup/LibPopup.stories.js +0 -147
  122. package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.d.ts +0 -10
  123. package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.js +0 -81
  124. package/dist/runtime/components/LibRecorder/LibRecorder.stories.d.ts +0 -19
  125. package/dist/runtime/components/LibRecorder/LibRecorder.stories.js +0 -63
  126. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.d.ts +0 -26
  127. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.js +0 -78
  128. package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.d.ts +0 -27
  129. package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.js +0 -112
  130. package/dist/runtime/components/LibTable/LibTable.stories.d.ts +0 -16
  131. package/dist/runtime/components/LibTable/LibTable.stories.js +0 -156
  132. package/dist/runtime/components/Reset.stories.d.ts +0 -5
  133. package/dist/runtime/components/Reset.stories.js +0 -19
  134. package/dist/runtime/components/Scrolling.stories.d.ts +0 -6
  135. package/dist/runtime/components/Scrolling.stories.js +0 -44
  136. package/dist/runtime/composables/useScrollNearContainerEdges.stories.d.ts +0 -7
  137. package/dist/runtime/composables/useScrollNearContainerEdges.stories.js +0 -85
  138. package/dist/types.d.ts +0 -7
@@ -1,7 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/vue3";
2
- import LibDarkModeSwitcher from "./LibDarkModeSwitcher.vue.js";
3
- declare const meta: Meta<typeof LibDarkModeSwitcher>;
4
- export default meta;
5
- type Story = StoryObj<typeof LibDarkModeSwitcher>;
6
- export declare const Primary: Story;
7
- export declare const WithoutLabel: Story;
@@ -1,36 +0,0 @@
1
- import { ref } from "vue";
2
- import LibDarkModeSwitcher from "./LibDarkModeSwitcher.vue";
3
- import * as components from "../index.js";
4
- const meta = {
5
- component: LibDarkModeSwitcher,
6
- title: "Components/DarkModeSwitcher",
7
- args: {}
8
- };
9
- export default meta;
10
- export const Primary = {
11
- render: (args) => ({
12
- components,
13
- setup: () => {
14
- const darkMode = ref(false);
15
- return {
16
- args,
17
- darkMode
18
- };
19
- },
20
- template: `
21
- Value: {{darkMode}}
22
- <LibDarkModeSwitcher
23
- @update:darkMode="darkMode = $event"
24
- v-bind="{...args}"
25
- ></LibDarkModeSwitcher>
26
-
27
- `
28
- })
29
- };
30
- export const WithoutLabel = {
31
- ...Primary,
32
- args: {
33
- ...Primary.args,
34
- showLabel: false
35
- }
36
- };
@@ -1,11 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/vue3";
2
- import * as components from "../index.js.js";
3
- declare const singleMeta: Meta<typeof components.LibDatePicker>;
4
- export default singleMeta;
5
- type Story = StoryObj<typeof components.LibDatePicker>;
6
- export declare const Primary: Story;
7
- export declare const DateRange: Story;
8
- export declare const IconTriggerFirst: Story;
9
- export declare const BottomSlot: Story;
10
- export declare const DateWithTime: Story;
11
- export declare const WithDifferentFallbackDate: Story;
@@ -1,98 +0,0 @@
1
- import { CalendarDate, fromDate, getLocalTimeZone, toTimeZone } from "@internationalized/date";
2
- import { computed, ref } from "vue";
3
- import { createNoonUtcDate } from "../../helpers/createNoonUtcDate.js";
4
- import * as components from "../index.js";
5
- function html(strings, ...values) {
6
- return String.raw(strings, ...values);
7
- }
8
- const singleMeta = {
9
- component: components.LibDatePicker,
10
- title: "Components/DatePicker",
11
- args: {
12
- // @ts-expect-error custom prop just for story
13
- slot: "",
14
- timeZone: getLocalTimeZone()
15
- }
16
- };
17
- export default singleMeta;
18
- function toUTC(m, timeZone) {
19
- return toTimeZone(fromDate(m, timeZone), "UTC").toAbsoluteString();
20
- }
21
- export const Primary = {
22
- render: (args) => ({
23
- components: {
24
- ...components
25
- },
26
- setup: () => {
27
- const modelValue = ref(args.modelValue);
28
- const timeZone = ref(args.timeZone);
29
- const debugUtcDate = computed(() => {
30
- const m = modelValue.value;
31
- const z = timeZone.value;
32
- return m instanceof Date ? toUTC(m, z) : typeof m === "object" ? `Start: ${m.start ? toUTC(m.start, z) : "undefined"}, End: ${m.end ? toUTC(m.end, z) : "undefined"}` : "undefined";
33
- });
34
- return { args, getLocalTimeZone, modelValue, timeZone, debugUtcDate };
35
- },
36
- template: `
37
- <div>Date: {{modelValue ?? "undefined"}}</div>
38
- <div>Date UTC: {{debugUtcDate}}</div>
39
- <div>Detected timezone (via @internationalized/date): {{getLocalTimeZone()}}</div>
40
- <LibTimeZonePicker
41
- v-model="timeZone"
42
- label="Override Time Zone"
43
- wrapper-class="[&_.suggestions]:max-h-[200px] [&_.suggestions]:overflow-y-auto"
44
- />
45
- <div>
46
- This component has no border, added here to see it's size.
47
- </div>
48
- <div class="border border-neutral-500">
49
- <LibDatePicker v-bind="args" v-model="modelValue" :time-zone="timeZone">
50
- ${args.slot}
51
- </LibDatePicker>
52
- </div>
53
- `
54
- })
55
- };
56
- export const DateRange = {
57
- ...Primary,
58
- args: {
59
- modelValue: { start: void 0, end: void 0 }
60
- }
61
- };
62
- export const IconTriggerFirst = {
63
- ...Primary,
64
- args: {
65
- ...Primary.args,
66
- class: "[&_.trigger]:order-first"
67
- }
68
- };
69
- export const BottomSlot = {
70
- ...Primary,
71
- args: {
72
- // @ts-expect-error see above
73
- slot: html`
74
- <template #default="slotProps">
75
- <LibButton>Custom content can be added here.</LibButton>
76
- <p class="break-all">
77
- Content has access to the internal temporary/suggested date value and can change it (e.g. set it to today).
78
- </p>
79
- <p>Temp value:</p>
80
- {{ slotProps.tempValue }}
81
- </template>
82
- `
83
- }
84
- };
85
- export const DateWithTime = {
86
- ...Primary,
87
- args: {
88
- ...Primary.args,
89
- showTime: true
90
- }
91
- };
92
- export const WithDifferentFallbackDate = {
93
- ...Primary,
94
- args: {
95
- ...Primary.args,
96
- fallbackDate: createNoonUtcDate(new CalendarDate(2e3, 1, 1)).toDate()
97
- }
98
- };
@@ -1,9 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/vue3";
2
- import LibDebug from "./LibDebug.vue.js";
3
- declare const meta: Meta<typeof LibDebug>;
4
- export default meta;
5
- type Story = StoryObj<typeof LibDebug>;
6
- export declare const Primary: Story;
7
- export declare const WithCustomTab: Story;
8
- export declare const NoValue: Story;
9
- export declare const StringWithWhitespace: Story;
@@ -1,46 +0,0 @@
1
- import { crop } from "@alanscodelog/utils/crop.js";
2
- import LibDebug from "./LibDebug.vue";
3
- import * as components from "../index.js";
4
- const meta = {
5
- component: LibDebug,
6
- title: "Components/Debug",
7
- args: {
8
- value: { any: ["any", { value: "any" }] }
9
- }
10
- };
11
- export default meta;
12
- export const Primary = {
13
- render: (args) => ({
14
- components,
15
- setup: () => ({ args }),
16
- template: `
17
- <lib-debug v-bind="args" />
18
- `
19
- })
20
- };
21
- export const WithCustomTab = {
22
- ...Primary,
23
- args: {
24
- ...Primary.args,
25
- value: { any: ["any", { value: "any" }] },
26
- tab: 2
27
- }
28
- };
29
- export const NoValue = {
30
- ...Primary,
31
- args: {
32
- ...Primary.args,
33
- value: void 0
34
- }
35
- };
36
- export const StringWithWhitespace = {
37
- ...Primary,
38
- args: {
39
- ...Primary.args,
40
- value: crop`
41
- Manually
42
- Indented
43
- String
44
- `
45
- }
46
- };
@@ -1,10 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/vue3";
2
- import LibFileInput from "./LibFileInput.vue.js";
3
- declare const meta: Meta<typeof LibFileInput>;
4
- export default meta;
5
- type Story = StoryObj<typeof LibFileInput>;
6
- export declare const SingleFile: Story;
7
- export declare const MultipleFile: Story;
8
- export declare const AnyFormat: Story;
9
- export declare const Compact: Story;
10
- export declare const ErrorHandling: Story;
@@ -1,63 +0,0 @@
1
- import { ref } from "vue";
2
- import LibFileInput from "./LibFileInput.vue";
3
- import * as components from "../index.js";
4
- const meta = {
5
- component: LibFileInput,
6
- title: "Components/FileInput",
7
- args: {}
8
- };
9
- export default meta;
10
- export const SingleFile = {
11
- render: (args) => ({
12
- components,
13
- setup: () => {
14
- function errorHandler(e) {
15
- console.log(e);
16
- }
17
- return { args, errorHandler };
18
- },
19
- template: `
20
- <lib-file-input v-bind="{...args}" @errors="errorHandler"></lib-file-input>
21
- `
22
- })
23
- };
24
- export const MultipleFile = {
25
- ...SingleFile,
26
- args: {
27
- ...SingleFile.args,
28
- multiple: true
29
- }
30
- };
31
- export const AnyFormat = {
32
- ...SingleFile,
33
- args: {
34
- ...SingleFile.args,
35
- multiple: true,
36
- formats: []
37
- }
38
- };
39
- export const Compact = {
40
- ...SingleFile,
41
- args: {
42
- ...SingleFile.args,
43
- compact: true
44
- }
45
- };
46
- export const ErrorHandling = {
47
- render: (args) => ({
48
- components,
49
- setup: () => {
50
- const errors = ref([]);
51
- const errorHandler = (e) => errors.value = e;
52
- return {
53
- args,
54
- errors,
55
- errorHandler
56
- };
57
- },
58
- template: `
59
- <lib-debug :title="'Errors'">{{errors}}</lib-debug>
60
- <lib-file-input v-bind="{...args}" @errors="errorHandler"></lib-file-input>
61
- `
62
- })
63
- };
@@ -1,33 +0,0 @@
1
- import type { StoryObj } from "@storybook/vue3";
2
- import LibInputDeprecated from "./LibInputDeprecated.vue.js";
3
- declare const meta: {
4
- component: any;
5
- title: string;
6
- args: any;
7
- };
8
- export default meta;
9
- type Story = StoryObj<typeof LibInputDeprecated>;
10
- export declare const Primary: Story;
11
- export declare const Disabled: Story;
12
- export declare const Readonly: Story;
13
- export declare const Invalid: Story;
14
- export declare const AttrsPassword: Story;
15
- export declare const AttrsDate: Story;
16
- export declare const AttrsNumber: Story;
17
- export declare const Borderless: any;
18
- export declare const WithAutosuggest: any;
19
- export declare const WithAutosuggestNoLabel: any;
20
- export declare const WithInstantAutosuggest: any;
21
- export declare const AutosuggestRestricted: any;
22
- export declare const AutosuggestRestrictedWithClearOnClick: any;
23
- export declare const AutosuggestSelectLikeShowAllUnrestricted: any;
24
- export declare const AutosuggestObjectOptions: any;
25
- export declare const Slots: Story;
26
- /** Press enter to add a value. */
27
- export declare const WithMultipleValues: Story;
28
- export declare const WithMultipleValuesWithSuggestions: any;
29
- export declare const WithMultipleValuesWithSuggestionsNoSelected: any;
30
- export declare const WithMultipleValuesDisabled: any;
31
- export declare const WithMultipleValuesReadonly: any;
32
- export declare const InputSlotReplacement: Story;
33
- export declare const NextToButton: Story;
@@ -1,384 +0,0 @@
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
- };