@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,85 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<WPopover
|
|
3
|
+
:root-props="{
|
|
4
|
+
class: 'color-input--popover-root',
|
|
5
|
+
...rootProps
|
|
6
|
+
}"
|
|
7
|
+
:content-props="{
|
|
8
|
+
onInteractOutside: () => {
|
|
9
|
+
$tempValue = void 0;
|
|
10
|
+
emit('cancel');
|
|
11
|
+
}
|
|
12
|
+
}"
|
|
13
|
+
v-model="showPopover"
|
|
14
|
+
>
|
|
15
|
+
<template #button>
|
|
16
|
+
<WColorSwatchButton
|
|
17
|
+
:id="finalId"
|
|
18
|
+
:temp-value="$tempValue"
|
|
19
|
+
:value="$value"
|
|
20
|
+
@click="togglePopover"
|
|
21
|
+
/>
|
|
22
|
+
</template>
|
|
23
|
+
<template #popover>
|
|
24
|
+
<div
|
|
25
|
+
class="color-input--popover-wrapper p-5"
|
|
26
|
+
>
|
|
27
|
+
<WColorPicker
|
|
28
|
+
v-if="showPopover"
|
|
29
|
+
:id="finalId"
|
|
30
|
+
:allow-alpha="allowAlpha"
|
|
31
|
+
:custom-representation="customRepresentation"
|
|
32
|
+
:string-precision="stringPrecision"
|
|
33
|
+
v-model="internalTempValue"
|
|
34
|
+
v-model:temp-value="$tempValue"
|
|
35
|
+
@save="save"
|
|
36
|
+
@cancel="cancel"
|
|
37
|
+
/>
|
|
38
|
+
</div>
|
|
39
|
+
</template>
|
|
40
|
+
</Wpopover>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<script setup>
|
|
44
|
+
import { ref } from "vue";
|
|
45
|
+
import WColorSwatchButton from "./WColorSwatchButton.vue";
|
|
46
|
+
import { useFallbackId } from "../../composables/useFallbackId.js";
|
|
47
|
+
import WColorPicker from "../WColorPicker/WColorPicker.vue";
|
|
48
|
+
import WPopover from "../WPopover/WPopover.vue";
|
|
49
|
+
defineOptions({
|
|
50
|
+
name: "WColorInput"
|
|
51
|
+
});
|
|
52
|
+
const props = defineProps({
|
|
53
|
+
id: { type: String, required: false },
|
|
54
|
+
label: { type: String, required: false },
|
|
55
|
+
allowAlpha: { type: Boolean, required: false, default: true },
|
|
56
|
+
border: { type: Boolean, required: false, default: true },
|
|
57
|
+
copyTransform: { type: Function, required: false, default: (_val, stringVal) => stringVal },
|
|
58
|
+
stringPrecision: { type: Number, required: false, default: 3 },
|
|
59
|
+
customRepresentation: { type: Object, required: false, default: void 0 },
|
|
60
|
+
rootProps: { type: Object, required: false }
|
|
61
|
+
});
|
|
62
|
+
const finalId = useFallbackId(props);
|
|
63
|
+
const emit = defineEmits(["save", "cancel"]);
|
|
64
|
+
const $value = defineModel({ type: Object, ...{ required: false, default: () => ({ r: 0, g: 0, b: 0 }) } });
|
|
65
|
+
const $tempValue = defineModel("tempValue", { type: null, ...{ required: false, default: () => void 0 } });
|
|
66
|
+
const internalTempValue = ref({ ...$value.value });
|
|
67
|
+
const showPopover = ref(false);
|
|
68
|
+
const togglePopover = () => {
|
|
69
|
+
if (showPopover.value) {
|
|
70
|
+
$value.value = internalTempValue.value;
|
|
71
|
+
}
|
|
72
|
+
showPopover.value = !showPopover.value;
|
|
73
|
+
};
|
|
74
|
+
function save() {
|
|
75
|
+
$value.value = internalTempValue.value;
|
|
76
|
+
showPopover.value = false;
|
|
77
|
+
$tempValue.value = void 0;
|
|
78
|
+
emit("save");
|
|
79
|
+
}
|
|
80
|
+
function cancel() {
|
|
81
|
+
showPopover.value = false;
|
|
82
|
+
$tempValue.value = void 0;
|
|
83
|
+
emit("cancel");
|
|
84
|
+
}
|
|
85
|
+
</script>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { DialogRootEmits, PopoverRootProps } from "reka-ui";
|
|
2
|
+
import { type ButtonHTMLAttributes, type EmitsToProps, type HTMLAttributes } from "vue";
|
|
3
|
+
import type { HsvaColor, RgbaColor, TailwindClassProp } from "../../types/index.js";
|
|
4
|
+
type __VLS_Props = {
|
|
5
|
+
id?: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
allowAlpha?: boolean;
|
|
8
|
+
border?: boolean;
|
|
9
|
+
/** See ColorPicker.copyTransform */
|
|
10
|
+
copyTransform?: (val: HsvaColor, stringVal: string) => any;
|
|
11
|
+
/** See ColorPicker.allowAlpha */
|
|
12
|
+
stringPrecision?: number;
|
|
13
|
+
/** See ColorPicker.customRepresentation */
|
|
14
|
+
customRepresentation?: {
|
|
15
|
+
fromHsvaToString: (hsva: HsvaColor, includeAlpha: boolean) => string;
|
|
16
|
+
};
|
|
17
|
+
rootProps?: PopoverRootProps & EmitsToProps<DialogRootEmits> & Omit<HTMLAttributes, "class"> & TailwindClassProp;
|
|
18
|
+
} & /** @vue-ignore */ Omit<ButtonHTMLAttributes, "class"> & /** @vue-ignore */ TailwindClassProp;
|
|
19
|
+
type __VLS_ModelProps = {
|
|
20
|
+
modelValue?: RgbaColor;
|
|
21
|
+
"tempValue"?: RgbaColor | undefined;
|
|
22
|
+
};
|
|
23
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
24
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
25
|
+
"update:modelValue": (value: RgbaColor) => any;
|
|
26
|
+
"update:tempValue": (value: RgbaColor | undefined) => any;
|
|
27
|
+
} & {
|
|
28
|
+
save: () => any;
|
|
29
|
+
cancel: () => any;
|
|
30
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
31
|
+
"onUpdate:modelValue"?: ((value: RgbaColor) => any) | undefined;
|
|
32
|
+
onSave?: (() => any) | undefined;
|
|
33
|
+
onCancel?: (() => any) | undefined;
|
|
34
|
+
"onUpdate:tempValue"?: ((value: RgbaColor | undefined) => any) | undefined;
|
|
35
|
+
}>, {
|
|
36
|
+
border: boolean;
|
|
37
|
+
allowAlpha: boolean;
|
|
38
|
+
copyTransform: (val: HsvaColor, stringVal: string) => any;
|
|
39
|
+
stringPrecision: number;
|
|
40
|
+
customRepresentation: {
|
|
41
|
+
fromHsvaToString: (hsva: HsvaColor, includeAlpha: boolean) => string;
|
|
42
|
+
};
|
|
43
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
44
|
+
declare const _default: typeof __VLS_export;
|
|
45
|
+
export default _default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type ButtonHTMLAttributes } from "vue";
|
|
2
|
+
import type { RgbaColor, TailwindClassProp } from "../../types/index.js";
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
id?: string;
|
|
5
|
+
tempValue: RgbaColor | undefined;
|
|
6
|
+
value: RgbaColor;
|
|
7
|
+
} & /** @vue-ignore */ Omit<ButtonHTMLAttributes, "class" | "value"> & /** @vue-ignore */ TailwindClassProp;
|
|
8
|
+
declare var __VLS_9: {
|
|
9
|
+
stringColor: string;
|
|
10
|
+
classes: "\n\tcolor-input--swatch\n\tafter:content-vertical-holder\n\tmin-w-4\n\tflex-1\n\trelative\n\tbefore:content-['']\n\tbefore:absolute\n\tbefore:inset-0\n\tbefore:bg-transparency-squares\n\tbefore:z-[-1]\n";
|
|
11
|
+
}, __VLS_11: {
|
|
12
|
+
tempStringColor: string;
|
|
13
|
+
classes: "\n\tcolor-input--swatch\n\tafter:content-vertical-holder\n\tmin-w-4\n\tflex-1\n\trelative\n\tbefore:content-['']\n\tbefore:absolute\n\tbefore:inset-0\n\tbefore:bg-transparency-squares\n\tbefore:z-[-1]\n";
|
|
14
|
+
};
|
|
15
|
+
type __VLS_Slots = {} & {
|
|
16
|
+
default?: (props: typeof __VLS_9) => any;
|
|
17
|
+
} & {
|
|
18
|
+
temp?: (props: typeof __VLS_11) => any;
|
|
19
|
+
};
|
|
20
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
23
|
+
export default _default;
|
|
24
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
25
|
+
new (): {
|
|
26
|
+
$slots: S;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<WButton
|
|
3
|
+
:id="id"
|
|
4
|
+
:class="twMerge(
|
|
5
|
+
`
|
|
6
|
+
color-input--button
|
|
7
|
+
p-0
|
|
8
|
+
flex
|
|
9
|
+
flex-nowrap
|
|
10
|
+
min-w-4
|
|
11
|
+
overflow-hidden
|
|
12
|
+
[&_.button--label]:items-stretch
|
|
13
|
+
[&_.button--label]:gap-0
|
|
14
|
+
after:hidden
|
|
15
|
+
`,
|
|
16
|
+
$attrs.class
|
|
17
|
+
)"
|
|
18
|
+
:aria-label="t('color-input.aria-and-title-prefix') + stringColor"
|
|
19
|
+
:title="t('color-input.aria-and-title-prefix') + stringColor"
|
|
20
|
+
v-bind="{ ...$attrs, class: void 0 }"
|
|
21
|
+
>
|
|
22
|
+
<template #label>
|
|
23
|
+
<div
|
|
24
|
+
class="
|
|
25
|
+
color-input--swatch-wrapper
|
|
26
|
+
flex
|
|
27
|
+
w-full
|
|
28
|
+
"
|
|
29
|
+
>
|
|
30
|
+
<slot v-bind="{ stringColor, classes: swatchClasses }">
|
|
31
|
+
<div
|
|
32
|
+
:class="swatchClasses"
|
|
33
|
+
:style="`background:${stringColor}`"
|
|
34
|
+
/>
|
|
35
|
+
</slot>
|
|
36
|
+
<slot
|
|
37
|
+
v-if="tempValue"
|
|
38
|
+
v-bind="{ tempStringColor, classes: swatchClasses }"
|
|
39
|
+
name="temp"
|
|
40
|
+
>
|
|
41
|
+
<div
|
|
42
|
+
:class="swatchClasses"
|
|
43
|
+
:style="`background:${tempStringColor}`"
|
|
44
|
+
/>
|
|
45
|
+
</slot>
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
48
|
+
</Wbutton>
|
|
49
|
+
</template>
|
|
50
|
+
|
|
51
|
+
<script setup>
|
|
52
|
+
import Color from "colorjs.io";
|
|
53
|
+
import { computed, useAttrs } from "vue";
|
|
54
|
+
import { useInjectedI18n } from "../../composables/useInjectedI18n.js";
|
|
55
|
+
import { twMerge } from "../../utils/twMerge.js";
|
|
56
|
+
import WButton from "../WButton/WButton.vue";
|
|
57
|
+
const $attrs = useAttrs();
|
|
58
|
+
const t = useInjectedI18n();
|
|
59
|
+
const props = defineProps({
|
|
60
|
+
id: { type: String, required: false },
|
|
61
|
+
tempValue: { type: null, required: true },
|
|
62
|
+
value: { type: Object, required: true }
|
|
63
|
+
});
|
|
64
|
+
const swatchClasses = `
|
|
65
|
+
color-input--swatch
|
|
66
|
+
after:content-vertical-holder
|
|
67
|
+
min-w-4
|
|
68
|
+
flex-1
|
|
69
|
+
relative
|
|
70
|
+
before:content-['']
|
|
71
|
+
before:absolute
|
|
72
|
+
before:inset-0
|
|
73
|
+
before:bg-transparency-squares
|
|
74
|
+
before:z-[-1]
|
|
75
|
+
`;
|
|
76
|
+
const stringColor = computed(() => new Color("srgb", [
|
|
77
|
+
props.value.r / 255,
|
|
78
|
+
props.value.g / 255,
|
|
79
|
+
props.value.b / 255
|
|
80
|
+
], props.value.a ?? 1).toString());
|
|
81
|
+
const tempStringColor = computed(() => props.tempValue ? new Color("srgb", [
|
|
82
|
+
props.tempValue.r / 255,
|
|
83
|
+
props.tempValue.g / 255,
|
|
84
|
+
props.tempValue.b / 255
|
|
85
|
+
], props.tempValue.a ?? 1).toString() : "");
|
|
86
|
+
</script>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type ButtonHTMLAttributes } from "vue";
|
|
2
|
+
import type { RgbaColor, TailwindClassProp } from "../../types/index.js";
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
id?: string;
|
|
5
|
+
tempValue: RgbaColor | undefined;
|
|
6
|
+
value: RgbaColor;
|
|
7
|
+
} & /** @vue-ignore */ Omit<ButtonHTMLAttributes, "class" | "value"> & /** @vue-ignore */ TailwindClassProp;
|
|
8
|
+
declare var __VLS_9: {
|
|
9
|
+
stringColor: string;
|
|
10
|
+
classes: "\n\tcolor-input--swatch\n\tafter:content-vertical-holder\n\tmin-w-4\n\tflex-1\n\trelative\n\tbefore:content-['']\n\tbefore:absolute\n\tbefore:inset-0\n\tbefore:bg-transparency-squares\n\tbefore:z-[-1]\n";
|
|
11
|
+
}, __VLS_11: {
|
|
12
|
+
tempStringColor: string;
|
|
13
|
+
classes: "\n\tcolor-input--swatch\n\tafter:content-vertical-holder\n\tmin-w-4\n\tflex-1\n\trelative\n\tbefore:content-['']\n\tbefore:absolute\n\tbefore:inset-0\n\tbefore:bg-transparency-squares\n\tbefore:z-[-1]\n";
|
|
14
|
+
};
|
|
15
|
+
type __VLS_Slots = {} & {
|
|
16
|
+
default?: (props: typeof __VLS_9) => any;
|
|
17
|
+
} & {
|
|
18
|
+
temp?: (props: typeof __VLS_11) => any;
|
|
19
|
+
};
|
|
20
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
23
|
+
export default _default;
|
|
24
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
25
|
+
new (): {
|
|
26
|
+
$slots: S;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { HsvaColor, RgbaColor } from "../../types/index.js";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
id?: string;
|
|
4
|
+
label?: string;
|
|
4
5
|
allowAlpha?: boolean;
|
|
5
6
|
/**
|
|
6
7
|
* The precision of the rgba string representation of the color. Defaults to 3. Extra trailing zeros are removed for a prettier number.
|
|
@@ -35,23 +36,23 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
35
36
|
"update:modelValue": (value: RgbaColor) => any;
|
|
36
37
|
"update:tempValue": (value: RgbaColor | undefined) => any;
|
|
37
38
|
} & {
|
|
38
|
-
cancel: () => any;
|
|
39
39
|
save: (val: RgbaColor) => any;
|
|
40
|
+
cancel: () => any;
|
|
40
41
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
41
42
|
"onUpdate:modelValue"?: ((value: RgbaColor) => any) | undefined;
|
|
42
|
-
onCancel?: (() => any) | undefined;
|
|
43
43
|
onSave?: ((val: RgbaColor) => any) | undefined;
|
|
44
|
+
onCancel?: (() => any) | undefined;
|
|
44
45
|
"onUpdate:tempValue"?: ((value: RgbaColor | undefined) => any) | undefined;
|
|
45
46
|
}>, {
|
|
46
47
|
border: boolean;
|
|
47
|
-
valid: boolean;
|
|
48
48
|
allowAlpha: boolean;
|
|
49
|
+
copyTransform: (val: HsvaColor, stringVal: string) => any;
|
|
49
50
|
stringPrecision: number;
|
|
50
51
|
customRepresentation: {
|
|
51
52
|
fromHsvaToString: (hsva: HsvaColor, includeAlpha: boolean) => string;
|
|
52
53
|
fromStringToHsva?: (string: string) => HsvaColor | undefined;
|
|
53
54
|
};
|
|
54
|
-
|
|
55
|
+
valid: boolean;
|
|
55
56
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
56
57
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
57
58
|
declare const _default: typeof __VLS_export;
|
package/dist/runtime/components/{LibColorPicker/LibColorPicker.vue → WColorPicker/WColorPicker.vue}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
-
:id="
|
|
3
|
+
:id="finalId"
|
|
4
4
|
:aria-label="t('color-picker.aria')"
|
|
5
5
|
:class="twMerge(
|
|
6
6
|
`color-picker
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
max-w-[300px]
|
|
13
13
|
flex flex-col items-center justify-center
|
|
14
14
|
bg-neutral-50
|
|
15
|
-
dark:bg-neutral-
|
|
15
|
+
dark:bg-neutral-800
|
|
16
16
|
gap-3
|
|
17
17
|
p-3
|
|
18
18
|
`,
|
|
@@ -21,7 +21,12 @@
|
|
|
21
21
|
[--bg:rgb(var(--contrast-dark))]
|
|
22
22
|
`,
|
|
23
23
|
border && `
|
|
24
|
-
border
|
|
24
|
+
border
|
|
25
|
+
rounded-sm
|
|
26
|
+
border-neutral-300
|
|
27
|
+
dark:border-neutral-900
|
|
28
|
+
shadow-md
|
|
29
|
+
shadow-black/30
|
|
25
30
|
`,
|
|
26
31
|
$attrs?.class
|
|
27
32
|
)"
|
|
@@ -44,9 +49,9 @@
|
|
|
44
49
|
ref="pickerEl"
|
|
45
50
|
/>
|
|
46
51
|
<div
|
|
47
|
-
|
|
52
|
+
role="slider"
|
|
48
53
|
:aria-description="ariaDescription"
|
|
49
|
-
:aria-
|
|
54
|
+
:aria-valuetext="`${t('color-picker.aria.saturation')}: ${localColor.percent.s}, ${t('color-picker.aria.value')}: ${localColor.percent.v}`"
|
|
50
55
|
:class="`
|
|
51
56
|
color-picker--all-handle
|
|
52
57
|
${handleClasses}
|
|
@@ -103,7 +108,7 @@
|
|
|
103
108
|
<div
|
|
104
109
|
role="slider"
|
|
105
110
|
:aria-label="t('color-picker.aria.alpha-slider')"
|
|
106
|
-
:aria-valuenow="`${localColor.percent.
|
|
111
|
+
:aria-valuenow="`${localColor.percent.a}`"
|
|
107
112
|
:aria-valuemin="0"
|
|
108
113
|
:aria-valuemax="100"
|
|
109
114
|
:aria-description="ariaDescription"
|
|
@@ -138,7 +143,7 @@
|
|
|
138
143
|
</div>
|
|
139
144
|
<div class="color-picker--input-group flex flex-1 items-center gap-2">
|
|
140
145
|
<slot name="input">
|
|
141
|
-
<
|
|
146
|
+
<WSimpleInput
|
|
142
147
|
:valid="valid"
|
|
143
148
|
class="color-picker--input w-full"
|
|
144
149
|
:aria-label="label"
|
|
@@ -146,30 +151,30 @@
|
|
|
146
151
|
@input="parseInput"
|
|
147
152
|
@blur="onBlurFixInvalidValue"
|
|
148
153
|
/>
|
|
149
|
-
<
|
|
154
|
+
<WButton
|
|
150
155
|
class="color-picker--copy-button"
|
|
151
156
|
:aria-label="t('copy')"
|
|
152
157
|
@click="copy(copyTransform?.(localColor.val, localColorString) ?? localColorString)"
|
|
153
158
|
>
|
|
154
|
-
<
|
|
155
|
-
</
|
|
159
|
+
<WIcon><i-lucide-copy/></WIcon>
|
|
160
|
+
</Wbutton>
|
|
156
161
|
</slot>
|
|
157
162
|
</div>
|
|
158
163
|
</div>
|
|
159
164
|
<slot name="buttons">
|
|
160
165
|
<div class="color-picker--save-cancel-group flex w-full items-center justify-center gap-2">
|
|
161
|
-
<
|
|
166
|
+
<WButton
|
|
162
167
|
class="color-picker--save-button"
|
|
163
168
|
@click="save()"
|
|
164
169
|
>
|
|
165
170
|
{{ t("save") }}
|
|
166
|
-
</
|
|
167
|
-
<
|
|
171
|
+
</Wbutton>
|
|
172
|
+
<WButton
|
|
168
173
|
class="color-picker--cancel-button"
|
|
169
174
|
@click="emits('cancel')"
|
|
170
175
|
>
|
|
171
176
|
{{ t("cancel") }}
|
|
172
|
-
</
|
|
177
|
+
</Wbutton>
|
|
173
178
|
</div>
|
|
174
179
|
</slot>
|
|
175
180
|
</div>
|
|
@@ -184,16 +189,15 @@ import { computed, onMounted, reactive, ref, useAttrs, watch } from "vue";
|
|
|
184
189
|
import { safeConvertToHsva } from "./utils/safeConvertToHsva.js";
|
|
185
190
|
import { safeConvertToRgba } from "./utils/safeConvertToRgba.js";
|
|
186
191
|
import { toLowPrecisionRgbaString } from "./utils/toLowPrecisionRgbaString.js";
|
|
187
|
-
import
|
|
192
|
+
import { useFallbackId } from "../../composables/useFallbackId.js";
|
|
188
193
|
import { useInjectedI18n } from "../../composables/useInjectedI18n.js";
|
|
189
194
|
import { copy } from "../../helpers/copy.js";
|
|
190
195
|
import { twMerge } from "../../utils/twMerge.js";
|
|
191
|
-
import
|
|
192
|
-
import
|
|
193
|
-
import
|
|
194
|
-
import { getFallbackId } from "../shared/props.js";
|
|
196
|
+
import WButton from "../WButton/WButton.vue";
|
|
197
|
+
import WIcon from "../WIcon/WIcon.vue";
|
|
198
|
+
import WSimpleInput from "../WSimpleInput/WSimpleInput.vue";
|
|
195
199
|
defineOptions({
|
|
196
|
-
name: "
|
|
200
|
+
name: "WColorPicker"
|
|
197
201
|
});
|
|
198
202
|
const $attrs = useAttrs();
|
|
199
203
|
const t = useInjectedI18n();
|
|
@@ -222,8 +226,8 @@ const handleClasses = `
|
|
|
222
226
|
`;
|
|
223
227
|
const emits = defineEmits(["save", "cancel"]);
|
|
224
228
|
const props = defineProps({
|
|
225
|
-
label: { type: String, required: false },
|
|
226
229
|
id: { type: String, required: false },
|
|
230
|
+
label: { type: String, required: false },
|
|
227
231
|
allowAlpha: { type: Boolean, required: false, default: true },
|
|
228
232
|
stringPrecision: { type: Number, required: false, default: 3 },
|
|
229
233
|
customRepresentation: { type: Object, required: false, default: void 0 },
|
|
@@ -231,13 +235,16 @@ const props = defineProps({
|
|
|
231
235
|
copyTransform: { type: Function, required: false, default: (_val, stringVal) => stringVal },
|
|
232
236
|
valid: { type: Boolean, required: false, default: true }
|
|
233
237
|
});
|
|
238
|
+
const finalId = useFallbackId(props);
|
|
234
239
|
const ariaDescription = t("color-picker.aria.description");
|
|
235
|
-
const fallbackId = getFallbackId();
|
|
236
240
|
const $value = defineModel({ type: Object, ...{ required: false, default: () => ({ r: 0, g: 0, b: 0 }) } });
|
|
237
241
|
const $tempValue = defineModel("tempValue", { type: null, ...{ required: false, default: () => void 0 } });
|
|
238
242
|
const pickerEl = ref(null);
|
|
239
243
|
const hueSliderEl = ref(null);
|
|
240
244
|
const alphaSliderEl = ref(null);
|
|
245
|
+
let pickerCtx = null;
|
|
246
|
+
let hueSliderCtx = null;
|
|
247
|
+
let alphaSliderCtx = null;
|
|
241
248
|
const config = {
|
|
242
249
|
hue: {
|
|
243
250
|
el: hueSliderEl,
|
|
@@ -294,7 +301,8 @@ function onBlurFixInvalidValue() {
|
|
|
294
301
|
}
|
|
295
302
|
}
|
|
296
303
|
function updatePicker(el, hue) {
|
|
297
|
-
|
|
304
|
+
if (!pickerCtx) return;
|
|
305
|
+
const ctx = pickerCtx;
|
|
298
306
|
const { height, width } = el;
|
|
299
307
|
ctx.clearRect(0, 0, width, height);
|
|
300
308
|
const gradient = ctx.createLinearGradient(0, 0, 0, height);
|
|
@@ -310,8 +318,8 @@ function updatePicker(el, hue) {
|
|
|
310
318
|
ctx.fillRect(0, 0, width, height);
|
|
311
319
|
ctx.globalCompositeOperation = "source-over";
|
|
312
320
|
}
|
|
313
|
-
function updateSlider(el, stops, length = 360) {
|
|
314
|
-
|
|
321
|
+
function updateSlider(el, ctx, stops, length = 360) {
|
|
322
|
+
if (!ctx) return;
|
|
315
323
|
const { height, width } = el;
|
|
316
324
|
ctx.clearRect(0, 0, width, height);
|
|
317
325
|
const end = isArray(stops) ? stops.length - 1 : length;
|
|
@@ -382,7 +390,7 @@ const slider = {
|
|
|
382
390
|
}
|
|
383
391
|
},
|
|
384
392
|
pointerdown: (e, type) => {
|
|
385
|
-
const focusTargetClass = `#${
|
|
393
|
+
const focusTargetClass = `#${finalId} .color-picker--${type}-handle`;
|
|
386
394
|
const focusTarget = document.querySelector(focusTargetClass);
|
|
387
395
|
if (focusTarget instanceof HTMLElement) focusTarget.focus();
|
|
388
396
|
if (dragging) return;
|
|
@@ -417,9 +425,9 @@ function updateSliders(_) {
|
|
|
417
425
|
hsl0.alpha = 0;
|
|
418
426
|
const hsl1 = color.clone();
|
|
419
427
|
hsl1.alpha = 1;
|
|
420
|
-
updateSlider(alphaSliderEl.value, [hsl0.toString(), hsl1.toString()]);
|
|
428
|
+
updateSlider(alphaSliderEl.value, alphaSliderCtx, [hsl0.toString(), hsl1.toString()]);
|
|
421
429
|
}
|
|
422
|
-
updateSlider(hueSliderEl.value, (i) => `hsl(${i} 100% 50%)`);
|
|
430
|
+
updateSlider(hueSliderEl.value, hueSliderCtx, (i) => `hsl(${i} 100% 50%)`);
|
|
423
431
|
updatePicker(pickerEl.value, _.h);
|
|
424
432
|
}
|
|
425
433
|
function updateValueAndPosition(_) {
|
|
@@ -456,8 +464,11 @@ onMounted(() => {
|
|
|
456
464
|
if ($tempValue.value !== void 0) {
|
|
457
465
|
convertAndUpdateAll($tempValue.value);
|
|
458
466
|
}
|
|
459
|
-
const handle = document.querySelector(`#${
|
|
467
|
+
const handle = document.querySelector(`#${finalId} .color-picker--all-handle`);
|
|
460
468
|
if (handle instanceof HTMLElement) handle.focus();
|
|
469
|
+
pickerCtx = pickerEl.value?.getContext("2d") ?? null;
|
|
470
|
+
hueSliderCtx = hueSliderEl.value?.getContext("2d") ?? null;
|
|
471
|
+
alphaSliderCtx = alphaSliderEl.value?.getContext("2d") ?? null;
|
|
461
472
|
});
|
|
462
473
|
watch($value, () => {
|
|
463
474
|
convertAndUpdateAll($value.value);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { HsvaColor, RgbaColor } from "../../types/index.js";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
id?: string;
|
|
4
|
+
label?: string;
|
|
4
5
|
allowAlpha?: boolean;
|
|
5
6
|
/**
|
|
6
7
|
* The precision of the rgba string representation of the color. Defaults to 3. Extra trailing zeros are removed for a prettier number.
|
|
@@ -35,23 +36,23 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
35
36
|
"update:modelValue": (value: RgbaColor) => any;
|
|
36
37
|
"update:tempValue": (value: RgbaColor | undefined) => any;
|
|
37
38
|
} & {
|
|
38
|
-
cancel: () => any;
|
|
39
39
|
save: (val: RgbaColor) => any;
|
|
40
|
+
cancel: () => any;
|
|
40
41
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
41
42
|
"onUpdate:modelValue"?: ((value: RgbaColor) => any) | undefined;
|
|
42
|
-
onCancel?: (() => any) | undefined;
|
|
43
43
|
onSave?: ((val: RgbaColor) => any) | undefined;
|
|
44
|
+
onCancel?: (() => any) | undefined;
|
|
44
45
|
"onUpdate:tempValue"?: ((value: RgbaColor | undefined) => any) | undefined;
|
|
45
46
|
}>, {
|
|
46
47
|
border: boolean;
|
|
47
|
-
valid: boolean;
|
|
48
48
|
allowAlpha: boolean;
|
|
49
|
+
copyTransform: (val: HsvaColor, stringVal: string) => any;
|
|
49
50
|
stringPrecision: number;
|
|
50
51
|
customRepresentation: {
|
|
51
52
|
fromHsvaToString: (hsva: HsvaColor, includeAlpha: boolean) => string;
|
|
52
53
|
fromStringToHsva?: (string: string) => HsvaColor | undefined;
|
|
53
54
|
};
|
|
54
|
-
|
|
55
|
+
valid: boolean;
|
|
55
56
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
56
57
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
57
58
|
declare const _default: typeof __VLS_export;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { AcceptableValue, ComboboxContentEmits, ComboboxContentProps, ComboboxInputEmits, ComboboxInputProps } from "reka-ui";
|
|
2
|
+
import type { EmitsToProps, HTMLAttributes, InputHTMLAttributes } from "vue";
|
|
3
|
+
import { type SuggestionsDisplayProps } from "../../composables/useDisplayForReka.js";
|
|
4
|
+
import type { PopupConstrainToProps } from "../../types/index.js";
|
|
5
|
+
declare const __VLS_export: <TSuggestion extends NonNullable<AcceptableValue>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
6
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<(SuggestionsDisplayProps<TSuggestion> & PopupConstrainToProps & {
|
|
7
|
+
id?: string;
|
|
8
|
+
border?: boolean;
|
|
9
|
+
to?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Validates the input, return true if valid, otherwise return an error message.
|
|
12
|
+
*
|
|
13
|
+
* If the input is invalid, modelValue is not updated. Empty inputs are visually valid, but they cannot trigger saves or or any setting of modelValue.
|
|
14
|
+
*
|
|
15
|
+
* If restrictToSuggestions is true, the input will be invalid if there is no exact match.
|
|
16
|
+
*
|
|
17
|
+
* `save` will not be emitted when the input is invalid.
|
|
18
|
+
*
|
|
19
|
+
* To show an error message, return a string from the function.
|
|
20
|
+
*/
|
|
21
|
+
isValid?: (searchTerm: string) => true | string;
|
|
22
|
+
suggestions: TSuggestion[];
|
|
23
|
+
/** Shown in the popup when the search term is valid, not empty, not already selected, there are no suggestions, and restrictToSuggestions is false. Defaults to undefined. */
|
|
24
|
+
emptyLabel?: string;
|
|
25
|
+
/** The popup can't be styled via the regular class attr because it's teleported. You can also pass any reka ComboboxContent options. */
|
|
26
|
+
contentProps?: {
|
|
27
|
+
class?: string;
|
|
28
|
+
to?: string;
|
|
29
|
+
} & HTMLAttributes & ComboboxContentProps & EmitsToProps<ComboboxContentEmits>;
|
|
30
|
+
/** Disables the filter. */
|
|
31
|
+
ignoreFilter?: boolean;
|
|
32
|
+
/** If false, modelValue is set to the search term (so long as it's valid). */
|
|
33
|
+
restrictToSuggestions?: boolean;
|
|
34
|
+
/** Input attributes or reka-ui ComboboxInput props. */
|
|
35
|
+
inputProps?: Omit<InputHTMLAttributes, "class"> & {
|
|
36
|
+
class?: string;
|
|
37
|
+
} & HTMLAttributes & ComboboxInputProps & EmitsToProps<ComboboxInputEmits>;
|
|
38
|
+
} & {
|
|
39
|
+
modelValue?: TSuggestion;
|
|
40
|
+
open?: boolean;
|
|
41
|
+
searchTerm?: string;
|
|
42
|
+
loading?: boolean;
|
|
43
|
+
}) & {
|
|
44
|
+
"onUpdate:modelValue"?: ((value: TSuggestion) => any) | undefined;
|
|
45
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
46
|
+
onSave?: ((value: string) => any) | undefined;
|
|
47
|
+
"onUpdate:searchTerm"?: ((value: string) => any) | undefined;
|
|
48
|
+
"onUpdate:loading"?: ((value: boolean) => any) | undefined;
|
|
49
|
+
onNew?: ((value: string) => any) | undefined;
|
|
50
|
+
}> & (typeof globalThis extends {
|
|
51
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
52
|
+
} ? P : {});
|
|
53
|
+
expose: (exposed: {}) => void;
|
|
54
|
+
attrs: any;
|
|
55
|
+
slots: {
|
|
56
|
+
'loading-indicator'?: (props: {}) => any;
|
|
57
|
+
} & {
|
|
58
|
+
trigger?: (props: {
|
|
59
|
+
open: boolean;
|
|
60
|
+
}) => any;
|
|
61
|
+
} & {
|
|
62
|
+
toggle?: (props: {
|
|
63
|
+
isOpen: boolean;
|
|
64
|
+
}) => any;
|
|
65
|
+
} & {
|
|
66
|
+
header?: (props: {
|
|
67
|
+
class: string;
|
|
68
|
+
filtered: TSuggestion[];
|
|
69
|
+
isShowingEmptyLabel: boolean;
|
|
70
|
+
}) => any;
|
|
71
|
+
} & {
|
|
72
|
+
invalid?: (props: {
|
|
73
|
+
searchTerm: string;
|
|
74
|
+
errorMessage: string;
|
|
75
|
+
id: string;
|
|
76
|
+
role: string;
|
|
77
|
+
}) => any;
|
|
78
|
+
} & {
|
|
79
|
+
suggestions?: (props: {
|
|
80
|
+
filtered: TSuggestion[];
|
|
81
|
+
display: (value: TSuggestion, options?: {
|
|
82
|
+
isForEmit?: boolean;
|
|
83
|
+
}) => string;
|
|
84
|
+
searchTerm: string;
|
|
85
|
+
}) => any;
|
|
86
|
+
} & {
|
|
87
|
+
'suggestion-icon'?: (props: {
|
|
88
|
+
suggestion: Exclude<TSuggestion, any[]>;
|
|
89
|
+
}) => any;
|
|
90
|
+
} & {
|
|
91
|
+
suggestion?: (props: {
|
|
92
|
+
suggestion: Exclude<TSuggestion, any[]>;
|
|
93
|
+
suggestionText: string;
|
|
94
|
+
}) => any;
|
|
95
|
+
};
|
|
96
|
+
emit: {
|
|
97
|
+
(e: "save", value: string): void;
|
|
98
|
+
(e: "new", value: string): void;
|
|
99
|
+
} & (((event: "update:modelValue", value: TSuggestion) => void) & ((event: "update:open", value: boolean) => void) & ((event: "update:searchTerm", value: string) => void) & ((event: "update:loading", value: boolean) => void));
|
|
100
|
+
}>) => import("vue").VNode & {
|
|
101
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
102
|
+
};
|
|
103
|
+
declare const _default: typeof __VLS_export;
|
|
104
|
+
export default _default;
|
|
105
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
106
|
+
[K in keyof T]: T[K];
|
|
107
|
+
} : {
|
|
108
|
+
[K in keyof T as K]: T[K];
|
|
109
|
+
}) & {};
|