@witchcraft/ui 0.3.26 → 0.4.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -61
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/assets/animations.css +1 -1
- package/dist/runtime/assets/locales/en.json +2 -0
- package/dist/runtime/build/WitchcraftUiResolver.js +1 -1
- package/dist/runtime/components/TestControls/TestControls.vue +3 -3
- package/dist/runtime/components/WButton/WButton.d.vue.ts +34 -0
- package/dist/runtime/components/{LibButton/LibButton.vue → WButton/WButton.vue} +26 -38
- package/dist/runtime/components/WButton/WButton.vue.d.ts +34 -0
- package/dist/runtime/components/WCheckbox/WCheckbox.d.vue.ts +33 -0
- package/dist/runtime/components/WCheckbox/WCheckbox.vue +109 -0
- package/dist/runtime/components/WCheckbox/WCheckbox.vue.d.ts +33 -0
- package/dist/runtime/components/WColorInput/WColorInput.d.vue.ts +45 -0
- package/dist/runtime/components/WColorInput/WColorInput.vue +85 -0
- package/dist/runtime/components/WColorInput/WColorInput.vue.d.ts +45 -0
- package/dist/runtime/components/WColorInput/WColorSwatchButton.d.vue.ts +28 -0
- package/dist/runtime/components/WColorInput/WColorSwatchButton.vue +86 -0
- package/dist/runtime/components/WColorInput/WColorSwatchButton.vue.d.ts +28 -0
- package/dist/runtime/components/{LibColorPicker/LibColorPicker.d.vue.ts → WColorPicker/WColorPicker.d.vue.ts} +7 -6
- package/dist/runtime/components/{LibColorPicker/LibColorPicker.vue → WColorPicker/WColorPicker.vue} +40 -29
- package/dist/runtime/components/{LibColorPicker/LibColorPicker.vue.d.ts → WColorPicker/WColorPicker.vue.d.ts} +7 -6
- package/dist/runtime/components/WCombobox/WCombobox.d.vue.ts +109 -0
- package/dist/runtime/components/WCombobox/WCombobox.vue +402 -0
- package/dist/runtime/components/WCombobox/WCombobox.vue.d.ts +109 -0
- package/dist/runtime/components/WCombobox/storyPlays.d.ts +18 -0
- package/dist/runtime/components/WCombobox/storyPlays.js +68 -0
- package/dist/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.d.vue.ts → WDarkModeSwitcher/WDarkModeSwitcher.d.vue.ts} +8 -13
- package/dist/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.vue → WDarkModeSwitcher/WDarkModeSwitcher.vue} +11 -14
- package/dist/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts → WDarkModeSwitcher/WDarkModeSwitcher.vue.d.ts} +8 -13
- package/dist/runtime/components/WDatePicker/WDatePicker.d.vue.ts +40 -0
- package/dist/runtime/components/{LibDatePicker/LibDatePicker.vue → WDatePicker/WDatePicker.vue} +3 -7
- package/dist/runtime/components/WDatePicker/WDatePicker.vue.d.ts +40 -0
- package/dist/runtime/components/{LibDatePicker/LibRangeDatePicker.vue → WDatePicker/WRangeDatePicker.vue} +16 -21
- package/dist/runtime/components/{LibDatePicker/LibSingleDatePicker.vue → WDatePicker/WSingleDatePicker.vue} +16 -21
- package/dist/runtime/components/{LibDatePicker/LibTimeZonePicker.d.vue.ts → WDatePicker/WTimeZonePicker.d.vue.ts} +1 -11
- package/dist/runtime/components/{LibDatePicker/LibTimeZonePicker.vue → WDatePicker/WTimeZonePicker.vue} +5 -12
- package/dist/runtime/components/{LibDatePicker/LibTimeZonePicker.vue.d.ts → WDatePicker/WTimeZonePicker.vue.d.ts} +1 -11
- package/dist/runtime/components/{LibDebug/LibDebug.vue → WDebug/WDebug.vue} +9 -12
- package/dist/runtime/components/{LibDevOnly/LibDevOnly.d.vue.ts → WDevOnly/WDevOnly.d.vue.ts} +0 -3
- package/dist/runtime/components/{LibDevOnly/LibDevOnly.vue.d.ts → WDevOnly/WDevOnly.vue.d.ts} +0 -3
- package/dist/runtime/components/WFileInput/WFileInput.d.vue.ts +58 -0
- package/dist/runtime/components/{LibFileInput/LibFileInput.vue → WFileInput/WFileInput.vue} +71 -57
- package/dist/runtime/components/WFileInput/WFileInput.vue.d.ts +58 -0
- package/dist/runtime/components/{Icon/Icon.vue.d.ts → WIcon/WIcon.d.vue.ts} +2 -6
- package/dist/runtime/components/{Icon/Icon.vue → WIcon/WIcon.vue} +1 -1
- package/dist/runtime/components/{Icon/Icon.d.vue.ts → WIcon/WIcon.vue.d.ts} +2 -6
- package/dist/runtime/components/{LibMultiValues/LibMultiValues.d.vue.ts → WMultiValues/WMultiValues.d.vue.ts} +8 -14
- package/dist/runtime/components/WMultiValues/WMultiValues.vue +149 -0
- package/dist/runtime/components/{LibMultiValues/LibMultiValues.vue.d.ts → WMultiValues/WMultiValues.vue.d.ts} +8 -14
- package/dist/runtime/components/WNotifications/WNotification.d.vue.ts +37 -0
- package/dist/runtime/components/{LibNotifications/LibNotification.vue → WNotifications/WNotification.vue} +32 -47
- package/dist/runtime/components/WNotifications/WNotification.vue.d.ts +37 -0
- package/dist/runtime/components/WNotifications/WNotifications.d.vue.ts +11 -0
- package/dist/runtime/components/{LibNotifications/LibNotifications.vue → WNotifications/WNotifications.vue} +35 -17
- package/dist/runtime/components/WNotifications/WNotifications.vue.d.ts +11 -0
- package/dist/runtime/components/WNumberInput/WNumberInput.d.vue.ts +27 -0
- package/dist/runtime/components/WNumberInput/WNumberInput.vue +96 -0
- package/dist/runtime/components/WNumberInput/WNumberInput.vue.d.ts +27 -0
- package/dist/runtime/components/WPagination/WPagination.d.vue.ts +59 -0
- package/dist/runtime/components/WPagination/WPagination.vue +182 -0
- package/dist/runtime/components/WPagination/WPagination.vue.d.ts +59 -0
- package/dist/runtime/components/WPalette/WPalette.d.vue.ts +11 -0
- package/dist/runtime/components/{LibPalette/LibPalette.vue → WPalette/WPalette.vue} +3 -8
- package/dist/runtime/components/WPalette/WPalette.vue.d.ts +11 -0
- package/dist/runtime/components/WPopover/WPopover.d.vue.ts +43 -0
- package/dist/runtime/components/WPopover/WPopover.vue +138 -0
- package/dist/runtime/components/WPopover/WPopover.vue.d.ts +43 -0
- package/dist/runtime/components/WPopup/WPopup.d.vue.ts +41 -0
- package/dist/runtime/components/WPopup/WPopup.vue +74 -0
- package/dist/runtime/components/WPopup/WPopup.vue.d.ts +41 -0
- package/dist/runtime/components/{LibProgressBar/LibProgressBar.d.vue.ts → WProgressBar/WProgressBar.d.vue.ts} +14 -18
- package/dist/runtime/components/WProgressBar/WProgressBar.vue +150 -0
- package/dist/runtime/components/{LibProgressBar/LibProgressBar.vue.d.ts → WProgressBar/WProgressBar.vue.d.ts} +14 -18
- package/dist/runtime/components/{LibRecorder/LibRecorder.d.vue.ts → WRecorder/WRecorder.d.vue.ts} +14 -29
- package/dist/runtime/components/{LibRecorder/LibRecorder.vue → WRecorder/WRecorder.vue} +37 -36
- package/dist/runtime/components/{LibRecorder/LibRecorder.vue.d.ts → WRecorder/WRecorder.vue.d.ts} +14 -29
- package/dist/runtime/components/{LibRoot/LibRoot.d.vue.ts → WRoot/WRoot.d.vue.ts} +6 -5
- package/dist/runtime/components/{LibRoot/LibRoot.vue → WRoot/WRoot.vue} +17 -15
- package/dist/runtime/components/{LibRoot/LibRoot.vue.d.ts → WRoot/WRoot.vue.d.ts} +6 -5
- package/dist/runtime/components/{LibSimpleInput/LibSimpleInput.d.vue.ts → WSimpleInput/WSimpleInput.d.vue.ts} +9 -16
- package/dist/runtime/components/{LibSimpleInput/LibSimpleInput.vue → WSimpleInput/WSimpleInput.vue} +12 -23
- package/dist/runtime/components/{LibSimpleInput/LibSimpleInput.vue.d.ts → WSimpleInput/WSimpleInput.vue.d.ts} +9 -16
- package/dist/runtime/components/WTable/WTable.d.vue.ts +102 -0
- package/dist/runtime/components/{LibTable/LibTable.vue → WTable/WTable.vue} +13 -14
- package/dist/runtime/components/WTable/WTable.vue.d.ts +102 -0
- package/dist/runtime/components/WTooltip/WTooltip.d.vue.ts +40 -0
- package/dist/runtime/components/WTooltip/WTooltip.vue +111 -0
- package/dist/runtime/components/WTooltip/WTooltip.vue.d.ts +40 -0
- package/dist/runtime/components/index.d.ts +20 -20
- package/dist/runtime/components/index.js +20 -20
- package/dist/runtime/composables/index.d.ts +4 -4
- package/dist/runtime/composables/index.js +4 -4
- package/dist/runtime/composables/useDelayedLoadingIndicator.d.ts +9 -0
- package/dist/runtime/composables/useDelayedLoadingIndicator.js +18 -0
- package/dist/runtime/composables/useDisplayForReka.d.ts +25 -0
- package/dist/runtime/composables/useDisplayForReka.js +16 -0
- package/dist/runtime/composables/useFallbackId.d.ts +3 -0
- package/dist/runtime/composables/useFallbackId.js +5 -0
- package/dist/runtime/composables/useInjectedDarkMode.d.ts +1 -1
- package/dist/runtime/composables/usePopupConstrainToStyle.d.ts +8 -0
- package/dist/runtime/composables/usePopupConstrainToStyle.js +8 -0
- package/dist/runtime/composables/useSetupDarkMode.d.ts +2 -3
- package/dist/runtime/composables/useSetupDarkMode.js +90 -4
- package/dist/runtime/helpers/NotificationHandler.d.ts +2 -2
- package/dist/runtime/injectionKeys.d.ts +1 -5
- package/dist/runtime/injectionKeys.js +0 -2
- package/dist/runtime/types/index.d.ts +85 -27
- package/dist/runtime/types/index.js +1 -0
- package/package.json +1 -1
- package/src/module.ts +1 -1
- package/src/runtime/assets/animations.css +3 -3
- package/src/runtime/assets/locales/en.json +2 -0
- package/src/runtime/build/WitchcraftUiResolver.ts +1 -1
- package/src/runtime/components/TestControls/TestControls.vue +3 -3
- package/src/runtime/components/WButton/WButton.stories.ts +112 -0
- package/src/runtime/components/{LibButton/LibButton.vue → WButton/WButton.vue} +34 -50
- package/src/runtime/components/{LibCheckbox/LibCheckbox.stories.ts → WCheckbox/WCheckbox.stories.ts} +5 -5
- package/src/runtime/components/WCheckbox/WCheckbox.vue +123 -0
- package/src/runtime/components/{LibColorInput/LibColorInput.stories.ts → WColorInput/WColorInput.stories.ts} +8 -8
- package/src/runtime/components/WColorInput/WColorInput.vue +112 -0
- package/src/runtime/components/WColorInput/WColorSwatchButton.vue +102 -0
- package/src/runtime/components/{LibColorPicker/LibColorPicker.stories.ts → WColorPicker/WColorPicker.stories.ts} +12 -12
- package/src/runtime/components/{LibColorPicker/LibColorPicker.vue → WColorPicker/WColorPicker.vue} +43 -32
- package/src/runtime/components/WCombobox/WCombobox.stories.ts +209 -0
- package/src/runtime/components/WCombobox/WCombobox.vue +446 -0
- package/src/runtime/components/WCombobox/storyPlays.ts +92 -0
- package/src/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.stories.ts → WDarkModeSwitcher/WDarkModeSwitcher.stories.ts} +6 -6
- package/src/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.vue → WDarkModeSwitcher/WDarkModeSwitcher.vue} +19 -30
- package/src/runtime/components/{LibDatePicker/LibDatePicker.stories.ts → WDatePicker/WDatePicker.stories.ts} +42 -34
- package/src/runtime/components/{LibDatePicker/LibDatePicker.vue → WDatePicker/WDatePicker.vue} +3 -7
- package/src/runtime/components/{LibDatePicker/LibRangeDatePicker.vue → WDatePicker/WRangeDatePicker.vue} +16 -22
- package/src/runtime/components/{LibDatePicker/LibSingleDatePicker.vue → WDatePicker/WSingleDatePicker.vue} +16 -22
- package/src/runtime/components/{LibDatePicker/LibTimeZonePicker.vue → WDatePicker/WTimeZonePicker.vue} +5 -12
- package/src/runtime/components/{LibDebug/LibDebug.stories.ts → WDebug/WDebug.stories.ts} +5 -5
- package/src/runtime/components/{LibDebug/LibDebug.vue → WDebug/WDebug.vue} +8 -11
- package/src/runtime/components/{LibDevOnly/LibDevOnly.vue → WDevOnly/WDevOnly.vue} +0 -4
- package/src/runtime/components/{LibFileInput/LibFileInput.stories.ts → WFileInput/WFileInput.stories.ts} +7 -7
- package/src/runtime/components/{LibFileInput/LibFileInput.vue → WFileInput/WFileInput.vue} +95 -98
- package/src/runtime/components/{Icon/Icon.vue → WIcon/WIcon.vue} +5 -8
- package/src/runtime/components/{LibMultiValues/LibMultiValues.stories.ts → WMultiValues/WMultiValues.stories.ts} +9 -9
- package/src/runtime/components/WMultiValues/WMultiValues.vue +161 -0
- package/src/runtime/components/{LibNotifications/LibNotification.stories.ts → WNotifications/WNotification.stories.ts} +9 -9
- package/src/runtime/components/{LibNotifications/LibNotification.vue → WNotifications/WNotification.vue} +43 -66
- package/src/runtime/components/WNotifications/WNotifications.stories.ts +139 -0
- package/src/runtime/components/{LibNotifications/LibNotifications.vue → WNotifications/WNotifications.vue} +51 -29
- package/src/runtime/components/WNumberInput/WNumberInput.vue +109 -0
- package/src/runtime/components/WPagination/WPagination.stories.ts +51 -0
- package/src/runtime/components/WPagination/WPagination.vue +207 -0
- package/src/runtime/components/{LibPalette/LibPalette.stories.ts → WPalette/WPalette.stories.ts} +6 -6
- package/src/runtime/components/{LibPalette/LibPalette.vue → WPalette/WPalette.vue} +3 -8
- package/src/runtime/components/WPopover/WPopover.stories.ts +218 -0
- package/src/runtime/components/WPopover/WPopover.vue +161 -0
- package/src/runtime/components/WPopup/WPopup.stories.ts +60 -0
- package/src/runtime/components/WPopup/WPopup.vue +93 -0
- package/src/runtime/components/WProgressBar/WProgressBar.stories.ts +119 -0
- package/src/runtime/components/WProgressBar/WProgressBar.vue +185 -0
- package/src/runtime/components/{LibRecorder/LibRecorder.stories.ts → WRecorder/WRecorder.stories.ts} +9 -6
- package/src/runtime/components/{LibRecorder/LibRecorder.vue → WRecorder/WRecorder.vue} +69 -68
- package/src/runtime/components/{LibRoot/LibRoot.vue → WRoot/WRoot.vue} +18 -15
- package/src/runtime/components/{LibSimpleInput/LibSimpleInput.stories.ts → WSimpleInput/WSimpleInput.stories.ts} +11 -12
- package/src/runtime/components/{LibSimpleInput/LibSimpleInput.vue → WSimpleInput/WSimpleInput.vue} +27 -44
- package/src/runtime/components/{LibTable/LibTable.stories.ts → WTable/WTable.stories.ts} +60 -52
- package/src/runtime/components/{LibTable/LibTable.vue → WTable/WTable.vue} +85 -87
- package/src/runtime/components/WTooltip/WTooltip.stories.ts +82 -0
- package/src/runtime/components/WTooltip/WTooltip.vue +126 -0
- package/src/runtime/components/index.ts +20 -20
- package/src/runtime/composables/index.ts +4 -4
- package/src/runtime/composables/useDelayedLoadingIndicator.ts +30 -0
- package/src/runtime/composables/useDisplayForReka.ts +37 -0
- package/src/runtime/composables/useFallbackId.ts +6 -0
- package/src/runtime/composables/useInjectedDarkMode.ts +1 -2
- package/src/runtime/composables/usePopupConstrainToStyle.ts +29 -0
- package/src/runtime/composables/useSetupDarkMode.ts +122 -4
- package/src/runtime/helpers/NotificationHandler.ts +2 -2
- package/src/runtime/injectionKeys.ts +1 -7
- package/src/runtime/types/index.ts +105 -32
- package/types/components.d.ts +13 -15
- package/dist/runtime/components/Aria/Aria.d.vue.ts +0 -6
- package/dist/runtime/components/Aria/Aria.vue +0 -16
- package/dist/runtime/components/Aria/Aria.vue.d.ts +0 -6
- package/dist/runtime/components/LibButton/LibButton.d.vue.ts +0 -37
- package/dist/runtime/components/LibButton/LibButton.vue.d.ts +0 -37
- package/dist/runtime/components/LibCheckbox/LibCheckbox.d.vue.ts +0 -41
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +0 -103
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +0 -41
- package/dist/runtime/components/LibColorInput/LibColorInput.d.vue.ts +0 -64
- package/dist/runtime/components/LibColorInput/LibColorInput.vue +0 -162
- package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +0 -64
- package/dist/runtime/components/LibDatePicker/LibDatePicker.d.vue.ts +0 -191
- package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +0 -191
- package/dist/runtime/components/LibFileInput/LibFileInput.d.vue.ts +0 -46
- package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +0 -46
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.d.vue.ts +0 -256
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +0 -387
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +0 -256
- package/dist/runtime/components/LibLabel/LibLabel.d.vue.ts +0 -27
- package/dist/runtime/components/LibLabel/LibLabel.vue +0 -45
- package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +0 -27
- package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +0 -109
- package/dist/runtime/components/LibNotifications/LibNotification.d.vue.ts +0 -45
- package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +0 -45
- package/dist/runtime/components/LibNotifications/LibNotifications.d.vue.ts +0 -15
- package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +0 -15
- package/dist/runtime/components/LibPagination/LibPagination.d.vue.ts +0 -105
- package/dist/runtime/components/LibPagination/LibPagination.vue +0 -229
- package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +0 -105
- package/dist/runtime/components/LibPalette/LibPalette.d.vue.ts +0 -15
- package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +0 -15
- package/dist/runtime/components/LibPopup/LibPopup.d.vue.ts +0 -52
- package/dist/runtime/components/LibPopup/LibPopup.vue +0 -365
- package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +0 -52
- package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +0 -169
- package/dist/runtime/components/LibSuggestions/LibSuggestions.d.vue.ts +0 -99
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +0 -178
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +0 -99
- package/dist/runtime/components/LibTable/LibTable.d.vue.ts +0 -125
- package/dist/runtime/components/LibTable/LibTable.vue.d.ts +0 -125
- package/dist/runtime/components/Template/NAME.d.vue.ts +0 -18
- package/dist/runtime/components/Template/NAME.vue +0 -27
- package/dist/runtime/components/Template/NAME.vue.d.ts +0 -18
- package/dist/runtime/components/Template/TemplateStory.d.ts +0 -7
- package/dist/runtime/components/Template/TemplateStory.js +0 -22
- package/dist/runtime/components/shared/props.d.ts +0 -171
- package/dist/runtime/components/shared/props.js +0 -2
- package/dist/runtime/composables/useAriaLabel.d.ts +0 -6
- package/dist/runtime/composables/useAriaLabel.js +0 -15
- package/dist/runtime/composables/useDarkMode.d.ts +0 -77
- package/dist/runtime/composables/useDarkMode.js +0 -89
- package/dist/runtime/composables/useDivideAttrs.d.ts +0 -27
- package/dist/runtime/composables/useDivideAttrs.js +0 -27
- package/dist/runtime/composables/useSuggestions.d.ts +0 -40
- package/dist/runtime/composables/useSuggestions.js +0 -263
- package/src/runtime/components/Aria/Aria.vue +0 -26
- package/src/runtime/components/LibButton/LibButton.stories.ts +0 -106
- package/src/runtime/components/LibCheckbox/LibCheckbox.vue +0 -131
- package/src/runtime/components/LibColorInput/LibColorInput.vue +0 -203
- package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.ts +0 -405
- package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +0 -419
- package/src/runtime/components/LibLabel/LibLabel.stories.ts +0 -33
- package/src/runtime/components/LibLabel/LibLabel.vue +0 -65
- package/src/runtime/components/LibMultiValues/LibMultiValues.vue +0 -123
- package/src/runtime/components/LibNotifications/LibNotifications.stories.ts +0 -131
- package/src/runtime/components/LibPagination/LibPagination.stories.ts +0 -49
- package/src/runtime/components/LibPagination/LibPagination.vue +0 -274
- package/src/runtime/components/LibPopup/LibPopup.stories.ts +0 -153
- package/src/runtime/components/LibPopup/LibPopup.vue +0 -396
- package/src/runtime/components/LibProgressBar/LibProgressBar.stories.ts +0 -90
- package/src/runtime/components/LibProgressBar/LibProgressBar.vue +0 -197
- package/src/runtime/components/LibSuggestions/LibSuggestions.stories.ts +0 -134
- package/src/runtime/components/LibSuggestions/LibSuggestions.vue +0 -212
- package/src/runtime/components/Template/NAME.vue +0 -49
- package/src/runtime/components/Template/TemplateStory.ts +0 -37
- package/src/runtime/components/shared/props.ts +0 -199
- package/src/runtime/composables/useAriaLabel.ts +0 -23
- package/src/runtime/composables/useDarkMode.ts +0 -199
- package/src/runtime/composables/useDivideAttrs.ts +0 -53
- package/src/runtime/composables/useSuggestions.ts +0 -339
- /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToHsva.d.ts +0 -0
- /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToHsva.js +0 -0
- /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToRgba.d.ts +0 -0
- /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToRgba.js +0 -0
- /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/toLowPrecisionRgbaString.d.ts +0 -0
- /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/toLowPrecisionRgbaString.js +0 -0
- /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/truncate.d.ts +0 -0
- /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/truncate.js +0 -0
- /package/dist/runtime/components/{LibDatePicker/LibRangeDatePicker.d.vue.ts → WDatePicker/WRangeDatePicker.d.vue.ts} +0 -0
- /package/dist/runtime/components/{LibDatePicker/LibRangeDatePicker.vue.d.ts → WDatePicker/WRangeDatePicker.vue.d.ts} +0 -0
- /package/dist/runtime/components/{LibDatePicker/LibSingleDatePicker.d.vue.ts → WDatePicker/WSingleDatePicker.d.vue.ts} +0 -0
- /package/dist/runtime/components/{LibDatePicker/LibSingleDatePicker.vue.d.ts → WDatePicker/WSingleDatePicker.vue.d.ts} +0 -0
- /package/dist/runtime/components/{LibDatePicker → WDatePicker}/helpers.d.ts +0 -0
- /package/dist/runtime/components/{LibDatePicker → WDatePicker}/helpers.js +0 -0
- /package/dist/runtime/components/{LibDebug/LibDebug.d.vue.ts → WDebug/WDebug.d.vue.ts} +0 -0
- /package/dist/runtime/components/{LibDebug/LibDebug.vue.d.ts → WDebug/WDebug.vue.d.ts} +0 -0
- /package/dist/runtime/components/{LibDevOnly/LibDevOnly.vue → WDevOnly/WDevOnly.vue} +0 -0
- /package/dist/runtime/components/{LibNotifications/LibNotificationTestMessageComponent.d.vue.ts → WNotifications/WNotificationTestMessageComponent.d.vue.ts} +0 -0
- /package/dist/runtime/components/{LibNotifications/LibNotificationTestMessageComponent.vue → WNotifications/WNotificationTestMessageComponent.vue} +0 -0
- /package/dist/runtime/components/{LibNotifications/LibNotificationTestMessageComponent.vue.d.ts → WNotifications/WNotificationTestMessageComponent.vue.d.ts} +0 -0
- /package/dist/runtime/components/{LibNotifications → WNotifications}/calculateNotificationProgress.d.ts +0 -0
- /package/dist/runtime/components/{LibNotifications → WNotifications}/calculateNotificationProgress.js +0 -0
- /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToHsva.ts +0 -0
- /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToRgba.ts +0 -0
- /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/toLowPrecisionRgbaString.ts +0 -0
- /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/truncate.ts +0 -0
- /package/src/runtime/components/{LibDatePicker → WDatePicker}/helpers.ts +0 -0
- /package/src/runtime/components/{LibNotifications/LibNotificationTestMessageComponent.vue → WNotifications/WNotificationTestMessageComponent.vue} +0 -0
- /package/src/runtime/components/{LibNotifications → WNotifications}/calculateNotificationProgress.ts +0 -0
|
@@ -0,0 +1,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"]
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/vue3"
|
|
3
|
+
import { computed, ref, useTemplateRef, watch } from "vue"
|
|
4
|
+
|
|
5
|
+
import WPopover from "./WPopover.vue"
|
|
6
|
+
|
|
7
|
+
import * as components from "../index.js"
|
|
8
|
+
|
|
9
|
+
type ExtraTestArgs = {
|
|
10
|
+
container?: Record<string, string>
|
|
11
|
+
}
|
|
12
|
+
const meta: Meta<typeof WPopover> = {
|
|
13
|
+
component: WPopover,
|
|
14
|
+
title: "Components/Popover",
|
|
15
|
+
args: {
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default meta
|
|
21
|
+
type Story = StoryObj<typeof WPopover> & { args?: ExtraTestArgs }
|
|
22
|
+
|
|
23
|
+
export const Primary: Story = {
|
|
24
|
+
render: args => {
|
|
25
|
+
const extraArgs = args as ExtraTestArgs
|
|
26
|
+
return {
|
|
27
|
+
components,
|
|
28
|
+
setup: () => {
|
|
29
|
+
const collisionBoundary = useTemplateRef("collisionBoundary")
|
|
30
|
+
const value = ref(false)
|
|
31
|
+
const buttonPositions = ["TL", "TC", "TR", "BL", "BC", "BR"] as const
|
|
32
|
+
const buttonPos = ref<typeof buttonPositions[number]>("TL")
|
|
33
|
+
const autoRotatePos = ref(true)
|
|
34
|
+
const buttonStyle = computed(() => {
|
|
35
|
+
switch (buttonPos.value) {
|
|
36
|
+
case "TL": return `align-self: flex-start; justify-self: flex-start;`
|
|
37
|
+
case "TC": return `align-self: flex-start; justify-self: center;`
|
|
38
|
+
case "TR": return `align-self: flex-start; justify-self: flex-end;`
|
|
39
|
+
case "BL": return `align-self: flex-end; justify-self: flex-start;`
|
|
40
|
+
case "BC": return `align-self: flex-end; justify-self: center;`
|
|
41
|
+
case "BR": return `align-self: flex-end; justify-self: flex-end;`
|
|
42
|
+
default: return ""
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
watch(value, () => {
|
|
47
|
+
if (!value.value && autoRotatePos.value) {
|
|
48
|
+
const buttonI = buttonPositions.indexOf(buttonPos.value)
|
|
49
|
+
if (buttonI < 5) { buttonPos.value = buttonPositions[buttonI + 1]! } else {
|
|
50
|
+
buttonPos.value = buttonPositions[0]!
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
args,
|
|
57
|
+
buttonPos,
|
|
58
|
+
autoRotatePos,
|
|
59
|
+
buttonStyle,
|
|
60
|
+
value,
|
|
61
|
+
collisionBoundary,
|
|
62
|
+
extraArgs
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
template: `
|
|
66
|
+
<WSimpleInput
|
|
67
|
+
:suggestions="['TL', 'TR', 'BL', 'BR']"
|
|
68
|
+
:restrict-to-suggestions="true"
|
|
69
|
+
:suggestions-filter="(_, items) => items"
|
|
70
|
+
:label="'Button Position'"
|
|
71
|
+
v-model="buttonPos"
|
|
72
|
+
>
|
|
73
|
+
</WSimpleInput>
|
|
74
|
+
<div>
|
|
75
|
+
<label>Auto Rotate Position</label>
|
|
76
|
+
<input type="checkbox" v-model="autoRotatePos">
|
|
77
|
+
</div>
|
|
78
|
+
<div
|
|
79
|
+
ref="collisionBoundary"
|
|
80
|
+
class="border border-red-500"
|
|
81
|
+
>
|
|
82
|
+
<div
|
|
83
|
+
class="overflow-auto max-w-[100vw] max-h-[100vh]"
|
|
84
|
+
>
|
|
85
|
+
<div
|
|
86
|
+
class="test bg-transparency-squares"
|
|
87
|
+
|
|
88
|
+
:style="{
|
|
89
|
+
display: 'grid',
|
|
90
|
+
width: '100vw',
|
|
91
|
+
height: '80vh',
|
|
92
|
+
padding: '50px',
|
|
93
|
+
border: '1px solid black',
|
|
94
|
+
...extraArgs.container
|
|
95
|
+
}"
|
|
96
|
+
>
|
|
97
|
+
|
|
98
|
+
<WPopover v-model="value" v-bind="{
|
|
99
|
+
...args,
|
|
100
|
+
contentProps: {...args.contentProps, collisionBoundary},
|
|
101
|
+
width:undefined,
|
|
102
|
+
height:undefined,
|
|
103
|
+
}" >
|
|
104
|
+
<template #button>
|
|
105
|
+
<WButton :style="buttonStyle" @click="value = !value" >Toggle Popover</WButton>
|
|
106
|
+
</template>
|
|
107
|
+
<template #popover>
|
|
108
|
+
<WDebug
|
|
109
|
+
:style="{width: args.width, height: args.height}"
|
|
110
|
+
class="overflow-auto"
|
|
111
|
+
>
|
|
112
|
+
Popover Content
|
|
113
|
+
</WDebug>
|
|
114
|
+
</template>
|
|
115
|
+
</WPopover>
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
`
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export const PopoverPreventsBoundaryEscape = {
|
|
125
|
+
...Primary,
|
|
126
|
+
args: {
|
|
127
|
+
container: {
|
|
128
|
+
width: "150vw",
|
|
129
|
+
height: "150vh"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
export const PopoverAllowBoundaryEscape = {
|
|
134
|
+
...Primary,
|
|
135
|
+
args: {
|
|
136
|
+
contentProps: {
|
|
137
|
+
sticky: "partial"
|
|
138
|
+
},
|
|
139
|
+
container: {
|
|
140
|
+
width: "150vw",
|
|
141
|
+
height: "150vh"
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/** Should cover button due to prioritizePosition */
|
|
146
|
+
export const PopoverPositionPriority = {
|
|
147
|
+
...Primary,
|
|
148
|
+
args: {
|
|
149
|
+
height: "500px",
|
|
150
|
+
contentProps: {
|
|
151
|
+
prioritizePosition: true,
|
|
152
|
+
side: "top"
|
|
153
|
+
},
|
|
154
|
+
container: {
|
|
155
|
+
width: "150vw",
|
|
156
|
+
height: "150vh"
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/** When the popover is too wide, it's set to overscroll content although ideally the popover should scroll it's own content. */
|
|
161
|
+
export const PopoverTooBig = {
|
|
162
|
+
...Primary,
|
|
163
|
+
args: {
|
|
164
|
+
width: "110vw",
|
|
165
|
+
height: "110vh"
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
export const PopoverRightStart = {
|
|
169
|
+
...Primary,
|
|
170
|
+
args: {
|
|
171
|
+
contentProps: {
|
|
172
|
+
side: "right",
|
|
173
|
+
align: "start"
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export const PopoverLeftEnd = {
|
|
179
|
+
...Primary,
|
|
180
|
+
args: {
|
|
181
|
+
contentProps: {
|
|
182
|
+
side: "left",
|
|
183
|
+
align: "end"
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
export const PopoverBottomStart = {
|
|
188
|
+
...Primary,
|
|
189
|
+
args: {
|
|
190
|
+
contentProps: {
|
|
191
|
+
side: "bottom",
|
|
192
|
+
align: "start"
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export const PopoverTopEnd = {
|
|
198
|
+
...Primary,
|
|
199
|
+
args: {
|
|
200
|
+
contentProps: {
|
|
201
|
+
side: "top",
|
|
202
|
+
align: "end"
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export const RightMenuShapeExample = {
|
|
208
|
+
...Primary,
|
|
209
|
+
args: {
|
|
210
|
+
contentProps: {
|
|
211
|
+
width: "300px",
|
|
212
|
+
height: "500px",
|
|
213
|
+
side: "right",
|
|
214
|
+
align: "start"
|
|
215
|
+
},
|
|
216
|
+
animationDirection: "use-align"
|
|
217
|
+
}
|
|
218
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<PopoverRoot
|
|
3
|
+
v-model:open="modelValue"
|
|
4
|
+
v-bind="rootProps"
|
|
5
|
+
>
|
|
6
|
+
<PopoverAnchor
|
|
7
|
+
v-if="$slots.button"
|
|
8
|
+
as-child
|
|
9
|
+
>
|
|
10
|
+
<slot name="button"/>
|
|
11
|
+
</PopoverAnchor>
|
|
12
|
+
|
|
13
|
+
<PopoverPortal :to="to">
|
|
14
|
+
<transition>
|
|
15
|
+
<div
|
|
16
|
+
v-if="showBackdrop && modelValue"
|
|
17
|
+
:class="twMerge(`popup--backdrop absolute inset-0 bg-black/50`, backdropClass)"
|
|
18
|
+
@click="modelValue = false"
|
|
19
|
+
/>
|
|
20
|
+
</transition>
|
|
21
|
+
|
|
22
|
+
<PopoverContent
|
|
23
|
+
v-bind="{
|
|
24
|
+
disableOutsidePointerEvents: false,
|
|
25
|
+
side: 'bottom',
|
|
26
|
+
sideFlip: true,
|
|
27
|
+
align: 'center',
|
|
28
|
+
sideOffset: 0,
|
|
29
|
+
alignOffset: 0,
|
|
30
|
+
avoidCollisions: true,
|
|
31
|
+
prioritizePosition: false,
|
|
32
|
+
sticky: 'always',
|
|
33
|
+
collisionPadding: 10,
|
|
34
|
+
positionStrategy: 'absolute',
|
|
35
|
+
...contentProps,
|
|
36
|
+
style: undefined
|
|
37
|
+
}"
|
|
38
|
+
:style="contentStyle"
|
|
39
|
+
:class="twMerge(`
|
|
40
|
+
popup--content-wrapper
|
|
41
|
+
focus:outline-none
|
|
42
|
+
overflow-auto
|
|
43
|
+
scrollbar-hidden
|
|
44
|
+
`,
|
|
45
|
+
animationDirection === `use-side` && `
|
|
46
|
+
data-[side=top]:animate-slideInUp
|
|
47
|
+
data-[side=bottom]:animate-slideInDown
|
|
48
|
+
data-[side=left]:animate-slideInLeft
|
|
49
|
+
data-[side=right]:animate-slideInRight
|
|
50
|
+
`,
|
|
51
|
+
animationDirection === `use-align` && (contentProps?.side === 'top' || contentProps?.side === 'bottom' || !contentProps?.side) && `
|
|
52
|
+
data-[align=start]:animate-slideInLeft
|
|
53
|
+
data-[align=end]:animate-slideInRight
|
|
54
|
+
data-[align=center]:animate-contentShow
|
|
55
|
+
`,
|
|
56
|
+
animationDirection === `use-align` && (contentProps?.side === 'left' || contentProps?.side === 'right' || !contentProps?.side) && `
|
|
57
|
+
data-[align=start]:animate-slideInDown
|
|
58
|
+
data-[align=end]:animate-slideInUp
|
|
59
|
+
data-[align=center]:animate-contentShow
|
|
60
|
+
`,
|
|
61
|
+
animationDirection === `left` && `
|
|
62
|
+
animate-slideInLeft
|
|
63
|
+
`,
|
|
64
|
+
animationDirection === `right` && `
|
|
65
|
+
animate-slideInRight
|
|
66
|
+
`,
|
|
67
|
+
animationDirection === `up` && `
|
|
68
|
+
data-[side=top]:animate-slideInUp
|
|
69
|
+
`,
|
|
70
|
+
animationDirection === `down` && `
|
|
71
|
+
animate-slideInDown
|
|
72
|
+
`,
|
|
73
|
+
contentProps?.class)"
|
|
74
|
+
>
|
|
75
|
+
<div
|
|
76
|
+
:class="twMerge(`
|
|
77
|
+
popup--content
|
|
78
|
+
flex
|
|
79
|
+
flex-col
|
|
80
|
+
bg-neutral-50
|
|
81
|
+
dark:bg-neutral-900
|
|
82
|
+
rounded-sm
|
|
83
|
+
p-2
|
|
84
|
+
text-sm
|
|
85
|
+
shadow-sm
|
|
86
|
+
shadow-black/30
|
|
87
|
+
border
|
|
88
|
+
border-black/30
|
|
89
|
+
whitespace-pre-wrap
|
|
90
|
+
overflow-auto
|
|
91
|
+
`)"
|
|
92
|
+
>
|
|
93
|
+
<slot name="popover"/>
|
|
94
|
+
</div>
|
|
95
|
+
|
|
96
|
+
<PopoverArrow
|
|
97
|
+
class="
|
|
98
|
+
-mt-px
|
|
99
|
+
fill-neutral-50
|
|
100
|
+
dark:fill-neutral-800
|
|
101
|
+
drop-shadow-[0_2px_1px_rgba(0,0,0,0.3)]
|
|
102
|
+
relative
|
|
103
|
+
"
|
|
104
|
+
/>
|
|
105
|
+
</PopoverContent>
|
|
106
|
+
</PopoverPortal>
|
|
107
|
+
</PopoverRoot>
|
|
108
|
+
</template>
|
|
109
|
+
|
|
110
|
+
<script setup lang="ts">
|
|
111
|
+
import {
|
|
112
|
+
type DialogContentEmits,
|
|
113
|
+
type DialogRootEmits,
|
|
114
|
+
PopoverAnchor,
|
|
115
|
+
PopoverArrow,
|
|
116
|
+
PopoverContent,
|
|
117
|
+
type PopoverContentProps,
|
|
118
|
+
PopoverPortal,
|
|
119
|
+
PopoverRoot,
|
|
120
|
+
type PopoverRootProps
|
|
121
|
+
} from "reka-ui"
|
|
122
|
+
import type { HTMLAttributes } from "vue"
|
|
123
|
+
|
|
124
|
+
import { usePopupConstrainToStyle } from "../../composables/usePopupConstrainToStyle.js"
|
|
125
|
+
import type { EmitsToProps, PopupConstrainToProps, TailwindClassProp } from "../../types/index.js"
|
|
126
|
+
import { twMerge } from "../../utils/twMerge.js"
|
|
127
|
+
|
|
128
|
+
/** Wrapper around reka-ui's `Popover` component. */
|
|
129
|
+
defineOptions({
|
|
130
|
+
name: "WPopup",
|
|
131
|
+
inheritAttrs: false
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
const props = withDefaults(defineProps<
|
|
136
|
+
& PopupConstrainToProps
|
|
137
|
+
& {
|
|
138
|
+
backdropClass?: string
|
|
139
|
+
/* If true, a backdrop is shown behind the popup. Whether interaction is allowed outside the popover is still determined by `disableOutsidePointerEvents`. */
|
|
140
|
+
showBackdrop?: boolean
|
|
141
|
+
animationDirection?: "use-side" | "use-align" | "left" | "right" | "up" | "down"
|
|
142
|
+
/** Overrides teleport target. */
|
|
143
|
+
to?: string
|
|
144
|
+
/** Overrides reka-ui's PopoverRootProps */
|
|
145
|
+
rootProps?: PopoverRootProps & EmitsToProps<DialogRootEmits> & Omit<HTMLAttributes, "class"> & TailwindClassProp
|
|
146
|
+
/** Overrides reka-ui's PopoverContentProps */
|
|
147
|
+
contentProps?: PopoverContentProps & EmitsToProps<DialogContentEmits> & Omit<HTMLAttributes, "class"> & TailwindClassProp
|
|
148
|
+
}
|
|
149
|
+
>(), {
|
|
150
|
+
showBackdrop: false,
|
|
151
|
+
constrainWidthTo: 400,
|
|
152
|
+
constrainHeightTo: "available",
|
|
153
|
+
animationDirection: "use-side",
|
|
154
|
+
to: "#root"
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
const modelValue = defineModel<boolean>({ default: false })
|
|
158
|
+
|
|
159
|
+
const contentStyle = usePopupConstrainToStyle("popover", props, [props?.contentProps?.style])
|
|
160
|
+
</script>
|
|
161
|
+
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/vue3"
|
|
3
|
+
import { ref } from "vue"
|
|
4
|
+
|
|
5
|
+
import WPopup from "./WPopup.vue"
|
|
6
|
+
|
|
7
|
+
import * as components from "../index.js"
|
|
8
|
+
|
|
9
|
+
const meta: Meta<typeof WPopup> = {
|
|
10
|
+
component: WPopup,
|
|
11
|
+
title: "Components/Popup"
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default meta
|
|
15
|
+
type Story = StoryObj<typeof WPopup>
|
|
16
|
+
|
|
17
|
+
export const Primary: Story = {
|
|
18
|
+
render: args => ({
|
|
19
|
+
components,
|
|
20
|
+
setup: () => {
|
|
21
|
+
const value = ref(false)
|
|
22
|
+
return { args, value }
|
|
23
|
+
},
|
|
24
|
+
template: `
|
|
25
|
+
<div class="test bg-transparency-squares flex items-center justify-center" style="height:80vh;border:1px solid black;">
|
|
26
|
+
<WPopup v-model="value" v-bind="args">
|
|
27
|
+
<template #button>
|
|
28
|
+
<WButton>Open Modal Popup</WButton>
|
|
29
|
+
</template>
|
|
30
|
+
<template #popup>
|
|
31
|
+
<div
|
|
32
|
+
:style="{width: args.width, height: args.height}"
|
|
33
|
+
class="p-3"
|
|
34
|
+
>
|
|
35
|
+
<div>Popup Content</div>
|
|
36
|
+
<WButton class="mt-4" @click="value = false">Close</WButton>
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
39
|
+
</WPopup>
|
|
40
|
+
</div>
|
|
41
|
+
`
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const PopupLarge = {
|
|
46
|
+
...Primary,
|
|
47
|
+
args: {
|
|
48
|
+
width: "80vw",
|
|
49
|
+
height: "80vh"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// popup should scroll contents instead of getting to big (popup will limit it)
|
|
54
|
+
export const PopupTooBig = {
|
|
55
|
+
...Primary,
|
|
56
|
+
args: {
|
|
57
|
+
width: "110vw",
|
|
58
|
+
height: "110vh"
|
|
59
|
+
}
|
|
60
|
+
}
|