@witchcraft/ui 0.4.0 → 0.4.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 +56 -61
- package/dist/module.d.mts +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +13 -9
- package/dist/runtime/assets/animations.css +1 -1
- package/dist/runtime/assets/locales/en.json +2 -0
- package/dist/runtime/assets/utils.css +1 -1
- package/dist/runtime/build/WitchcraftUiResolver.js +1 -2
- package/dist/runtime/components/TestControls/TestControls.d.vue.ts +2 -1
- package/dist/runtime/components/TestControls/TestControls.vue +3 -3
- package/dist/runtime/components/TestControls/TestControls.vue.d.ts +2 -1
- 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 +110 -0
- package/dist/runtime/components/WCheckbox/WCheckbox.vue.d.ts +33 -0
- package/dist/runtime/components/{LibColorInput/LibColorInput.d.vue.ts → WColorInput/WColorInput.d.vue.ts} +18 -36
- package/dist/runtime/components/WColorInput/WColorInput.vue +85 -0
- package/dist/runtime/components/{LibColorInput/LibColorInput.vue.d.ts → WColorInput/WColorInput.vue.d.ts} +18 -36
- 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} +12 -9
- package/dist/runtime/components/{LibColorPicker/LibColorPicker.vue → WColorPicker/WColorPicker.vue} +41 -29
- package/dist/runtime/components/{LibColorPicker/LibColorPicker.vue.d.ts → WColorPicker/WColorPicker.vue.d.ts} +12 -9
- package/dist/runtime/components/WCombobox/WCombobox.d.vue.ts +111 -0
- package/dist/runtime/components/WCombobox/WCombobox.vue +405 -0
- package/dist/runtime/components/WCombobox/WCombobox.vue.d.ts +111 -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} +9 -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} +9 -13
- package/dist/runtime/components/{LibDatePicker/LibDatePicker.d.vue.ts → WDatePicker/WDatePicker.d.vue.ts} +7 -7
- package/dist/runtime/components/{LibDatePicker/LibDatePicker.vue → WDatePicker/WDatePicker.vue} +3 -7
- package/dist/runtime/components/{LibDatePicker/LibDatePicker.vue.d.ts → WDatePicker/WDatePicker.vue.d.ts} +7 -7
- package/dist/runtime/components/WDatePicker/WRangeDatePicker.d.vue.ts +182 -0
- package/dist/runtime/components/{LibDatePicker/LibRangeDatePicker.vue → WDatePicker/WRangeDatePicker.vue} +29 -25
- package/dist/runtime/components/WDatePicker/WRangeDatePicker.vue.d.ts +182 -0
- package/dist/runtime/components/{LibDatePicker/LibSingleDatePicker.d.vue.ts → WDatePicker/WSingleDatePicker.d.vue.ts} +7 -5
- package/dist/runtime/components/{LibDatePicker/LibSingleDatePicker.vue → WDatePicker/WSingleDatePicker.vue} +21 -21
- package/dist/runtime/components/{LibDatePicker/LibSingleDatePicker.vue.d.ts → WDatePicker/WSingleDatePicker.vue.d.ts} +7 -5
- package/dist/runtime/components/WDatePicker/WTimeZonePicker.d.vue.ts +13 -0
- package/dist/runtime/components/{LibDatePicker/LibTimeZonePicker.vue → WDatePicker/WTimeZonePicker.vue} +5 -12
- package/dist/runtime/components/WDatePicker/WTimeZonePicker.vue.d.ts +13 -0
- package/dist/runtime/components/{LibDebug/LibDebug.d.vue.ts → WDebug/WDebug.d.vue.ts} +3 -2
- package/dist/runtime/components/{LibDebug/LibDebug.vue → WDebug/WDebug.vue} +10 -12
- package/dist/runtime/components/{LibDebug/LibDebug.vue.d.ts → WDebug/WDebug.vue.d.ts} +3 -2
- package/dist/runtime/components/{LibDevOnly/LibDevOnly.d.vue.ts → WDevOnly/WDevOnly.d.vue.ts} +3 -5
- package/dist/runtime/components/{LibDevOnly/LibDevOnly.vue.d.ts → WDevOnly/WDevOnly.vue.d.ts} +3 -5
- package/dist/runtime/components/WFileInput/WFileInput.d.vue.ts +58 -0
- package/dist/runtime/components/WFileInput/WFileInput.vue +348 -0
- package/dist/runtime/components/WFileInput/WFileInput.vue.d.ts +58 -0
- package/dist/runtime/components/WIcon/WIcon.d.vue.ts +18 -0
- package/dist/runtime/components/{Icon/Icon.vue → WIcon/WIcon.vue} +1 -1
- package/dist/runtime/components/WIcon/WIcon.vue.d.ts +18 -0
- package/dist/runtime/components/WMultiValues/WMultiValues.d.vue.ts +28 -0
- package/dist/runtime/components/WMultiValues/WMultiValues.vue +150 -0
- package/dist/runtime/components/WMultiValues/WMultiValues.vue.d.ts +28 -0
- package/dist/runtime/components/WNotifications/WNotification.d.vue.ts +37 -0
- package/dist/runtime/components/{LibNotifications/LibNotification.vue → WNotifications/WNotification.vue} +61 -35
- package/dist/runtime/components/WNotifications/WNotification.vue.d.ts +37 -0
- package/dist/runtime/components/WNotifications/WNotificationTestMessageComponent.d.vue.ts +7 -0
- package/dist/runtime/components/WNotifications/WNotificationTestMessageComponent.vue +29 -0
- package/dist/runtime/components/WNotifications/WNotificationTestMessageComponent.vue.d.ts +7 -0
- package/dist/runtime/components/WNotifications/WNotifications.d.vue.ts +11 -0
- package/dist/runtime/components/{LibNotifications/LibNotifications.vue → WNotifications/WNotifications.vue} +72 -36
- package/dist/runtime/components/WNotifications/WNotifications.vue.d.ts +11 -0
- package/dist/runtime/components/WNotifications/calculateNotificationProgress.d.ts +2 -0
- package/dist/runtime/components/WNotifications/calculateNotificationProgress.js +4 -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 +45 -0
- package/dist/runtime/components/WPopover/WPopover.vue +144 -0
- package/dist/runtime/components/WPopover/WPopover.vue.d.ts +45 -0
- package/dist/runtime/components/WPopup/WPopup.d.vue.ts +51 -0
- package/dist/runtime/components/WPopup/WPopup.vue +115 -0
- package/dist/runtime/components/WPopup/WPopup.vue.d.ts +51 -0
- package/dist/runtime/components/{LibProgressBar/LibProgressBar.d.vue.ts → WProgressBar/WProgressBar.d.vue.ts} +13 -16
- package/dist/runtime/components/WProgressBar/WProgressBar.vue +150 -0
- package/dist/runtime/components/{LibProgressBar/LibProgressBar.vue.d.ts → WProgressBar/WProgressBar.vue.d.ts} +13 -16
- package/dist/runtime/components/{LibRecorder/LibRecorder.d.vue.ts → WRecorder/WRecorder.d.vue.ts} +13 -27
- 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} +13 -27
- package/dist/runtime/components/{LibRoot/LibRoot.d.vue.ts → WRoot/WRoot.d.vue.ts} +11 -9
- 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} +11 -9
- package/dist/runtime/components/WSimpleInput/WSimpleInput.d.vue.ts +34 -0
- package/dist/runtime/components/{LibSimpleInput/LibSimpleInput.vue → WSimpleInput/WSimpleInput.vue} +14 -24
- package/dist/runtime/components/WSimpleInput/WSimpleInput.vue.d.ts +34 -0
- package/dist/runtime/components/WTable/WTable.d.vue.ts +102 -0
- package/dist/runtime/components/WTable/WTable.vue +370 -0
- 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 +112 -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/composables/useTimeConditionally.d.ts +16 -0
- package/dist/runtime/composables/useTimeConditionally.js +27 -0
- package/dist/runtime/directives/vResizableCols.js +101 -34
- package/dist/runtime/helpers/NotificationHandler.d.ts +28 -3
- package/dist/runtime/helpers/NotificationHandler.js +7 -10
- package/dist/runtime/injectionKeys.d.ts +1 -5
- package/dist/runtime/injectionKeys.js +0 -2
- package/dist/runtime/types/index.d.ts +97 -31
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/utils/notifyIfError.d.ts +3 -1
- package/dist/runtime/utils/notifyIfError.js +4 -2
- package/dist/runtime/utils/twMerge.d.ts +1 -0
- package/dist/runtime/utils/twMerge.js +2 -1
- package/package.json +59 -56
- package/src/module.ts +16 -8
- package/src/runtime/assets/animations.css +53 -6
- package/src/runtime/assets/locales/en.json +2 -0
- package/src/runtime/assets/tailwind.css +1 -1
- package/src/runtime/assets/utils.css +52 -4
- package/src/runtime/build/WitchcraftUiResolver.ts +1 -2
- 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 +125 -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} +44 -31
- package/src/runtime/components/WCombobox/WCombobox.stories.ts +209 -0
- package/src/runtime/components/WCombobox/WCombobox.vue +450 -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} +29 -25
- package/src/runtime/components/{LibDatePicker/LibSingleDatePicker.vue → WDatePicker/WSingleDatePicker.vue} +21 -21
- 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} +9 -10
- package/src/runtime/components/{LibDevOnly/LibDevOnly.vue → WDevOnly/WDevOnly.vue} +0 -4
- package/src/runtime/components/{LibFileInput/LibFileInput.stories.ts → WFileInput/WFileInput.stories.ts} +20 -10
- package/src/runtime/components/WFileInput/WFileInput.vue +392 -0
- 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 +163 -0
- package/src/runtime/components/{LibNotifications/LibNotification.stories.ts → WNotifications/WNotification.stories.ts} +42 -6
- package/src/runtime/components/{LibNotifications/LibNotification.vue → WNotifications/WNotification.vue} +72 -45
- package/src/runtime/components/WNotifications/WNotificationTestMessageComponent.vue +27 -0
- package/src/runtime/components/WNotifications/WNotifications.stories.ts +139 -0
- package/src/runtime/components/{LibNotifications/LibNotifications.vue → WNotifications/WNotifications.vue} +87 -47
- package/src/runtime/components/WNotifications/calculateNotificationProgress.ts +8 -0
- 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 +168 -0
- package/src/runtime/components/WPopup/WPopup.stories.ts +104 -0
- package/src/runtime/components/WPopup/WPopup.vue +134 -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} +28 -42
- package/src/runtime/components/WTable/WTable.stories.ts +334 -0
- package/src/runtime/components/WTable/WTable.vue +471 -0
- package/src/runtime/components/WTooltip/WTooltip.stories.ts +82 -0
- package/src/runtime/components/WTooltip/WTooltip.vue +128 -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/composables/useTimeConditionally.ts +51 -0
- package/src/runtime/directives/vResizableCols.ts +121 -38
- package/src/runtime/helpers/NotificationHandler.ts +30 -11
- package/src/runtime/injectionKeys.ts +1 -7
- package/src/runtime/types/index.ts +118 -36
- package/src/runtime/utils/notifyIfError.ts +6 -2
- package/src/runtime/utils/twMerge.ts +2 -1
- package/types/components.d.ts +14 -15
- package/dist/runtime/components/Aria/Aria.d.vue.ts +0 -5
- package/dist/runtime/components/Aria/Aria.vue +0 -16
- package/dist/runtime/components/Aria/Aria.vue.d.ts +0 -5
- package/dist/runtime/components/Icon/Icon.d.vue.ts +0 -21
- package/dist/runtime/components/Icon/Icon.vue.d.ts +0 -21
- package/dist/runtime/components/LibButton/LibButton.d.vue.ts +0 -36
- package/dist/runtime/components/LibButton/LibButton.vue.d.ts +0 -36
- package/dist/runtime/components/LibCheckbox/LibCheckbox.d.vue.ts +0 -42
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +0 -103
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +0 -42
- package/dist/runtime/components/LibColorInput/LibColorInput.vue +0 -162
- package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.d.vue.ts +0 -34
- package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue.d.ts +0 -34
- package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.d.vue.ts +0 -22
- package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue.d.ts +0 -22
- package/dist/runtime/components/LibFileInput/LibFileInput.d.vue.ts +0 -43
- package/dist/runtime/components/LibFileInput/LibFileInput.vue +0 -274
- package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +0 -43
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.d.vue.ts +0 -165
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +0 -387
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +0 -165
- package/dist/runtime/components/LibLabel/LibLabel.d.vue.ts +0 -26
- package/dist/runtime/components/LibLabel/LibLabel.vue +0 -45
- package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +0 -26
- package/dist/runtime/components/LibMultiValues/LibMultiValues.d.vue.ts +0 -29
- package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +0 -109
- package/dist/runtime/components/LibMultiValues/LibMultiValues.vue.d.ts +0 -29
- package/dist/runtime/components/LibNotifications/LibNotification.d.vue.ts +0 -30
- package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +0 -30
- package/dist/runtime/components/LibNotifications/LibNotifications.d.vue.ts +0 -13
- package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +0 -13
- package/dist/runtime/components/LibPagination/LibPagination.d.vue.ts +0 -104
- package/dist/runtime/components/LibPagination/LibPagination.vue +0 -229
- package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +0 -104
- package/dist/runtime/components/LibPalette/LibPalette.d.vue.ts +0 -14
- package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +0 -14
- package/dist/runtime/components/LibPopup/LibPopup.d.vue.ts +0 -46
- package/dist/runtime/components/LibPopup/LibPopup.vue +0 -365
- package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +0 -46
- package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +0 -169
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.d.vue.ts +0 -35
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue.d.ts +0 -35
- package/dist/runtime/components/LibSuggestions/LibSuggestions.d.vue.ts +0 -94
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +0 -178
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +0 -94
- package/dist/runtime/components/LibTable/LibTable.d.vue.ts +0 -45
- package/dist/runtime/components/LibTable/LibTable.vue +0 -155
- package/dist/runtime/components/LibTable/LibTable.vue.d.ts +0 -45
- package/dist/runtime/components/Template/NAME.d.vue.ts +0 -17
- package/dist/runtime/components/Template/NAME.vue +0 -27
- package/dist/runtime/components/Template/NAME.vue.d.ts +0 -17
- 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 -129
- package/src/runtime/components/LibColorInput/LibColorInput.vue +0 -203
- package/src/runtime/components/LibFileInput/LibFileInput.vue +0 -320
- package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.ts +0 -405
- package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +0 -414
- 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 -120
- 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/LibTable/LibTable.stories.ts +0 -167
- package/src/runtime/components/LibTable/LibTable.vue +0 -190
- 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 → WDatePicker}/helpers.d.ts +0 -0
- /package/dist/runtime/components/{LibDatePicker → WDatePicker}/helpers.js +0 -0
- /package/dist/runtime/components/{LibDevOnly/LibDevOnly.vue → WDevOnly/WDevOnly.vue} +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
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/vue3"
|
|
3
|
+
import { onUnmounted, ref } from "vue"
|
|
4
|
+
|
|
5
|
+
import WProgressBar from "./WProgressBar.vue"
|
|
6
|
+
|
|
7
|
+
import * as components from "../index.js"
|
|
8
|
+
|
|
9
|
+
type ExtraTestArgs = {
|
|
10
|
+
_start?: number
|
|
11
|
+
_timeout?: number
|
|
12
|
+
_add?: number
|
|
13
|
+
}
|
|
14
|
+
const meta: Meta<typeof WProgressBar> = {
|
|
15
|
+
component: WProgressBar,
|
|
16
|
+
title: "Components/ProgressBar",
|
|
17
|
+
args: {
|
|
18
|
+
label: "Label",
|
|
19
|
+
...{
|
|
20
|
+
_timeout: 1000,
|
|
21
|
+
_add: 10,
|
|
22
|
+
_start: 50
|
|
23
|
+
} satisfies ExtraTestArgs as any
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default meta
|
|
28
|
+
type Story = StoryObj<typeof WProgressBar> & { args?: ExtraTestArgs }
|
|
29
|
+
|
|
30
|
+
export const Primary: Story = {
|
|
31
|
+
render: args => {
|
|
32
|
+
const extraArgs = args as ExtraTestArgs
|
|
33
|
+
return {
|
|
34
|
+
components,
|
|
35
|
+
setup: () => {
|
|
36
|
+
const forceFull = ref(false)
|
|
37
|
+
const progress = ref(extraArgs._start as number)
|
|
38
|
+
if (args.progress) {
|
|
39
|
+
progress.value = args.progress
|
|
40
|
+
} else {
|
|
41
|
+
let justHitFull = false
|
|
42
|
+
const interval = setInterval(() => {
|
|
43
|
+
if (justHitFull) return
|
|
44
|
+
if (progress.value >= 100) {
|
|
45
|
+
justHitFull = true
|
|
46
|
+
// give it time to hide
|
|
47
|
+
setTimeout(() => {
|
|
48
|
+
progress.value = 0
|
|
49
|
+
justHitFull = false
|
|
50
|
+
}, 2000)
|
|
51
|
+
} else {
|
|
52
|
+
progress.value += extraArgs._add as number
|
|
53
|
+
}
|
|
54
|
+
}, extraArgs._timeout as number)
|
|
55
|
+
onUnmounted(() => {
|
|
56
|
+
clearInterval(interval)
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
args: { ...args },
|
|
61
|
+
forceFull,
|
|
62
|
+
progress
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
template: `
|
|
66
|
+
<WCheckbox v-model="forceFull">Force 100%</WCheckbox>
|
|
67
|
+
<WProgressBar class="flex-1" v-bind="args" :progress="forceFull ? 100 : progress"></WProgressBar>
|
|
68
|
+
<br/>
|
|
69
|
+
Stretched in flexbox:
|
|
70
|
+
<div class="flex w-full">
|
|
71
|
+
<WProgressBar class="flex-1" v-bind="args" :progress="forceFull ? 100 : progress"></WProgressBar>
|
|
72
|
+
</div>
|
|
73
|
+
<hr class="mt-2"/>
|
|
74
|
+
`
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
export const ReallyLongLabel: Story = {
|
|
81
|
+
...Primary,
|
|
82
|
+
args: {
|
|
83
|
+
...Primary.args,
|
|
84
|
+
label: "Really Long Label Label to See Effect Really Long Label Label to See Effect Really Long Label Label to See Effect Really Long Label Label to See Effect"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
export const Static: Story = {
|
|
88
|
+
...Primary,
|
|
89
|
+
args: {
|
|
90
|
+
...Primary.args,
|
|
91
|
+
progress: 50
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export const AutoHiding: Story = {
|
|
96
|
+
...Primary,
|
|
97
|
+
args: {
|
|
98
|
+
...Primary.args,
|
|
99
|
+
autohideOnComplete: 500,
|
|
100
|
+
clamp: [10, 100],
|
|
101
|
+
// keepSpaceWhenHidden: true,
|
|
102
|
+
_start: 0,
|
|
103
|
+
_timeout: 1000,
|
|
104
|
+
_add: 10
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export const AutoHidingNoKeepSpace: Story = {
|
|
109
|
+
...Primary,
|
|
110
|
+
args: {
|
|
111
|
+
...Primary.args,
|
|
112
|
+
autohideOnComplete: 500,
|
|
113
|
+
keepSpaceWhenHidden: false,
|
|
114
|
+
clamp: [10, 100],
|
|
115
|
+
_start: 0,
|
|
116
|
+
_timeout: 1000,
|
|
117
|
+
_add: 10
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Transition>
|
|
3
|
+
<div
|
|
4
|
+
v-if="currentVisibility !== 'hidden'"
|
|
5
|
+
:class="twMerge(`
|
|
6
|
+
progress-bar
|
|
7
|
+
w-[200px]
|
|
8
|
+
whitespace-nowrap
|
|
9
|
+
overflow-x-scroll
|
|
10
|
+
scrollbar-hidden
|
|
11
|
+
rounded-sm
|
|
12
|
+
flex
|
|
13
|
+
relative
|
|
14
|
+
text-sm
|
|
15
|
+
min-w-[50px]
|
|
16
|
+
after:shadow-inner
|
|
17
|
+
after:shadow-black/50
|
|
18
|
+
after:content-['']
|
|
19
|
+
after:absolute
|
|
20
|
+
after:inset-0
|
|
21
|
+
after:pointer-events-none
|
|
22
|
+
after:z-2
|
|
23
|
+
after:transition-all
|
|
24
|
+
before:content-['']
|
|
25
|
+
before:shadow-inner
|
|
26
|
+
before:shadow-black/50
|
|
27
|
+
before:rounded-sm
|
|
28
|
+
before:bg-bars-gradient
|
|
29
|
+
before:animate-slideBgInf
|
|
30
|
+
before:[background-size:15px_15px]
|
|
31
|
+
before:absolute
|
|
32
|
+
before:w-[var(--progress)]
|
|
33
|
+
before:top-0 before:bottom-0 before:left-0
|
|
34
|
+
before:transition-all
|
|
35
|
+
before:z-1
|
|
36
|
+
before:duration-500
|
|
37
|
+
`, currentVisibility === 'pseudo' && `
|
|
38
|
+
after:opacity-0
|
|
39
|
+
before:opacity-0
|
|
40
|
+
`, ($attrs as any).class)"
|
|
41
|
+
:data-value="progress"
|
|
42
|
+
role="progressbar"
|
|
43
|
+
:aria-valuenow="clampNumber(progress, clamp[0] ?? 0, clamp[1] ?? 100)"
|
|
44
|
+
:aria-valuemin="clamp[0] ?? 0"
|
|
45
|
+
:aria-valuemax="clamp[1] ?? 100"
|
|
46
|
+
:aria-label="label"
|
|
47
|
+
v-bind="{ ...$attrs, class: undefined }"
|
|
48
|
+
:style="`--progress: ${clampNumber(progress, clamp[0] ?? 0, clamp[1] ?? 100)}%;`"
|
|
49
|
+
>
|
|
50
|
+
<div
|
|
51
|
+
class="progress-bar--label-wrapper relative flex-1 z-3"
|
|
52
|
+
aria-hidden="true"
|
|
53
|
+
>
|
|
54
|
+
<span class="before:content-vertical-holder"/>
|
|
55
|
+
|
|
56
|
+
<Transition v-if="currentVisibility === 'visible'">
|
|
57
|
+
<slot>
|
|
58
|
+
<div
|
|
59
|
+
class="
|
|
60
|
+
progress-bar--bottom-label
|
|
61
|
+
text-black
|
|
62
|
+
dark:text-white
|
|
63
|
+
absolute
|
|
64
|
+
inset-0
|
|
65
|
+
flex
|
|
66
|
+
justify-center
|
|
67
|
+
px-2
|
|
68
|
+
"
|
|
69
|
+
>
|
|
70
|
+
<div class="truncate">
|
|
71
|
+
{{ label ?? "" }}
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
</slot>
|
|
75
|
+
</Transition>
|
|
76
|
+
<Transition v-if="currentVisibility === 'visible'">
|
|
77
|
+
<slot>
|
|
78
|
+
<div
|
|
79
|
+
class="
|
|
80
|
+
progress-bar--top-label
|
|
81
|
+
pointer-events-none
|
|
82
|
+
absolute
|
|
83
|
+
inset-0
|
|
84
|
+
flex
|
|
85
|
+
justify-center
|
|
86
|
+
transition-all
|
|
87
|
+
duration-500
|
|
88
|
+
text-white
|
|
89
|
+
[clip-path:inset(0_calc(100%-var(--progress))_0_0)]
|
|
90
|
+
px-2
|
|
91
|
+
"
|
|
92
|
+
>
|
|
93
|
+
<div class="truncate">
|
|
94
|
+
{{ label ?? "" }}
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
</slot>
|
|
98
|
+
</Transition>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
</Transition>
|
|
102
|
+
</template>
|
|
103
|
+
|
|
104
|
+
<script setup lang="ts">
|
|
105
|
+
import { clampNumber } from "@alanscodelog/utils/clampNumber"
|
|
106
|
+
import { unreachable } from "@alanscodelog/utils/unreachable"
|
|
107
|
+
import type { HTMLAttributes } from "vue"
|
|
108
|
+
import { ref, useAttrs, watch } from "vue"
|
|
109
|
+
|
|
110
|
+
import type { TailwindClassProp } from "../../types/index.js"
|
|
111
|
+
import { twMerge } from "../../utils/twMerge.js"
|
|
112
|
+
|
|
113
|
+
defineOptions({
|
|
114
|
+
name: "WProgressBar",
|
|
115
|
+
inheritAttrs: false
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
const $attrs = useAttrs()
|
|
119
|
+
const props = withDefaults(defineProps<
|
|
120
|
+
& /** @vue-ignore */ Omit<HTMLAttributes, "class">
|
|
121
|
+
& /** @vue-ignore */ TailwindClassProp
|
|
122
|
+
& {
|
|
123
|
+
label?: string
|
|
124
|
+
/** A number from 0-100. It is auto-clamped. */
|
|
125
|
+
progress: number
|
|
126
|
+
/** Will auto hide after this given time if progress is 100% or more or less than 0% until progress is set to something else. Disabled (-1) by default. */
|
|
127
|
+
autohideOnComplete?: number
|
|
128
|
+
/**
|
|
129
|
+
* Do not actually hide the element, just leave an unstyled div,
|
|
130
|
+
* so the whole layout doesn't change on completion when autohideOnComplete is set.
|
|
131
|
+
*/
|
|
132
|
+
keepSpaceWhenHidden?: boolean
|
|
133
|
+
/**
|
|
134
|
+
* By default the progress bar is visually clamped to 0-100, even if the value might be something else.
|
|
135
|
+
* You can change what it's clamped to here, to for example,
|
|
136
|
+
* show at least a small sliver of the progress bar when it's still 0.
|
|
137
|
+
*/
|
|
138
|
+
clamp?: [start: number, end: number]
|
|
139
|
+
}
|
|
140
|
+
>(), {
|
|
141
|
+
autohideOnComplete: -1,
|
|
142
|
+
keepSpaceWhenHidden: false,
|
|
143
|
+
clamp: () => [0, 100]
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
type Visibility = "visible" | "pseudo" | "hidden"
|
|
147
|
+
const currentVisibility = ref<Visibility>("visible")
|
|
148
|
+
let lastVisibility: Visibility | null = null
|
|
149
|
+
|
|
150
|
+
function updateVisibility(
|
|
151
|
+
immediate: boolean = false,
|
|
152
|
+
onCleanup?: (cb: () => void) => void
|
|
153
|
+
): void {
|
|
154
|
+
const isComplete = props.progress >= 100 || props.progress < 0
|
|
155
|
+
const shouldHide = props.autohideOnComplete > -1 && isComplete
|
|
156
|
+
|
|
157
|
+
if (!shouldHide) {
|
|
158
|
+
lastVisibility = null
|
|
159
|
+
currentVisibility.value = "visible"
|
|
160
|
+
return
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const newVisibility: Visibility = props.keepSpaceWhenHidden ? "pseudo" : "hidden"
|
|
164
|
+
|
|
165
|
+
if (immediate) {
|
|
166
|
+
currentVisibility.value = newVisibility
|
|
167
|
+
lastVisibility = newVisibility
|
|
168
|
+
} else if (lastVisibility !== newVisibility) {
|
|
169
|
+
lastVisibility = newVisibility
|
|
170
|
+
const timeout = setTimeout(() => {
|
|
171
|
+
currentVisibility.value = newVisibility
|
|
172
|
+
}, props.autohideOnComplete) as any
|
|
173
|
+
if (!onCleanup) unreachable()
|
|
174
|
+
onCleanup(() => clearTimeout(timeout))
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
updateVisibility(true)
|
|
179
|
+
|
|
180
|
+
watch([
|
|
181
|
+
() => [props.progress, props.keepSpaceWhenHidden, props.autohideOnComplete]
|
|
182
|
+
], (_new, _old, onCleanup) => {
|
|
183
|
+
updateVisibility(false, onCleanup)
|
|
184
|
+
})
|
|
185
|
+
</script>
|
package/src/runtime/components/{LibRecorder/LibRecorder.stories.ts → WRecorder/WRecorder.stories.ts}
RENAMED
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
import type { Meta, StoryObj } from "@storybook/vue3"
|
|
3
3
|
import { ref, watchEffect } from "vue"
|
|
4
4
|
|
|
5
|
+
import { vExtractRootEl } from "../../directives/vExtractRootEl.js"
|
|
5
6
|
import { createRecorderHandler, createRecorderWatchEffect } from "../../helpers/storybook.js"
|
|
6
7
|
import * as components from "../index.js"
|
|
8
|
+
|
|
7
9
|
/**
|
|
8
10
|
* This is a special input component designed to record any type of event.
|
|
9
11
|
*
|
|
@@ -11,22 +13,22 @@ import * as components from "../index.js"
|
|
|
11
13
|
*
|
|
12
14
|
* This basic implementation just lists the keys. Enter accepts the recording, escape cancels back to the initial value.
|
|
13
15
|
*/
|
|
14
|
-
const meta: Meta<typeof components.
|
|
15
|
-
component: components.
|
|
16
|
+
const meta: Meta<typeof components.WRecorder> = {
|
|
17
|
+
component: components.WRecorder,
|
|
16
18
|
title: "Components/Recorder",
|
|
17
19
|
args: {
|
|
18
|
-
label: "Some Label",
|
|
19
20
|
recordingTitle: "Recording. Press enter or click away to accept. Press escape to cancel.",
|
|
20
21
|
modelValue: "K E Y S"
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
export default meta
|
|
25
|
-
type Story = StoryObj<typeof components.
|
|
26
|
+
type Story = StoryObj<typeof components.WRecorder>
|
|
26
27
|
|
|
27
28
|
export const Primary: Story = {
|
|
28
29
|
render: args => ({
|
|
29
30
|
components,
|
|
31
|
+
directives: { vExtractRootEl },
|
|
30
32
|
setup: () => {
|
|
31
33
|
const recording = ref(false)
|
|
32
34
|
const recordingValue = ref("")
|
|
@@ -44,14 +46,15 @@ export const Primary: Story = {
|
|
|
44
46
|
}
|
|
45
47
|
},
|
|
46
48
|
template: `
|
|
47
|
-
<
|
|
49
|
+
<WRecorder
|
|
48
50
|
v-bind="args"
|
|
49
51
|
v-extract-root-el="_ => recorderEl = _"
|
|
50
52
|
:recordingValue="recordingValue"
|
|
51
53
|
:recorder="recorder"
|
|
52
54
|
v-model:recording="recording"
|
|
53
55
|
v-model="modelValue"
|
|
54
|
-
@recorder:
|
|
56
|
+
@recorder:pointerdown="recording = !recording"
|
|
57
|
+
@recorder:blur="recordingValue = modelValue; recording = false"
|
|
55
58
|
/>
|
|
56
59
|
`
|
|
57
60
|
})
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
contenteditable=false is because of storybook, it's shortcuts interfere when not using real input elements
|
|
5
5
|
-->
|
|
6
6
|
<div
|
|
7
|
-
:
|
|
8
|
-
|
|
7
|
+
:class="twMerge(`
|
|
8
|
+
recorder
|
|
9
9
|
flex items-center
|
|
10
10
|
gap-2
|
|
11
11
|
px-2
|
|
@@ -13,12 +13,11 @@
|
|
|
13
13
|
focus-outline-no-offset
|
|
14
14
|
rounded-sm
|
|
15
15
|
`,
|
|
16
|
-
border
|
|
16
|
+
border && `
|
|
17
17
|
border
|
|
18
18
|
border-neutral-500
|
|
19
19
|
focus:border-accent-500
|
|
20
20
|
`,
|
|
21
|
-
|
|
22
21
|
(disabled || readonly) && `
|
|
23
22
|
text-neutral-400
|
|
24
23
|
dark:text-neutral-600
|
|
@@ -30,37 +29,47 @@
|
|
|
30
29
|
dark:border-neutral-600
|
|
31
30
|
`,
|
|
32
31
|
($attrs as any).class)"
|
|
33
|
-
:aria-disabled="disabled"
|
|
34
32
|
:aria-readonly="readonly"
|
|
35
33
|
:tabindex="disabled ? -1 : 0"
|
|
36
34
|
:title="recording ? recordingTitle : tempValue"
|
|
37
35
|
contenteditable="false"
|
|
36
|
+
v-bind="{ ...$attrs, class: undefined }"
|
|
37
|
+
role="button"
|
|
38
|
+
:aria-pressed="recording"
|
|
39
|
+
:aria-disabled="disabled"
|
|
38
40
|
ref="recorderEl"
|
|
39
|
-
v-bind="{ ...ariaLabel, ...$attrs, class: undefined }"
|
|
40
41
|
@blur="handleBlurRecorder($event)"
|
|
41
|
-
@
|
|
42
|
-
@keydown.space.prevent="handleClickRecorder($event, true)"
|
|
42
|
+
@keydown.space.prevent.capture="handlePointerdownRecorder($event, true)"
|
|
43
43
|
>
|
|
44
|
-
|
|
44
|
+
<span
|
|
45
|
+
class="sr-only"
|
|
46
|
+
aria-live="polite"
|
|
47
|
+
>
|
|
48
|
+
{{ recording ? (recordingTitle || t('recorder.recording')) : '' }}
|
|
49
|
+
</span>
|
|
45
50
|
<div
|
|
46
|
-
:class="twMerge(`
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
:class="twMerge(`
|
|
52
|
+
recorder--indicator
|
|
53
|
+
inline-block
|
|
54
|
+
bg-red-700
|
|
55
|
+
rounded-full
|
|
56
|
+
w-[1em]
|
|
57
|
+
h-[1em]
|
|
58
|
+
shrink-0
|
|
59
|
+
`,
|
|
55
60
|
recording && `
|
|
56
61
|
animate-blinkInf
|
|
57
62
|
bg-red-500
|
|
58
63
|
`,
|
|
59
64
|
(disabled || readonly) && `
|
|
60
65
|
bg-neutral-500
|
|
66
|
+
`,
|
|
67
|
+
!(disabled || readonly) && `
|
|
68
|
+
hover:bg-red-500
|
|
61
69
|
`
|
|
62
70
|
)"
|
|
63
71
|
ref="recorderIndicatorEl"
|
|
72
|
+
@pointerdown.capture.prevent="handlePointerdownRecorder($event)"
|
|
64
73
|
/>
|
|
65
74
|
<div class="recorder--value before:content-vertical-holder truncate">
|
|
66
75
|
{{ recording
|
|
@@ -72,15 +81,16 @@
|
|
|
72
81
|
|
|
73
82
|
<script setup lang="ts">
|
|
74
83
|
import { keys } from "@alanscodelog/utils/keys"
|
|
75
|
-
import {
|
|
84
|
+
import type { HTMLAttributes } from "vue"
|
|
85
|
+
import { computed, onBeforeUnmount, onMounted, ref, useAttrs, watch, watchPostEffect } from "vue"
|
|
76
86
|
|
|
77
|
-
import { useAriaLabel } from "../../composables/useAriaLabel.js"
|
|
78
87
|
import { useInjectedI18n } from "../../composables/useInjectedI18n.js"
|
|
88
|
+
import type { BaseInteractiveProps, TailwindClassProp } from "../../types/index.js"
|
|
79
89
|
import { twMerge } from "../../utils/twMerge.js"
|
|
80
|
-
|
|
90
|
+
|
|
81
91
|
|
|
82
92
|
defineOptions({
|
|
83
|
-
name: "
|
|
93
|
+
name: "WRecorder",
|
|
84
94
|
inheritAttrs: false
|
|
85
95
|
})
|
|
86
96
|
const t = useInjectedI18n()
|
|
@@ -88,18 +98,40 @@ const t = useInjectedI18n()
|
|
|
88
98
|
const emits = defineEmits<{
|
|
89
99
|
/** Recorder is blurred */
|
|
90
100
|
(e: "recorder:blur", $event: FocusEvent): void
|
|
91
|
-
/** Recorder
|
|
92
|
-
(e: "recorder:
|
|
101
|
+
/** Recorder pointerdown event. The component's indicator and recorder elements are passed to help filter out those clicks. */
|
|
102
|
+
(e: "recorder:pointerdown", { event, indicator, input }: { event: MouseEvent | KeyboardEvent, indicator: HTMLElement, input: HTMLInputElement }): void
|
|
93
103
|
/* User presses enter. Not emitted when multiple values are used. */
|
|
94
104
|
(e: "focus:parent"): void
|
|
95
105
|
}>()
|
|
96
|
-
|
|
97
|
-
const
|
|
106
|
+
|
|
107
|
+
const $attrs = useAttrs()
|
|
108
|
+
|
|
109
|
+
const props = withDefaults(defineProps<
|
|
110
|
+
& /** @vue-ignore */ Omit<HTMLAttributes, "class">
|
|
111
|
+
& /** @vue-ignore */ TailwindClassProp
|
|
112
|
+
& BaseInteractiveProps
|
|
113
|
+
& {
|
|
114
|
+
border?: boolean
|
|
115
|
+
/** A value to display while recording, if none given the i18n `recorder.recording` key is used. */
|
|
116
|
+
recordingValue?: string
|
|
117
|
+
/** A title to display on the input div while recording. Is also used as the aria-description. */
|
|
118
|
+
recordingTitle?: string
|
|
119
|
+
/**
|
|
120
|
+
* The recorder object is a series of event listeners to attach to the input div while recording is started. If you need to bind directly to the element, see the `binders` prop.
|
|
121
|
+
*
|
|
122
|
+
* The listeners are then unbound when recording is set to false again.
|
|
123
|
+
*
|
|
124
|
+
* Note that the component does not handle the setting of `recording` (unless the component is disabled), `modelValue`, or `recordingValue` at all and has no mechanism for cancelling a recording. It is left to the recorder listeners and any `recorder:*` handlers to determine what to do.
|
|
125
|
+
*/
|
|
126
|
+
recorder?: undefined | Record<string, any>
|
|
127
|
+
/** This provides a way to manually attach/remove event listeners to/from the element. It is an alternative to the `recorder` prop, see it for more details. Both cannot be specified at the same time. */
|
|
128
|
+
binders?: undefined | { bind: (el: HTMLElement) => void, unbind: (el: HTMLElement) => void }
|
|
129
|
+
}
|
|
130
|
+
>(), {
|
|
98
131
|
recordingTitle: "",
|
|
99
|
-
id: undefined,
|
|
100
132
|
binders: undefined,
|
|
101
133
|
recorder: undefined,
|
|
102
|
-
|
|
134
|
+
border: true
|
|
103
135
|
})
|
|
104
136
|
/**
|
|
105
137
|
* Puts the element into recording mode if true. See {@link props.recorder}.
|
|
@@ -109,12 +141,12 @@ const recording = defineModel<boolean>("recording", { required: false, default:
|
|
|
109
141
|
/** The final value of the recorder. For intermediate values while recording, pass a recorder and set an appropriate recording value. */
|
|
110
142
|
const modelValue = defineModel<string>({ required: true })
|
|
111
143
|
|
|
112
|
-
const recorderEl = ref<
|
|
144
|
+
const recorderEl = ref<HTMLElement | null>(null)
|
|
113
145
|
const recorderIndicatorEl = ref<HTMLElement | null>(null)
|
|
114
146
|
const canEdit = computed(() => !props.disabled && !props.readonly)
|
|
115
147
|
const tempValue = ref(modelValue.value)
|
|
116
148
|
|
|
117
|
-
watch([() => props.binders, () => props.
|
|
149
|
+
watch([() => props.binders, () => props.recorder], () => {
|
|
118
150
|
if (recording.value) {
|
|
119
151
|
throw new Error("Component was not designed to allow swapping out of binders/recorders while recording")
|
|
120
152
|
}
|
|
@@ -123,7 +155,6 @@ watch([() => props.binders, () => props.binders], () => {
|
|
|
123
155
|
watch(modelValue, () => {
|
|
124
156
|
tempValue.value = modelValue.value
|
|
125
157
|
})
|
|
126
|
-
const ariaLabel = useAriaLabel(props)
|
|
127
158
|
|
|
128
159
|
const boundListeners: Record<string, any> = {}
|
|
129
160
|
let isBound = false
|
|
@@ -138,12 +169,13 @@ const unbindListeners = (): void => {
|
|
|
138
169
|
}
|
|
139
170
|
}
|
|
140
171
|
if (props.binders && recorderEl.value) {
|
|
141
|
-
props.binders.unbind(recorderEl.value
|
|
172
|
+
props.binders.unbind(recorderEl.value)
|
|
142
173
|
}
|
|
143
174
|
}
|
|
175
|
+
|
|
144
176
|
const bindListeners = (): void => {
|
|
145
177
|
if (!props.recorder && !props.binders) {
|
|
146
|
-
throw new Error("
|
|
178
|
+
throw new Error("Recording is true but no recorder or binders props was passed")
|
|
147
179
|
}
|
|
148
180
|
if (props.recorder && props.binders) {
|
|
149
181
|
throw new Error("Recording is true and was passed both a recorder and a binders prop. Both cannot be used at the same time.")
|
|
@@ -156,7 +188,7 @@ const bindListeners = (): void => {
|
|
|
156
188
|
}
|
|
157
189
|
}
|
|
158
190
|
if (props.binders && recorderEl.value) {
|
|
159
|
-
props.binders.bind(recorderEl.value
|
|
191
|
+
props.binders.bind(recorderEl.value)
|
|
160
192
|
}
|
|
161
193
|
}
|
|
162
194
|
|
|
@@ -182,6 +214,7 @@ watchPostEffect(() => {
|
|
|
182
214
|
onBeforeUnmount(() => {
|
|
183
215
|
unbindListeners()
|
|
184
216
|
})
|
|
217
|
+
|
|
185
218
|
onMounted(() => {
|
|
186
219
|
if (recording.value) {
|
|
187
220
|
bindListeners()
|
|
@@ -195,7 +228,7 @@ const handleBlurRecorder = (e: FocusEvent): void => {
|
|
|
195
228
|
}
|
|
196
229
|
}
|
|
197
230
|
|
|
198
|
-
const
|
|
231
|
+
const handlePointerdownRecorder = (e: MouseEvent | KeyboardEvent, isSpaceKey: boolean = false): void => {
|
|
199
232
|
if (!canEdit.value) return
|
|
200
233
|
if (!recording.value) {
|
|
201
234
|
recorderEl.value?.focus()
|
|
@@ -203,40 +236,8 @@ const handleClickRecorder = (e: MouseEvent | KeyboardEvent, isSpaceKey: boolean
|
|
|
203
236
|
// toggle if clicking on the recording indicator, otherwise only allow starting recording, so if needed, clicks can be recorded
|
|
204
237
|
if (props.recorder || props.binders) {
|
|
205
238
|
if (isSpaceKey) { return }
|
|
206
|
-
emits("recorder:
|
|
239
|
+
emits("recorder:pointerdown", { event: e as MouseEvent, indicator: recorderIndicatorEl.value! as HTMLElement, input: recorderEl.value! as HTMLInputElement })
|
|
207
240
|
}
|
|
208
241
|
}
|
|
209
242
|
</script>
|
|
210
243
|
|
|
211
|
-
<script lang="ts">
|
|
212
|
-
type RealProps
|
|
213
|
-
= & LinkableByIdProps
|
|
214
|
-
& BaseInteractiveProps
|
|
215
|
-
& LabelProps
|
|
216
|
-
& {
|
|
217
|
-
border?: boolean
|
|
218
|
-
/** A value to display while recording, if none given the i18n `recorder.recording` key is used. */
|
|
219
|
-
recordingValue?: string
|
|
220
|
-
/** A title to display on the input div while recording. Is also used as the aria-description. */
|
|
221
|
-
recordingTitle?: string
|
|
222
|
-
/**
|
|
223
|
-
* The recorder object is a series of event listeners to attach to the input div while recording is started. If you need to bind directly to the element, see the `binders` prop.
|
|
224
|
-
*
|
|
225
|
-
* The listeners are then unbound when recording is set to false again.
|
|
226
|
-
*
|
|
227
|
-
* Note that the component does not handle the setting of `recording` (unless the component is disabled), `modelValue`, or `recordingValue` at all and has no mechanism for cancelling a recording. It is left to the recorder listeners and any `recorder:*` handlers to determine what to do.
|
|
228
|
-
*/
|
|
229
|
-
recorder?: undefined | Record<string, any>
|
|
230
|
-
/** This provides a way to manually attach/remove event listeners to/from the element. It is an alternative to the `recorder` prop, see it for more details. Both cannot be specified at the same time. */
|
|
231
|
-
binders?: undefined | { bind: (el: HTMLElement) => void, unbind: (el: HTMLElement) => void }
|
|
232
|
-
/** The id of the element. If not provided, the id will be generated automatically. */
|
|
233
|
-
id?: string
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
interface Props
|
|
237
|
-
extends
|
|
238
|
-
/** @vue-ignore */
|
|
239
|
-
Partial<Omit<HTMLAttributes, "class"> & TailwindClassProp>,
|
|
240
|
-
RealProps
|
|
241
|
-
{ }
|
|
242
|
-
</script>
|