@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
|
@@ -5,17 +5,16 @@
|
|
|
5
5
|
tag="div"
|
|
6
6
|
:class="twMerge(`
|
|
7
7
|
notifications
|
|
8
|
-
[--notification-width:
|
|
8
|
+
[--notification-width:calc(100dvw-var(--spacing)*4)]
|
|
9
|
+
sm:[--notification-width:300px]
|
|
9
10
|
fixed
|
|
10
11
|
top-0
|
|
11
12
|
z-50
|
|
12
13
|
right-[calc(var(--notification-width)*-1)]
|
|
13
14
|
w-[calc(var(--spacing)*2+var(--notification-width)*2)]
|
|
14
|
-
[&_.notification]:w-[var(--notification-width)]
|
|
15
15
|
max-h-[100dvh]
|
|
16
16
|
flex
|
|
17
17
|
flex-col
|
|
18
|
-
[&_.notification]:shrink-0
|
|
19
18
|
gap-1
|
|
20
19
|
list-none
|
|
21
20
|
outline-none
|
|
@@ -25,18 +24,25 @@
|
|
|
25
24
|
`, ($attrs as any).class)"
|
|
26
25
|
v-bind="{ ...$attrs, class: undefined }"
|
|
27
26
|
>
|
|
28
|
-
<
|
|
27
|
+
<WNotification
|
|
29
28
|
:handler="handler"
|
|
30
29
|
tabindex="0"
|
|
31
30
|
:notification="notification"
|
|
32
|
-
class="
|
|
31
|
+
class="
|
|
32
|
+
overflow-hidden
|
|
33
|
+
my-2
|
|
34
|
+
max-h-[300px]
|
|
35
|
+
w-[var(--notification-width)]
|
|
36
|
+
shrink-0
|
|
37
|
+
max-sm:[&_.notification--button]:p-2
|
|
38
|
+
max-sm:[&_.notification--button]:py-1
|
|
39
|
+
max-sm:[&_.notification--header]:text-lg
|
|
40
|
+
"
|
|
33
41
|
v-for="notification of notifications"
|
|
34
42
|
:key="notification.id"
|
|
35
|
-
@pointerenter="notification.timeout && !notification.isPaused && handler.pause(notification)"
|
|
36
|
-
@blur="notification.timeout && notification.isPaused && handler.resume(notification)"
|
|
37
43
|
>
|
|
38
44
|
<template #top>
|
|
39
|
-
<
|
|
45
|
+
<WProgressBar
|
|
40
46
|
v-if="notification.timeout !== undefined"
|
|
41
47
|
class="
|
|
42
48
|
w-full
|
|
@@ -46,10 +52,10 @@
|
|
|
46
52
|
-mx-[calc(var(--spacing)*2+2px)]
|
|
47
53
|
rounded-none
|
|
48
54
|
"
|
|
49
|
-
:progress="
|
|
55
|
+
:progress="calculateNotificationProgress(notification, time!)"
|
|
50
56
|
/>
|
|
51
57
|
</template>
|
|
52
|
-
</
|
|
58
|
+
</Wnotification>
|
|
53
59
|
</TransitionGroup>
|
|
54
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 -->
|
|
55
61
|
<AlertDialogRoot
|
|
@@ -59,7 +65,7 @@
|
|
|
59
65
|
<AlertDialogPortal :to="'#root'">
|
|
60
66
|
<AlertDialogOverlay
|
|
61
67
|
class="
|
|
62
|
-
fixed inset-0 z-
|
|
68
|
+
fixed inset-0 z-90
|
|
63
69
|
bg-neutral-950/20
|
|
64
70
|
data-[state=open]:animate-overlayShow
|
|
65
71
|
"
|
|
@@ -67,18 +73,27 @@
|
|
|
67
73
|
<AlertDialogContent
|
|
68
74
|
class="
|
|
69
75
|
data-[state=open]:animate-contentShow
|
|
76
|
+
max-sm:data-[state=open]:animate-slideInUp
|
|
70
77
|
fixed
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
flex justify-center
|
|
79
|
+
top-1/2
|
|
80
|
+
left-1/2
|
|
81
|
+
w-full
|
|
82
|
+
sm:translate-x-[-50%]
|
|
83
|
+
sm:translate-y-[-50%]
|
|
84
|
+
p-2
|
|
85
|
+
max-sm:bottom-0
|
|
86
|
+
max-sm:top-[unset]
|
|
87
|
+
max-sm:left-0
|
|
77
88
|
z-100
|
|
78
89
|
"
|
|
90
|
+
@interact-outside="topNotifications[0] && NotificationHandler.dismiss(topNotifications[0])"
|
|
79
91
|
>
|
|
80
|
-
<
|
|
92
|
+
<WNotification
|
|
81
93
|
class="
|
|
94
|
+
w-full
|
|
95
|
+
sm:max-w-[700px]
|
|
96
|
+
max-h-[80dvh]
|
|
82
97
|
top-notification
|
|
83
98
|
text-md
|
|
84
99
|
gap-2
|
|
@@ -102,7 +117,7 @@
|
|
|
102
117
|
{{ slotProps.message }}
|
|
103
118
|
</AlertDialogDescription>
|
|
104
119
|
</template>
|
|
105
|
-
</
|
|
120
|
+
</Wnotification>
|
|
106
121
|
</AlertDialogContent>
|
|
107
122
|
</AlertDialogPortal>
|
|
108
123
|
</AlertDialogRoot>
|
|
@@ -117,51 +132,76 @@ import {
|
|
|
117
132
|
AlertDialogRoot,
|
|
118
133
|
AlertDialogTitle
|
|
119
134
|
} from "reka-ui"
|
|
120
|
-
import {
|
|
135
|
+
import type { HTMLAttributes } from "vue"
|
|
136
|
+
import { computed, onBeforeUnmount, onMounted, useAttrs } from "vue"
|
|
121
137
|
|
|
122
|
-
import
|
|
138
|
+
import { calculateNotificationProgress } from "./calculateNotificationProgress.js"
|
|
139
|
+
import WNotification from "./WNotification.vue"
|
|
123
140
|
|
|
124
141
|
import { useNotificationHandler } from "../../composables/useNotificationHandler.js"
|
|
142
|
+
import { useTimeConditionally } from "../../composables/useTimeConditionally.js"
|
|
125
143
|
import { NotificationHandler } from "../../helpers/NotificationHandler.js"
|
|
144
|
+
import type { TailwindClassProp } from "../../types/index.js"
|
|
126
145
|
import { twMerge } from "../../utils/twMerge.js"
|
|
127
|
-
import
|
|
128
|
-
|
|
146
|
+
import WProgressBar from "../WProgressBar/WProgressBar.vue"
|
|
147
|
+
|
|
129
148
|
|
|
130
149
|
defineOptions({
|
|
131
|
-
name: "
|
|
150
|
+
name: "WNotifications",
|
|
132
151
|
inheritAttrs: false
|
|
133
152
|
})
|
|
134
153
|
|
|
135
|
-
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
|
+
>()
|
|
165
|
+
|
|
166
|
+
const handler = props.handler ?? useNotificationHandler()
|
|
136
167
|
|
|
137
168
|
const topNotifications = computed(() => handler.queue.filter(entry => entry.requiresAction).reverse())
|
|
138
169
|
const notifications = computed(() => handler.queue.filter(entry => !entry.requiresAction))
|
|
139
170
|
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
time.value = Date.now()
|
|
144
|
-
})
|
|
145
|
-
}, 50)
|
|
171
|
+
const fetchTime = computed(() => {
|
|
172
|
+
return notifications.value.filter(entry => entry.timeout !== undefined && !entry.isPaused).length > 0
|
|
173
|
+
})
|
|
146
174
|
|
|
175
|
+
const { time } = useTimeConditionally(fetchTime, { refreshInterval: props.progressUpdateInterval })
|
|
147
176
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
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
|
|
153
182
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
handler
|
|
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)
|
|
159
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
|
+
}
|
|
160
198
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
199
|
+
onMounted(() => {
|
|
200
|
+
window.addEventListener("pointerdown", handleGlobalPointerDown)
|
|
201
|
+
})
|
|
202
|
+
|
|
203
|
+
onBeforeUnmount(() => {
|
|
204
|
+
window.removeEventListener("pointerdown", handleGlobalPointerDown)
|
|
205
|
+
})
|
|
167
206
|
</script>
|
|
207
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { NotificationEntry } from "../../helpers/NotificationHandler.js"
|
|
2
|
+
|
|
3
|
+
export function calculateNotificationProgress(notification: NotificationEntry, time: number) {
|
|
4
|
+
if (notification.timeout === undefined) return 0
|
|
5
|
+
|
|
6
|
+
return 100 - (((notification.isPaused ? (notification._timer.elapsedBeforePause) : (notification._timer.elapsedBeforePause + (time - notification.startTime))) / notification.timeout) * 100)
|
|
7
|
+
}
|
|
8
|
+
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<PaginationRoot
|
|
3
|
+
:total="total"
|
|
4
|
+
:items-per-page="itemsPerPage"
|
|
5
|
+
:sibling-count="siblingCount"
|
|
6
|
+
show-edges
|
|
7
|
+
:class="twMerge(`
|
|
8
|
+
pagination--wrapper
|
|
9
|
+
flex flex-wrap items-center justify-center gap-2
|
|
10
|
+
`, ($attrs as any).class)"
|
|
11
|
+
v-model:page="current"
|
|
12
|
+
v-bind="{ ...$attrs, class: undefined }"
|
|
13
|
+
>
|
|
14
|
+
<PaginationList
|
|
15
|
+
v-slot="{ items }"
|
|
16
|
+
class="flex items-center gap-2 w-full"
|
|
17
|
+
>
|
|
18
|
+
<PaginationFirst
|
|
19
|
+
as-child
|
|
20
|
+
:class="`pagination--link ${pageClasses}`"
|
|
21
|
+
>
|
|
22
|
+
<a
|
|
23
|
+
:href="customRoute(route, 1).href"
|
|
24
|
+
:aria-label="t('pagination.aria.go-to-first-page')"
|
|
25
|
+
>
|
|
26
|
+
<slot name="first">
|
|
27
|
+
<i-lucide-chevrons-left class="w-4 h-4"/>
|
|
28
|
+
</slot>
|
|
29
|
+
</a>
|
|
30
|
+
</PaginationFirst>
|
|
31
|
+
|
|
32
|
+
<PaginationPrev
|
|
33
|
+
as-child
|
|
34
|
+
:class="`pagination--link ${pageClasses}`"
|
|
35
|
+
>
|
|
36
|
+
<a
|
|
37
|
+
:href="customRoute(route, current - 1).href"
|
|
38
|
+
:aria-label="t('pagination.aria.go-to-previous-page')"
|
|
39
|
+
@click="onLinkClick($event, current - 1)"
|
|
40
|
+
>
|
|
41
|
+
<slot name="prev">
|
|
42
|
+
<i-lucide-chevron-left class="w-4 h-4"/>
|
|
43
|
+
</slot>
|
|
44
|
+
</a>
|
|
45
|
+
</PaginationPrev>
|
|
46
|
+
|
|
47
|
+
<div class="pagination--spacer flex-1"/>
|
|
48
|
+
|
|
49
|
+
<template v-for="(page, index) in items">
|
|
50
|
+
<PaginationListItem
|
|
51
|
+
v-if="page.type === 'page'"
|
|
52
|
+
:value="page.value"
|
|
53
|
+
as-child
|
|
54
|
+
:key="index"
|
|
55
|
+
>
|
|
56
|
+
<a
|
|
57
|
+
:href="customRoute(route, page.value).href"
|
|
58
|
+
:aria-label="t('pagination.aria.go-to-page', { count: page.value })"
|
|
59
|
+
:class="page.value === current ? currentPageClasses : pageClasses"
|
|
60
|
+
@click="onLinkClick($event, page.value)"
|
|
61
|
+
>
|
|
62
|
+
<slot
|
|
63
|
+
name="page"
|
|
64
|
+
:value="page.value"
|
|
65
|
+
>
|
|
66
|
+
{{ page.value }}
|
|
67
|
+
</slot>
|
|
68
|
+
</a>
|
|
69
|
+
</PaginationListItem>
|
|
70
|
+
|
|
71
|
+
<!-- @vue-expect-error index is a prop... -->
|
|
72
|
+
<PaginationEllipsis
|
|
73
|
+
v-else
|
|
74
|
+
:index="index"
|
|
75
|
+
class="pagination--page-fill flex items-center justify-center w-8 h-8"
|
|
76
|
+
:key="page.type"
|
|
77
|
+
>
|
|
78
|
+
...
|
|
79
|
+
</PaginationEllipsis>
|
|
80
|
+
</template>
|
|
81
|
+
|
|
82
|
+
<div class="pagination--spacer flex-1"/>
|
|
83
|
+
|
|
84
|
+
<PaginationNext
|
|
85
|
+
as-child
|
|
86
|
+
:class="`pagination--link ${pageClasses}`"
|
|
87
|
+
>
|
|
88
|
+
<a
|
|
89
|
+
:href="customRoute(route, current + 1).href"
|
|
90
|
+
:aria-label="t('pagination.aria.go-to-next-page')"
|
|
91
|
+
@click="onLinkClick($event, current + 1)"
|
|
92
|
+
>
|
|
93
|
+
<slot name="next">
|
|
94
|
+
<i-lucide-chevron-right class="w-4 h-4"/>
|
|
95
|
+
</slot>
|
|
96
|
+
</a>
|
|
97
|
+
</PaginationNext>
|
|
98
|
+
|
|
99
|
+
<PaginationLast
|
|
100
|
+
as-child
|
|
101
|
+
:class="`pagination--link ${pageClasses}`"
|
|
102
|
+
>
|
|
103
|
+
<a
|
|
104
|
+
:href="customRoute(route, Math.ceil(total / itemsPerPage)).href"
|
|
105
|
+
:aria-label="t('pagination.aria.go-to-last-page')"
|
|
106
|
+
@click="onLinkClick($event, Math.ceil(total / itemsPerPage))"
|
|
107
|
+
>
|
|
108
|
+
<slot name="last">
|
|
109
|
+
<i-lucide-chevrons-right class="w-4 h-4"/>
|
|
110
|
+
</slot>
|
|
111
|
+
</a>
|
|
112
|
+
</PaginationLast>
|
|
113
|
+
</PaginationList>
|
|
114
|
+
</PaginationRoot>
|
|
115
|
+
</template>
|
|
116
|
+
|
|
117
|
+
<script setup lang="ts">
|
|
118
|
+
import {
|
|
119
|
+
PaginationEllipsis,
|
|
120
|
+
PaginationFirst,
|
|
121
|
+
PaginationLast,
|
|
122
|
+
PaginationList,
|
|
123
|
+
PaginationListItem,
|
|
124
|
+
PaginationNext,
|
|
125
|
+
PaginationPrev,
|
|
126
|
+
PaginationRoot,
|
|
127
|
+
type PaginationRootProps
|
|
128
|
+
} from "reka-ui"
|
|
129
|
+
import { type HTMLAttributes, useAttrs } from "vue"
|
|
130
|
+
|
|
131
|
+
import ILucideChevronLeft from "~icons/lucide/chevron-left"
|
|
132
|
+
import ILucideChevronRight from "~icons/lucide/chevron-right"
|
|
133
|
+
import ILucideChevronsLeft from "~icons/lucide/chevrons-left"
|
|
134
|
+
import ILucideChevronsRight from "~icons/lucide/chevrons-right"
|
|
135
|
+
|
|
136
|
+
import { useInjectedI18n } from "../../composables/useInjectedI18n.js"
|
|
137
|
+
import type { TailwindClassProp } from "../../types/index.js"
|
|
138
|
+
import { twMerge } from "../../utils/twMerge.js"
|
|
139
|
+
|
|
140
|
+
defineOptions({
|
|
141
|
+
name: "WPagination",
|
|
142
|
+
inheritAttrs: false
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
const t = useInjectedI18n()
|
|
146
|
+
const $attrs = useAttrs()
|
|
147
|
+
|
|
148
|
+
const props = withDefaults(defineProps<
|
|
149
|
+
& /** @vue-ignore */ Omit<HTMLAttributes, "class">
|
|
150
|
+
& /** @vue-ignore */ TailwindClassProp
|
|
151
|
+
& Pick<PaginationRootProps, "defaultPage" | "siblingCount" | "itemsPerPage">
|
|
152
|
+
& {
|
|
153
|
+
route: string
|
|
154
|
+
customRoute?: (route: string, i: number) => { i: number, href: string }
|
|
155
|
+
total: number
|
|
156
|
+
}
|
|
157
|
+
>(), {
|
|
158
|
+
customRoute: (route: string = "", i: number) => {
|
|
159
|
+
if (i <= 1) return { href: route, i: 1 }
|
|
160
|
+
return { href: `${route}${i}`, i }
|
|
161
|
+
},
|
|
162
|
+
siblingCount: 1,
|
|
163
|
+
defaultPage: 1,
|
|
164
|
+
itemsPerPage: 1
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
const current = defineModel<number>("current", { required: true })
|
|
168
|
+
|
|
169
|
+
const emit = defineEmits<{
|
|
170
|
+
/**
|
|
171
|
+
* Fired when a link is clicked. Can be used to prevent navigation. Is passed the href calculated by customRoute.
|
|
172
|
+
*/
|
|
173
|
+
(e: "link-click", event: MouseEvent, payload: { i: number, href: string }): void
|
|
174
|
+
}>()
|
|
175
|
+
|
|
176
|
+
function onLinkClick(event: MouseEvent, pageNum: number) {
|
|
177
|
+
const routeInfo = props.customRoute(props.route, pageNum)
|
|
178
|
+
emit("link-click", event, routeInfo)
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const commonClasses = `
|
|
182
|
+
flex
|
|
183
|
+
items-center
|
|
184
|
+
justify-center
|
|
185
|
+
w-8
|
|
186
|
+
h-8
|
|
187
|
+
focus-outline
|
|
188
|
+
border-b-2
|
|
189
|
+
border-transparent
|
|
190
|
+
transition-all
|
|
191
|
+
outlined:rounded-sm
|
|
192
|
+
`
|
|
193
|
+
const pageClasses = `
|
|
194
|
+
${commonClasses}
|
|
195
|
+
focus-outline
|
|
196
|
+
hover:text-accent-600
|
|
197
|
+
hover:border-b-accent-500
|
|
198
|
+
hover:scale-125
|
|
199
|
+
`
|
|
200
|
+
|
|
201
|
+
const currentPageClasses = `
|
|
202
|
+
${commonClasses}
|
|
203
|
+
border-b-accent-500
|
|
204
|
+
scale-125
|
|
205
|
+
`
|
|
206
|
+
</script>
|
|
207
|
+
|
package/src/runtime/components/{LibPalette/LibPalette.stories.ts → WPalette/WPalette.stories.ts}
RENAMED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
2
|
import type { Meta, StoryObj } from "@storybook/vue3"
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import WPalette from "./WPalette.vue"
|
|
5
5
|
|
|
6
6
|
import { theme } from "../../theme.js"
|
|
7
7
|
import * as components from "../index.js"
|
|
8
8
|
|
|
9
|
-
const meta: Meta<typeof
|
|
10
|
-
component:
|
|
9
|
+
const meta: Meta<typeof WPalette> = {
|
|
10
|
+
component: WPalette,
|
|
11
11
|
title: "Components/Palette",
|
|
12
12
|
args: {
|
|
13
13
|
// theme,
|
|
@@ -15,14 +15,14 @@ const meta: Meta<typeof LibPalette> = {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export default meta
|
|
18
|
-
type Story = StoryObj<typeof
|
|
18
|
+
type Story = StoryObj<typeof WPalette>
|
|
19
19
|
|
|
20
20
|
export const Primary: Story = {
|
|
21
21
|
render: args => ({
|
|
22
|
-
components: { ...components,
|
|
22
|
+
components: { ...components, WPalette },
|
|
23
23
|
setup: () => ({ args: { ...args, theme } }),
|
|
24
24
|
template: `
|
|
25
|
-
<
|
|
25
|
+
<WPalette v-bind="{...args}">{{args.value}}</WPalette>
|
|
26
26
|
`
|
|
27
27
|
})
|
|
28
28
|
}
|
|
@@ -25,24 +25,19 @@
|
|
|
25
25
|
</div>
|
|
26
26
|
</template>
|
|
27
27
|
|
|
28
|
-
<script lang="ts">
|
|
29
|
-
export default { name: "LibPalette" }
|
|
30
|
-
</script>
|
|
31
|
-
|
|
32
|
-
<script setup lang="ts">
|
|
28
|
+
<script setup lang="ts">
|
|
33
29
|
import { keys } from "@alanscodelog/utils/keys"
|
|
34
30
|
import type { Theme } from "metamorphosis"
|
|
35
31
|
|
|
36
|
-
import type { BaseInteractiveProps
|
|
32
|
+
import type { BaseInteractiveProps } from "../../types/index.js"
|
|
37
33
|
|
|
38
34
|
const props = withDefaults(defineProps<
|
|
39
|
-
& LinkableByIdProps
|
|
40
35
|
& BaseInteractiveProps
|
|
41
36
|
& {
|
|
42
37
|
theme?: Theme
|
|
43
38
|
}>(), {
|
|
44
39
|
theme: () => ({} as any),
|
|
45
|
-
|
|
40
|
+
border: true
|
|
46
41
|
})
|
|
47
42
|
|
|
48
43
|
const exclude = ["--color-bg", "--color-fg"]
|