@witchcraft/ui 0.3.26 → 0.4.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -61
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/assets/animations.css +1 -1
- package/dist/runtime/assets/locales/en.json +2 -0
- package/dist/runtime/build/WitchcraftUiResolver.js +1 -1
- package/dist/runtime/components/TestControls/TestControls.vue +3 -3
- package/dist/runtime/components/WButton/WButton.d.vue.ts +34 -0
- package/dist/runtime/components/{LibButton/LibButton.vue → WButton/WButton.vue} +26 -38
- package/dist/runtime/components/WButton/WButton.vue.d.ts +34 -0
- package/dist/runtime/components/WCheckbox/WCheckbox.d.vue.ts +33 -0
- package/dist/runtime/components/WCheckbox/WCheckbox.vue +109 -0
- package/dist/runtime/components/WCheckbox/WCheckbox.vue.d.ts +33 -0
- package/dist/runtime/components/WColorInput/WColorInput.d.vue.ts +45 -0
- package/dist/runtime/components/WColorInput/WColorInput.vue +85 -0
- package/dist/runtime/components/WColorInput/WColorInput.vue.d.ts +45 -0
- package/dist/runtime/components/WColorInput/WColorSwatchButton.d.vue.ts +28 -0
- package/dist/runtime/components/WColorInput/WColorSwatchButton.vue +86 -0
- package/dist/runtime/components/WColorInput/WColorSwatchButton.vue.d.ts +28 -0
- package/dist/runtime/components/{LibColorPicker/LibColorPicker.d.vue.ts → WColorPicker/WColorPicker.d.vue.ts} +7 -6
- package/dist/runtime/components/{LibColorPicker/LibColorPicker.vue → WColorPicker/WColorPicker.vue} +40 -29
- package/dist/runtime/components/{LibColorPicker/LibColorPicker.vue.d.ts → WColorPicker/WColorPicker.vue.d.ts} +7 -6
- package/dist/runtime/components/WCombobox/WCombobox.d.vue.ts +109 -0
- package/dist/runtime/components/WCombobox/WCombobox.vue +402 -0
- package/dist/runtime/components/WCombobox/WCombobox.vue.d.ts +109 -0
- package/dist/runtime/components/WCombobox/storyPlays.d.ts +18 -0
- package/dist/runtime/components/WCombobox/storyPlays.js +68 -0
- package/dist/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.d.vue.ts → WDarkModeSwitcher/WDarkModeSwitcher.d.vue.ts} +8 -13
- package/dist/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.vue → WDarkModeSwitcher/WDarkModeSwitcher.vue} +11 -14
- package/dist/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts → WDarkModeSwitcher/WDarkModeSwitcher.vue.d.ts} +8 -13
- package/dist/runtime/components/WDatePicker/WDatePicker.d.vue.ts +40 -0
- package/dist/runtime/components/{LibDatePicker/LibDatePicker.vue → WDatePicker/WDatePicker.vue} +3 -7
- package/dist/runtime/components/WDatePicker/WDatePicker.vue.d.ts +40 -0
- package/dist/runtime/components/{LibDatePicker/LibRangeDatePicker.vue → WDatePicker/WRangeDatePicker.vue} +16 -21
- package/dist/runtime/components/{LibDatePicker/LibSingleDatePicker.vue → WDatePicker/WSingleDatePicker.vue} +16 -21
- package/dist/runtime/components/{LibDatePicker/LibTimeZonePicker.d.vue.ts → WDatePicker/WTimeZonePicker.d.vue.ts} +1 -11
- package/dist/runtime/components/{LibDatePicker/LibTimeZonePicker.vue → WDatePicker/WTimeZonePicker.vue} +5 -12
- package/dist/runtime/components/{LibDatePicker/LibTimeZonePicker.vue.d.ts → WDatePicker/WTimeZonePicker.vue.d.ts} +1 -11
- package/dist/runtime/components/{LibDebug/LibDebug.vue → WDebug/WDebug.vue} +9 -12
- package/dist/runtime/components/{LibDevOnly/LibDevOnly.d.vue.ts → WDevOnly/WDevOnly.d.vue.ts} +0 -3
- package/dist/runtime/components/{LibDevOnly/LibDevOnly.vue.d.ts → WDevOnly/WDevOnly.vue.d.ts} +0 -3
- package/dist/runtime/components/WFileInput/WFileInput.d.vue.ts +58 -0
- package/dist/runtime/components/{LibFileInput/LibFileInput.vue → WFileInput/WFileInput.vue} +71 -57
- package/dist/runtime/components/WFileInput/WFileInput.vue.d.ts +58 -0
- package/dist/runtime/components/{Icon/Icon.vue.d.ts → WIcon/WIcon.d.vue.ts} +2 -6
- package/dist/runtime/components/{Icon/Icon.vue → WIcon/WIcon.vue} +1 -1
- package/dist/runtime/components/{Icon/Icon.d.vue.ts → WIcon/WIcon.vue.d.ts} +2 -6
- package/dist/runtime/components/{LibMultiValues/LibMultiValues.d.vue.ts → WMultiValues/WMultiValues.d.vue.ts} +8 -14
- package/dist/runtime/components/WMultiValues/WMultiValues.vue +149 -0
- package/dist/runtime/components/{LibMultiValues/LibMultiValues.vue.d.ts → WMultiValues/WMultiValues.vue.d.ts} +8 -14
- package/dist/runtime/components/WNotifications/WNotification.d.vue.ts +37 -0
- package/dist/runtime/components/{LibNotifications/LibNotification.vue → WNotifications/WNotification.vue} +32 -47
- package/dist/runtime/components/WNotifications/WNotification.vue.d.ts +37 -0
- package/dist/runtime/components/WNotifications/WNotifications.d.vue.ts +11 -0
- package/dist/runtime/components/{LibNotifications/LibNotifications.vue → WNotifications/WNotifications.vue} +35 -17
- package/dist/runtime/components/WNotifications/WNotifications.vue.d.ts +11 -0
- package/dist/runtime/components/WNumberInput/WNumberInput.d.vue.ts +27 -0
- package/dist/runtime/components/WNumberInput/WNumberInput.vue +96 -0
- package/dist/runtime/components/WNumberInput/WNumberInput.vue.d.ts +27 -0
- package/dist/runtime/components/WPagination/WPagination.d.vue.ts +59 -0
- package/dist/runtime/components/WPagination/WPagination.vue +182 -0
- package/dist/runtime/components/WPagination/WPagination.vue.d.ts +59 -0
- package/dist/runtime/components/WPalette/WPalette.d.vue.ts +11 -0
- package/dist/runtime/components/{LibPalette/LibPalette.vue → WPalette/WPalette.vue} +3 -8
- package/dist/runtime/components/WPalette/WPalette.vue.d.ts +11 -0
- package/dist/runtime/components/WPopover/WPopover.d.vue.ts +43 -0
- package/dist/runtime/components/WPopover/WPopover.vue +138 -0
- package/dist/runtime/components/WPopover/WPopover.vue.d.ts +43 -0
- package/dist/runtime/components/WPopup/WPopup.d.vue.ts +41 -0
- package/dist/runtime/components/WPopup/WPopup.vue +74 -0
- package/dist/runtime/components/WPopup/WPopup.vue.d.ts +41 -0
- package/dist/runtime/components/{LibProgressBar/LibProgressBar.d.vue.ts → WProgressBar/WProgressBar.d.vue.ts} +14 -18
- package/dist/runtime/components/WProgressBar/WProgressBar.vue +150 -0
- package/dist/runtime/components/{LibProgressBar/LibProgressBar.vue.d.ts → WProgressBar/WProgressBar.vue.d.ts} +14 -18
- package/dist/runtime/components/{LibRecorder/LibRecorder.d.vue.ts → WRecorder/WRecorder.d.vue.ts} +14 -29
- package/dist/runtime/components/{LibRecorder/LibRecorder.vue → WRecorder/WRecorder.vue} +37 -36
- package/dist/runtime/components/{LibRecorder/LibRecorder.vue.d.ts → WRecorder/WRecorder.vue.d.ts} +14 -29
- package/dist/runtime/components/{LibRoot/LibRoot.d.vue.ts → WRoot/WRoot.d.vue.ts} +6 -5
- package/dist/runtime/components/{LibRoot/LibRoot.vue → WRoot/WRoot.vue} +17 -15
- package/dist/runtime/components/{LibRoot/LibRoot.vue.d.ts → WRoot/WRoot.vue.d.ts} +6 -5
- package/dist/runtime/components/{LibSimpleInput/LibSimpleInput.d.vue.ts → WSimpleInput/WSimpleInput.d.vue.ts} +9 -16
- package/dist/runtime/components/{LibSimpleInput/LibSimpleInput.vue → WSimpleInput/WSimpleInput.vue} +12 -23
- package/dist/runtime/components/{LibSimpleInput/LibSimpleInput.vue.d.ts → WSimpleInput/WSimpleInput.vue.d.ts} +9 -16
- package/dist/runtime/components/WTable/WTable.d.vue.ts +102 -0
- package/dist/runtime/components/{LibTable/LibTable.vue → WTable/WTable.vue} +13 -14
- package/dist/runtime/components/WTable/WTable.vue.d.ts +102 -0
- package/dist/runtime/components/WTooltip/WTooltip.d.vue.ts +40 -0
- package/dist/runtime/components/WTooltip/WTooltip.vue +111 -0
- package/dist/runtime/components/WTooltip/WTooltip.vue.d.ts +40 -0
- package/dist/runtime/components/index.d.ts +20 -20
- package/dist/runtime/components/index.js +20 -20
- package/dist/runtime/composables/index.d.ts +4 -4
- package/dist/runtime/composables/index.js +4 -4
- package/dist/runtime/composables/useDelayedLoadingIndicator.d.ts +9 -0
- package/dist/runtime/composables/useDelayedLoadingIndicator.js +18 -0
- package/dist/runtime/composables/useDisplayForReka.d.ts +25 -0
- package/dist/runtime/composables/useDisplayForReka.js +16 -0
- package/dist/runtime/composables/useFallbackId.d.ts +3 -0
- package/dist/runtime/composables/useFallbackId.js +5 -0
- package/dist/runtime/composables/useInjectedDarkMode.d.ts +1 -1
- package/dist/runtime/composables/usePopupConstrainToStyle.d.ts +8 -0
- package/dist/runtime/composables/usePopupConstrainToStyle.js +8 -0
- package/dist/runtime/composables/useSetupDarkMode.d.ts +2 -3
- package/dist/runtime/composables/useSetupDarkMode.js +90 -4
- package/dist/runtime/helpers/NotificationHandler.d.ts +2 -2
- package/dist/runtime/injectionKeys.d.ts +1 -5
- package/dist/runtime/injectionKeys.js +0 -2
- package/dist/runtime/types/index.d.ts +85 -27
- package/dist/runtime/types/index.js +1 -0
- package/package.json +1 -1
- package/src/module.ts +1 -1
- package/src/runtime/assets/animations.css +3 -3
- package/src/runtime/assets/locales/en.json +2 -0
- package/src/runtime/build/WitchcraftUiResolver.ts +1 -1
- package/src/runtime/components/TestControls/TestControls.vue +3 -3
- package/src/runtime/components/WButton/WButton.stories.ts +112 -0
- package/src/runtime/components/{LibButton/LibButton.vue → WButton/WButton.vue} +34 -50
- package/src/runtime/components/{LibCheckbox/LibCheckbox.stories.ts → WCheckbox/WCheckbox.stories.ts} +5 -5
- package/src/runtime/components/WCheckbox/WCheckbox.vue +123 -0
- package/src/runtime/components/{LibColorInput/LibColorInput.stories.ts → WColorInput/WColorInput.stories.ts} +8 -8
- package/src/runtime/components/WColorInput/WColorInput.vue +112 -0
- package/src/runtime/components/WColorInput/WColorSwatchButton.vue +102 -0
- package/src/runtime/components/{LibColorPicker/LibColorPicker.stories.ts → WColorPicker/WColorPicker.stories.ts} +12 -12
- package/src/runtime/components/{LibColorPicker/LibColorPicker.vue → WColorPicker/WColorPicker.vue} +43 -32
- package/src/runtime/components/WCombobox/WCombobox.stories.ts +209 -0
- package/src/runtime/components/WCombobox/WCombobox.vue +446 -0
- package/src/runtime/components/WCombobox/storyPlays.ts +92 -0
- package/src/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.stories.ts → WDarkModeSwitcher/WDarkModeSwitcher.stories.ts} +6 -6
- package/src/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.vue → WDarkModeSwitcher/WDarkModeSwitcher.vue} +19 -30
- package/src/runtime/components/{LibDatePicker/LibDatePicker.stories.ts → WDatePicker/WDatePicker.stories.ts} +42 -34
- package/src/runtime/components/{LibDatePicker/LibDatePicker.vue → WDatePicker/WDatePicker.vue} +3 -7
- package/src/runtime/components/{LibDatePicker/LibRangeDatePicker.vue → WDatePicker/WRangeDatePicker.vue} +16 -22
- package/src/runtime/components/{LibDatePicker/LibSingleDatePicker.vue → WDatePicker/WSingleDatePicker.vue} +16 -22
- package/src/runtime/components/{LibDatePicker/LibTimeZonePicker.vue → WDatePicker/WTimeZonePicker.vue} +5 -12
- package/src/runtime/components/{LibDebug/LibDebug.stories.ts → WDebug/WDebug.stories.ts} +5 -5
- package/src/runtime/components/{LibDebug/LibDebug.vue → WDebug/WDebug.vue} +8 -11
- package/src/runtime/components/{LibDevOnly/LibDevOnly.vue → WDevOnly/WDevOnly.vue} +0 -4
- package/src/runtime/components/{LibFileInput/LibFileInput.stories.ts → WFileInput/WFileInput.stories.ts} +7 -7
- package/src/runtime/components/{LibFileInput/LibFileInput.vue → WFileInput/WFileInput.vue} +95 -98
- package/src/runtime/components/{Icon/Icon.vue → WIcon/WIcon.vue} +5 -8
- package/src/runtime/components/{LibMultiValues/LibMultiValues.stories.ts → WMultiValues/WMultiValues.stories.ts} +9 -9
- package/src/runtime/components/WMultiValues/WMultiValues.vue +161 -0
- package/src/runtime/components/{LibNotifications/LibNotification.stories.ts → WNotifications/WNotification.stories.ts} +9 -9
- package/src/runtime/components/{LibNotifications/LibNotification.vue → WNotifications/WNotification.vue} +43 -66
- package/src/runtime/components/WNotifications/WNotifications.stories.ts +139 -0
- package/src/runtime/components/{LibNotifications/LibNotifications.vue → WNotifications/WNotifications.vue} +51 -29
- package/src/runtime/components/WNumberInput/WNumberInput.vue +109 -0
- package/src/runtime/components/WPagination/WPagination.stories.ts +51 -0
- package/src/runtime/components/WPagination/WPagination.vue +207 -0
- package/src/runtime/components/{LibPalette/LibPalette.stories.ts → WPalette/WPalette.stories.ts} +6 -6
- package/src/runtime/components/{LibPalette/LibPalette.vue → WPalette/WPalette.vue} +3 -8
- package/src/runtime/components/WPopover/WPopover.stories.ts +218 -0
- package/src/runtime/components/WPopover/WPopover.vue +161 -0
- package/src/runtime/components/WPopup/WPopup.stories.ts +60 -0
- package/src/runtime/components/WPopup/WPopup.vue +93 -0
- package/src/runtime/components/WProgressBar/WProgressBar.stories.ts +119 -0
- package/src/runtime/components/WProgressBar/WProgressBar.vue +185 -0
- package/src/runtime/components/{LibRecorder/LibRecorder.stories.ts → WRecorder/WRecorder.stories.ts} +9 -6
- package/src/runtime/components/{LibRecorder/LibRecorder.vue → WRecorder/WRecorder.vue} +69 -68
- package/src/runtime/components/{LibRoot/LibRoot.vue → WRoot/WRoot.vue} +18 -15
- package/src/runtime/components/{LibSimpleInput/LibSimpleInput.stories.ts → WSimpleInput/WSimpleInput.stories.ts} +11 -12
- package/src/runtime/components/{LibSimpleInput/LibSimpleInput.vue → WSimpleInput/WSimpleInput.vue} +27 -44
- package/src/runtime/components/{LibTable/LibTable.stories.ts → WTable/WTable.stories.ts} +60 -52
- package/src/runtime/components/{LibTable/LibTable.vue → WTable/WTable.vue} +85 -87
- package/src/runtime/components/WTooltip/WTooltip.stories.ts +82 -0
- package/src/runtime/components/WTooltip/WTooltip.vue +126 -0
- package/src/runtime/components/index.ts +20 -20
- package/src/runtime/composables/index.ts +4 -4
- package/src/runtime/composables/useDelayedLoadingIndicator.ts +30 -0
- package/src/runtime/composables/useDisplayForReka.ts +37 -0
- package/src/runtime/composables/useFallbackId.ts +6 -0
- package/src/runtime/composables/useInjectedDarkMode.ts +1 -2
- package/src/runtime/composables/usePopupConstrainToStyle.ts +29 -0
- package/src/runtime/composables/useSetupDarkMode.ts +122 -4
- package/src/runtime/helpers/NotificationHandler.ts +2 -2
- package/src/runtime/injectionKeys.ts +1 -7
- package/src/runtime/types/index.ts +105 -32
- package/types/components.d.ts +13 -15
- package/dist/runtime/components/Aria/Aria.d.vue.ts +0 -6
- package/dist/runtime/components/Aria/Aria.vue +0 -16
- package/dist/runtime/components/Aria/Aria.vue.d.ts +0 -6
- package/dist/runtime/components/LibButton/LibButton.d.vue.ts +0 -37
- package/dist/runtime/components/LibButton/LibButton.vue.d.ts +0 -37
- package/dist/runtime/components/LibCheckbox/LibCheckbox.d.vue.ts +0 -41
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +0 -103
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +0 -41
- package/dist/runtime/components/LibColorInput/LibColorInput.d.vue.ts +0 -64
- package/dist/runtime/components/LibColorInput/LibColorInput.vue +0 -162
- package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +0 -64
- package/dist/runtime/components/LibDatePicker/LibDatePicker.d.vue.ts +0 -191
- package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +0 -191
- package/dist/runtime/components/LibFileInput/LibFileInput.d.vue.ts +0 -46
- package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +0 -46
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.d.vue.ts +0 -256
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +0 -387
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +0 -256
- package/dist/runtime/components/LibLabel/LibLabel.d.vue.ts +0 -27
- package/dist/runtime/components/LibLabel/LibLabel.vue +0 -45
- package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +0 -27
- package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +0 -109
- package/dist/runtime/components/LibNotifications/LibNotification.d.vue.ts +0 -45
- package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +0 -45
- package/dist/runtime/components/LibNotifications/LibNotifications.d.vue.ts +0 -15
- package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +0 -15
- package/dist/runtime/components/LibPagination/LibPagination.d.vue.ts +0 -105
- package/dist/runtime/components/LibPagination/LibPagination.vue +0 -229
- package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +0 -105
- package/dist/runtime/components/LibPalette/LibPalette.d.vue.ts +0 -15
- package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +0 -15
- package/dist/runtime/components/LibPopup/LibPopup.d.vue.ts +0 -52
- package/dist/runtime/components/LibPopup/LibPopup.vue +0 -365
- package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +0 -52
- package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +0 -169
- package/dist/runtime/components/LibSuggestions/LibSuggestions.d.vue.ts +0 -99
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +0 -178
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +0 -99
- package/dist/runtime/components/LibTable/LibTable.d.vue.ts +0 -125
- package/dist/runtime/components/LibTable/LibTable.vue.d.ts +0 -125
- package/dist/runtime/components/Template/NAME.d.vue.ts +0 -18
- package/dist/runtime/components/Template/NAME.vue +0 -27
- package/dist/runtime/components/Template/NAME.vue.d.ts +0 -18
- package/dist/runtime/components/Template/TemplateStory.d.ts +0 -7
- package/dist/runtime/components/Template/TemplateStory.js +0 -22
- package/dist/runtime/components/shared/props.d.ts +0 -171
- package/dist/runtime/components/shared/props.js +0 -2
- package/dist/runtime/composables/useAriaLabel.d.ts +0 -6
- package/dist/runtime/composables/useAriaLabel.js +0 -15
- package/dist/runtime/composables/useDarkMode.d.ts +0 -77
- package/dist/runtime/composables/useDarkMode.js +0 -89
- package/dist/runtime/composables/useDivideAttrs.d.ts +0 -27
- package/dist/runtime/composables/useDivideAttrs.js +0 -27
- package/dist/runtime/composables/useSuggestions.d.ts +0 -40
- package/dist/runtime/composables/useSuggestions.js +0 -263
- package/src/runtime/components/Aria/Aria.vue +0 -26
- package/src/runtime/components/LibButton/LibButton.stories.ts +0 -106
- package/src/runtime/components/LibCheckbox/LibCheckbox.vue +0 -131
- package/src/runtime/components/LibColorInput/LibColorInput.vue +0 -203
- package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.ts +0 -405
- package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +0 -419
- package/src/runtime/components/LibLabel/LibLabel.stories.ts +0 -33
- package/src/runtime/components/LibLabel/LibLabel.vue +0 -65
- package/src/runtime/components/LibMultiValues/LibMultiValues.vue +0 -123
- package/src/runtime/components/LibNotifications/LibNotifications.stories.ts +0 -131
- package/src/runtime/components/LibPagination/LibPagination.stories.ts +0 -49
- package/src/runtime/components/LibPagination/LibPagination.vue +0 -274
- package/src/runtime/components/LibPopup/LibPopup.stories.ts +0 -153
- package/src/runtime/components/LibPopup/LibPopup.vue +0 -396
- package/src/runtime/components/LibProgressBar/LibProgressBar.stories.ts +0 -90
- package/src/runtime/components/LibProgressBar/LibProgressBar.vue +0 -197
- package/src/runtime/components/LibSuggestions/LibSuggestions.stories.ts +0 -134
- package/src/runtime/components/LibSuggestions/LibSuggestions.vue +0 -212
- package/src/runtime/components/Template/NAME.vue +0 -49
- package/src/runtime/components/Template/TemplateStory.ts +0 -37
- package/src/runtime/components/shared/props.ts +0 -199
- package/src/runtime/composables/useAriaLabel.ts +0 -23
- package/src/runtime/composables/useDarkMode.ts +0 -199
- package/src/runtime/composables/useDivideAttrs.ts +0 -53
- package/src/runtime/composables/useSuggestions.ts +0 -339
- /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToHsva.d.ts +0 -0
- /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToHsva.js +0 -0
- /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToRgba.d.ts +0 -0
- /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToRgba.js +0 -0
- /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/toLowPrecisionRgbaString.d.ts +0 -0
- /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/toLowPrecisionRgbaString.js +0 -0
- /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/truncate.d.ts +0 -0
- /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/truncate.js +0 -0
- /package/dist/runtime/components/{LibDatePicker/LibRangeDatePicker.d.vue.ts → WDatePicker/WRangeDatePicker.d.vue.ts} +0 -0
- /package/dist/runtime/components/{LibDatePicker/LibRangeDatePicker.vue.d.ts → WDatePicker/WRangeDatePicker.vue.d.ts} +0 -0
- /package/dist/runtime/components/{LibDatePicker/LibSingleDatePicker.d.vue.ts → WDatePicker/WSingleDatePicker.d.vue.ts} +0 -0
- /package/dist/runtime/components/{LibDatePicker/LibSingleDatePicker.vue.d.ts → WDatePicker/WSingleDatePicker.vue.d.ts} +0 -0
- /package/dist/runtime/components/{LibDatePicker → WDatePicker}/helpers.d.ts +0 -0
- /package/dist/runtime/components/{LibDatePicker → WDatePicker}/helpers.js +0 -0
- /package/dist/runtime/components/{LibDebug/LibDebug.d.vue.ts → WDebug/WDebug.d.vue.ts} +0 -0
- /package/dist/runtime/components/{LibDebug/LibDebug.vue.d.ts → WDebug/WDebug.vue.d.ts} +0 -0
- /package/dist/runtime/components/{LibDevOnly/LibDevOnly.vue → WDevOnly/WDevOnly.vue} +0 -0
- /package/dist/runtime/components/{LibNotifications/LibNotificationTestMessageComponent.d.vue.ts → WNotifications/WNotificationTestMessageComponent.d.vue.ts} +0 -0
- /package/dist/runtime/components/{LibNotifications/LibNotificationTestMessageComponent.vue → WNotifications/WNotificationTestMessageComponent.vue} +0 -0
- /package/dist/runtime/components/{LibNotifications/LibNotificationTestMessageComponent.vue.d.ts → WNotifications/WNotificationTestMessageComponent.vue.d.ts} +0 -0
- /package/dist/runtime/components/{LibNotifications → WNotifications}/calculateNotificationProgress.d.ts +0 -0
- /package/dist/runtime/components/{LibNotifications → WNotifications}/calculateNotificationProgress.js +0 -0
- /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToHsva.ts +0 -0
- /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToRgba.ts +0 -0
- /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/toLowPrecisionRgbaString.ts +0 -0
- /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/truncate.ts +0 -0
- /package/src/runtime/components/{LibDatePicker → WDatePicker}/helpers.ts +0 -0
- /package/src/runtime/components/{LibNotifications/LibNotificationTestMessageComponent.vue → WNotifications/WNotificationTestMessageComponent.vue} +0 -0
- /package/src/runtime/components/{LibNotifications → WNotifications}/calculateNotificationProgress.ts +0 -0
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
-
import type { StoryObj } from "@storybook/vue3"
|
|
3
|
-
import { computed, onMounted, ref } from "vue"
|
|
4
|
-
import type { ComponentExposed } from "vue-component-type-helpers"
|
|
5
|
-
|
|
6
|
-
import LibSuggestions from "./LibSuggestions.vue"
|
|
7
|
-
|
|
8
|
-
import * as components from "../index.js"
|
|
9
|
-
|
|
10
|
-
const meta = {
|
|
11
|
-
component: LibSuggestions,
|
|
12
|
-
title: "Components/Suggestions",
|
|
13
|
-
args: {
|
|
14
|
-
id: "some-id",
|
|
15
|
-
modelValue: "",
|
|
16
|
-
label: "Some Label",
|
|
17
|
-
border: true,
|
|
18
|
-
suggestions: ["A", "AB", "ABC", "B", "BC", "C", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"]
|
|
19
|
-
}
|
|
20
|
-
} // satisfies Meta<typeof LibSuggestions> & Meta<{ custom: string }>
|
|
21
|
-
|
|
22
|
-
export default meta
|
|
23
|
-
type Story = StoryObj<typeof LibSuggestions> // & StoryObj<typeof extraArgs>
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* The suggestions component is just the dropdown part.
|
|
27
|
-
*
|
|
28
|
-
* Here it is decoupled from the input.
|
|
29
|
-
*
|
|
30
|
-
* More examples can be found in the input component.
|
|
31
|
-
*/
|
|
32
|
-
export const Primary: Story = {
|
|
33
|
-
render: args => ({
|
|
34
|
-
components: { ...components, LibSuggestions },
|
|
35
|
-
|
|
36
|
-
setup: () => {
|
|
37
|
-
const inputValue = ref(args.modelValue)
|
|
38
|
-
const modelValue = ref(args.modelValue)
|
|
39
|
-
const drawer = ref<ComponentExposed<typeof LibSuggestions> | null>(null)
|
|
40
|
-
const keydownHandler = (e: KeyboardEvent): void => {
|
|
41
|
-
drawer.value?.inputKeydownHandler(e)
|
|
42
|
-
}
|
|
43
|
-
const suggestions = computed(() => drawer.value?.suggestions)
|
|
44
|
-
const blurHandler = (e: MouseEvent) => {
|
|
45
|
-
drawer.value?.inputBlurHandler(e)
|
|
46
|
-
}
|
|
47
|
-
onMounted(() => {
|
|
48
|
-
drawer.value?.suggestions.open()
|
|
49
|
-
})
|
|
50
|
-
return {
|
|
51
|
-
args,
|
|
52
|
-
inputValue,
|
|
53
|
-
modelValue,
|
|
54
|
-
isOpen: ref(false),
|
|
55
|
-
suggestions,
|
|
56
|
-
drawer,
|
|
57
|
-
keydownHandler,
|
|
58
|
-
blurHandler
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
template: `
|
|
63
|
-
<div class="flex flex-col gap-3">
|
|
64
|
-
Temporary Value: {{inputValue}}
|
|
65
|
-
<br/>
|
|
66
|
-
Model Value (Final Value): <span class="inline-block" data-testid="model-value">{{modelValue}}</span>\n
|
|
67
|
-
|
|
68
|
-
<br/>
|
|
69
|
-
Selected: {{suggestions?.filtered[suggestions.active]}}
|
|
70
|
-
<label>Some Label</label>
|
|
71
|
-
<lib-simple-input
|
|
72
|
-
:class="isOpen ? 'open' : ''"
|
|
73
|
-
v-model="inputValue"
|
|
74
|
-
@focus="suggestions.open()"
|
|
75
|
-
@blur="blurHandler"
|
|
76
|
-
@keydown="keydownHandler"
|
|
77
|
-
></lib-simple-input>
|
|
78
|
-
<lib-suggestions
|
|
79
|
-
ref="drawer"
|
|
80
|
-
v-bind="{...args}"
|
|
81
|
-
@update:isOpen="isOpen = $event"
|
|
82
|
-
v-model="modelValue"
|
|
83
|
-
v-model:inputValue="inputValue"
|
|
84
|
-
>
|
|
85
|
-
<template #item={item}>
|
|
86
|
-
{{item}}
|
|
87
|
-
</template>
|
|
88
|
-
</lib-suggestions>
|
|
89
|
-
</div>
|
|
90
|
-
`
|
|
91
|
-
})
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export const RestrictToSuggestions: Story = {
|
|
95
|
-
...Primary,
|
|
96
|
-
args: {
|
|
97
|
-
...Primary.args,
|
|
98
|
-
restrictToSuggestions: true
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
export const AlwaysShowAllSuggestions = {
|
|
103
|
-
...Primary,
|
|
104
|
-
args: {
|
|
105
|
-
...Primary.args,
|
|
106
|
-
restrictToSuggestions: true,
|
|
107
|
-
suggestionsFilter: (_input: string, items: string[]) => items
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
export const AlwaysShowAllSuggestionsAndNoRestrictToSuggestions = {
|
|
112
|
-
...Primary,
|
|
113
|
-
args: {
|
|
114
|
-
...Primary.args,
|
|
115
|
-
restrictToSuggestions: false,
|
|
116
|
-
suggestionsFilter: (_input: string, items: string[]) => items
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
export const CustomSuggestionsObject = {
|
|
121
|
-
...Primary,
|
|
122
|
-
args: {
|
|
123
|
-
...Primary.args,
|
|
124
|
-
restrictToSuggestions: true,
|
|
125
|
-
suggestions: [
|
|
126
|
-
{ label: "A", other: "some data A" },
|
|
127
|
-
{ label: "AB", other: "some data AB" },
|
|
128
|
-
{ label: "ABC", other: "some data ABC" },
|
|
129
|
-
{ label: "ABCDEFGHIJKLMNOPQRSTUVWXYZ", other: "some data ABCDEFGHIJKLMNOPQRSTUVWXYZ" }
|
|
130
|
-
],
|
|
131
|
-
suggestionLabel: (item: any) => item.label
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
}
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
v-if="$open"
|
|
4
|
-
:id="`suggestions-${id ?? fallbackId}`"
|
|
5
|
-
:class="twMerge(`
|
|
6
|
-
suggestions
|
|
7
|
-
bg-bg
|
|
8
|
-
dark:bg-fg
|
|
9
|
-
dark:text-bg
|
|
10
|
-
`,
|
|
11
|
-
($.attrs as any)?.class
|
|
12
|
-
)"
|
|
13
|
-
:data-open="$open"
|
|
14
|
-
role="listbox"
|
|
15
|
-
ref="el"
|
|
16
|
-
v-bind="{ ...$.attrs, class: undefined }"
|
|
17
|
-
>
|
|
18
|
-
<!-- Click event is just in case, it should not really be triggered. We can do click selections via the blur handler. -->
|
|
19
|
-
<div
|
|
20
|
-
:id="`suggestion-${id ?? fallbackId}-${index}`"
|
|
21
|
-
role="option"
|
|
22
|
-
:class="twMerge(`
|
|
23
|
-
suggestions--item
|
|
24
|
-
user-select-none
|
|
25
|
-
cursor-pointer
|
|
26
|
-
px-2
|
|
27
|
-
`,
|
|
28
|
-
index=== suggestions.active && `
|
|
29
|
-
bg-accent-200
|
|
30
|
-
dark:bg-accent-800/70
|
|
31
|
-
`,
|
|
32
|
-
($.itemAttrs as any)?.class
|
|
33
|
-
)"
|
|
34
|
-
v-bind="{ ...$.itemAttrs, class: undefined }"
|
|
35
|
-
:aria-selected="index === suggestions.active ? true : false"
|
|
36
|
-
:aria-label="suggestions.getLabel(item)"
|
|
37
|
-
v-for="(item, index) in suggestions.filtered"
|
|
38
|
-
:key="item"
|
|
39
|
-
@mouseover="suggestions.active = index"
|
|
40
|
-
@mousedown.prevent
|
|
41
|
-
@mouseup="suggestions.enterIndex(index, !Array.isArray($modelValue))"
|
|
42
|
-
>
|
|
43
|
-
<slot
|
|
44
|
-
name="item"
|
|
45
|
-
:item="item"
|
|
46
|
-
:index="index"
|
|
47
|
-
:is-selected="Array.isArray($modelValue) ? $modelValue.includes(item) : $modelValue === item"
|
|
48
|
-
>
|
|
49
|
-
<div class="flex gap-2 nowrap">
|
|
50
|
-
<lib-checkbox
|
|
51
|
-
v-if="Array.isArray($modelValue) && showSelectedValues"
|
|
52
|
-
:model-value="$modelValue.includes(item)"
|
|
53
|
-
@mousedown.prevent
|
|
54
|
-
/>
|
|
55
|
-
<div> {{ item }} </div>
|
|
56
|
-
</div>
|
|
57
|
-
</slot>
|
|
58
|
-
</div>
|
|
59
|
-
</div>
|
|
60
|
-
</template>
|
|
61
|
-
|
|
62
|
-
<script setup lang="ts" generic="TSuggestion extends string | object, TValue extends string|string[]">
|
|
63
|
-
import { type HTMLAttributes, reactive, ref } from "vue"
|
|
64
|
-
|
|
65
|
-
import { useDivideAttrs } from "../../composables/useDivideAttrs.js"
|
|
66
|
-
import { useSuggestions } from "../../composables/useSuggestions.js"
|
|
67
|
-
import { hasModifiers } from "../../helpers/hasModifiers.js"
|
|
68
|
-
import { twMerge } from "../../utils/twMerge.js"
|
|
69
|
-
import LibCheckbox from "../LibCheckbox/LibCheckbox.vue"
|
|
70
|
-
import { type BaseInteractiveProps, getFallbackId, type LabelProps, type LinkableByIdProps, type SuggestionsEmits, type SuggestionsProps, type WrapperProps } from "../shared/props.js"
|
|
71
|
-
|
|
72
|
-
defineOptions({
|
|
73
|
-
name: "LibSuggestions",
|
|
74
|
-
inheritAttrs: false
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
const $ = useDivideAttrs(["item"] as const)
|
|
78
|
-
|
|
79
|
-
const emits = defineEmits<SuggestionsEmits>()
|
|
80
|
-
|
|
81
|
-
const fallbackId = getFallbackId()
|
|
82
|
-
const props = withDefaults(defineProps<Props & SuggestionsProps<TSuggestion>>(), {
|
|
83
|
-
isValid: true,
|
|
84
|
-
canOpen: true,
|
|
85
|
-
canClose: true,
|
|
86
|
-
filterKeydown: undefined,
|
|
87
|
-
unstyle: false, disabled: false, readonly: false, border: true
|
|
88
|
-
})
|
|
89
|
-
/**
|
|
90
|
-
* The final valid value. This is *not* the value you want to share with the input. If `restrictToSuggestions` is true this will not update on any invalid values that `inputValue` might be set to.
|
|
91
|
-
*
|
|
92
|
-
* If suggestions are objects, this will be the string returned by the `suggestionLabel` prop.
|
|
93
|
-
*/
|
|
94
|
-
const $modelValue = defineModel<TValue>("modelValue", { required: true })
|
|
95
|
-
/**
|
|
96
|
-
* If the element is bound to an input, this is the value that the input should be sharing.
|
|
97
|
-
*
|
|
98
|
-
* It allows the component to read even invalid output, and also to reset that invalid output when either modelValue is set to a new value, or when the component is closed via cancel.
|
|
99
|
-
*/
|
|
100
|
-
const $inputValue = defineModel<string>("inputValue", { default: "" })
|
|
101
|
-
|
|
102
|
-
const $open = defineModel<boolean>("open", { default: false })
|
|
103
|
-
|
|
104
|
-
if (typeof props.suggestions?.[0] === "object" && !props.suggestionLabel && !props.suggestionsFilter) {
|
|
105
|
-
throw new Error("`suggestionLabel` or `suggestionsFilter` must be passed if suggestions are objects.")
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const el = ref<HTMLElement | null>(null)
|
|
109
|
-
|
|
110
|
-
const suggestions = reactive(useSuggestions<TSuggestion, TValue extends string[] ? true : false>(
|
|
111
|
-
$inputValue,
|
|
112
|
-
$modelValue as any,
|
|
113
|
-
$open,
|
|
114
|
-
emits,
|
|
115
|
-
props
|
|
116
|
-
))
|
|
117
|
-
|
|
118
|
-
const inputKeydownHandler = (e: KeyboardEvent): void => {
|
|
119
|
-
if (props.filterKeydown?.(e)) return
|
|
120
|
-
if (hasModifiers(e)) return
|
|
121
|
-
if (e.key === "Enter") {
|
|
122
|
-
suggestions.enterSelected(!Array.isArray($modelValue))
|
|
123
|
-
e.preventDefault()
|
|
124
|
-
} else if (e.key === "Escape") {
|
|
125
|
-
suggestions.cancel()
|
|
126
|
-
e.preventDefault()
|
|
127
|
-
} else if (!$open.value && ["ArrowDown", "ArrowUp", "PageUp", "PageDown"].includes(e.key) && suggestions.available) {
|
|
128
|
-
suggestions.open()
|
|
129
|
-
e.preventDefault()
|
|
130
|
-
if (e.key === "PageUp") {
|
|
131
|
-
suggestions.first()
|
|
132
|
-
} else if (e.key === "PageDown") {
|
|
133
|
-
suggestions.last()
|
|
134
|
-
}
|
|
135
|
-
} else if (e.key === "ArrowUp") {
|
|
136
|
-
suggestions.prev()
|
|
137
|
-
e.preventDefault()
|
|
138
|
-
} else if (e.key === "ArrowDown") {
|
|
139
|
-
suggestions.next()
|
|
140
|
-
e.preventDefault()
|
|
141
|
-
} else if (e.key === "PageUp") {
|
|
142
|
-
suggestions.first()
|
|
143
|
-
e.preventDefault()
|
|
144
|
-
} else if (e.key === "PageDown") {
|
|
145
|
-
suggestions.last()
|
|
146
|
-
e.preventDefault()
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
const inputBlurHandler = (e: MouseEvent): void => {
|
|
150
|
-
if (props.filterBlur?.(e)) return
|
|
151
|
-
|
|
152
|
-
if (!$open.value) return
|
|
153
|
-
|
|
154
|
-
if (props.restrictToSuggestions) {
|
|
155
|
-
suggestions.cancel()
|
|
156
|
-
} else {
|
|
157
|
-
if (!Array.isArray($modelValue.value)) {
|
|
158
|
-
$modelValue.value = $inputValue.value as any
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
if ($open.value) {
|
|
162
|
-
suggestions.close()
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
const inputFocusHandler = (e: FocusEvent): void => {
|
|
166
|
-
if (props.filterFocus?.(e)) return
|
|
167
|
-
suggestions.open()
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
defineExpose({
|
|
171
|
-
suggestions,
|
|
172
|
-
el,
|
|
173
|
-
/** A simple keydown handler that can be passed to an input to control the component while still focused inside it. */
|
|
174
|
-
inputKeydownHandler,
|
|
175
|
-
/** A blur handler for the input that controls the component. This also takes care of making clicking on a suggestion work, since otherwise if canOpen is set to false in the blur handler, no click event will fire. */
|
|
176
|
-
inputBlurHandler,
|
|
177
|
-
/** A focus handler for the input that controls the component. */
|
|
178
|
-
inputFocusHandler
|
|
179
|
-
})
|
|
180
|
-
</script>
|
|
181
|
-
|
|
182
|
-
<script lang="ts">
|
|
183
|
-
type WrapperTypes = Partial<WrapperProps<"item", HTMLAttributes, {
|
|
184
|
-
/** Tailwind classes. */
|
|
185
|
-
class?: string
|
|
186
|
-
}>>
|
|
187
|
-
|
|
188
|
-
type RealProps
|
|
189
|
-
= & LinkableByIdProps
|
|
190
|
-
& LabelProps
|
|
191
|
-
& BaseInteractiveProps
|
|
192
|
-
& {
|
|
193
|
-
/** Return true to prevent the keydown event from being handled. */
|
|
194
|
-
filterKeydown?: (e: KeyboardEvent) => boolean
|
|
195
|
-
/** Return true to prevent the blur event from being handled. */
|
|
196
|
-
filterBlur?: (e: MouseEvent) => boolean
|
|
197
|
-
/** Return true to prevent the focus event from being handled. */
|
|
198
|
-
filterFocus?: (e: FocusEvent) => boolean
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
interface Props
|
|
202
|
-
extends
|
|
203
|
-
/** @vue-ignore */
|
|
204
|
-
Partial<Omit<HTMLAttributes, "class" | "onSubmit"> & {
|
|
205
|
-
/** Tailwind classes. */
|
|
206
|
-
class?: string
|
|
207
|
-
}>,
|
|
208
|
-
/** @vue-ignore */
|
|
209
|
-
WrapperTypes,
|
|
210
|
-
RealProps
|
|
211
|
-
{}
|
|
212
|
-
</script>
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
<!-- eslint-disable -->
|
|
2
|
-
<template>
|
|
3
|
-
<div :class="twMerge(`
|
|
4
|
-
|
|
5
|
-
`, ($attrs as any).class)"
|
|
6
|
-
v-bind="{...$attrs, class:undefined}"
|
|
7
|
-
>
|
|
8
|
-
<slot/>
|
|
9
|
-
</div>
|
|
10
|
-
</template>
|
|
11
|
-
|
|
12
|
-
<script setup lang="ts">
|
|
13
|
-
// remove when copying
|
|
14
|
-
// @ts-nocheck this is a templatek
|
|
15
|
-
/* eslint-disable */
|
|
16
|
-
|
|
17
|
-
import { type HTMLAttributes, ref } from "vue"
|
|
18
|
-
|
|
19
|
-
import { twMerge } from "../../utils/twMerge.js"
|
|
20
|
-
import type { TailwindClassProp } from "../shared/props.js"
|
|
21
|
-
|
|
22
|
-
defineOptions({
|
|
23
|
-
name: "LibName", /* todo */
|
|
24
|
-
inheritAttrs: false
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
// const props = defineProps<{}>({ })
|
|
28
|
-
|
|
29
|
-
const el = ref<null | HTMLElement>(null)
|
|
30
|
-
|
|
31
|
-
const modelValue = defineModel<string>({ required: true })
|
|
32
|
-
</script>
|
|
33
|
-
|
|
34
|
-
<script lang="ts">
|
|
35
|
-
export default {
|
|
36
|
-
name: "LibName"
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
type RealProps = {
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
interface Props
|
|
43
|
-
extends
|
|
44
|
-
/** @vue-ignore */
|
|
45
|
-
Partial<Omit<HTMLAttributes, "class">
|
|
46
|
-
& TailwindClassProp
|
|
47
|
-
& RealProps
|
|
48
|
-
> { }
|
|
49
|
-
</script>
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// remove when copying
|
|
2
|
-
// @ts-nocheck this is a templatek
|
|
3
|
-
/* eslint-disable */
|
|
4
|
-
|
|
5
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
6
|
-
import type { Meta, StoryObj } from "@storybook/vue3"
|
|
7
|
-
|
|
8
|
-
import NAME from "./NAME.vue"
|
|
9
|
-
|
|
10
|
-
// todo, maybe don't do this for perf reasons
|
|
11
|
-
import * as components from "../index.js"
|
|
12
|
-
|
|
13
|
-
const meta: Meta<typeof NAME> = {
|
|
14
|
-
component: NAME,
|
|
15
|
-
args: {
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export default meta
|
|
21
|
-
type Story = StoryObj<typeof NAME>
|
|
22
|
-
|
|
23
|
-
export const Primary: Story = {
|
|
24
|
-
render: args => ({
|
|
25
|
-
components,
|
|
26
|
-
setup: () => ({ args }),
|
|
27
|
-
template: `
|
|
28
|
-
<NAME v-bind="{...args}">{{args.value}}</NAME>
|
|
29
|
-
`
|
|
30
|
-
})
|
|
31
|
-
}
|
|
32
|
-
export const Secondary: Story = {
|
|
33
|
-
...Primary,
|
|
34
|
-
args: {
|
|
35
|
-
...Primary.args
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import { useId } from "vue"
|
|
2
|
-
|
|
3
|
-
import type { PopupPositioner, PopupPositionModifier } from "../../types"
|
|
4
|
-
|
|
5
|
-
export interface LinkableByIdProps {
|
|
6
|
-
/**
|
|
7
|
-
* The id for the input. Uses vue's useId if none provided.
|
|
8
|
-
*
|
|
9
|
-
* For components that are not inputs, the id passed to inputs should be shared with the corresponding label/suggestions/etc component to connect them.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
id?: string
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const getFallbackId = (): string => useId()
|
|
16
|
-
export interface ButtonProps {
|
|
17
|
-
border?: boolean
|
|
18
|
-
color?: "warning" | "ok" | "danger" | "primary" | "secondary" | false
|
|
19
|
-
autoTitleFromAria?: boolean
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface LabelProps {
|
|
23
|
-
/** For the label. Note the component might or might not support an actual label element. If none is supported, this is used for the `aria-label`. */
|
|
24
|
-
label?: string
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export type SuggestionsProps<T = any> = {
|
|
28
|
-
/**
|
|
29
|
-
* A list of autocomplete suggestions. Can be a simple list of strings, or more complicated, like a list of objects. In the case of objects, you'll want to specify `suggestionsLabel`.
|
|
30
|
-
*
|
|
31
|
-
* Each item is passed to the suggestion slot via the `items` prop. You can access it like:
|
|
32
|
-
* ```
|
|
33
|
-
* <div #item={item}>
|
|
34
|
-
* {{item}}
|
|
35
|
-
* </div>
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
suggestions?: T[]
|
|
39
|
-
/** A function that specifies how to extract the label from a suggestion when it's an object, e.g. `(item) => item.label`. By default, if none is passed, it's assumed suggestions is a list of strings. */
|
|
40
|
-
suggestionLabel?: (item: T) => string
|
|
41
|
-
/**
|
|
42
|
-
* Whether to restrict the value to the suggestions list or merely use it to suggest values. Default is false.
|
|
43
|
-
*
|
|
44
|
-
* This stops v-modeling of what the user is typing when there is a value that does not match any values in the suggestions list. `update:modelValue` will only be emitted when they type/select/click a valid option.
|
|
45
|
-
*
|
|
46
|
-
* When the input is partially valid (it partially matches an option in the suggestions list), if the user presses enter or focuses away, the last selected suggestion is set as the value.
|
|
47
|
-
*
|
|
48
|
-
* When the input is completely invalid, the `errored` class is added to the component and the input goes red. If the user focuses away or tries to press enter anyways, the value is reset to the last valid value.
|
|
49
|
-
*
|
|
50
|
-
* Additionally when the input is invalid, the user can open the dropdown menu (it won't auto open) to view all the suggestions.
|
|
51
|
-
*/
|
|
52
|
-
restrictToSuggestions?: boolean
|
|
53
|
-
/**
|
|
54
|
-
* Usually when using autosuggest, we only want to update the modelValue when the user submits the input.
|
|
55
|
-
* This happens by default if using `restrictToSuggestions`, but not if not restricting them.
|
|
56
|
-
*
|
|
57
|
-
* This can be worked around by listening a bit differently to events, but this is a common use case so there's now an option that automatically does this.
|
|
58
|
-
*
|
|
59
|
-
* By default it's false.
|
|
60
|
-
*/
|
|
61
|
-
updateOnlyOnSubmit?: boolean
|
|
62
|
-
/** A function to filter the suggestions based on the current input. If none is given, will attempt to filter by the label using a basic case insensitive `includes` search. */
|
|
63
|
-
suggestionsFilter?: (input: string | number, items: T[]) => any[]
|
|
64
|
-
/** Allows opening the input dropdown when it's empty. Default is true. */
|
|
65
|
-
allowOpenEmpty?: boolean
|
|
66
|
-
/** Whether the suggestions dropdown can be opened. Default is true. */
|
|
67
|
-
canOpen?: boolean
|
|
68
|
-
/** Whether the suggestions dropdown can be closed. Default is true. */
|
|
69
|
-
canClose?: boolean
|
|
70
|
-
/** Whether the input is valid. Default is true. */
|
|
71
|
-
isValid?: boolean
|
|
72
|
-
/**
|
|
73
|
-
* A function to determine which selection to auto select. By default, the start of the string must match and the longest match is used. If the input is 0 length, the first element is selected.
|
|
74
|
-
*
|
|
75
|
-
* You can implement custom behavior here like fuzzy matching. Note that an exactly matching selection is always picked (the function will not be called).
|
|
76
|
-
*/
|
|
77
|
-
suggestionSelector?: (suggestions: T[], input: string) => number
|
|
78
|
-
/** In the case modelValue is an array of values, whether to show the selected values in the suggestions list. Default is true so users can deselect from the list as well. If false, the checkboxes will also not be shown. */
|
|
79
|
-
showSelectedValues?: boolean
|
|
80
|
-
}
|
|
81
|
-
export type SuggestionsOptions<T> = SuggestionsProps<T>
|
|
82
|
-
|
|
83
|
-
export interface SuggestionsEmits<TMultivalue extends boolean = false> {
|
|
84
|
-
(e: "submit", val: string, suggestion?: any, wasRemoved?: boolean): void
|
|
85
|
-
(e: "update:isOpen", val: boolean): void
|
|
86
|
-
(e: "update:activeSuggestion", val: TMultivalue extends true ? number[] : number): void
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export interface PopupProps {
|
|
90
|
-
/**
|
|
91
|
-
* Whether to use the dialog element instead of a regular backdrop. While using the dialog element would be ideal, css variables won't be applied to it, tailwind themes will fail, etc, if the css variables are not applied to `::backdrop`.
|
|
92
|
-
*
|
|
93
|
-
* Using a div ends up easier to setup.
|
|
94
|
-
*
|
|
95
|
-
* The default is now false.
|
|
96
|
-
*/
|
|
97
|
-
useDialogForBackdrop?: false
|
|
98
|
-
/** Wether to use a backdrop (clicking it will close the popup), or not (use is allowed to click elsewhere. */
|
|
99
|
-
useBackdrop?: boolean
|
|
100
|
-
/**
|
|
101
|
-
* The preferred horizontal positioning of the popup. The first position in the array to fit is used.
|
|
102
|
-
*
|
|
103
|
-
* All elements need to have box-sizing: border-box set. Also note that while the component should work with dynamic popup sizes, in practice there's issues with the positioning being slightly off. Giving the popup element a static size is better. If you need margins around the popup, this can be done with a wrapper element + padding.
|
|
104
|
-
*
|
|
105
|
-
* The positions `right`/`left`/`top`/`bottom` are relative to the opposite side of the button element so as to try not to cover the triggering button.
|
|
106
|
-
*
|
|
107
|
-
* So positioning `right` and `left` look like this:
|
|
108
|
-
*
|
|
109
|
-
* ```
|
|
110
|
-
* // right
|
|
111
|
-
* [button]
|
|
112
|
-
* [----popup----]
|
|
113
|
-
*
|
|
114
|
-
* // left
|
|
115
|
-
* [button]
|
|
116
|
-
* [----popup----]
|
|
117
|
-
* ```
|
|
118
|
-
*
|
|
119
|
-
* Positions `*-most` try to position the popup as close to that side of the screen as possible, otherwise limiting the popup to that edge. For example:
|
|
120
|
-
*
|
|
121
|
-
* ```
|
|
122
|
-
* [--------------screen---------------]
|
|
123
|
-
* // right-most
|
|
124
|
-
* [button]
|
|
125
|
-
* [----popup----]
|
|
126
|
-
* // near the edge:
|
|
127
|
-
* [button]
|
|
128
|
-
* [----popup----]
|
|
129
|
-
* ```
|
|
130
|
-
*
|
|
131
|
-
* There is also the `center-screen` position, which centers the popup on the screen.
|
|
132
|
-
*
|
|
133
|
-
* These last two (`*-most` and `center-screen`) are greedy, they will always find a position that fits. Positions listed after are ignored.
|
|
134
|
-
*
|
|
135
|
-
* You can also specify a function instead which is given some additional information regarding the space around the button reference element. It should a number for the x position (or y, if preferredVertical).
|
|
136
|
-
*
|
|
137
|
-
* If you only need to slightly modify the position, you can use the `modifyPosition` option instead.
|
|
138
|
-
*/
|
|
139
|
-
preferredHorizontal?: ("center" | "right" | "left" | "either" | "center-screen" | "right-most" | "left-most" | "center-most")[] | PopupPositioner
|
|
140
|
-
/** See `preferredHorizontal`. */
|
|
141
|
-
preferredVertical?: ("top" | "bottom" | "center" | "either" | "center-screen" | "top-most" | "bottom-most" | "center-most")[] | PopupPositioner
|
|
142
|
-
/**
|
|
143
|
-
* When the user scrolls or resizes, normally the entire popup position is recomputed, taking into account the preferred positioning.
|
|
144
|
-
*
|
|
145
|
-
* This can cause it to shift around.
|
|
146
|
-
*
|
|
147
|
-
* Set this to true to only shift the popup depending on how much the button element moved and avoid recalculating the best position.
|
|
148
|
-
*/
|
|
149
|
-
avoidRepositioning?: boolean
|
|
150
|
-
/**
|
|
151
|
-
* Allows modifying the calculated position, to for example, clamp it.
|
|
152
|
-
*/
|
|
153
|
-
modifyPosition?: PopupPositionModifier
|
|
154
|
-
canClose?: boolean
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
export type BaseInteractiveProps = {
|
|
158
|
-
/** Default is false. */
|
|
159
|
-
disabled?: boolean
|
|
160
|
-
/** Default is false. */
|
|
161
|
-
readonly?: boolean
|
|
162
|
-
/** Default is true. */
|
|
163
|
-
border?: boolean
|
|
164
|
-
/** Removes styles from the component. Default is false. */
|
|
165
|
-
unstyle?: boolean
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
// see https://github.com/nuxt/module-builder/issues/649
|
|
169
|
-
// export const baseInteractivePropsDefaults = {
|
|
170
|
-
// disabled: false,
|
|
171
|
-
// readonly: false,
|
|
172
|
-
// border: true,
|
|
173
|
-
// unstyle: false,
|
|
174
|
-
// }
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* @internal
|
|
178
|
-
* For easily typing attributes created by useDivideAttrs. See readme.
|
|
179
|
-
*
|
|
180
|
-
* By default overrides the `class` prop to only take a string (to pass to tailwing).
|
|
181
|
-
*/
|
|
182
|
-
export type WrapperProps<TPrefix extends string, T, TOverrides extends Record<string, any> | never = TailwindClassProp> = {
|
|
183
|
-
[P in keyof T as P extends keyof TOverrides
|
|
184
|
-
? never
|
|
185
|
-
: P extends string
|
|
186
|
-
? `${TPrefix}${Capitalize<P>}`
|
|
187
|
-
: never
|
|
188
|
-
]: T[P];
|
|
189
|
-
} & {
|
|
190
|
-
[P in keyof TOverrides as P extends string
|
|
191
|
-
? `${TPrefix}${Capitalize<P>}`
|
|
192
|
-
: never
|
|
193
|
-
]: TOverrides[P];
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
export type TailwindClassProp = {
|
|
197
|
-
/** Tailwind classes. */
|
|
198
|
-
class?: string | false
|
|
199
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { computed, type ComputedRef, onMounted, ref } from "vue"
|
|
2
|
-
|
|
3
|
-
/** Returns a computed ref that creates aria-label and aria-labelledby with the correct id for labelledby. */
|
|
4
|
-
export const useAriaLabel = (
|
|
5
|
-
props: { id?: string, label?: string },
|
|
6
|
-
fallbackId?: string
|
|
7
|
-
|
|
8
|
-
): ComputedRef<Record<string, string | undefined>> => {
|
|
9
|
-
const id = computed(() => props.id ?? fallbackId)
|
|
10
|
-
const labelExists = ref(false)
|
|
11
|
-
|
|
12
|
-
const aria = computed(() => ({
|
|
13
|
-
"aria-label": labelExists.value ? undefined : props.label,
|
|
14
|
-
"aria-labelledby": labelExists.value ? `label-${id.value}` : undefined
|
|
15
|
-
}))
|
|
16
|
-
|
|
17
|
-
onMounted(() => {
|
|
18
|
-
if (id.value && document.querySelector(`#label-${id.value}`)) {
|
|
19
|
-
labelExists.value = true
|
|
20
|
-
}
|
|
21
|
-
})
|
|
22
|
-
return aria
|
|
23
|
-
}
|