@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
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- reka's filter does not work well, specially with lowercase/uppercase, e.g. A !== A but a === A ??? -->
|
|
3
|
+
<ComboboxRoot
|
|
4
|
+
:ignore-filter="true"
|
|
5
|
+
:class="twMerge(`combobox-root relative`, $attrs?.class as any)"
|
|
6
|
+
v-bind="{ ...$attrs, class: undefined }"
|
|
7
|
+
:reset-search-term-on-select="true"
|
|
8
|
+
:reset-search-term-on-blur="true"
|
|
9
|
+
:open-on-click="true"
|
|
10
|
+
ref="comboboxRootComponent"
|
|
11
|
+
v-model:open="open"
|
|
12
|
+
v-model="modelValue"
|
|
13
|
+
>
|
|
14
|
+
<ComboboxAnchor
|
|
15
|
+
class="combobox-anchor justify-between flex"
|
|
16
|
+
>
|
|
17
|
+
<div
|
|
18
|
+
:class="twMerge(`
|
|
19
|
+
combobox--input-wrapper
|
|
20
|
+
flex
|
|
21
|
+
items-center
|
|
22
|
+
justify-between
|
|
23
|
+
rounded-sm
|
|
24
|
+
px-1
|
|
25
|
+
leading-none
|
|
26
|
+
fg-inherit
|
|
27
|
+
bg-inherit
|
|
28
|
+
outlined-within:border-accent-500
|
|
29
|
+
gap-2
|
|
30
|
+
focus-outline-none
|
|
31
|
+
focus-outline-hidden
|
|
32
|
+
w-full
|
|
33
|
+
min-w-0
|
|
34
|
+
`, errorMessage !== false && `!border-danger-500`,
|
|
35
|
+
border &&`
|
|
36
|
+
border
|
|
37
|
+
border-neutral-300
|
|
38
|
+
dark:border-neutral-700
|
|
39
|
+
bg-neutral-100
|
|
40
|
+
dark:bg-neutral-800/50
|
|
41
|
+
focus:bg-bg
|
|
42
|
+
dark:focus:bg-neutral-800
|
|
43
|
+
dark:focus:border-accent-500
|
|
44
|
+
focus-within:border-accent-500
|
|
45
|
+
dark:focus-within:border-accent-500
|
|
46
|
+
has-[input:invalid]:border-danger-500
|
|
47
|
+
invalid:border-danger-500
|
|
48
|
+
`,
|
|
49
|
+
open && popupSide === 'top' && `rounded-tl-none rounded-tr-none`,
|
|
50
|
+
open && popupSide === 'bottom' && `rounded-bl-none rounded-br-none`
|
|
51
|
+
)"
|
|
52
|
+
>
|
|
53
|
+
<!-- @vue-expect-error aria/keydown can be defined -->
|
|
54
|
+
<ComboboxInput
|
|
55
|
+
:id="id"
|
|
56
|
+
:display-value="display"
|
|
57
|
+
spellcheck="false"
|
|
58
|
+
:aria-invalid="errorMessage !== false"
|
|
59
|
+
:aria-busy="loading"
|
|
60
|
+
:aria-errormessage="ariaDescribedBy"
|
|
61
|
+
:class="twMerge(`
|
|
62
|
+
combobox--input
|
|
63
|
+
bg-transparent
|
|
64
|
+
min-w-[70px]
|
|
65
|
+
w-full
|
|
66
|
+
outline-hidden
|
|
67
|
+
px-1
|
|
68
|
+
`,
|
|
69
|
+
inputProps?.class
|
|
70
|
+
)"
|
|
71
|
+
v-bind="{ ...inputProps, class: undefined }"
|
|
72
|
+
:aria-describedby="ariaDescribedBy"
|
|
73
|
+
v-model="searchTerm"
|
|
74
|
+
@keydown.enter="save"
|
|
75
|
+
/>
|
|
76
|
+
<Transition>
|
|
77
|
+
<slot
|
|
78
|
+
v-if="showLoadingIndicator"
|
|
79
|
+
name="loading-indicator"
|
|
80
|
+
>
|
|
81
|
+
<WIcon
|
|
82
|
+
v-if="showLoadingIndicator"
|
|
83
|
+
aria-label="Loading suggestions"
|
|
84
|
+
class="
|
|
85
|
+
combobox--loading-indicator
|
|
86
|
+
animate-spin
|
|
87
|
+
text-neutral-500
|
|
88
|
+
-mr-1
|
|
89
|
+
"
|
|
90
|
+
>
|
|
91
|
+
<i-lucide-loader-circle/>
|
|
92
|
+
</WIcon>
|
|
93
|
+
</slot>
|
|
94
|
+
</Transition>
|
|
95
|
+
<ComboboxTrigger
|
|
96
|
+
:as-child="true"
|
|
97
|
+
>
|
|
98
|
+
<slot
|
|
99
|
+
name="trigger"
|
|
100
|
+
v-bind="{ open }"
|
|
101
|
+
>
|
|
102
|
+
<WButton
|
|
103
|
+
:border="false"
|
|
104
|
+
class="combobox--toggle p-0"
|
|
105
|
+
:aria-label="open ? 'Close' : 'Open'"
|
|
106
|
+
>
|
|
107
|
+
<slot
|
|
108
|
+
name="toggle"
|
|
109
|
+
:is-open="open"
|
|
110
|
+
>
|
|
111
|
+
<WIcon
|
|
112
|
+
:class="twMerge(`combobox--toggle scale-150`, open && `rotate-180`)"
|
|
113
|
+
>
|
|
114
|
+
<i-chevron-caret-down/>
|
|
115
|
+
</WIcon>
|
|
116
|
+
</slot>
|
|
117
|
+
</WButton>
|
|
118
|
+
</slot>
|
|
119
|
+
</ComboboxTrigger>
|
|
120
|
+
</div>
|
|
121
|
+
</ComboboxAnchor>
|
|
122
|
+
<ComboboxPortal :to="to">
|
|
123
|
+
<ComboboxContent
|
|
124
|
+
v-if="showEmptyLabel || filtered.length > 0 || errorMessage !== false"
|
|
125
|
+
:style="contentStyle"
|
|
126
|
+
:class="twMerge(`
|
|
127
|
+
combobox--content
|
|
128
|
+
z-100
|
|
129
|
+
w-[var(--reka-combobox-trigger-width)]
|
|
130
|
+
align-end
|
|
131
|
+
bg-white
|
|
132
|
+
dark:bg-neutral-900
|
|
133
|
+
will-change-[opacity,transform]
|
|
134
|
+
data-[side=top]:animate-slideDownAndFade
|
|
135
|
+
data-[side=right]:animate-slideLeftAndFade
|
|
136
|
+
data-[side=bottom]:animate-slideUpAndFade
|
|
137
|
+
data-[side=left]:animate-slideRightAndFade
|
|
138
|
+
border-neutral-300
|
|
139
|
+
dark:border-neutral-700
|
|
140
|
+
border
|
|
141
|
+
rounded-sm
|
|
142
|
+
shadow-lg
|
|
143
|
+
shadow-black/50
|
|
144
|
+
data-[side=bottom]:border-t-0
|
|
145
|
+
data-[side=top]:border-b-0
|
|
146
|
+
dark:data-[side=bottom]:border-t-0
|
|
147
|
+
dark:data-[side=top]:border-b-0
|
|
148
|
+
data-[side=bottom]:rounded-tl-none
|
|
149
|
+
data-[side=bottom]:rounded-tr-none
|
|
150
|
+
data-[side=top]:rounded-bl-none
|
|
151
|
+
data-[side=top]:rounded-br-none
|
|
152
|
+
max-h-[500px]
|
|
153
|
+
overflow-y-auto
|
|
154
|
+
`, contentProps?.class)"
|
|
155
|
+
ref="contentComponent"
|
|
156
|
+
v-bind="{
|
|
157
|
+
side: 'bottom',
|
|
158
|
+
position: 'popper',
|
|
159
|
+
avoidCollisions: true,
|
|
160
|
+
prioritizePosition: true,
|
|
161
|
+
...contentProps,
|
|
162
|
+
class: undefined
|
|
163
|
+
}"
|
|
164
|
+
>
|
|
165
|
+
<ComboboxViewport
|
|
166
|
+
|
|
167
|
+
class="combobox--viewport flex flex-col"
|
|
168
|
+
>
|
|
169
|
+
<Transition>
|
|
170
|
+
<div
|
|
171
|
+
v-if="useSlots()['header']"
|
|
172
|
+
:id="`${id}-instruction`"
|
|
173
|
+
class="
|
|
174
|
+
combobox--popup-header
|
|
175
|
+
px-2
|
|
176
|
+
flex
|
|
177
|
+
items-center
|
|
178
|
+
justify-center
|
|
179
|
+
"
|
|
180
|
+
>
|
|
181
|
+
<slot
|
|
182
|
+
:filtered="filtered"
|
|
183
|
+
:is-showing-empty-label="showEmptyLabel"
|
|
184
|
+
name="header"
|
|
185
|
+
class="
|
|
186
|
+
text-neutral-800
|
|
187
|
+
dark:text-neutral-200
|
|
188
|
+
combobox--popup-label
|
|
189
|
+
text-ellipsis
|
|
190
|
+
overflow-hidden
|
|
191
|
+
whitespace-nowrap
|
|
192
|
+
"
|
|
193
|
+
/>
|
|
194
|
+
</div>
|
|
195
|
+
</Transition>
|
|
196
|
+
<slot
|
|
197
|
+
v-if="errorMessage !== false"
|
|
198
|
+
name="invalid"
|
|
199
|
+
v-bind="{ searchTerm, errorMessage, id: `${id}-error`, role: 'alert' }"
|
|
200
|
+
>
|
|
201
|
+
<div
|
|
202
|
+
:id="`${id}-error`"
|
|
203
|
+
role="alert"
|
|
204
|
+
class="
|
|
205
|
+
combobox--error-message
|
|
206
|
+
text-danger-500
|
|
207
|
+
dark:text-danger-500
|
|
208
|
+
text-sm
|
|
209
|
+
px-2
|
|
210
|
+
py-1
|
|
211
|
+
bg-danger-100
|
|
212
|
+
dark:bg-danger-800
|
|
213
|
+
flex
|
|
214
|
+
items-center
|
|
215
|
+
justify-center
|
|
216
|
+
"
|
|
217
|
+
>
|
|
218
|
+
{{ errorMessage }}
|
|
219
|
+
</div>
|
|
220
|
+
</slot>
|
|
221
|
+
<ComboboxEmpty
|
|
222
|
+
v-if="showEmptyLabel"
|
|
223
|
+
class="
|
|
224
|
+
combobox--empty
|
|
225
|
+
px-2
|
|
226
|
+
text-center
|
|
227
|
+
text-neutral-800
|
|
228
|
+
dark:text-neutral-200
|
|
229
|
+
bg-neutral-100
|
|
230
|
+
dark:bg-neutral-800
|
|
231
|
+
"
|
|
232
|
+
>
|
|
233
|
+
{{ emptyLabel }}
|
|
234
|
+
</ComboboxEmpty>
|
|
235
|
+
<slot
|
|
236
|
+
name="suggestions"
|
|
237
|
+
v-bind="{ filtered, display, searchTerm }"
|
|
238
|
+
>
|
|
239
|
+
<div
|
|
240
|
+
class="
|
|
241
|
+
combobox--suggestions
|
|
242
|
+
flex-col
|
|
243
|
+
flex
|
|
244
|
+
max-h-[500px]
|
|
245
|
+
overflow-y-auto
|
|
246
|
+
"
|
|
247
|
+
>
|
|
248
|
+
<ComboboxItem
|
|
249
|
+
class="
|
|
250
|
+
combobox--suggestion
|
|
251
|
+
flex
|
|
252
|
+
justify-between
|
|
253
|
+
gap-2
|
|
254
|
+
px-2
|
|
255
|
+
cursor-pointer
|
|
256
|
+
data-[highlighted]:outline-hidden
|
|
257
|
+
data-[highlighted]:bg-accent-200
|
|
258
|
+
data-[highlighted]:text-accent-800
|
|
259
|
+
dark:data-[highlighted]:bg-accent-800
|
|
260
|
+
dark:data-[highlighted]:text-accent-200
|
|
261
|
+
"
|
|
262
|
+
:value="suggestion"
|
|
263
|
+
v-for="(suggestion, index) in filtered"
|
|
264
|
+
:key="index"
|
|
265
|
+
>
|
|
266
|
+
<slot
|
|
267
|
+
name="suggestion-icon"
|
|
268
|
+
v-bind="{ suggestion: suggestion as Exclude<TSuggestion, any[]> }"
|
|
269
|
+
/>
|
|
270
|
+
<slot
|
|
271
|
+
name="suggestion"
|
|
272
|
+
v-bind="{
|
|
273
|
+
suggestion: suggestion as Exclude<TSuggestion, any[]>,
|
|
274
|
+
suggestionText: display(suggestion)
|
|
275
|
+
}"
|
|
276
|
+
>
|
|
277
|
+
<div
|
|
278
|
+
class="
|
|
279
|
+
combobox--suggestion-label
|
|
280
|
+
"
|
|
281
|
+
>
|
|
282
|
+
{{ display(suggestion) }}
|
|
283
|
+
</div>
|
|
284
|
+
</slot>
|
|
285
|
+
</ComboboxItem>
|
|
286
|
+
</div>
|
|
287
|
+
</slot>
|
|
288
|
+
</ComboboxViewport>
|
|
289
|
+
</ComboboxContent>
|
|
290
|
+
</ComboboxPortal>
|
|
291
|
+
</ComboboxRoot>
|
|
292
|
+
</template>
|
|
293
|
+
|
|
294
|
+
<script setup lang="ts" generic="TSuggestion extends NonNullable<AcceptableValue>">
|
|
295
|
+
import type { AcceptableValue, ComboboxContentEmits, ComboboxContentProps, ComboboxInputEmits, ComboboxInputProps } from "reka-ui"
|
|
296
|
+
import {
|
|
297
|
+
ComboboxAnchor,
|
|
298
|
+
ComboboxContent,
|
|
299
|
+
ComboboxEmpty,
|
|
300
|
+
ComboboxInput,
|
|
301
|
+
ComboboxItem,
|
|
302
|
+
ComboboxPortal,
|
|
303
|
+
ComboboxRoot,
|
|
304
|
+
ComboboxTrigger,
|
|
305
|
+
ComboboxViewport, useFilter } from "reka-ui"
|
|
306
|
+
import type { EmitsToProps, HTMLAttributes, InputHTMLAttributes } from "vue"
|
|
307
|
+
import { computed, nextTick, ref, useAttrs, useSlots, useTemplateRef, watch } from "vue"
|
|
308
|
+
|
|
309
|
+
import { useDelayedLoadingIndicator } from "../../composables/useDelayedLoadingIndicator.js"
|
|
310
|
+
import { type SuggestionsDisplayProps, useDisplayForReka } from "../../composables/useDisplayForReka.js"
|
|
311
|
+
import { useFallbackId } from "../../composables/useFallbackId.js"
|
|
312
|
+
import { usePopupConstrainToStyle } from "../../composables/usePopupConstrainToStyle.js"
|
|
313
|
+
import { usePreHydrationValue } from "../../composables/usePreHydrationValue.js"
|
|
314
|
+
import type { PopupConstrainToProps } from "../../types/index.js"
|
|
315
|
+
import { twMerge } from "../../utils/twMerge.js"
|
|
316
|
+
import WButton from "../WButton/WButton.vue"
|
|
317
|
+
import WIcon from "../WIcon/WIcon.vue"
|
|
318
|
+
|
|
319
|
+
const $attrs = useAttrs()
|
|
320
|
+
|
|
321
|
+
const emit = defineEmits<{
|
|
322
|
+
(e: "save", value: string): void
|
|
323
|
+
(e: "new", value: string): void
|
|
324
|
+
}>()
|
|
325
|
+
|
|
326
|
+
const props = withDefaults(defineProps<
|
|
327
|
+
& SuggestionsDisplayProps<TSuggestion>
|
|
328
|
+
& PopupConstrainToProps
|
|
329
|
+
& {
|
|
330
|
+
id?: string
|
|
331
|
+
border?: boolean
|
|
332
|
+
to?: string
|
|
333
|
+
/**
|
|
334
|
+
* Validates the input, return true if valid, otherwise return an error message.
|
|
335
|
+
*
|
|
336
|
+
* If the input is invalid, modelValue is not updated. Empty inputs are visually valid, but they cannot trigger saves or or any setting of modelValue.
|
|
337
|
+
*
|
|
338
|
+
* If restrictToSuggestions is true, the input will be invalid if there is no exact match.
|
|
339
|
+
*
|
|
340
|
+
* `save` will not be emitted when the input is invalid.
|
|
341
|
+
*
|
|
342
|
+
* To show an error message, return a string from the function.
|
|
343
|
+
*/
|
|
344
|
+
isValid?: (searchTerm: string) => true | string
|
|
345
|
+
suggestions: TSuggestion[]
|
|
346
|
+
/** Shown in the popup when the search term is valid, not empty, not already selected, there are no suggestions, and restrictToSuggestions is false. Defaults to undefined. */
|
|
347
|
+
emptyLabel?: string
|
|
348
|
+
/** The popup can't be styled via the regular class attr because it's teleported. You can also pass any reka ComboboxContent options. */
|
|
349
|
+
contentProps?: { class?: string, to?: string } & HTMLAttributes & ComboboxContentProps & EmitsToProps<ComboboxContentEmits>
|
|
350
|
+
/** Disables the filter. */
|
|
351
|
+
ignoreFilter?: boolean
|
|
352
|
+
/** If false, modelValue is set to the search term (so long as it's valid). */
|
|
353
|
+
restrictToSuggestions?: boolean
|
|
354
|
+
/** Input attributes or reka-ui ComboboxInput props. */
|
|
355
|
+
inputProps?: Omit<InputHTMLAttributes, "class"> & { class?: string } & HTMLAttributes & ComboboxInputProps & EmitsToProps<ComboboxInputEmits>
|
|
356
|
+
}>(), {
|
|
357
|
+
border: true,
|
|
358
|
+
ignoreFilter: false,
|
|
359
|
+
emptyLabel: undefined,
|
|
360
|
+
isValid: (_: string) => true as const,
|
|
361
|
+
restrictToSuggestions: false,
|
|
362
|
+
to: "#root"
|
|
363
|
+
})
|
|
364
|
+
const finalId = useFallbackId(props)
|
|
365
|
+
|
|
366
|
+
const contentStyle = usePopupConstrainToStyle("combobox-content", props, [props?.contentProps?.style])
|
|
367
|
+
|
|
368
|
+
const modelValue = defineModel<TSuggestion>({ required: false, default: "" })
|
|
369
|
+
usePreHydrationValue(finalId, modelValue)
|
|
370
|
+
const open = defineModel<boolean>("open", { required: false, default: false })
|
|
371
|
+
const searchTerm = defineModel<string>("searchTerm", { default: "" })
|
|
372
|
+
const display = useDisplayForReka(props)
|
|
373
|
+
|
|
374
|
+
const { contains } = useFilter()
|
|
375
|
+
const filtered = computed(() => {
|
|
376
|
+
const f = props.ignoreFilter
|
|
377
|
+
? props.suggestions
|
|
378
|
+
: props.suggestions.filter(v => {
|
|
379
|
+
return contains(display(v), searchTerm.value)
|
|
380
|
+
})
|
|
381
|
+
if ((f?.length ?? 0) === 0 && props.restrictToSuggestions) {
|
|
382
|
+
return props.suggestions
|
|
383
|
+
} else {
|
|
384
|
+
return f
|
|
385
|
+
}
|
|
386
|
+
})
|
|
387
|
+
|
|
388
|
+
const errorMessage = computed(() => {
|
|
389
|
+
if (searchTerm.value === "") return false
|
|
390
|
+
const isExactMatch = filtered.value.find(v => display(v) === searchTerm.value)
|
|
391
|
+
if (!props.restrictToSuggestions && isExactMatch) return false
|
|
392
|
+
const validation = props.isValid(searchTerm.value)
|
|
393
|
+
if (validation === true) return false
|
|
394
|
+
return validation
|
|
395
|
+
})
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
watch(searchTerm, () => {
|
|
399
|
+
const isExactMatch = filtered.value.find(v => display(v) === searchTerm.value)
|
|
400
|
+
if (isExactMatch) {
|
|
401
|
+
modelValue.value = isExactMatch
|
|
402
|
+
}
|
|
403
|
+
})
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
function save(e: Event) {
|
|
407
|
+
if (errorMessage.value !== false || searchTerm.value === "") {
|
|
408
|
+
open.value = false
|
|
409
|
+
return
|
|
410
|
+
}
|
|
411
|
+
e.preventDefault()
|
|
412
|
+
emit("save", searchTerm.value)
|
|
413
|
+
open.value = false
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
const loading = defineModel<boolean>("loading", { default: false })
|
|
417
|
+
const showLoadingIndicator = useDelayedLoadingIndicator(loading)
|
|
418
|
+
|
|
419
|
+
const showEmptyLabel = computed(() => {
|
|
420
|
+
return errorMessage.value === false
|
|
421
|
+
&& !props.restrictToSuggestions
|
|
422
|
+
&& searchTerm.value !== ""
|
|
423
|
+
&& props.emptyLabel !== ""
|
|
424
|
+
&& !props.suggestions.some(s => display(s) === searchTerm.value)
|
|
425
|
+
})
|
|
426
|
+
|
|
427
|
+
const ariaDescribedBy = computed(() => {
|
|
428
|
+
const ids = []
|
|
429
|
+
if (open.value) ids.push(`${props.id}-instruction`)
|
|
430
|
+
if (errorMessage.value !== false) ids.push(`${props.id}-error`)
|
|
431
|
+
if ("ariaDescribedby" in $attrs) ids.push($attrs.ariaDescribedby as any)
|
|
432
|
+
return ids.join(" ") || undefined
|
|
433
|
+
})
|
|
434
|
+
|
|
435
|
+
const contentComp = useTemplateRef("contentComponent")
|
|
436
|
+
const popupSide = ref<"top" | "right" | "bottom" | "left" | undefined>(undefined)
|
|
437
|
+
watch(open, () => {
|
|
438
|
+
nextTick(() => {
|
|
439
|
+
if (open.value && contentComp.value?.$el) {
|
|
440
|
+
popupSide.value = contentComp.value.$el.getAttribute("data-side")
|
|
441
|
+
} else {
|
|
442
|
+
popupSide.value = undefined
|
|
443
|
+
}
|
|
444
|
+
})
|
|
445
|
+
})
|
|
446
|
+
</script>
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { expect, userEvent, waitFor, within } from "@storybook/test"
|
|
2
|
+
|
|
3
|
+
export const playBasic = async ({ canvasElement }: { canvasElement: HTMLElement, args: any }) => {
|
|
4
|
+
const canvas = within(canvasElement)
|
|
5
|
+
const input = canvas.getByRole("combobox") // More robust than LabelText
|
|
6
|
+
await userEvent.clear(input)
|
|
7
|
+
|
|
8
|
+
await userEvent.type(input, "A")
|
|
9
|
+
await expect(canvas.getByTestId("model-value")).toHaveTextContent("A")
|
|
10
|
+
|
|
11
|
+
await userEvent.clear(input)
|
|
12
|
+
await userEvent.type(input, "[Esc]")
|
|
13
|
+
await expect(canvas.getByTestId("search-term")).toHaveTextContent("")
|
|
14
|
+
|
|
15
|
+
await expect(canvas.getByTestId("model-value")).toHaveTextContent("A")
|
|
16
|
+
}
|
|
17
|
+
export const playBasicKeyboardSelect = async ({ canvasElement }: { canvasElement: HTMLElement, args: any }) => {
|
|
18
|
+
const canvas = within(canvasElement)
|
|
19
|
+
const input = canvas.getByRole("combobox")
|
|
20
|
+
|
|
21
|
+
await userEvent.clear(input)
|
|
22
|
+
await userEvent.type(input, "A")
|
|
23
|
+
|
|
24
|
+
await expect(canvas.getByRole("listbox")).toBeInTheDocument()
|
|
25
|
+
|
|
26
|
+
await userEvent.keyboard("{ArrowDown}")
|
|
27
|
+
const options = canvas.getAllByRole("option")
|
|
28
|
+
|
|
29
|
+
await expect(options[1]).toHaveAttribute("data-highlighted")
|
|
30
|
+
|
|
31
|
+
await userEvent.keyboard("{Enter}")
|
|
32
|
+
// it's the 0th element because of the filter
|
|
33
|
+
await expect(canvas.getByTestId("model-value")).toHaveTextContent(options[0]!.textContent?.trim() ?? "")
|
|
34
|
+
}
|
|
35
|
+
export const playBasicClickSelect = async ({ canvasElement }: { canvasElement: HTMLElement, args: any }) => {
|
|
36
|
+
const canvas = within(canvasElement)
|
|
37
|
+
const input = canvas.getByRole("combobox")
|
|
38
|
+
await userEvent.clear(input)
|
|
39
|
+
|
|
40
|
+
await userEvent.click(input)
|
|
41
|
+
|
|
42
|
+
const option = canvas.getByRole("option", { name: "AB" })
|
|
43
|
+
await userEvent.click(option)
|
|
44
|
+
|
|
45
|
+
await expect(canvas.getByTestId("model-value")).toHaveTextContent("AB")
|
|
46
|
+
|
|
47
|
+
await waitFor(() => {
|
|
48
|
+
expect(canvas.queryByRole("listbox")).not.toBeInTheDocument()
|
|
49
|
+
})
|
|
50
|
+
}
|
|
51
|
+
export const playValidation = async ({ canvasElement }: { canvasElement: HTMLElement }) => {
|
|
52
|
+
const canvas = within(canvasElement)
|
|
53
|
+
const input = canvas.getByRole("combobox")
|
|
54
|
+
|
|
55
|
+
await userEvent.clear(input)
|
|
56
|
+
await userEvent.type(input, "Invalid")
|
|
57
|
+
|
|
58
|
+
await userEvent.click(input)
|
|
59
|
+
|
|
60
|
+
const body = within(document.body)
|
|
61
|
+
await waitFor(() => {
|
|
62
|
+
expect(body.getByRole("alert")).toBeInTheDocument()
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const playAllowNewValues = async ({ canvasElement }: { canvasElement: HTMLElement }) => {
|
|
67
|
+
const canvas = within(canvasElement)
|
|
68
|
+
const input = canvas.getByRole("combobox")
|
|
69
|
+
await userEvent.clear(input)
|
|
70
|
+
const newValue = "New Custom Value"
|
|
71
|
+
|
|
72
|
+
await userEvent.type(input, newValue)
|
|
73
|
+
|
|
74
|
+
const body = within(document.body)
|
|
75
|
+
await waitFor(() => {
|
|
76
|
+
expect(body.getByText(/Press Enter to Add Value/i)).toBeInTheDocument()
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
await userEvent.keyboard("{Enter}")
|
|
80
|
+
|
|
81
|
+
await expect(canvas.getByTestId("model-value")).toHaveTextContent(newValue)
|
|
82
|
+
|
|
83
|
+
await userEvent.clear(input)
|
|
84
|
+
await userEvent.type(input, newValue)
|
|
85
|
+
expect(body.queryByText(/Press Enter to Add Value/i)).not.toBeInTheDocument()
|
|
86
|
+
|
|
87
|
+
await userEvent.clear(input)
|
|
88
|
+
await userEvent.type(input, "New")
|
|
89
|
+
await waitFor(() => {
|
|
90
|
+
expect(body.getByRole("option", { name: newValue })).toBeInTheDocument()
|
|
91
|
+
})
|
|
92
|
+
}
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
import type { Meta, StoryObj } from "@storybook/vue3"
|
|
4
4
|
import { ref } from "vue"
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import WDarkModeSwitcher from "./WDarkModeSwitcher.vue"
|
|
7
7
|
|
|
8
8
|
// todo, maybe don't do this for perf reasons
|
|
9
9
|
import * as components from "../index.js"
|
|
10
10
|
|
|
11
|
-
const meta: Meta<typeof
|
|
12
|
-
component:
|
|
11
|
+
const meta: Meta<typeof WDarkModeSwitcher> = {
|
|
12
|
+
component: WDarkModeSwitcher,
|
|
13
13
|
title: "Components/DarkModeSwitcher",
|
|
14
14
|
args: {
|
|
15
15
|
|
|
@@ -17,7 +17,7 @@ const meta: Meta<typeof LibDarkModeSwitcher> = {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export default meta
|
|
20
|
-
type Story = StoryObj<typeof
|
|
20
|
+
type Story = StoryObj<typeof WDarkModeSwitcher>
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
export const Primary: Story = {
|
|
@@ -32,10 +32,10 @@ export const Primary: Story = {
|
|
|
32
32
|
},
|
|
33
33
|
template: `
|
|
34
34
|
Value: {{darkMode}}
|
|
35
|
-
<
|
|
35
|
+
<WDarkModeSwitcher
|
|
36
36
|
@update:darkMode="darkMode = $event"
|
|
37
37
|
v-bind="{...args}"
|
|
38
|
-
></
|
|
38
|
+
></WDarkModeSwitcher>
|
|
39
39
|
<!-- workaround for style tag not being allowed -->
|
|
40
40
|
<component is="style">
|
|
41
41
|
{{args.css}}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<WButton
|
|
3
3
|
v-bind="{ ...$attrs, class: undefined }"
|
|
4
|
-
:class="!
|
|
4
|
+
:class="!unstyle && twMerge(`
|
|
5
5
|
dark-mode-switcher
|
|
6
6
|
rounded-full
|
|
7
7
|
after:rounded-full
|
|
8
8
|
`,
|
|
9
9
|
($attrs as any)?.class
|
|
10
10
|
)"
|
|
11
|
-
:
|
|
11
|
+
:aria-label="`${t('dark-mode-switcher.title')}${t(`dark-mode-switcher.${darkModeState}`)}`"
|
|
12
12
|
@click="cycleDarkMode"
|
|
13
13
|
>
|
|
14
14
|
<!-- content-vertical-holder will keep the icon the height of a text line regardless of the svg used -->
|
|
15
15
|
<template #icon>
|
|
16
|
-
<
|
|
16
|
+
<WIcon
|
|
17
17
|
class="w-[1em] items-center content-vertical-holder"
|
|
18
18
|
>
|
|
19
19
|
<component :is="darkModeState==='dark' ? IFaSolidMoon : darkModeState==='light' ? IPhSunBold : IFa6SolidCircleHalfStroke"/>
|
|
20
|
-
</
|
|
20
|
+
</WIcon>
|
|
21
21
|
</template>
|
|
22
22
|
<template
|
|
23
23
|
#default
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
{{ t(`dark-mode-switcher.${darkModeState}`) }}
|
|
28
28
|
</div>
|
|
29
29
|
</template>
|
|
30
|
-
</
|
|
30
|
+
</Wbutton>
|
|
31
31
|
</template>
|
|
32
32
|
|
|
33
33
|
<script lang="ts" setup>
|
|
@@ -39,10 +39,10 @@ import IPhSunBold from "~icons/ph/sun-bold"
|
|
|
39
39
|
|
|
40
40
|
import { useInjectedDarkMode } from "../../composables/useInjectedDarkMode.js"
|
|
41
41
|
import { useInjectedI18n } from "../../composables/useInjectedI18n.js"
|
|
42
|
+
import type { BaseInteractiveProps, TailwindClassProp } from "../../types/index.js"
|
|
42
43
|
import { twMerge } from "../../utils/twMerge.js"
|
|
43
|
-
import
|
|
44
|
-
import
|
|
45
|
-
import type { TailwindClassProp } from "../shared/props.js"
|
|
44
|
+
import WButton from "../WButton/WButton.vue"
|
|
45
|
+
import WIcon from "../WIcon/WIcon.vue"
|
|
46
46
|
|
|
47
47
|
const t = useInjectedI18n()
|
|
48
48
|
|
|
@@ -54,7 +54,16 @@ const emit = defineEmits<{
|
|
|
54
54
|
}>()
|
|
55
55
|
const $attrs = useAttrs()
|
|
56
56
|
|
|
57
|
-
withDefaults(defineProps<
|
|
57
|
+
withDefaults(defineProps<
|
|
58
|
+
& Pick<BaseInteractiveProps, "border">
|
|
59
|
+
& {
|
|
60
|
+
disabled?: boolean
|
|
61
|
+
unstyle?: boolean
|
|
62
|
+
showLabel?: boolean
|
|
63
|
+
}
|
|
64
|
+
& /** @vue-ignore */ Omit<ButtonHTMLAttributes, "class">
|
|
65
|
+
& /** @vue-ignore */ TailwindClassProp
|
|
66
|
+
>(), { showLabel: true })
|
|
58
67
|
|
|
59
68
|
const {
|
|
60
69
|
darkMode,
|
|
@@ -70,23 +79,3 @@ onMounted(() => {
|
|
|
70
79
|
})
|
|
71
80
|
</script>
|
|
72
81
|
|
|
73
|
-
<script lang="ts">
|
|
74
|
-
export default {
|
|
75
|
-
name: "LibDarkModeSwitcher"
|
|
76
|
-
}
|
|
77
|
-
type RealProps = {
|
|
78
|
-
showLabel?: boolean
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
interface Props
|
|
82
|
-
extends
|
|
83
|
-
/** @vue-ignore */
|
|
84
|
-
Partial<Omit<ButtonHTMLAttributes, "class" | "color" | "disabled">
|
|
85
|
-
& TailwindClassProp
|
|
86
|
-
& {
|
|
87
|
-
disabled?: boolean
|
|
88
|
-
unstyle?: boolean
|
|
89
|
-
}>,
|
|
90
|
-
RealProps
|
|
91
|
-
{ }
|
|
92
|
-
</script>
|