@witchcraft/ui 0.3.26 → 0.4.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -61
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/assets/animations.css +1 -1
- package/dist/runtime/assets/locales/en.json +2 -0
- package/dist/runtime/build/WitchcraftUiResolver.js +1 -1
- package/dist/runtime/components/TestControls/TestControls.vue +3 -3
- package/dist/runtime/components/WButton/WButton.d.vue.ts +34 -0
- package/dist/runtime/components/{LibButton/LibButton.vue → WButton/WButton.vue} +26 -38
- package/dist/runtime/components/WButton/WButton.vue.d.ts +34 -0
- package/dist/runtime/components/WCheckbox/WCheckbox.d.vue.ts +33 -0
- package/dist/runtime/components/WCheckbox/WCheckbox.vue +109 -0
- package/dist/runtime/components/WCheckbox/WCheckbox.vue.d.ts +33 -0
- package/dist/runtime/components/WColorInput/WColorInput.d.vue.ts +45 -0
- package/dist/runtime/components/WColorInput/WColorInput.vue +85 -0
- package/dist/runtime/components/WColorInput/WColorInput.vue.d.ts +45 -0
- package/dist/runtime/components/WColorInput/WColorSwatchButton.d.vue.ts +28 -0
- package/dist/runtime/components/WColorInput/WColorSwatchButton.vue +86 -0
- package/dist/runtime/components/WColorInput/WColorSwatchButton.vue.d.ts +28 -0
- package/dist/runtime/components/{LibColorPicker/LibColorPicker.d.vue.ts → WColorPicker/WColorPicker.d.vue.ts} +7 -6
- package/dist/runtime/components/{LibColorPicker/LibColorPicker.vue → WColorPicker/WColorPicker.vue} +40 -29
- package/dist/runtime/components/{LibColorPicker/LibColorPicker.vue.d.ts → WColorPicker/WColorPicker.vue.d.ts} +7 -6
- package/dist/runtime/components/WCombobox/WCombobox.d.vue.ts +109 -0
- package/dist/runtime/components/WCombobox/WCombobox.vue +402 -0
- package/dist/runtime/components/WCombobox/WCombobox.vue.d.ts +109 -0
- package/dist/runtime/components/WCombobox/storyPlays.d.ts +18 -0
- package/dist/runtime/components/WCombobox/storyPlays.js +68 -0
- package/dist/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.d.vue.ts → WDarkModeSwitcher/WDarkModeSwitcher.d.vue.ts} +8 -13
- package/dist/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.vue → WDarkModeSwitcher/WDarkModeSwitcher.vue} +11 -14
- package/dist/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts → WDarkModeSwitcher/WDarkModeSwitcher.vue.d.ts} +8 -13
- package/dist/runtime/components/WDatePicker/WDatePicker.d.vue.ts +40 -0
- package/dist/runtime/components/{LibDatePicker/LibDatePicker.vue → WDatePicker/WDatePicker.vue} +3 -7
- package/dist/runtime/components/WDatePicker/WDatePicker.vue.d.ts +40 -0
- package/dist/runtime/components/{LibDatePicker/LibRangeDatePicker.vue → WDatePicker/WRangeDatePicker.vue} +16 -21
- package/dist/runtime/components/{LibDatePicker/LibSingleDatePicker.vue → WDatePicker/WSingleDatePicker.vue} +16 -21
- package/dist/runtime/components/{LibDatePicker/LibTimeZonePicker.d.vue.ts → WDatePicker/WTimeZonePicker.d.vue.ts} +1 -11
- package/dist/runtime/components/{LibDatePicker/LibTimeZonePicker.vue → WDatePicker/WTimeZonePicker.vue} +5 -12
- package/dist/runtime/components/{LibDatePicker/LibTimeZonePicker.vue.d.ts → WDatePicker/WTimeZonePicker.vue.d.ts} +1 -11
- package/dist/runtime/components/{LibDebug/LibDebug.vue → WDebug/WDebug.vue} +9 -12
- package/dist/runtime/components/{LibDevOnly/LibDevOnly.d.vue.ts → WDevOnly/WDevOnly.d.vue.ts} +0 -3
- package/dist/runtime/components/{LibDevOnly/LibDevOnly.vue.d.ts → WDevOnly/WDevOnly.vue.d.ts} +0 -3
- package/dist/runtime/components/WFileInput/WFileInput.d.vue.ts +58 -0
- package/dist/runtime/components/{LibFileInput/LibFileInput.vue → WFileInput/WFileInput.vue} +71 -57
- package/dist/runtime/components/WFileInput/WFileInput.vue.d.ts +58 -0
- package/dist/runtime/components/{Icon/Icon.vue.d.ts → WIcon/WIcon.d.vue.ts} +2 -6
- package/dist/runtime/components/{Icon/Icon.vue → WIcon/WIcon.vue} +1 -1
- package/dist/runtime/components/{Icon/Icon.d.vue.ts → WIcon/WIcon.vue.d.ts} +2 -6
- package/dist/runtime/components/{LibMultiValues/LibMultiValues.d.vue.ts → WMultiValues/WMultiValues.d.vue.ts} +8 -14
- package/dist/runtime/components/WMultiValues/WMultiValues.vue +149 -0
- package/dist/runtime/components/{LibMultiValues/LibMultiValues.vue.d.ts → WMultiValues/WMultiValues.vue.d.ts} +8 -14
- package/dist/runtime/components/WNotifications/WNotification.d.vue.ts +37 -0
- package/dist/runtime/components/{LibNotifications/LibNotification.vue → WNotifications/WNotification.vue} +32 -47
- package/dist/runtime/components/WNotifications/WNotification.vue.d.ts +37 -0
- package/dist/runtime/components/WNotifications/WNotifications.d.vue.ts +11 -0
- package/dist/runtime/components/{LibNotifications/LibNotifications.vue → WNotifications/WNotifications.vue} +35 -17
- package/dist/runtime/components/WNotifications/WNotifications.vue.d.ts +11 -0
- package/dist/runtime/components/WNumberInput/WNumberInput.d.vue.ts +27 -0
- package/dist/runtime/components/WNumberInput/WNumberInput.vue +96 -0
- package/dist/runtime/components/WNumberInput/WNumberInput.vue.d.ts +27 -0
- package/dist/runtime/components/WPagination/WPagination.d.vue.ts +59 -0
- package/dist/runtime/components/WPagination/WPagination.vue +182 -0
- package/dist/runtime/components/WPagination/WPagination.vue.d.ts +59 -0
- package/dist/runtime/components/WPalette/WPalette.d.vue.ts +11 -0
- package/dist/runtime/components/{LibPalette/LibPalette.vue → WPalette/WPalette.vue} +3 -8
- package/dist/runtime/components/WPalette/WPalette.vue.d.ts +11 -0
- package/dist/runtime/components/WPopover/WPopover.d.vue.ts +43 -0
- package/dist/runtime/components/WPopover/WPopover.vue +138 -0
- package/dist/runtime/components/WPopover/WPopover.vue.d.ts +43 -0
- package/dist/runtime/components/WPopup/WPopup.d.vue.ts +41 -0
- package/dist/runtime/components/WPopup/WPopup.vue +74 -0
- package/dist/runtime/components/WPopup/WPopup.vue.d.ts +41 -0
- package/dist/runtime/components/{LibProgressBar/LibProgressBar.d.vue.ts → WProgressBar/WProgressBar.d.vue.ts} +14 -18
- package/dist/runtime/components/WProgressBar/WProgressBar.vue +150 -0
- package/dist/runtime/components/{LibProgressBar/LibProgressBar.vue.d.ts → WProgressBar/WProgressBar.vue.d.ts} +14 -18
- package/dist/runtime/components/{LibRecorder/LibRecorder.d.vue.ts → WRecorder/WRecorder.d.vue.ts} +14 -29
- package/dist/runtime/components/{LibRecorder/LibRecorder.vue → WRecorder/WRecorder.vue} +37 -36
- package/dist/runtime/components/{LibRecorder/LibRecorder.vue.d.ts → WRecorder/WRecorder.vue.d.ts} +14 -29
- package/dist/runtime/components/{LibRoot/LibRoot.d.vue.ts → WRoot/WRoot.d.vue.ts} +6 -5
- package/dist/runtime/components/{LibRoot/LibRoot.vue → WRoot/WRoot.vue} +17 -15
- package/dist/runtime/components/{LibRoot/LibRoot.vue.d.ts → WRoot/WRoot.vue.d.ts} +6 -5
- package/dist/runtime/components/{LibSimpleInput/LibSimpleInput.d.vue.ts → WSimpleInput/WSimpleInput.d.vue.ts} +9 -16
- package/dist/runtime/components/{LibSimpleInput/LibSimpleInput.vue → WSimpleInput/WSimpleInput.vue} +12 -23
- package/dist/runtime/components/{LibSimpleInput/LibSimpleInput.vue.d.ts → WSimpleInput/WSimpleInput.vue.d.ts} +9 -16
- package/dist/runtime/components/WTable/WTable.d.vue.ts +102 -0
- package/dist/runtime/components/{LibTable/LibTable.vue → WTable/WTable.vue} +13 -14
- package/dist/runtime/components/WTable/WTable.vue.d.ts +102 -0
- package/dist/runtime/components/WTooltip/WTooltip.d.vue.ts +40 -0
- package/dist/runtime/components/WTooltip/WTooltip.vue +111 -0
- package/dist/runtime/components/WTooltip/WTooltip.vue.d.ts +40 -0
- package/dist/runtime/components/index.d.ts +20 -20
- package/dist/runtime/components/index.js +20 -20
- package/dist/runtime/composables/index.d.ts +4 -4
- package/dist/runtime/composables/index.js +4 -4
- package/dist/runtime/composables/useDelayedLoadingIndicator.d.ts +9 -0
- package/dist/runtime/composables/useDelayedLoadingIndicator.js +18 -0
- package/dist/runtime/composables/useDisplayForReka.d.ts +25 -0
- package/dist/runtime/composables/useDisplayForReka.js +16 -0
- package/dist/runtime/composables/useFallbackId.d.ts +3 -0
- package/dist/runtime/composables/useFallbackId.js +5 -0
- package/dist/runtime/composables/useInjectedDarkMode.d.ts +1 -1
- package/dist/runtime/composables/usePopupConstrainToStyle.d.ts +8 -0
- package/dist/runtime/composables/usePopupConstrainToStyle.js +8 -0
- package/dist/runtime/composables/useSetupDarkMode.d.ts +2 -3
- package/dist/runtime/composables/useSetupDarkMode.js +90 -4
- package/dist/runtime/helpers/NotificationHandler.d.ts +2 -2
- package/dist/runtime/injectionKeys.d.ts +1 -5
- package/dist/runtime/injectionKeys.js +0 -2
- package/dist/runtime/types/index.d.ts +85 -27
- package/dist/runtime/types/index.js +1 -0
- package/package.json +1 -1
- package/src/module.ts +1 -1
- package/src/runtime/assets/animations.css +3 -3
- package/src/runtime/assets/locales/en.json +2 -0
- package/src/runtime/build/WitchcraftUiResolver.ts +1 -1
- package/src/runtime/components/TestControls/TestControls.vue +3 -3
- package/src/runtime/components/WButton/WButton.stories.ts +112 -0
- package/src/runtime/components/{LibButton/LibButton.vue → WButton/WButton.vue} +34 -50
- package/src/runtime/components/{LibCheckbox/LibCheckbox.stories.ts → WCheckbox/WCheckbox.stories.ts} +5 -5
- package/src/runtime/components/WCheckbox/WCheckbox.vue +123 -0
- package/src/runtime/components/{LibColorInput/LibColorInput.stories.ts → WColorInput/WColorInput.stories.ts} +8 -8
- package/src/runtime/components/WColorInput/WColorInput.vue +112 -0
- package/src/runtime/components/WColorInput/WColorSwatchButton.vue +102 -0
- package/src/runtime/components/{LibColorPicker/LibColorPicker.stories.ts → WColorPicker/WColorPicker.stories.ts} +12 -12
- package/src/runtime/components/{LibColorPicker/LibColorPicker.vue → WColorPicker/WColorPicker.vue} +43 -32
- package/src/runtime/components/WCombobox/WCombobox.stories.ts +209 -0
- package/src/runtime/components/WCombobox/WCombobox.vue +446 -0
- package/src/runtime/components/WCombobox/storyPlays.ts +92 -0
- package/src/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.stories.ts → WDarkModeSwitcher/WDarkModeSwitcher.stories.ts} +6 -6
- package/src/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.vue → WDarkModeSwitcher/WDarkModeSwitcher.vue} +19 -30
- package/src/runtime/components/{LibDatePicker/LibDatePicker.stories.ts → WDatePicker/WDatePicker.stories.ts} +42 -34
- package/src/runtime/components/{LibDatePicker/LibDatePicker.vue → WDatePicker/WDatePicker.vue} +3 -7
- package/src/runtime/components/{LibDatePicker/LibRangeDatePicker.vue → WDatePicker/WRangeDatePicker.vue} +16 -22
- package/src/runtime/components/{LibDatePicker/LibSingleDatePicker.vue → WDatePicker/WSingleDatePicker.vue} +16 -22
- package/src/runtime/components/{LibDatePicker/LibTimeZonePicker.vue → WDatePicker/WTimeZonePicker.vue} +5 -12
- package/src/runtime/components/{LibDebug/LibDebug.stories.ts → WDebug/WDebug.stories.ts} +5 -5
- package/src/runtime/components/{LibDebug/LibDebug.vue → WDebug/WDebug.vue} +8 -11
- package/src/runtime/components/{LibDevOnly/LibDevOnly.vue → WDevOnly/WDevOnly.vue} +0 -4
- package/src/runtime/components/{LibFileInput/LibFileInput.stories.ts → WFileInput/WFileInput.stories.ts} +7 -7
- package/src/runtime/components/{LibFileInput/LibFileInput.vue → WFileInput/WFileInput.vue} +95 -98
- package/src/runtime/components/{Icon/Icon.vue → WIcon/WIcon.vue} +5 -8
- package/src/runtime/components/{LibMultiValues/LibMultiValues.stories.ts → WMultiValues/WMultiValues.stories.ts} +9 -9
- package/src/runtime/components/WMultiValues/WMultiValues.vue +161 -0
- package/src/runtime/components/{LibNotifications/LibNotification.stories.ts → WNotifications/WNotification.stories.ts} +9 -9
- package/src/runtime/components/{LibNotifications/LibNotification.vue → WNotifications/WNotification.vue} +43 -66
- package/src/runtime/components/WNotifications/WNotifications.stories.ts +139 -0
- package/src/runtime/components/{LibNotifications/LibNotifications.vue → WNotifications/WNotifications.vue} +51 -29
- package/src/runtime/components/WNumberInput/WNumberInput.vue +109 -0
- package/src/runtime/components/WPagination/WPagination.stories.ts +51 -0
- package/src/runtime/components/WPagination/WPagination.vue +207 -0
- package/src/runtime/components/{LibPalette/LibPalette.stories.ts → WPalette/WPalette.stories.ts} +6 -6
- package/src/runtime/components/{LibPalette/LibPalette.vue → WPalette/WPalette.vue} +3 -8
- package/src/runtime/components/WPopover/WPopover.stories.ts +218 -0
- package/src/runtime/components/WPopover/WPopover.vue +161 -0
- package/src/runtime/components/WPopup/WPopup.stories.ts +60 -0
- package/src/runtime/components/WPopup/WPopup.vue +93 -0
- package/src/runtime/components/WProgressBar/WProgressBar.stories.ts +119 -0
- package/src/runtime/components/WProgressBar/WProgressBar.vue +185 -0
- package/src/runtime/components/{LibRecorder/LibRecorder.stories.ts → WRecorder/WRecorder.stories.ts} +9 -6
- package/src/runtime/components/{LibRecorder/LibRecorder.vue → WRecorder/WRecorder.vue} +69 -68
- package/src/runtime/components/{LibRoot/LibRoot.vue → WRoot/WRoot.vue} +18 -15
- package/src/runtime/components/{LibSimpleInput/LibSimpleInput.stories.ts → WSimpleInput/WSimpleInput.stories.ts} +11 -12
- package/src/runtime/components/{LibSimpleInput/LibSimpleInput.vue → WSimpleInput/WSimpleInput.vue} +27 -44
- package/src/runtime/components/{LibTable/LibTable.stories.ts → WTable/WTable.stories.ts} +60 -52
- package/src/runtime/components/{LibTable/LibTable.vue → WTable/WTable.vue} +85 -87
- package/src/runtime/components/WTooltip/WTooltip.stories.ts +82 -0
- package/src/runtime/components/WTooltip/WTooltip.vue +126 -0
- package/src/runtime/components/index.ts +20 -20
- package/src/runtime/composables/index.ts +4 -4
- package/src/runtime/composables/useDelayedLoadingIndicator.ts +30 -0
- package/src/runtime/composables/useDisplayForReka.ts +37 -0
- package/src/runtime/composables/useFallbackId.ts +6 -0
- package/src/runtime/composables/useInjectedDarkMode.ts +1 -2
- package/src/runtime/composables/usePopupConstrainToStyle.ts +29 -0
- package/src/runtime/composables/useSetupDarkMode.ts +122 -4
- package/src/runtime/helpers/NotificationHandler.ts +2 -2
- package/src/runtime/injectionKeys.ts +1 -7
- package/src/runtime/types/index.ts +105 -32
- package/types/components.d.ts +13 -15
- package/dist/runtime/components/Aria/Aria.d.vue.ts +0 -6
- package/dist/runtime/components/Aria/Aria.vue +0 -16
- package/dist/runtime/components/Aria/Aria.vue.d.ts +0 -6
- package/dist/runtime/components/LibButton/LibButton.d.vue.ts +0 -37
- package/dist/runtime/components/LibButton/LibButton.vue.d.ts +0 -37
- package/dist/runtime/components/LibCheckbox/LibCheckbox.d.vue.ts +0 -41
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +0 -103
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +0 -41
- package/dist/runtime/components/LibColorInput/LibColorInput.d.vue.ts +0 -64
- package/dist/runtime/components/LibColorInput/LibColorInput.vue +0 -162
- package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +0 -64
- package/dist/runtime/components/LibDatePicker/LibDatePicker.d.vue.ts +0 -191
- package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +0 -191
- package/dist/runtime/components/LibFileInput/LibFileInput.d.vue.ts +0 -46
- package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +0 -46
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.d.vue.ts +0 -256
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +0 -387
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +0 -256
- package/dist/runtime/components/LibLabel/LibLabel.d.vue.ts +0 -27
- package/dist/runtime/components/LibLabel/LibLabel.vue +0 -45
- package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +0 -27
- package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +0 -109
- package/dist/runtime/components/LibNotifications/LibNotification.d.vue.ts +0 -45
- package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +0 -45
- package/dist/runtime/components/LibNotifications/LibNotifications.d.vue.ts +0 -15
- package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +0 -15
- package/dist/runtime/components/LibPagination/LibPagination.d.vue.ts +0 -105
- package/dist/runtime/components/LibPagination/LibPagination.vue +0 -229
- package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +0 -105
- package/dist/runtime/components/LibPalette/LibPalette.d.vue.ts +0 -15
- package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +0 -15
- package/dist/runtime/components/LibPopup/LibPopup.d.vue.ts +0 -52
- package/dist/runtime/components/LibPopup/LibPopup.vue +0 -365
- package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +0 -52
- package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +0 -169
- package/dist/runtime/components/LibSuggestions/LibSuggestions.d.vue.ts +0 -99
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +0 -178
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +0 -99
- package/dist/runtime/components/LibTable/LibTable.d.vue.ts +0 -125
- package/dist/runtime/components/LibTable/LibTable.vue.d.ts +0 -125
- package/dist/runtime/components/Template/NAME.d.vue.ts +0 -18
- package/dist/runtime/components/Template/NAME.vue +0 -27
- package/dist/runtime/components/Template/NAME.vue.d.ts +0 -18
- package/dist/runtime/components/Template/TemplateStory.d.ts +0 -7
- package/dist/runtime/components/Template/TemplateStory.js +0 -22
- package/dist/runtime/components/shared/props.d.ts +0 -171
- package/dist/runtime/components/shared/props.js +0 -2
- package/dist/runtime/composables/useAriaLabel.d.ts +0 -6
- package/dist/runtime/composables/useAriaLabel.js +0 -15
- package/dist/runtime/composables/useDarkMode.d.ts +0 -77
- package/dist/runtime/composables/useDarkMode.js +0 -89
- package/dist/runtime/composables/useDivideAttrs.d.ts +0 -27
- package/dist/runtime/composables/useDivideAttrs.js +0 -27
- package/dist/runtime/composables/useSuggestions.d.ts +0 -40
- package/dist/runtime/composables/useSuggestions.js +0 -263
- package/src/runtime/components/Aria/Aria.vue +0 -26
- package/src/runtime/components/LibButton/LibButton.stories.ts +0 -106
- package/src/runtime/components/LibCheckbox/LibCheckbox.vue +0 -131
- package/src/runtime/components/LibColorInput/LibColorInput.vue +0 -203
- package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.ts +0 -405
- package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +0 -419
- package/src/runtime/components/LibLabel/LibLabel.stories.ts +0 -33
- package/src/runtime/components/LibLabel/LibLabel.vue +0 -65
- package/src/runtime/components/LibMultiValues/LibMultiValues.vue +0 -123
- package/src/runtime/components/LibNotifications/LibNotifications.stories.ts +0 -131
- package/src/runtime/components/LibPagination/LibPagination.stories.ts +0 -49
- package/src/runtime/components/LibPagination/LibPagination.vue +0 -274
- package/src/runtime/components/LibPopup/LibPopup.stories.ts +0 -153
- package/src/runtime/components/LibPopup/LibPopup.vue +0 -396
- package/src/runtime/components/LibProgressBar/LibProgressBar.stories.ts +0 -90
- package/src/runtime/components/LibProgressBar/LibProgressBar.vue +0 -197
- package/src/runtime/components/LibSuggestions/LibSuggestions.stories.ts +0 -134
- package/src/runtime/components/LibSuggestions/LibSuggestions.vue +0 -212
- package/src/runtime/components/Template/NAME.vue +0 -49
- package/src/runtime/components/Template/TemplateStory.ts +0 -37
- package/src/runtime/components/shared/props.ts +0 -199
- package/src/runtime/composables/useAriaLabel.ts +0 -23
- package/src/runtime/composables/useDarkMode.ts +0 -199
- package/src/runtime/composables/useDivideAttrs.ts +0 -53
- package/src/runtime/composables/useSuggestions.ts +0 -339
- /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToHsva.d.ts +0 -0
- /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToHsva.js +0 -0
- /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToRgba.d.ts +0 -0
- /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToRgba.js +0 -0
- /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/toLowPrecisionRgbaString.d.ts +0 -0
- /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/toLowPrecisionRgbaString.js +0 -0
- /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/truncate.d.ts +0 -0
- /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/truncate.js +0 -0
- /package/dist/runtime/components/{LibDatePicker/LibRangeDatePicker.d.vue.ts → WDatePicker/WRangeDatePicker.d.vue.ts} +0 -0
- /package/dist/runtime/components/{LibDatePicker/LibRangeDatePicker.vue.d.ts → WDatePicker/WRangeDatePicker.vue.d.ts} +0 -0
- /package/dist/runtime/components/{LibDatePicker/LibSingleDatePicker.d.vue.ts → WDatePicker/WSingleDatePicker.d.vue.ts} +0 -0
- /package/dist/runtime/components/{LibDatePicker/LibSingleDatePicker.vue.d.ts → WDatePicker/WSingleDatePicker.vue.d.ts} +0 -0
- /package/dist/runtime/components/{LibDatePicker → WDatePicker}/helpers.d.ts +0 -0
- /package/dist/runtime/components/{LibDatePicker → WDatePicker}/helpers.js +0 -0
- /package/dist/runtime/components/{LibDebug/LibDebug.d.vue.ts → WDebug/WDebug.d.vue.ts} +0 -0
- /package/dist/runtime/components/{LibDebug/LibDebug.vue.d.ts → WDebug/WDebug.vue.d.ts} +0 -0
- /package/dist/runtime/components/{LibDevOnly/LibDevOnly.vue → WDevOnly/WDevOnly.vue} +0 -0
- /package/dist/runtime/components/{LibNotifications/LibNotificationTestMessageComponent.d.vue.ts → WNotifications/WNotificationTestMessageComponent.d.vue.ts} +0 -0
- /package/dist/runtime/components/{LibNotifications/LibNotificationTestMessageComponent.vue → WNotifications/WNotificationTestMessageComponent.vue} +0 -0
- /package/dist/runtime/components/{LibNotifications/LibNotificationTestMessageComponent.vue.d.ts → WNotifications/WNotificationTestMessageComponent.vue.d.ts} +0 -0
- /package/dist/runtime/components/{LibNotifications → WNotifications}/calculateNotificationProgress.d.ts +0 -0
- /package/dist/runtime/components/{LibNotifications → WNotifications}/calculateNotificationProgress.js +0 -0
- /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToHsva.ts +0 -0
- /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToRgba.ts +0 -0
- /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/toLowPrecisionRgbaString.ts +0 -0
- /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/truncate.ts +0 -0
- /package/src/runtime/components/{LibDatePicker → WDatePicker}/helpers.ts +0 -0
- /package/src/runtime/components/{LibNotifications/LibNotificationTestMessageComponent.vue → WNotifications/WNotificationTestMessageComponent.vue} +0 -0
- /package/src/runtime/components/{LibNotifications → WNotifications}/calculateNotificationProgress.ts +0 -0
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
3
|
v-if="notification"
|
|
4
|
+
:role="notification.requiresAction ? 'alertdialog' : 'status'"
|
|
5
|
+
:aria-labelledby="notification.title ? `title-${notification.id}` : undefined"
|
|
6
|
+
:aria-describedby="notification.message ? `msg-${notification.id}` : undefined"
|
|
4
7
|
:class="twMerge(`
|
|
5
8
|
notification
|
|
6
9
|
bg-neutral-50
|
|
@@ -21,41 +24,42 @@
|
|
|
21
24
|
focus-within:border-accent-500
|
|
22
25
|
`,
|
|
23
26
|
($attrs as any).class,
|
|
24
|
-
notification.
|
|
27
|
+
notification.notificationAttrs?.class
|
|
25
28
|
)
|
|
26
29
|
"
|
|
27
|
-
v-bind="{ ...$attrs, ...(notification?.
|
|
30
|
+
v-bind="{ ...$attrs, ...(notification?.notificationAttrs ?? {}), class: undefined }"
|
|
28
31
|
tabindex="0"
|
|
29
32
|
:data-id="notification.id"
|
|
30
33
|
ref="notificationEl"
|
|
31
34
|
@keydown.enter.self="NotificationHandler.resolveToDefault(notification)"
|
|
32
|
-
@pointerenter="notification.timeout && !notification.isPaused && emit('pause', notification)"
|
|
33
35
|
>
|
|
34
36
|
<slot
|
|
35
37
|
name="top"
|
|
36
38
|
:notification="notification"
|
|
37
39
|
/>
|
|
40
|
+
|
|
41
|
+
|
|
38
42
|
<div
|
|
39
43
|
class="
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
notification--header
|
|
45
|
+
flex-reverse
|
|
46
|
+
flex
|
|
47
|
+
justify-between
|
|
48
|
+
items-center
|
|
49
|
+
"
|
|
46
50
|
>
|
|
47
51
|
<slot
|
|
48
52
|
v-if="notification.title"
|
|
49
53
|
name="title"
|
|
50
54
|
v-bind="setSlotVar('title', {
|
|
55
|
+
id: `title-${notification.id}`,
|
|
51
56
|
title: notification.title,
|
|
52
57
|
class: `
|
|
53
58
|
notification--title
|
|
54
59
|
focus-outline
|
|
55
60
|
rounded-sm
|
|
56
61
|
font-bold
|
|
57
|
-
|
|
58
|
-
tabindex: 0
|
|
62
|
+
`
|
|
59
63
|
})"
|
|
60
64
|
>
|
|
61
65
|
<div
|
|
@@ -66,8 +70,9 @@
|
|
|
66
70
|
</slot>
|
|
67
71
|
<div class="notification--spacer flex-1"/>
|
|
68
72
|
<div class="notification--actions flex">
|
|
69
|
-
<
|
|
73
|
+
<WButton
|
|
70
74
|
:border="false"
|
|
75
|
+
aria-label="Copy notification content"
|
|
71
76
|
class="
|
|
72
77
|
notification--title-button
|
|
73
78
|
notification--copy-button
|
|
@@ -76,10 +81,11 @@
|
|
|
76
81
|
"
|
|
77
82
|
@click="copy(handler ? handler.stringify(notification) : JSON.stringify(notification))"
|
|
78
83
|
>
|
|
79
|
-
<
|
|
80
|
-
</
|
|
81
|
-
<
|
|
84
|
+
<WIcon><i-lucide-copy/></WIcon>
|
|
85
|
+
</WButton>
|
|
86
|
+
<WButton
|
|
82
87
|
v-if="notification.cancellable"
|
|
88
|
+
aria-label="Dismiss notification"
|
|
83
89
|
class="
|
|
84
90
|
notification--title-button
|
|
85
91
|
notification--cancel-button
|
|
@@ -87,8 +93,8 @@
|
|
|
87
93
|
:border="false"
|
|
88
94
|
@click="NotificationHandler.dismiss(notification)"
|
|
89
95
|
>
|
|
90
|
-
<
|
|
91
|
-
</
|
|
96
|
+
<WIcon><i-lucide-x/></WIcon>
|
|
97
|
+
</Wbutton>
|
|
92
98
|
</div>
|
|
93
99
|
</div>
|
|
94
100
|
<slot
|
|
@@ -104,12 +110,12 @@
|
|
|
104
110
|
dark:text-neutral-200
|
|
105
111
|
mb-1
|
|
106
112
|
`,
|
|
107
|
-
message: notification.message
|
|
108
|
-
tabindex: 0
|
|
113
|
+
message: notification.message
|
|
109
114
|
})"
|
|
110
115
|
>
|
|
111
116
|
<div
|
|
112
117
|
v-bind="slotVars.message"
|
|
118
|
+
:id="`msg-${notification.id}`"
|
|
113
119
|
>
|
|
114
120
|
{{ notification.message }}
|
|
115
121
|
</div>
|
|
@@ -118,6 +124,7 @@
|
|
|
118
124
|
v-if="notification.component"
|
|
119
125
|
:is="notification.component"
|
|
120
126
|
v-bind="{
|
|
127
|
+
notification,
|
|
121
128
|
message: notification.message,
|
|
122
129
|
messageClasses: `
|
|
123
130
|
notification--message
|
|
@@ -147,7 +154,7 @@
|
|
|
147
154
|
gap-2
|
|
148
155
|
"
|
|
149
156
|
>
|
|
150
|
-
<
|
|
157
|
+
<WButton
|
|
151
158
|
:label="option"
|
|
152
159
|
:class="twMerge(`
|
|
153
160
|
notification--button
|
|
@@ -167,21 +174,18 @@
|
|
|
167
174
|
</template>
|
|
168
175
|
|
|
169
176
|
<script setup lang="ts">
|
|
170
|
-
import { computed, type HTMLAttributes,
|
|
171
|
-
|
|
172
|
-
import IFa6RegularCopy from "~icons/fa6-regular/copy"
|
|
173
|
-
import IFa6SolidXmark from "~icons/fa6-solid/xmark"
|
|
177
|
+
import { computed, type HTMLAttributes, onMounted, ref, useAttrs } from "vue"
|
|
174
178
|
|
|
175
179
|
import { useSlotVars } from "../../composables/useSlotVars.js"
|
|
176
180
|
import { copy } from "../../helpers/copy.js"
|
|
177
181
|
import { type NotificationEntry, NotificationHandler } from "../../helpers/NotificationHandler.js"
|
|
182
|
+
import type { TailwindClassProp } from "../../types/index.js"
|
|
178
183
|
import { twMerge } from "../../utils/twMerge.js"
|
|
179
|
-
import
|
|
180
|
-
import
|
|
181
|
-
import type { TailwindClassProp } from "../shared/props.js"
|
|
184
|
+
import WButton from "../WButton/WButton.vue"
|
|
185
|
+
import WIcon from "../WIcon/WIcon.vue"
|
|
182
186
|
|
|
183
187
|
defineOptions({
|
|
184
|
-
name: "
|
|
188
|
+
name: "WNotification",
|
|
185
189
|
inheritAttrs: false
|
|
186
190
|
})
|
|
187
191
|
const $attrs = useAttrs()
|
|
@@ -189,14 +193,17 @@ const $attrs = useAttrs()
|
|
|
189
193
|
const { setSlotVar, slotVars } = useSlotVars()
|
|
190
194
|
|
|
191
195
|
|
|
192
|
-
const props = withDefaults(defineProps<
|
|
196
|
+
const props = withDefaults(defineProps<
|
|
197
|
+
& {
|
|
198
|
+
notification: NotificationEntry
|
|
199
|
+
handler?: NotificationHandler
|
|
200
|
+
}
|
|
201
|
+
& /** @vue-ignore */ Omit<HTMLAttributes, "class">
|
|
202
|
+
& /** @vue-ignore */ TailwindClassProp
|
|
203
|
+
>(), {
|
|
193
204
|
handler: undefined
|
|
194
205
|
})
|
|
195
206
|
|
|
196
|
-
const emit = defineEmits<{
|
|
197
|
-
(e: "pause", notification: NotificationEntry): void
|
|
198
|
-
(e: "resume", notification: NotificationEntry): void
|
|
199
|
-
}>()
|
|
200
207
|
|
|
201
208
|
const getColor = (notification: NotificationEntry, option: string): "ok" | "primary" | "danger" | "secondary" => {
|
|
202
209
|
return notification.dangerous.includes(option)
|
|
@@ -206,51 +213,21 @@ const getColor = (notification: NotificationEntry, option: string): "ok" | "prim
|
|
|
206
213
|
: "secondary"
|
|
207
214
|
}
|
|
208
215
|
|
|
209
|
-
/* Todo make this more flexible? */
|
|
210
216
|
|
|
217
|
+
/* Todo make this more flexible? */
|
|
211
218
|
const buttonColors = computed(() => props.notification.options.map((option: any /* what ??? */) => getColor(props.notification, option)))
|
|
212
219
|
|
|
213
220
|
const notificationEl = ref<null | HTMLElement>(null)
|
|
214
221
|
|
|
215
|
-
const mousedownAbortController = new AbortController()
|
|
216
|
-
|
|
217
222
|
onMounted(() => {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
window.addEventListener("pointerdown", e => {
|
|
221
|
-
if (!e.target || !(e.target instanceof HTMLElement)) return
|
|
222
|
-
if (e.target === notificationEl.value || notificationEl.value?.contains(e.target)) {
|
|
223
|
-
if (props.notification.isPaused) return
|
|
224
|
-
emit("pause", props.notification)
|
|
225
|
-
} else {
|
|
226
|
-
if (!props.notification.isPaused) return
|
|
227
|
-
emit("resume", props.notification)
|
|
228
|
-
}
|
|
229
|
-
}, { signal: mousedownAbortController.signal })
|
|
223
|
+
if (props.notification.requiresAction) {
|
|
224
|
+
notificationEl.value?.focus()
|
|
230
225
|
}
|
|
231
226
|
})
|
|
232
227
|
|
|
233
|
-
onBeforeUnmount(() => {
|
|
234
|
-
mousedownAbortController.abort()
|
|
235
|
-
})
|
|
236
|
-
|
|
237
228
|
defineExpose({
|
|
238
229
|
focus: () => {
|
|
239
230
|
notificationEl.value?.focus()
|
|
240
231
|
}
|
|
241
232
|
})
|
|
242
233
|
</script>
|
|
243
|
-
|
|
244
|
-
<script lang="ts">
|
|
245
|
-
type RealProps = {
|
|
246
|
-
notification: NotificationEntry
|
|
247
|
-
handler?: NotificationHandler
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
interface Props
|
|
251
|
-
extends
|
|
252
|
-
/** @vue-ignore */
|
|
253
|
-
Partial<Omit<HTMLAttributes, "class"> & TailwindClassProp>,
|
|
254
|
-
RealProps
|
|
255
|
-
{}
|
|
256
|
-
</script>
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
+
import { faker } from "@faker-js/faker"
|
|
3
|
+
import type { Meta, StoryObj } from "@storybook/vue3"
|
|
4
|
+
import { computed, ref } from "vue"
|
|
5
|
+
|
|
6
|
+
import WNotifications from "./WNotifications.vue"
|
|
7
|
+
|
|
8
|
+
import { NotificationHandler } from "../../helpers/NotificationHandler.js"
|
|
9
|
+
import * as components from "../index.js"
|
|
10
|
+
|
|
11
|
+
type ExtraTestArgs = {
|
|
12
|
+
_withTitle?: boolean
|
|
13
|
+
}
|
|
14
|
+
const meta: Meta<typeof WNotifications> = {
|
|
15
|
+
component: WNotifications,
|
|
16
|
+
title: "Components/Notifications",
|
|
17
|
+
args: {
|
|
18
|
+
_withTitle: true
|
|
19
|
+
} satisfies ExtraTestArgs as any
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default meta
|
|
23
|
+
|
|
24
|
+
type Story = StoryObj<typeof WNotifications> & {
|
|
25
|
+
args?: ExtraTestArgs
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const Primary: Story = {
|
|
29
|
+
render: args => {
|
|
30
|
+
const extraArgs = args as ExtraTestArgs
|
|
31
|
+
return {
|
|
32
|
+
components,
|
|
33
|
+
setup() {
|
|
34
|
+
const handler = new NotificationHandler({})
|
|
35
|
+
|
|
36
|
+
let count = 0
|
|
37
|
+
|
|
38
|
+
const withTitle = ref(extraArgs._withTitle)
|
|
39
|
+
const disableTimeout = ref(false)
|
|
40
|
+
const lotsOfText = ref(false)
|
|
41
|
+
const paragraphs = `\n Simulating lots of text:\n${faker.lorem.paragraphs(20)}`
|
|
42
|
+
const extraText = computed(() => lotsOfText.value ? paragraphs : "")
|
|
43
|
+
|
|
44
|
+
const notifyRequiresAction = (options: any) => {
|
|
45
|
+
count++
|
|
46
|
+
void handler.notify({
|
|
47
|
+
title: withTitle.value ? `Notification(${count})` : undefined,
|
|
48
|
+
message: `This is a cancellable notification that requires action. Pick an option:${extraText.value}`,
|
|
49
|
+
requiresAction: true,
|
|
50
|
+
options: ["Ok", "Default Answer", "Cancel"],
|
|
51
|
+
default: "Default Answer",
|
|
52
|
+
cancellable: true,
|
|
53
|
+
...options
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const notifyWithDangerousOption = () => {
|
|
58
|
+
count++
|
|
59
|
+
void handler.notify({
|
|
60
|
+
title: withTitle.value ? `Notification(${count})` : undefined,
|
|
61
|
+
message: `This is a cancellable notification that has a dangerous option. Pick an option:${extraText.value}`,
|
|
62
|
+
options: ["Ok", "Default Answer", "Dangerous Option", "Cancel"],
|
|
63
|
+
cancellable: true,
|
|
64
|
+
default: "Default Answer",
|
|
65
|
+
dangerous: ["Dangerous Option"]
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
const notifyNonCancellable = () => {
|
|
69
|
+
count++
|
|
70
|
+
void handler.notify({
|
|
71
|
+
title: withTitle.value ? `Notification(${count})` : undefined,
|
|
72
|
+
message: `This is a non-cancellable notification. Pick an option:${extraText.value}`,
|
|
73
|
+
options: ["Ok", "Default Answer"],
|
|
74
|
+
default: "Default Answer",
|
|
75
|
+
cancellable: false
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
const notifyNonCancellableRequiresAction = () => {
|
|
79
|
+
count++
|
|
80
|
+
void handler.notify({
|
|
81
|
+
title: withTitle.value ? `Notification(${count})` : undefined,
|
|
82
|
+
message: `This is a non-cancellable notification. Pick an option:${extraText.value}`,
|
|
83
|
+
requiresAction: true,
|
|
84
|
+
options: ["Ok", "Default Answer"],
|
|
85
|
+
default: "Default Answer",
|
|
86
|
+
cancellable: false
|
|
87
|
+
})
|
|
88
|
+
}
|
|
89
|
+
const notifyTimeoutable = () => {
|
|
90
|
+
count++
|
|
91
|
+
void handler.notify({
|
|
92
|
+
title: withTitle.value ? `Notification(${count})` : undefined,
|
|
93
|
+
message: `This is a notification. No action required.${extraText.value}`,
|
|
94
|
+
timeout: disableTimeout.value ? false : 5000
|
|
95
|
+
})
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
notifyRequiresAction,
|
|
99
|
+
notifyTimeoutable,
|
|
100
|
+
notifyNonCancellable,
|
|
101
|
+
notifyWithDangerousOption,
|
|
102
|
+
notifyNonCancellableRequiresAction,
|
|
103
|
+
handler,
|
|
104
|
+
withTitle,
|
|
105
|
+
disableTimeout,
|
|
106
|
+
lotsOfText,
|
|
107
|
+
args: {
|
|
108
|
+
outline: false,
|
|
109
|
+
...args
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
backgrounds: { disable: true },
|
|
114
|
+
// <WDebug>{{args.handler}}</WDebug>
|
|
115
|
+
template: `
|
|
116
|
+
<WRoot :outline="args.outline" :notification-handler="handler">
|
|
117
|
+
<WButton :label="'Notify Timeoutable'" @click="notifyTimeoutable()"></WButton>
|
|
118
|
+
<WButton :label="'Notify RequiresAction (Cancellable)'" @click="notifyRequiresAction()"></WButton>
|
|
119
|
+
<WButton :label="'Notify RequiresAction (Cancellable) - Custom Width'" @click="notifyRequiresAction({cancellable:true,notificationProps: {class: 'sm:max-w-[90dvw]'}})"></WButton>
|
|
120
|
+
<WButton :label="'Notify Non-Cancellable that RequiresAction'" @click="notifyNonCancellableRequiresAction()"></WButton>
|
|
121
|
+
<WButton :label="'Notify With Dangerous Option (Cancellable)'" @click="notifyWithDangerousOption()"></WButton>
|
|
122
|
+
<WButton :label="'Notify Non-Cancellable'" @click="notifyNonCancellable()"></WButton>
|
|
123
|
+
<WCheckbox v-model="lotsOfText">Use lots of text</WCheckbox>
|
|
124
|
+
<WCheckbox v-model="disableTimeout">Disable Timeout</WCheckbox>
|
|
125
|
+
<WCheckbox v-model="withTitle">With Title</WCheckbox>
|
|
126
|
+
<WNotifications :handler="handler" />
|
|
127
|
+
History:
|
|
128
|
+
<WDebug>
|
|
129
|
+
<template v-for="entry in handler.history">
|
|
130
|
+
Message: {{entry.message}}
|
|
131
|
+
Resolution: {{entry.resolution}}
|
|
132
|
+
<br>
|
|
133
|
+
</template>
|
|
134
|
+
</WDebug>
|
|
135
|
+
</WRoot>
|
|
136
|
+
`
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
`, ($attrs as any).class)"
|
|
25
25
|
v-bind="{ ...$attrs, class: undefined }"
|
|
26
26
|
>
|
|
27
|
-
<
|
|
27
|
+
<WNotification
|
|
28
28
|
:handler="handler"
|
|
29
29
|
tabindex="0"
|
|
30
30
|
:notification="notification"
|
|
@@ -40,11 +40,9 @@
|
|
|
40
40
|
"
|
|
41
41
|
v-for="notification of notifications"
|
|
42
42
|
:key="notification.id"
|
|
43
|
-
@pause="handler.pause(notification)"
|
|
44
|
-
@resume="handler.resume(notification)"
|
|
45
43
|
>
|
|
46
44
|
<template #top>
|
|
47
|
-
<
|
|
45
|
+
<WProgressBar
|
|
48
46
|
v-if="notification.timeout !== undefined"
|
|
49
47
|
class="
|
|
50
48
|
w-full
|
|
@@ -57,7 +55,7 @@
|
|
|
57
55
|
:progress="calculateNotificationProgress(notification, time!)"
|
|
58
56
|
/>
|
|
59
57
|
</template>
|
|
60
|
-
</
|
|
58
|
+
</Wnotification>
|
|
61
59
|
</TransitionGroup>
|
|
62
60
|
<!-- we don't need to worry about the user accidentally closing a non-closable dialog as keeping open=true (which the handler handles when the component tries to close) is enough to keep it open without issues -->
|
|
63
61
|
<AlertDialogRoot
|
|
@@ -67,7 +65,7 @@
|
|
|
67
65
|
<AlertDialogPortal :to="'#root'">
|
|
68
66
|
<AlertDialogOverlay
|
|
69
67
|
class="
|
|
70
|
-
fixed inset-0 z-
|
|
68
|
+
fixed inset-0 z-90
|
|
71
69
|
bg-neutral-950/20
|
|
72
70
|
data-[state=open]:animate-overlayShow
|
|
73
71
|
"
|
|
@@ -91,7 +89,7 @@
|
|
|
91
89
|
"
|
|
92
90
|
@interact-outside="topNotifications[0] && NotificationHandler.dismiss(topNotifications[0])"
|
|
93
91
|
>
|
|
94
|
-
<
|
|
92
|
+
<WNotification
|
|
95
93
|
class="
|
|
96
94
|
w-full
|
|
97
95
|
sm:max-w-[700px]
|
|
@@ -119,7 +117,7 @@
|
|
|
119
117
|
{{ slotProps.message }}
|
|
120
118
|
</AlertDialogDescription>
|
|
121
119
|
</template>
|
|
122
|
-
</
|
|
120
|
+
</Wnotification>
|
|
123
121
|
</AlertDialogContent>
|
|
124
122
|
</AlertDialogPortal>
|
|
125
123
|
</AlertDialogRoot>
|
|
@@ -134,24 +132,36 @@ import {
|
|
|
134
132
|
AlertDialogRoot,
|
|
135
133
|
AlertDialogTitle
|
|
136
134
|
} from "reka-ui"
|
|
137
|
-
import {
|
|
135
|
+
import type { HTMLAttributes } from "vue"
|
|
136
|
+
import { computed, onBeforeUnmount, onMounted, useAttrs } from "vue"
|
|
138
137
|
|
|
139
138
|
import { calculateNotificationProgress } from "./calculateNotificationProgress.js"
|
|
140
|
-
import
|
|
139
|
+
import WNotification from "./WNotification.vue"
|
|
141
140
|
|
|
142
141
|
import { useNotificationHandler } from "../../composables/useNotificationHandler.js"
|
|
143
142
|
import { useTimeConditionally } from "../../composables/useTimeConditionally.js"
|
|
144
143
|
import { NotificationHandler } from "../../helpers/NotificationHandler.js"
|
|
144
|
+
import type { TailwindClassProp } from "../../types/index.js"
|
|
145
145
|
import { twMerge } from "../../utils/twMerge.js"
|
|
146
|
-
import
|
|
147
|
-
|
|
146
|
+
import WProgressBar from "../WProgressBar/WProgressBar.vue"
|
|
147
|
+
|
|
148
148
|
|
|
149
149
|
defineOptions({
|
|
150
|
-
name: "
|
|
150
|
+
name: "WNotifications",
|
|
151
151
|
inheritAttrs: false
|
|
152
152
|
})
|
|
153
153
|
|
|
154
|
-
const
|
|
154
|
+
const $attrs = useAttrs()
|
|
155
|
+
|
|
156
|
+
const props = defineProps<
|
|
157
|
+
& {
|
|
158
|
+
/** If not provided, uses the global handler (this requires useNotificationHandler be called and configured). */
|
|
159
|
+
handler?: NotificationHandler
|
|
160
|
+
progressUpdateInterval?: number
|
|
161
|
+
}
|
|
162
|
+
& /** @vue-ignore */ Omit<HTMLAttributes, "class">
|
|
163
|
+
& /** @vue-ignore */ TailwindClassProp
|
|
164
|
+
>()
|
|
155
165
|
|
|
156
166
|
const handler = props.handler ?? useNotificationHandler()
|
|
157
167
|
|
|
@@ -163,23 +173,35 @@ const fetchTime = computed(() => {
|
|
|
163
173
|
})
|
|
164
174
|
|
|
165
175
|
const { time } = useTimeConditionally(fetchTime, { refreshInterval: props.progressUpdateInterval })
|
|
166
|
-
</script>
|
|
167
176
|
|
|
168
|
-
|
|
169
|
-
|
|
177
|
+
function handleGlobalPointerDown(e: PointerEvent) {
|
|
178
|
+
const target = e.target as HTMLElement
|
|
179
|
+
const notificationEl = target.closest(".notification") as HTMLElement
|
|
180
|
+
const rawId = notificationEl?.dataset.id
|
|
181
|
+
const clickedId = rawId ? Number.parseInt(rawId, 10) : null
|
|
170
182
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
handler
|
|
176
|
-
progressUpdateInterval?: number
|
|
183
|
+
if (clickedId !== null) {
|
|
184
|
+
// User clicked a specific notification -> Pause it
|
|
185
|
+
const entry = handler.queue.find(n => n.id === clickedId)
|
|
186
|
+
if (entry && entry.timeout && !entry.isPaused) {
|
|
187
|
+
handler.pause(entry)
|
|
177
188
|
}
|
|
189
|
+
} else {
|
|
190
|
+
// User clicked outside -> Resume all paused ephemeral notifications
|
|
191
|
+
handler.queue.forEach(entry => {
|
|
192
|
+
if (entry.timeout && entry.isPaused) {
|
|
193
|
+
handler.resume(entry)
|
|
194
|
+
}
|
|
195
|
+
})
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
onMounted(() => {
|
|
200
|
+
window.addEventListener("pointerdown", handleGlobalPointerDown)
|
|
201
|
+
})
|
|
178
202
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
Partial<Omit<HTMLAttributes, "class"> & TailwindClassProp>,
|
|
183
|
-
RealProps
|
|
184
|
-
{}
|
|
203
|
+
onBeforeUnmount(() => {
|
|
204
|
+
window.removeEventListener("pointerdown", handleGlobalPointerDown)
|
|
205
|
+
})
|
|
185
206
|
</script>
|
|
207
|
+
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<NumberFieldRoot
|
|
3
|
+
:min="props.min"
|
|
4
|
+
:max="props.max"
|
|
5
|
+
:step="props.step"
|
|
6
|
+
:format-options="{
|
|
7
|
+
signDisplay: 'exceptZero',
|
|
8
|
+
...rootProps?.formatOptions
|
|
9
|
+
}"
|
|
10
|
+
:class="twMerge(`
|
|
11
|
+
flex
|
|
12
|
+
items-center
|
|
13
|
+
justify-center
|
|
14
|
+
metadata-input-border
|
|
15
|
+
rounded-sm
|
|
16
|
+
focus-outline-within
|
|
17
|
+
gap-2
|
|
18
|
+
`,
|
|
19
|
+
!isValid && 'text-danger-500',
|
|
20
|
+
rootProps?.class
|
|
21
|
+
)"
|
|
22
|
+
v-bind="{ ...rootProps, class: undefined }"
|
|
23
|
+
v-model="modelValue"
|
|
24
|
+
>
|
|
25
|
+
<NumberFieldDecrement
|
|
26
|
+
class="
|
|
27
|
+
px-1
|
|
28
|
+
flex-1
|
|
29
|
+
hover:bg-neutral-200
|
|
30
|
+
dark:hover:bg-neutral-800
|
|
31
|
+
[&_.button--label]:justify-start
|
|
32
|
+
rounded-bl-sm
|
|
33
|
+
rounded-tl-sm
|
|
34
|
+
cursor-pointer
|
|
35
|
+
disabled:cursor-not-allowed
|
|
36
|
+
"
|
|
37
|
+
>
|
|
38
|
+
<WIcon><i-radix-icons-minus/></WIcon>
|
|
39
|
+
</NumberFieldDecrement>
|
|
40
|
+
|
|
41
|
+
<NumberFieldInput
|
|
42
|
+
:class="twMerge(
|
|
43
|
+
`
|
|
44
|
+
bg-transparent
|
|
45
|
+
tabular-nums
|
|
46
|
+
text-center
|
|
47
|
+
focus-outline-none
|
|
48
|
+
px-1
|
|
49
|
+
shrink-1
|
|
50
|
+
basis-[20ch]
|
|
51
|
+
grow-0
|
|
52
|
+
min-w-0
|
|
53
|
+
[&::-webkit-outer-spin-button]:appearance-none
|
|
54
|
+
[&::-webkit-inner-spin-button]:appearance-none
|
|
55
|
+
[-moz-appearance:textfield]
|
|
56
|
+
`,
|
|
57
|
+
!isValid && 'text-danger-500',
|
|
58
|
+
inputProps?.class
|
|
59
|
+
)"
|
|
60
|
+
v-bind="{ ...inputProps, class: undefined }"
|
|
61
|
+
/>
|
|
62
|
+
|
|
63
|
+
<NumberFieldIncrement
|
|
64
|
+
class="
|
|
65
|
+
px-1
|
|
66
|
+
flex-1
|
|
67
|
+
hover:bg-neutral-200
|
|
68
|
+
dark:hover:bg-neutral-800
|
|
69
|
+
[&_.button--label]:justify-end
|
|
70
|
+
rounded-br-sm
|
|
71
|
+
rounded-tr-sm
|
|
72
|
+
cursor-pointer
|
|
73
|
+
disabled:cursor-not-allowed
|
|
74
|
+
"
|
|
75
|
+
>
|
|
76
|
+
<WIcon><i-radix-icons-plus/></WIcon>
|
|
77
|
+
</NumberFieldIncrement>
|
|
78
|
+
</NumberFieldRoot>
|
|
79
|
+
</template>
|
|
80
|
+
|
|
81
|
+
<script setup lang="ts">
|
|
82
|
+
import type {
|
|
83
|
+
NumberFieldInputProps,
|
|
84
|
+
NumberFieldRootEmits,
|
|
85
|
+
NumberFieldRootProps
|
|
86
|
+
} from "reka-ui"
|
|
87
|
+
import type { HTMLAttributes, InputHTMLAttributes } from "vue"
|
|
88
|
+
|
|
89
|
+
import type { EmitsToProps, TailwindClassProp } from "../../types/index.js"
|
|
90
|
+
import { twMerge } from "../../utils/twMerge.js"
|
|
91
|
+
|
|
92
|
+
const props = withDefaults(defineProps<
|
|
93
|
+
& {
|
|
94
|
+
id?: string
|
|
95
|
+
max?: NumberFieldRootProps["max"]
|
|
96
|
+
min?: NumberFieldRootProps["min"]
|
|
97
|
+
step?: NumberFieldRootProps["step"]
|
|
98
|
+
isValid?: (value: any) => boolean
|
|
99
|
+
inputProps?: NumberFieldInputProps & Omit<InputHTMLAttributes, "class"> & TailwindClassProp
|
|
100
|
+
rootProps?: NumberFieldRootProps & EmitsToProps<NumberFieldRootEmits> & Omit<HTMLAttributes, "class"> & TailwindClassProp
|
|
101
|
+
}
|
|
102
|
+
>(), {
|
|
103
|
+
max: Number.MAX_SAFE_INTEGER,
|
|
104
|
+
min: Number.MIN_SAFE_INTEGER,
|
|
105
|
+
isValid: (value: any) => { return typeof value === "number" && !Number.isNaN(value) }
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
const modelValue = defineModel<number>({ required: true })
|
|
109
|
+
</script>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/vue3"
|
|
3
|
+
import { ref } from "vue"
|
|
4
|
+
|
|
5
|
+
import WPagination from "./WPagination.vue"
|
|
6
|
+
|
|
7
|
+
import * as components from "../index.js"
|
|
8
|
+
|
|
9
|
+
const meta: Meta<typeof WPagination> = {
|
|
10
|
+
component: WPagination,
|
|
11
|
+
title: "Components/Pagination",
|
|
12
|
+
args: {
|
|
13
|
+
total: 10
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default meta
|
|
18
|
+
type Story = StoryObj<typeof WPagination>
|
|
19
|
+
|
|
20
|
+
export const Primary: Story = {
|
|
21
|
+
render: args => ({
|
|
22
|
+
components,
|
|
23
|
+
setup() {
|
|
24
|
+
const num = ref(1)
|
|
25
|
+
const interceptClick = ref(false)
|
|
26
|
+
const changePage = ($event: any, i: any) => {
|
|
27
|
+
if (interceptClick.value) {
|
|
28
|
+
$event.preventDefault()
|
|
29
|
+
}
|
|
30
|
+
if (i >= 10) num.value = 10
|
|
31
|
+
if (i <= 1) num.value = 1
|
|
32
|
+
num.value = i
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
changePage,
|
|
37
|
+
args,
|
|
38
|
+
num,
|
|
39
|
+
interceptClick
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
template: `
|
|
43
|
+
<WCheckbox v-model="interceptClick">Intercept Click (url should change when off)</WCheckbox>
|
|
44
|
+
<WPagination v-bind="{...args, current: num, route:'#'}" @link-click="changePage($event, num)">
|
|
45
|
+
</WPagination>
|
|
46
|
+
<WSimpleInput class="mt-5" :label="'Change Page'" :modelValue="num.toString()" @update:modelValue="num = parseInt($event)" type="number" min="0" :max="args.total">
|
|
47
|
+
|
|
48
|
+
</WSimpleInput>
|
|
49
|
+
`
|
|
50
|
+
})
|
|
51
|
+
}
|