@witchcraft/ui 0.3.24 → 0.4.0-beta.1
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/runtime/assets/animations.css +1 -1
- package/dist/runtime/assets/locales/en.json +2 -0
- package/dist/runtime/assets/utils.css +1 -1
- package/dist/runtime/build/WitchcraftUiResolver.js +1 -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} +5 -4
- 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} +5 -4
- 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} +38 -50
- 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} +44 -28
- 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 +25 -3
- package/dist/runtime/helpers/NotificationHandler.js +5 -9
- 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 +43 -43
- package/src/runtime/assets/animations.css +5 -5
- package/src/runtime/assets/locales/en.json +2 -0
- package/src/runtime/assets/utils.css +43 -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} +24 -9
- package/src/runtime/components/{LibNotifications/LibNotification.vue → WNotifications/WNotification.vue} +46 -66
- package/src/runtime/components/WNotifications/WNotifications.stories.ts +139 -0
- package/src/runtime/components/{LibNotifications/LibNotifications.vue → WNotifications/WNotifications.vue} +60 -40
- 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 +26 -11
- 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 -127
- 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
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
contenteditable=false is because of storybook, it's shortcuts interfere when not using real input elements
|
|
5
5
|
-->
|
|
6
6
|
<div
|
|
7
|
-
:
|
|
8
|
-
|
|
7
|
+
:class="twMerge(`
|
|
8
|
+
recorder
|
|
9
9
|
flex items-center
|
|
10
10
|
gap-2
|
|
11
11
|
px-2
|
|
@@ -13,12 +13,11 @@
|
|
|
13
13
|
focus-outline-no-offset
|
|
14
14
|
rounded-sm
|
|
15
15
|
`,
|
|
16
|
-
border
|
|
16
|
+
border && `
|
|
17
17
|
border
|
|
18
18
|
border-neutral-500
|
|
19
19
|
focus:border-accent-500
|
|
20
20
|
`,
|
|
21
|
-
|
|
22
21
|
(disabled || readonly) && `
|
|
23
22
|
text-neutral-400
|
|
24
23
|
dark:text-neutral-600
|
|
@@ -30,37 +29,47 @@
|
|
|
30
29
|
dark:border-neutral-600
|
|
31
30
|
`,
|
|
32
31
|
($attrs as any).class)"
|
|
33
|
-
:aria-disabled="disabled"
|
|
34
32
|
:aria-readonly="readonly"
|
|
35
33
|
:tabindex="disabled ? -1 : 0"
|
|
36
34
|
:title="recording ? recordingTitle : tempValue"
|
|
37
35
|
contenteditable="false"
|
|
36
|
+
v-bind="{ ...$attrs, class: undefined }"
|
|
37
|
+
role="button"
|
|
38
|
+
:aria-pressed="recording"
|
|
39
|
+
:aria-disabled="disabled"
|
|
38
40
|
ref="recorderEl"
|
|
39
|
-
v-bind="{ ...ariaLabel, ...$attrs, class: undefined }"
|
|
40
41
|
@blur="handleBlurRecorder($event)"
|
|
41
|
-
@
|
|
42
|
-
@keydown.space.prevent="handleClickRecorder($event, true)"
|
|
42
|
+
@keydown.space.prevent.capture="handlePointerdownRecorder($event, true)"
|
|
43
43
|
>
|
|
44
|
-
|
|
44
|
+
<span
|
|
45
|
+
class="sr-only"
|
|
46
|
+
aria-live="polite"
|
|
47
|
+
>
|
|
48
|
+
{{ recording ? (recordingTitle || t('recorder.recording')) : '' }}
|
|
49
|
+
</span>
|
|
45
50
|
<div
|
|
46
|
-
:class="twMerge(`
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
:class="twMerge(`
|
|
52
|
+
recorder--indicator
|
|
53
|
+
inline-block
|
|
54
|
+
bg-red-700
|
|
55
|
+
rounded-full
|
|
56
|
+
w-[1em]
|
|
57
|
+
h-[1em]
|
|
58
|
+
shrink-0
|
|
59
|
+
`,
|
|
55
60
|
recording && `
|
|
56
61
|
animate-blinkInf
|
|
57
62
|
bg-red-500
|
|
58
63
|
`,
|
|
59
64
|
(disabled || readonly) && `
|
|
60
65
|
bg-neutral-500
|
|
66
|
+
`,
|
|
67
|
+
!(disabled || readonly) && `
|
|
68
|
+
hover:bg-red-500
|
|
61
69
|
`
|
|
62
70
|
)"
|
|
63
71
|
ref="recorderIndicatorEl"
|
|
72
|
+
@pointerdown.capture.prevent="handlePointerdownRecorder($event)"
|
|
64
73
|
/>
|
|
65
74
|
<div class="recorder--value before:content-vertical-holder truncate">
|
|
66
75
|
{{ recording
|
|
@@ -72,15 +81,16 @@
|
|
|
72
81
|
|
|
73
82
|
<script setup lang="ts">
|
|
74
83
|
import { keys } from "@alanscodelog/utils/keys"
|
|
75
|
-
import {
|
|
84
|
+
import type { HTMLAttributes } from "vue"
|
|
85
|
+
import { computed, onBeforeUnmount, onMounted, ref, useAttrs, watch, watchPostEffect } from "vue"
|
|
76
86
|
|
|
77
|
-
import { useAriaLabel } from "../../composables/useAriaLabel.js"
|
|
78
87
|
import { useInjectedI18n } from "../../composables/useInjectedI18n.js"
|
|
88
|
+
import type { BaseInteractiveProps, TailwindClassProp } from "../../types/index.js"
|
|
79
89
|
import { twMerge } from "../../utils/twMerge.js"
|
|
80
|
-
|
|
90
|
+
|
|
81
91
|
|
|
82
92
|
defineOptions({
|
|
83
|
-
name: "
|
|
93
|
+
name: "WRecorder",
|
|
84
94
|
inheritAttrs: false
|
|
85
95
|
})
|
|
86
96
|
const t = useInjectedI18n()
|
|
@@ -88,18 +98,40 @@ const t = useInjectedI18n()
|
|
|
88
98
|
const emits = defineEmits<{
|
|
89
99
|
/** Recorder is blurred */
|
|
90
100
|
(e: "recorder:blur", $event: FocusEvent): void
|
|
91
|
-
/** Recorder
|
|
92
|
-
(e: "recorder:
|
|
101
|
+
/** Recorder pointerdown event. The component's indicator and recorder elements are passed to help filter out those clicks. */
|
|
102
|
+
(e: "recorder:pointerdown", { event, indicator, input }: { event: MouseEvent | KeyboardEvent, indicator: HTMLElement, input: HTMLInputElement }): void
|
|
93
103
|
/* User presses enter. Not emitted when multiple values are used. */
|
|
94
104
|
(e: "focus:parent"): void
|
|
95
105
|
}>()
|
|
96
|
-
|
|
97
|
-
const
|
|
106
|
+
|
|
107
|
+
const $attrs = useAttrs()
|
|
108
|
+
|
|
109
|
+
const props = withDefaults(defineProps<
|
|
110
|
+
& /** @vue-ignore */ Omit<HTMLAttributes, "class">
|
|
111
|
+
& /** @vue-ignore */ TailwindClassProp
|
|
112
|
+
& BaseInteractiveProps
|
|
113
|
+
& {
|
|
114
|
+
border?: boolean
|
|
115
|
+
/** A value to display while recording, if none given the i18n `recorder.recording` key is used. */
|
|
116
|
+
recordingValue?: string
|
|
117
|
+
/** A title to display on the input div while recording. Is also used as the aria-description. */
|
|
118
|
+
recordingTitle?: string
|
|
119
|
+
/**
|
|
120
|
+
* The recorder object is a series of event listeners to attach to the input div while recording is started. If you need to bind directly to the element, see the `binders` prop.
|
|
121
|
+
*
|
|
122
|
+
* The listeners are then unbound when recording is set to false again.
|
|
123
|
+
*
|
|
124
|
+
* Note that the component does not handle the setting of `recording` (unless the component is disabled), `modelValue`, or `recordingValue` at all and has no mechanism for cancelling a recording. It is left to the recorder listeners and any `recorder:*` handlers to determine what to do.
|
|
125
|
+
*/
|
|
126
|
+
recorder?: undefined | Record<string, any>
|
|
127
|
+
/** This provides a way to manually attach/remove event listeners to/from the element. It is an alternative to the `recorder` prop, see it for more details. Both cannot be specified at the same time. */
|
|
128
|
+
binders?: undefined | { bind: (el: HTMLElement) => void, unbind: (el: HTMLElement) => void }
|
|
129
|
+
}
|
|
130
|
+
>(), {
|
|
98
131
|
recordingTitle: "",
|
|
99
|
-
id: undefined,
|
|
100
132
|
binders: undefined,
|
|
101
133
|
recorder: undefined,
|
|
102
|
-
|
|
134
|
+
border: true
|
|
103
135
|
})
|
|
104
136
|
/**
|
|
105
137
|
* Puts the element into recording mode if true. See {@link props.recorder}.
|
|
@@ -109,12 +141,12 @@ const recording = defineModel<boolean>("recording", { required: false, default:
|
|
|
109
141
|
/** The final value of the recorder. For intermediate values while recording, pass a recorder and set an appropriate recording value. */
|
|
110
142
|
const modelValue = defineModel<string>({ required: true })
|
|
111
143
|
|
|
112
|
-
const recorderEl = ref<
|
|
144
|
+
const recorderEl = ref<HTMLElement | null>(null)
|
|
113
145
|
const recorderIndicatorEl = ref<HTMLElement | null>(null)
|
|
114
146
|
const canEdit = computed(() => !props.disabled && !props.readonly)
|
|
115
147
|
const tempValue = ref(modelValue.value)
|
|
116
148
|
|
|
117
|
-
watch([() => props.binders, () => props.
|
|
149
|
+
watch([() => props.binders, () => props.recorder], () => {
|
|
118
150
|
if (recording.value) {
|
|
119
151
|
throw new Error("Component was not designed to allow swapping out of binders/recorders while recording")
|
|
120
152
|
}
|
|
@@ -123,7 +155,6 @@ watch([() => props.binders, () => props.binders], () => {
|
|
|
123
155
|
watch(modelValue, () => {
|
|
124
156
|
tempValue.value = modelValue.value
|
|
125
157
|
})
|
|
126
|
-
const ariaLabel = useAriaLabel(props)
|
|
127
158
|
|
|
128
159
|
const boundListeners: Record<string, any> = {}
|
|
129
160
|
let isBound = false
|
|
@@ -138,12 +169,13 @@ const unbindListeners = (): void => {
|
|
|
138
169
|
}
|
|
139
170
|
}
|
|
140
171
|
if (props.binders && recorderEl.value) {
|
|
141
|
-
props.binders.unbind(recorderEl.value
|
|
172
|
+
props.binders.unbind(recorderEl.value)
|
|
142
173
|
}
|
|
143
174
|
}
|
|
175
|
+
|
|
144
176
|
const bindListeners = (): void => {
|
|
145
177
|
if (!props.recorder && !props.binders) {
|
|
146
|
-
throw new Error("
|
|
178
|
+
throw new Error("Recording is true but no recorder or binders props was passed")
|
|
147
179
|
}
|
|
148
180
|
if (props.recorder && props.binders) {
|
|
149
181
|
throw new Error("Recording is true and was passed both a recorder and a binders prop. Both cannot be used at the same time.")
|
|
@@ -156,7 +188,7 @@ const bindListeners = (): void => {
|
|
|
156
188
|
}
|
|
157
189
|
}
|
|
158
190
|
if (props.binders && recorderEl.value) {
|
|
159
|
-
props.binders.bind(recorderEl.value
|
|
191
|
+
props.binders.bind(recorderEl.value)
|
|
160
192
|
}
|
|
161
193
|
}
|
|
162
194
|
|
|
@@ -182,6 +214,7 @@ watchPostEffect(() => {
|
|
|
182
214
|
onBeforeUnmount(() => {
|
|
183
215
|
unbindListeners()
|
|
184
216
|
})
|
|
217
|
+
|
|
185
218
|
onMounted(() => {
|
|
186
219
|
if (recording.value) {
|
|
187
220
|
bindListeners()
|
|
@@ -195,7 +228,7 @@ const handleBlurRecorder = (e: FocusEvent): void => {
|
|
|
195
228
|
}
|
|
196
229
|
}
|
|
197
230
|
|
|
198
|
-
const
|
|
231
|
+
const handlePointerdownRecorder = (e: MouseEvent | KeyboardEvent, isSpaceKey: boolean = false): void => {
|
|
199
232
|
if (!canEdit.value) return
|
|
200
233
|
if (!recording.value) {
|
|
201
234
|
recorderEl.value?.focus()
|
|
@@ -203,40 +236,8 @@ const handleClickRecorder = (e: MouseEvent | KeyboardEvent, isSpaceKey: boolean
|
|
|
203
236
|
// toggle if clicking on the recording indicator, otherwise only allow starting recording, so if needed, clicks can be recorded
|
|
204
237
|
if (props.recorder || props.binders) {
|
|
205
238
|
if (isSpaceKey) { return }
|
|
206
|
-
emits("recorder:
|
|
239
|
+
emits("recorder:pointerdown", { event: e as MouseEvent, indicator: recorderIndicatorEl.value! as HTMLElement, input: recorderEl.value! as HTMLInputElement })
|
|
207
240
|
}
|
|
208
241
|
}
|
|
209
242
|
</script>
|
|
210
243
|
|
|
211
|
-
<script lang="ts">
|
|
212
|
-
type RealProps
|
|
213
|
-
= & LinkableByIdProps
|
|
214
|
-
& BaseInteractiveProps
|
|
215
|
-
& LabelProps
|
|
216
|
-
& {
|
|
217
|
-
border?: boolean
|
|
218
|
-
/** A value to display while recording, if none given the i18n `recorder.recording` key is used. */
|
|
219
|
-
recordingValue?: string
|
|
220
|
-
/** A title to display on the input div while recording. Is also used as the aria-description. */
|
|
221
|
-
recordingTitle?: string
|
|
222
|
-
/**
|
|
223
|
-
* The recorder object is a series of event listeners to attach to the input div while recording is started. If you need to bind directly to the element, see the `binders` prop.
|
|
224
|
-
*
|
|
225
|
-
* The listeners are then unbound when recording is set to false again.
|
|
226
|
-
*
|
|
227
|
-
* Note that the component does not handle the setting of `recording` (unless the component is disabled), `modelValue`, or `recordingValue` at all and has no mechanism for cancelling a recording. It is left to the recorder listeners and any `recorder:*` handlers to determine what to do.
|
|
228
|
-
*/
|
|
229
|
-
recorder?: undefined | Record<string, any>
|
|
230
|
-
/** This provides a way to manually attach/remove event listeners to/from the element. It is an alternative to the `recorder` prop, see it for more details. Both cannot be specified at the same time. */
|
|
231
|
-
binders?: undefined | { bind: (el: HTMLElement) => void, unbind: (el: HTMLElement) => void }
|
|
232
|
-
/** The id of the element. If not provided, the id will be generated automatically. */
|
|
233
|
-
id?: string
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
interface Props
|
|
237
|
-
extends
|
|
238
|
-
/** @vue-ignore */
|
|
239
|
-
Partial<Omit<HTMLAttributes, "class"> & TailwindClassProp>,
|
|
240
|
-
RealProps
|
|
241
|
-
{ }
|
|
242
|
-
</script>
|
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
-
:id="id"
|
|
4
3
|
tabindex="-1"
|
|
5
4
|
:class="twMerge(
|
|
6
5
|
(showOutline ? 'group outlined outlined-visible' : '[&_*]:outline-hidden'),
|
|
7
6
|
darkMode && ' dark',
|
|
8
|
-
|
|
7
|
+
wrapperAttrs?.class
|
|
9
8
|
)"
|
|
10
|
-
v-bind="{
|
|
9
|
+
v-bind="{
|
|
10
|
+
id: 'app',
|
|
11
|
+
...wrapperAttrs,
|
|
12
|
+
class: undefined
|
|
13
|
+
}"
|
|
11
14
|
:ref="handleRef"
|
|
12
15
|
>
|
|
13
16
|
<!-- id root is useful for teleports, so they are at the topmost level where they can still be styled -->
|
|
14
17
|
<!-- See TestControls for why the margins here -->
|
|
15
18
|
<div
|
|
16
19
|
id="root"
|
|
17
|
-
v-bind="{ ...$attrs
|
|
20
|
+
v-bind="{ ...$attrs, class: undefined }"
|
|
18
21
|
:class="twMerge(`
|
|
19
|
-
dark:bg-
|
|
20
|
-
dark:text-
|
|
21
|
-
bg-
|
|
22
|
-
text-
|
|
22
|
+
dark:bg-neutral-900
|
|
23
|
+
dark:text-white
|
|
24
|
+
bg-neutral-50
|
|
25
|
+
text-black
|
|
23
26
|
`,
|
|
24
27
|
testWrapperMode && `
|
|
25
28
|
px-10
|
|
@@ -30,7 +33,7 @@
|
|
|
30
33
|
flex
|
|
31
34
|
flex-col
|
|
32
35
|
`,
|
|
33
|
-
($attrs as any).
|
|
36
|
+
($attrs as any).class)"
|
|
34
37
|
>
|
|
35
38
|
<TestControls
|
|
36
39
|
v-if="testWrapperMode"
|
|
@@ -48,10 +51,10 @@
|
|
|
48
51
|
<script setup lang="ts">
|
|
49
52
|
import { unreachable } from "@alanscodelog/utils/unreachable"
|
|
50
53
|
import type { Theme } from "metamorphosis"
|
|
51
|
-
import {
|
|
54
|
+
import type { ComponentPublicInstance, HTMLAttributes } from "vue"
|
|
55
|
+
import { computed, onBeforeUnmount, onMounted, ref, toRaw, useAttrs } from "vue"
|
|
52
56
|
|
|
53
57
|
import { useAccesibilityOutline } from "../../composables/useAccesibilityOutline.js"
|
|
54
|
-
import { useDivideAttrs } from "../../composables/useDivideAttrs.js"
|
|
55
58
|
import { useNotificationHandler } from "../../composables/useNotificationHandler.js"
|
|
56
59
|
import { useSetupDarkMode } from "../../composables/useSetupDarkMode.js"
|
|
57
60
|
import { useSetupI18n } from "../../composables/useSetupI18n.js"
|
|
@@ -59,19 +62,19 @@ import { useSetupLocale } from "../../composables/useSetupLocale.js"
|
|
|
59
62
|
import { useShowDevOnlyKey } from "../../composables/useShowDevOnlyKey.js"
|
|
60
63
|
import { NotificationHandler } from "../../helpers/NotificationHandler.js"
|
|
61
64
|
import { theme as defaultTheme } from "../../theme.js"
|
|
65
|
+
import type { TailwindClassProp } from "../../types/index.js"
|
|
62
66
|
import { twMerge } from "../../utils/twMerge.js"
|
|
63
|
-
import Notifications from "../LibNotifications/LibNotifications.vue"
|
|
64
67
|
import TestControls from "../TestControls/TestControls.vue"
|
|
68
|
+
import Notifications from "../WNotifications/WNotifications.vue"
|
|
65
69
|
|
|
66
|
-
const $attrs = useDivideAttrs(["wrapper"])
|
|
67
70
|
|
|
68
71
|
defineOptions({ name: "Root", inheritAttrs: false, suspensible: false })
|
|
72
|
+
const $attrs = useAttrs()
|
|
69
73
|
const props = withDefaults(defineProps<{
|
|
70
74
|
theme?: Theme
|
|
71
75
|
outline?: boolean
|
|
72
76
|
forceOutline?: boolean
|
|
73
77
|
testWrapperMode?: boolean
|
|
74
|
-
id?: string
|
|
75
78
|
/** You can set a ref to the root element by passing :getRef="_ => el = _" */
|
|
76
79
|
getRef?: (el: HTMLElement | null) => void
|
|
77
80
|
/** True by default, should be passed import.meta.client if using nuxt, or false when running server side. */
|
|
@@ -79,12 +82,12 @@ const props = withDefaults(defineProps<{
|
|
|
79
82
|
useBuiltinTranslations?: boolean
|
|
80
83
|
useNotifications?: boolean
|
|
81
84
|
notificationHandler?: NotificationHandler
|
|
85
|
+
wrapperAttrs?: Omit<HTMLAttributes, "class"> & TailwindClassProp
|
|
82
86
|
}>(), {
|
|
83
87
|
theme: undefined,
|
|
84
88
|
testWrapperMode: false,
|
|
85
89
|
outline: true,
|
|
86
90
|
forceOutline: false,
|
|
87
|
-
id: "app",
|
|
88
91
|
getRef: undefined,
|
|
89
92
|
isClientSide: true,
|
|
90
93
|
useBuiltinTranslations: true,
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
-
import type {
|
|
2
|
+
import type { StoryObj } from "@storybook/vue3"
|
|
3
|
+
|
|
4
|
+
import WSimpleInput from "./WSimpleInput.vue"
|
|
3
5
|
|
|
4
6
|
import * as components from "../index.js"
|
|
5
7
|
|
|
6
8
|
const meta = {
|
|
7
|
-
component:
|
|
9
|
+
component: WSimpleInput,
|
|
8
10
|
title: "Components/Input",
|
|
9
11
|
args: {
|
|
10
12
|
modelValue: "Value",
|
|
11
13
|
placeholder: "Placeholder"
|
|
12
14
|
}
|
|
13
|
-
}
|
|
15
|
+
}
|
|
14
16
|
|
|
15
17
|
export default meta
|
|
16
|
-
type Story = StoryObj<typeof components.
|
|
18
|
+
type Story = StoryObj<typeof components.WSimpleInput>
|
|
17
19
|
|
|
18
20
|
/** Input */
|
|
19
21
|
export const Primary: Story = {
|
|
@@ -25,10 +27,10 @@ export const Primary: Story = {
|
|
|
25
27
|
// eslint-disable-next-line no-console
|
|
26
28
|
setup: () => ({ args, test: () => console.log("Enter") }),
|
|
27
29
|
template: `
|
|
28
|
-
<
|
|
30
|
+
<WSimpleInput
|
|
29
31
|
@keydown="test"
|
|
30
|
-
class="m-2" v-bind="args" v-model="args.modelValue" ></
|
|
31
|
-
<
|
|
32
|
+
class="m-2" v-bind="args" v-model="args.modelValue" ></WSimpleInput>
|
|
33
|
+
<WSimpleInput class="m-2" v-bind="{...args, modelValue:''}" ></WSimpleInput>
|
|
32
34
|
`
|
|
33
35
|
})
|
|
34
36
|
}
|
|
@@ -41,14 +43,11 @@ export const InsideAFlexbox: Story = {
|
|
|
41
43
|
template: `
|
|
42
44
|
Inside a flexbox:
|
|
43
45
|
<div class="flex flex-wrap">
|
|
44
|
-
<
|
|
46
|
+
<WSimpleInput v-bind="args" v-model="args.modelValue"></WSimpleInput>
|
|
45
47
|
<div class="border-1 border-danger-500 flex-1 whitespace-nowrap">Flex Grow: 1</div>
|
|
46
48
|
</div>
|
|
47
49
|
`
|
|
48
|
-
})
|
|
49
|
-
args: {
|
|
50
|
-
stretch: true
|
|
51
|
-
}
|
|
50
|
+
})
|
|
52
51
|
}
|
|
53
52
|
|
|
54
53
|
export const Disabled = {
|
package/src/runtime/components/{LibSimpleInput/LibSimpleInput.vue → WSimpleInput/WSimpleInput.vue}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<input
|
|
3
|
-
:id="
|
|
4
|
-
:class="twMerge(`
|
|
3
|
+
:id="finalId"
|
|
4
|
+
:class="!unstyle && twMerge(`
|
|
5
5
|
simple-input
|
|
6
6
|
flex-1
|
|
7
7
|
grow-[999999]
|
|
@@ -70,12 +70,11 @@
|
|
|
70
70
|
)"
|
|
71
71
|
:data-border="border"
|
|
72
72
|
:data-invalid="!valid"
|
|
73
|
-
:type="type"
|
|
74
|
-
:placeholder="placeholder"
|
|
75
|
-
:disabled="disabled"
|
|
76
|
-
:readonly="readonly"
|
|
77
73
|
v-model="modelValue"
|
|
78
|
-
v-bind="{
|
|
74
|
+
v-bind="{
|
|
75
|
+
...$attrs,
|
|
76
|
+
class: undefined
|
|
77
|
+
}"
|
|
79
78
|
@keydown="handleKeydown"
|
|
80
79
|
@input="emit('input', $event as InputEvent)"
|
|
81
80
|
>
|
|
@@ -84,27 +83,41 @@
|
|
|
84
83
|
<script lang="ts" setup generic="T">
|
|
85
84
|
import { type InputHTMLAttributes, useAttrs } from "vue"
|
|
86
85
|
|
|
87
|
-
import {
|
|
86
|
+
import { useFallbackId } from "../../composables/useFallbackId.js"
|
|
88
87
|
import { usePreHydrationValue } from "../../composables/usePreHydrationValue.js"
|
|
89
88
|
import { hasModifiers } from "../../helpers/hasModifiers.js"
|
|
89
|
+
import type { BaseInteractiveProps, TailwindClassProp } from "../../types/index.js"
|
|
90
90
|
import { twMerge } from "../../utils/twMerge.js"
|
|
91
|
-
import { type BaseInteractiveProps, getFallbackId, type LabelProps, type LinkableByIdProps, type TailwindClassProp } from "../shared/props.js"
|
|
92
91
|
|
|
93
92
|
defineOptions({
|
|
94
|
-
name: "
|
|
93
|
+
name: "WSimpleInput",
|
|
95
94
|
inheritAttrs: false
|
|
96
95
|
})
|
|
97
96
|
|
|
98
|
-
const fallbackId = getFallbackId()
|
|
99
97
|
|
|
100
|
-
const props = withDefaults(defineProps<
|
|
98
|
+
const props = withDefaults(defineProps<
|
|
99
|
+
& /** @vue-ignore */ Omit<
|
|
100
|
+
InputHTMLAttributes,
|
|
101
|
+
| "class" | "readonly" | "disabled" | "onSubmit" | "onInput"
|
|
102
|
+
// https://github.com/vuejs/core/pull/14237
|
|
103
|
+
| "autocomplete"
|
|
104
|
+
>
|
|
105
|
+
& /** @vue-ignore */ TailwindClassProp
|
|
106
|
+
& Pick<BaseInteractiveProps, "unstyle" | "border">
|
|
107
|
+
& {
|
|
108
|
+
id?: string
|
|
109
|
+
label?: string
|
|
110
|
+
valid?: boolean
|
|
111
|
+
}
|
|
112
|
+
>(), {
|
|
101
113
|
id: "",
|
|
102
114
|
placeholder: "",
|
|
103
115
|
valid: true,
|
|
104
116
|
label: "",
|
|
105
117
|
type: undefined,
|
|
106
|
-
|
|
118
|
+
border: true
|
|
107
119
|
})
|
|
120
|
+
const finalId = useFallbackId(props)
|
|
108
121
|
|
|
109
122
|
const modelValue = defineModel<T>({ required: true })
|
|
110
123
|
|
|
@@ -114,42 +127,12 @@ const emit = defineEmits<{
|
|
|
114
127
|
(e: "input", val: InputEvent): void
|
|
115
128
|
}>()
|
|
116
129
|
const $attrs = useAttrs()
|
|
117
|
-
const ariaLabel = useAriaLabel(props, fallbackId)
|
|
118
130
|
|
|
119
131
|
function handleKeydown(e: KeyboardEvent) {
|
|
120
132
|
if (e.key === "Enter" && !hasModifiers(e)) {
|
|
121
133
|
emit("submit", modelValue.value)
|
|
122
134
|
}
|
|
123
135
|
}
|
|
124
|
-
usePreHydrationValue(
|
|
136
|
+
usePreHydrationValue(finalId, modelValue)
|
|
125
137
|
</script>
|
|
126
138
|
|
|
127
|
-
<script lang="ts">
|
|
128
|
-
type RealProps
|
|
129
|
-
= & LinkableByIdProps
|
|
130
|
-
& LabelProps
|
|
131
|
-
& BaseInteractiveProps
|
|
132
|
-
& {
|
|
133
|
-
placeholder?: InputHTMLAttributes["placeholder"]
|
|
134
|
-
disabled?: InputHTMLAttributes["disabled"]
|
|
135
|
-
id?: InputHTMLAttributes["id"]
|
|
136
|
-
type?: InputHTMLAttributes["type"]
|
|
137
|
-
valid?: boolean
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
interface Props
|
|
141
|
-
extends
|
|
142
|
-
/** @vue-ignore */
|
|
143
|
-
Partial<Omit<
|
|
144
|
-
InputHTMLAttributes,
|
|
145
|
-
| "class"
|
|
146
|
-
| "readonly"
|
|
147
|
-
| "disabled"
|
|
148
|
-
| "onSubmit"
|
|
149
|
-
| "onInput"
|
|
150
|
-
// https://github.com/vuejs/core/pull/14237
|
|
151
|
-
| "autocomplete"
|
|
152
|
-
> & TailwindClassProp>,
|
|
153
|
-
RealProps
|
|
154
|
-
{}
|
|
155
|
-
</script>
|