@rotki/ui-library 2.26.1 → 3.0.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 +36 -15
- package/dist/components/accordions/accordion/RuiAccordion.js.map +1 -1
- package/dist/components/accordions/accordion/RuiAccordion.vue.d.ts +0 -4
- package/dist/components/accordions/accordion/RuiAccordion.vue_vue_type_script_setup_true_lang.js +6 -7
- package/dist/components/accordions/accordion/RuiAccordion.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/accordions/accordions/RuiAccordions.js.map +1 -1
- package/dist/components/accordions/accordions/RuiAccordions.vue_vue_type_script_setup_true_lang.js +15 -2
- package/dist/components/accordions/accordions/RuiAccordions.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/alerts/RuiAlert.js.map +1 -1
- package/dist/components/alerts/RuiAlert.vue_vue_type_script_setup_true_lang.js +43 -212
- package/dist/components/alerts/RuiAlert.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/avatars/RuiAvatar.js.map +1 -1
- package/dist/components/avatars/RuiAvatar.vue_vue_type_script_setup_true_lang.js +21 -31
- package/dist/components/avatars/RuiAvatar.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/avatars/RuiAvatarGroup.js.map +1 -1
- package/dist/components/avatars/RuiAvatarGroup.vue.d.ts +6 -0
- package/dist/components/avatars/RuiAvatarGroup.vue_vue_type_script_setup_true_lang.js +16 -12
- package/dist/components/avatars/RuiAvatarGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/avatars/avatar-props.d.ts +16 -3
- package/dist/components/avatars/avatar-props.js +42 -5
- package/dist/components/avatars/avatar-props.js.map +1 -1
- package/dist/components/buttons/button/RuiButton.js.map +1 -1
- package/dist/components/buttons/button/RuiButton.vue.d.ts +0 -1
- package/dist/components/buttons/button/RuiButton.vue_vue_type_script_setup_true_lang.js +29 -16
- package/dist/components/buttons/button/RuiButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/buttons/button/button-props.d.ts +0 -2
- package/dist/components/buttons/button/button-props.js +5 -5
- package/dist/components/buttons/button/button-props.js.map +1 -1
- package/dist/components/buttons/button/button-styles.d.ts +4 -1
- package/dist/components/buttons/button/button-styles.js +127 -54
- package/dist/components/buttons/button/button-styles.js.map +1 -1
- package/dist/components/buttons/button-group/RuiButtonGroup.js.map +1 -1
- package/dist/components/buttons/button-group/RuiButtonGroup.vue.d.ts +8 -2
- package/dist/components/buttons/button-group/RuiButtonGroup.vue_vue_type_script_setup_true_lang.js +65 -96
- package/dist/components/buttons/button-group/RuiButtonGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/buttons/button-group/button-group-context.d.ts +28 -0
- package/dist/components/buttons/button-group/button-group-context.js +22 -0
- package/dist/components/buttons/button-group/button-group-context.js.map +1 -0
- package/dist/components/calendar/RuiCalendar.js.map +1 -1
- package/dist/components/calendar/RuiCalendar.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/components/calendar/RuiCalendar.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/calendar/RuiCalendarGrid.js.map +1 -1
- package/dist/components/calendar/RuiCalendarGrid.vue_vue_type_script_setup_true_lang.js +11 -7
- package/dist/components/calendar/RuiCalendarGrid.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/calendar/RuiCalendarHeader.js.map +1 -1
- package/dist/components/calendar/RuiCalendarHeader.vue_vue_type_script_setup_true_lang.js +20 -21
- package/dist/components/calendar/RuiCalendarHeader.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/calendar/RuiCalendarMenu.js.map +1 -1
- package/dist/components/calendar/RuiCalendarMenu.vue_vue_type_script_setup_true_lang.js +16 -20
- package/dist/components/calendar/RuiCalendarMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/cards/RuiCard.js.map +1 -1
- package/dist/components/cards/RuiCard.vue.d.ts +0 -3
- package/dist/components/cards/RuiCard.vue_vue_type_script_setup_true_lang.js +31 -19
- package/dist/components/cards/RuiCard.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/cards/RuiCardHeader.js.map +1 -1
- package/dist/components/cards/RuiCardHeader.vue_vue_type_script_setup_true_lang.js +13 -25
- package/dist/components/cards/RuiCardHeader.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/chips/RuiChip.js.map +1 -1
- package/dist/components/chips/RuiChip.vue.d.ts +5 -2
- package/dist/components/chips/RuiChip.vue_vue_type_script_setup_true_lang.js +127 -78
- package/dist/components/chips/RuiChip.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/chips/chip-props.d.ts +2 -0
- package/dist/components/chips/chip-props.js +5 -3
- package/dist/components/chips/chip-props.js.map +1 -1
- package/dist/components/color-picker/RuiColorBoard.js.map +1 -1
- package/dist/components/color-picker/RuiColorBoard.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/components/color-picker/RuiColorBoard.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/color-picker/RuiColorHue.js.map +1 -1
- package/dist/components/color-picker/RuiColorHue.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/color-picker/RuiColorHue.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/color-picker/RuiColorInput.js.map +1 -1
- package/dist/components/color-picker/RuiColorInput.vue_vue_type_script_setup_true_lang.js +38 -27
- package/dist/components/color-picker/RuiColorInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/color-picker/RuiColorPicker.js.map +1 -1
- package/dist/components/color-picker/RuiColorPicker.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/color-picker/RuiColorPicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/date-time-picker/RuiDateTimePicker.js.map +1 -1
- package/dist/components/date-time-picker/RuiDateTimePicker.vue.d.ts +3 -2
- package/dist/components/date-time-picker/RuiDateTimePicker.vue_vue_type_script_setup_true_lang.js +49 -47
- package/dist/components/date-time-picker/RuiDateTimePicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/date-time-picker/RuiDateTimePickerMenu.js.map +1 -1
- package/dist/components/date-time-picker/RuiDateTimePickerMenu.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/date-time-picker/RuiDateTimePickerMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/date-time-picker/RuiTimezoneSelect.js.map +1 -1
- package/dist/components/date-time-picker/RuiTimezoneSelect.vue.d.ts +4 -3
- package/dist/components/date-time-picker/RuiTimezoneSelect.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/components/date-time-picker/RuiTimezoneSelect.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/date-time-picker/date-time-picker-styles.d.ts +128 -219
- package/dist/components/date-time-picker/date-time-picker-styles.js +1 -2
- package/dist/components/date-time-picker/date-time-picker-styles.js.map +1 -1
- package/dist/components/date-time-picker/dayjs-setup.d.ts +12 -1
- package/dist/components/date-time-picker/dayjs-setup.js +19 -4
- package/dist/components/date-time-picker/dayjs-setup.js.map +1 -1
- package/dist/components/date-time-picker/segment-utils.d.ts +1 -2
- package/dist/components/date-time-picker/segment-utils.js +1 -2
- package/dist/components/date-time-picker/segment-utils.js.map +1 -1
- package/dist/components/date-time-picker/use-date-bounds.d.ts +1 -1
- package/dist/components/date-time-picker/use-date-bounds.js +1 -1
- package/dist/components/date-time-picker/use-date-bounds.js.map +1 -1
- package/dist/components/date-time-picker/use-date-time-selection.d.ts +1 -2
- package/dist/components/date-time-picker/use-date-time-selection.js +1 -2
- package/dist/components/date-time-picker/use-date-time-selection.js.map +1 -1
- package/dist/components/date-time-picker/utils.d.ts +0 -1
- package/dist/components/date-time-picker/utils.js +1 -2
- package/dist/components/date-time-picker/utils.js.map +1 -1
- package/dist/components/forms/auto-complete/RuiAutoComplete.js.map +1 -1
- package/dist/components/forms/auto-complete/RuiAutoComplete.vue.d.ts +1 -68
- package/dist/components/forms/auto-complete/RuiAutoComplete.vue_vue_type_script_setup_true_lang.js +184 -180
- package/dist/components/forms/auto-complete/RuiAutoComplete.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/forms/auto-complete/RuiAutoCompleteOption.js.map +1 -1
- package/dist/components/forms/auto-complete/RuiAutoCompleteOption.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/components/forms/auto-complete/RuiAutoCompleteOption.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/forms/auto-complete/RuiAutoCompleteOptionList.js.map +1 -1
- package/dist/components/forms/auto-complete/RuiAutoCompleteOptionList.vue.d.ts +2 -0
- package/dist/components/forms/auto-complete/RuiAutoCompleteOptionList.vue_vue_type_script_setup_true_lang.js +8 -3
- package/dist/components/forms/auto-complete/RuiAutoCompleteOptionList.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/forms/auto-complete/RuiAutoCompleteSelection.js.map +1 -1
- package/dist/components/forms/auto-complete/RuiAutoCompleteSelection.vue.d.ts +4 -0
- package/dist/components/forms/auto-complete/RuiAutoCompleteSelection.vue_vue_type_script_setup_true_lang.js +24 -10
- package/dist/components/forms/auto-complete/RuiAutoCompleteSelection.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/forms/auto-complete/auto-complete-props.d.ts +66 -0
- package/dist/components/forms/auto-complete/auto-complete-styles.d.ts +128 -218
- package/dist/components/forms/auto-complete/auto-complete-styles.js +4 -2
- package/dist/components/forms/auto-complete/auto-complete-styles.js.map +1 -1
- package/dist/components/forms/category-picker/RuiCategoryPicker.js.map +1 -1
- package/dist/components/forms/category-picker/RuiCategoryPicker.vue.d.ts +3 -6
- package/dist/components/forms/category-picker/RuiCategoryPicker.vue_vue_type_script_setup_true_lang.js +106 -105
- package/dist/components/forms/category-picker/RuiCategoryPicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/forms/category-picker/category-picker-styles.d.ts +83 -232
- package/dist/components/forms/category-picker/category-picker-styles.js +20 -26
- package/dist/components/forms/category-picker/category-picker-styles.js.map +1 -1
- package/dist/components/forms/check-control-styles.d.ts +61 -2
- package/dist/components/forms/check-control-styles.js +53 -46
- package/dist/components/forms/check-control-styles.js.map +1 -1
- package/dist/components/forms/checkbox/RuiCheckbox.js.map +1 -1
- package/dist/components/forms/checkbox/RuiCheckbox.vue_vue_type_script_setup_true_lang.js +31 -18
- package/dist/components/forms/checkbox/RuiCheckbox.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/forms/checkbox/checkbox-group/RuiCheckboxGroup.js.map +1 -1
- package/dist/components/forms/checkbox/checkbox-group/RuiCheckboxGroup.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/components/forms/checkbox/checkbox-group/RuiCheckboxGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/forms/field-defaults/RuiFieldDefaults.js +7 -0
- package/dist/components/forms/field-defaults/RuiFieldDefaults.js.map +1 -0
- package/dist/components/forms/field-defaults/RuiFieldDefaults.vue.d.ts +16 -0
- package/dist/components/forms/field-defaults/RuiFieldDefaults.vue_vue_type_script_setup_true_lang.js +18 -0
- package/dist/components/forms/field-defaults/RuiFieldDefaults.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/forms/field-label/RuiFieldLabel.js +7 -0
- package/dist/components/forms/field-label/RuiFieldLabel.js.map +1 -0
- package/dist/components/forms/field-label/RuiFieldLabel.vue.d.ts +17 -0
- package/dist/components/forms/field-label/RuiFieldLabel.vue_vue_type_script_setup_true_lang.js +57 -0
- package/dist/components/forms/field-label/RuiFieldLabel.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/forms/file-upload/RuiFileUpload.js.map +1 -1
- package/dist/components/forms/file-upload/RuiFileUpload.vue.d.ts +1 -1
- package/dist/components/forms/file-upload/RuiFileUpload.vue_vue_type_script_setup_true_lang.js +39 -20
- package/dist/components/forms/file-upload/RuiFileUpload.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/forms/radio-button/radio/RuiRadio.js.map +1 -1
- package/dist/components/forms/radio-button/radio/RuiRadio.vue_vue_type_script_setup_true_lang.js +13 -14
- package/dist/components/forms/radio-button/radio/RuiRadio.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/forms/radio-button/radio-group/RuiRadioGroup.js.map +1 -1
- package/dist/components/forms/radio-button/radio-group/RuiRadioGroup.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/components/forms/radio-button/radio-group/RuiRadioGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/forms/revealable-text-field/RuiRevealableTextField.js.map +1 -1
- package/dist/components/forms/revealable-text-field/RuiRevealableTextField.vue_vue_type_script_setup_true_lang.js +6 -6
- package/dist/components/forms/revealable-text-field/RuiRevealableTextField.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/forms/select/RuiMenuSelect.js.map +1 -1
- package/dist/components/forms/select/RuiMenuSelect.vue.d.ts +3 -12
- package/dist/components/forms/select/RuiMenuSelect.vue_vue_type_script_setup_true_lang.js +50 -45
- package/dist/components/forms/select/RuiMenuSelect.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/forms/select/RuiSimpleSelect.js.map +1 -1
- package/dist/components/forms/select/RuiSimpleSelect.vue.d.ts +0 -1
- package/dist/components/forms/select/RuiSimpleSelect.vue_vue_type_script_setup_true_lang.js +13 -20
- package/dist/components/forms/select/RuiSimpleSelect.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/forms/select/menu-select-styles.d.ts +99 -221
- package/dist/components/forms/select/menu-select-styles.js +1 -4
- package/dist/components/forms/select/menu-select-styles.js.map +1 -1
- package/dist/components/forms/slider/RuiSlider.js.map +1 -1
- package/dist/components/forms/slider/RuiSlider.vue.d.ts +0 -4
- package/dist/components/forms/slider/RuiSlider.vue_vue_type_script_setup_true_lang.js +113 -90
- package/dist/components/forms/slider/RuiSlider.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/forms/slider/slider-styles.d.ts +40 -40
- package/dist/components/forms/slider/slider-styles.js +67 -109
- package/dist/components/forms/slider/slider-styles.js.map +1 -1
- package/dist/components/forms/switch/RuiSwitch.js.map +1 -1
- package/dist/components/forms/switch/RuiSwitch.vue_vue_type_script_setup_true_lang.js +32 -44
- package/dist/components/forms/switch/RuiSwitch.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/forms/text-area/RuiTextArea.js.map +1 -1
- package/dist/components/forms/text-area/RuiTextArea.vue.d.ts +3 -2
- package/dist/components/forms/text-area/RuiTextArea.vue_vue_type_script_setup_true_lang.js +120 -99
- package/dist/components/forms/text-area/RuiTextArea.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/forms/text-area/text-area-styles.d.ts +41 -115
- package/dist/components/forms/text-area/text-area-styles.js +34 -194
- package/dist/components/forms/text-area/text-area-styles.js.map +1 -1
- package/dist/components/forms/text-field/RuiTextField.js.map +1 -1
- package/dist/components/forms/text-field/RuiTextField.vue.d.ts +3 -2
- package/dist/components/forms/text-field/RuiTextField.vue_vue_type_script_setup_true_lang.js +93 -90
- package/dist/components/forms/text-field/RuiTextField.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/forms/text-field/text-field-styles.d.ts +37 -145
- package/dist/components/forms/text-field/text-field-styles.js +24 -267
- package/dist/components/forms/text-field/text-field-styles.js.map +1 -1
- package/dist/components/forms/text-input-styles.d.ts +98 -229
- package/dist/components/forms/text-input-styles.js +63 -193
- package/dist/components/forms/text-input-styles.js.map +1 -1
- package/dist/components/helpers/RuiFormTextDetail.js.map +1 -1
- package/dist/components/helpers/RuiFormTextDetail.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/helpers/RuiFormTextDetail.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/icons/RuiIcon.js.map +1 -1
- package/dist/components/icons/RuiIcon.vue_vue_type_script_setup_true_lang.js +6 -3
- package/dist/components/icons/RuiIcon.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/index.d.ts +5 -3
- package/dist/components/index.js +4 -3
- package/dist/components/loaders/RuiSkeletonBase.js.map +1 -1
- package/dist/components/loaders/RuiSkeletonBase.vue_vue_type_script_setup_true_lang.js +6 -5
- package/dist/components/loaders/RuiSkeletonBase.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/loaders/RuiSkeletonLoader.js.map +1 -1
- package/dist/components/loaders/RuiSkeletonLoader.vue_vue_type_script_setup_true_lang.js +8 -8
- package/dist/components/loaders/RuiSkeletonLoader.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/logos/RuiLogo.js.map +1 -1
- package/dist/components/logos/RuiLogo.vue.d.ts +8 -10
- package/dist/components/logos/RuiLogo.vue_vue_type_script_setup_true_lang.js +42 -43
- package/dist/components/logos/RuiLogo.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/logos/verified-logo.d.ts +17 -0
- package/dist/components/logos/verified-logo.js +36 -0
- package/dist/components/logos/verified-logo.js.map +1 -0
- package/dist/components/overlays/badge/RuiBadge.js.map +1 -1
- package/dist/components/overlays/badge/RuiBadge.vue_vue_type_script_setup_true_lang.js +75 -47
- package/dist/components/overlays/badge/RuiBadge.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/overlays/dialog/RuiDialog.js.map +1 -1
- package/dist/components/overlays/dialog/RuiDialog.vue.d.ts +3 -2
- package/dist/components/overlays/dialog/RuiDialog.vue_vue_type_script_setup_true_lang.js +16 -12
- package/dist/components/overlays/dialog/RuiDialog.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/overlays/menu/RuiMenu.js.map +1 -1
- package/dist/components/overlays/menu/RuiMenu.vue.d.ts +15 -10
- package/dist/components/overlays/menu/RuiMenu.vue_vue_type_script_setup_true_lang.js +29 -22
- package/dist/components/overlays/menu/RuiMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/overlays/menu/activator-handlers.d.ts +11 -0
- package/dist/components/overlays/menu/activator-handlers.js +18 -0
- package/dist/components/overlays/menu/activator-handlers.js.map +1 -0
- package/dist/components/overlays/navigation-drawer/RuiNavigationDrawer.js.map +1 -1
- package/dist/components/overlays/navigation-drawer/RuiNavigationDrawer.vue.d.ts +6 -2
- package/dist/components/overlays/navigation-drawer/RuiNavigationDrawer.vue_vue_type_script_setup_true_lang.js +40 -16
- package/dist/components/overlays/navigation-drawer/RuiNavigationDrawer.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/overlays/notification/RuiNotification.js.map +1 -1
- package/dist/components/overlays/notification/RuiNotification.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/components/overlays/notification/RuiNotification.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/overlays/tooltip/RuiTooltip.js.map +1 -1
- package/dist/components/overlays/tooltip/RuiTooltip.vue.d.ts +0 -5
- package/dist/components/overlays/tooltip/RuiTooltip.vue_vue_type_script_setup_true_lang.js +16 -10
- package/dist/components/overlays/tooltip/RuiTooltip.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/overlays/tooltip/tooltip-styles.d.ts +5 -12
- package/dist/components/overlays/tooltip/tooltip-styles.js +11 -18
- package/dist/components/overlays/tooltip/tooltip-styles.js.map +1 -1
- package/dist/components/progress/RuiProgress.js.map +1 -1
- package/dist/components/progress/RuiProgress.vue.d.ts +4 -0
- package/dist/components/progress/RuiProgress.vue_vue_type_script_setup_true_lang.js +72 -46
- package/dist/components/progress/RuiProgress.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/steppers/RuiFooterStepper.js.map +1 -1
- package/dist/components/steppers/RuiFooterStepper.vue_vue_type_script_setup_true_lang.js +27 -28
- package/dist/components/steppers/RuiFooterStepper.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/steppers/RuiStepper.js.map +1 -1
- package/dist/components/steppers/RuiStepper.vue.d.ts +0 -4
- package/dist/components/steppers/RuiStepper.vue_vue_type_script_setup_true_lang.js +25 -23
- package/dist/components/steppers/RuiStepper.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/steppers/RuiStepperIcon.js.map +1 -1
- package/dist/components/steppers/RuiStepperIcon.vue.d.ts +2 -0
- package/dist/components/steppers/RuiStepperIcon.vue_vue_type_script_setup_true_lang.js +47 -47
- package/dist/components/steppers/RuiStepperIcon.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/tables/RuiDataTable.js.map +1 -1
- package/dist/components/tables/RuiDataTable.vue.d.ts +3 -6
- package/dist/components/tables/RuiDataTable.vue_vue_type_script_setup_true_lang.js +65 -47
- package/dist/components/tables/RuiDataTable.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/tables/RuiExpandButton.js.map +1 -1
- package/dist/components/tables/RuiExpandButton.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/components/tables/RuiExpandButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/tables/RuiTable.js.map +1 -1
- package/dist/components/tables/RuiTable.vue_vue_type_script_setup_true_lang.js +8 -5
- package/dist/components/tables/RuiTable.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/tables/RuiTableEmptyState.js.map +1 -1
- package/dist/components/tables/RuiTableEmptyState.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/tables/RuiTableEmptyState.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/tables/RuiTableHead.js.map +1 -1
- package/dist/components/tables/RuiTableHead.vue_vue_type_script_setup_true_lang.js +88 -66
- package/dist/components/tables/RuiTableHead.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/tables/RuiTablePagination.js.map +1 -1
- package/dist/components/tables/RuiTablePagination.vue_vue_type_script_setup_true_lang.js +8 -11
- package/dist/components/tables/RuiTablePagination.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/tables/data-table/RuiDataTableExpandedRow.js.map +1 -1
- package/dist/components/tables/data-table/RuiDataTableExpandedRow.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/components/tables/data-table/RuiDataTableExpandedRow.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/tables/data-table/RuiDataTableGroupRow.js.map +1 -1
- package/dist/components/tables/data-table/RuiDataTableGroupRow.vue_vue_type_script_setup_true_lang.js +7 -3
- package/dist/components/tables/data-table/RuiDataTableGroupRow.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/tables/data-table/RuiDataTableMobileSort.js.map +1 -1
- package/dist/components/tables/data-table/RuiDataTableMobileSort.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/tables/data-table/RuiDataTableMobileSort.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/tables/data-table/RuiDataTableRow.js.map +1 -1
- package/dist/components/tables/data-table/RuiDataTableRow.vue_vue_type_script_setup_true_lang.js +58 -19
- package/dist/components/tables/data-table/RuiDataTableRow.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/tables/data-table-styles.d.ts +24 -0
- package/dist/components/tables/data-table-styles.js +35 -20
- package/dist/components/tables/data-table-styles.js.map +1 -1
- package/dist/components/tables/table_no_data_placeholder.js +1 -1
- package/dist/components/tables/table_no_data_placeholder.js.map +1 -1
- package/dist/components/tables/table_no_data_placeholder_dark.js +1 -1
- package/dist/components/tables/table_no_data_placeholder_dark.js.map +1 -1
- package/dist/components/tabs/tab/RuiTab.js.map +1 -1
- package/dist/components/tabs/tab/RuiTab.vue.d.ts +2 -5
- package/dist/components/tabs/tab/RuiTab.vue_vue_type_script_setup_true_lang.js +94 -68
- package/dist/components/tabs/tab/RuiTab.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/tabs/tab-item/RuiTabItem.js.map +1 -1
- package/dist/components/tabs/tab-item/RuiTabItem.vue.d.ts +0 -1
- package/dist/components/tabs/tab-item/RuiTabItem.vue_vue_type_script_setup_true_lang.js +5 -11
- package/dist/components/tabs/tab-item/RuiTabItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/tabs/tab-items/RuiTabItems.js.map +1 -1
- package/dist/components/tabs/tab-items/RuiTabItems.vue_vue_type_script_setup_true_lang.js +3 -8
- package/dist/components/tabs/tab-items/RuiTabItems.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/tabs/tab-props.d.ts +7 -1
- package/dist/components/tabs/tab-props.js +7 -1
- package/dist/components/tabs/tab-props.js.map +1 -1
- package/dist/components/tabs/tabs/RuiTabs.js.map +1 -1
- package/dist/components/tabs/tabs/RuiTabs.vue.d.ts +2 -1
- package/dist/components/tabs/tabs/RuiTabs.vue_vue_type_script_setup_true_lang.js +178 -32
- package/dist/components/tabs/tabs/RuiTabs.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/tabs/tabs/use-tab-indicator.d.ts +27 -0
- package/dist/components/tabs/tabs/use-tab-indicator.js +67 -0
- package/dist/components/tabs/tabs/use-tab-indicator.js.map +1 -0
- package/dist/components/tabs/tabs/use-tab-keyboard.d.ts +17 -0
- package/dist/components/tabs/tabs/use-tab-keyboard.js +57 -0
- package/dist/components/tabs/tabs/use-tab-keyboard.js.map +1 -0
- package/dist/components/tabs/tabs/use-tab-routing.js +1 -2
- package/dist/components/tabs/tabs/use-tab-routing.js.map +1 -1
- package/dist/components/time-picker/RuiTimePicker.js.map +1 -1
- package/dist/components/time-picker/RuiTimePicker.vue_vue_type_script_setup_true_lang.js +35 -32
- package/dist/components/time-picker/RuiTimePicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/time-picker/time-picker-styles.d.ts +18 -0
- package/dist/components/time-picker/time-picker-styles.js +16 -10
- package/dist/components/time-picker/time-picker-styles.js.map +1 -1
- package/dist/composables/defaults/field.d.ts +22 -0
- package/dist/composables/defaults/field.js +29 -0
- package/dist/composables/defaults/field.js.map +1 -0
- package/dist/composables/defaults/logo.d.ts +18 -0
- package/dist/composables/defaults/logo.js +13 -0
- package/dist/composables/defaults/logo.js.map +1 -0
- package/dist/composables/dropdown-menu.d.ts +14 -2
- package/dist/composables/dropdown-menu.js +12 -2
- package/dist/composables/dropdown-menu.js.map +1 -1
- package/dist/composables/floating.d.ts +0 -2
- package/dist/composables/floating.js +5 -2
- package/dist/composables/floating.js.map +1 -1
- package/dist/composables/forms/auto-complete/chips.d.ts +22 -0
- package/dist/composables/forms/auto-complete/chips.js +42 -0
- package/dist/composables/forms/auto-complete/chips.js.map +1 -0
- package/dist/composables/forms/auto-complete/combobox.d.ts +25 -0
- package/dist/composables/forms/auto-complete/combobox.js +35 -0
- package/dist/composables/forms/auto-complete/combobox.js.map +1 -0
- package/dist/composables/forms/auto-complete/focus.d.ts +5 -2
- package/dist/composables/forms/auto-complete/focus.js +36 -10
- package/dist/composables/forms/auto-complete/focus.js.map +1 -1
- package/dist/composables/forms/auto-complete/index.d.ts +3 -0
- package/dist/composables/forms/auto-complete/keyboard-navigation.d.ts +8 -1
- package/dist/composables/forms/auto-complete/keyboard-navigation.js +48 -20
- package/dist/composables/forms/auto-complete/keyboard-navigation.js.map +1 -1
- package/dist/composables/forms/auto-complete/selection.d.ts +37 -0
- package/dist/composables/forms/auto-complete/selection.js +60 -0
- package/dist/composables/forms/auto-complete/selection.js.map +1 -0
- package/dist/composables/forms/auto-complete/value.js +19 -0
- package/dist/composables/forms/auto-complete/value.js.map +1 -1
- package/dist/composables/keyboard-scroll.d.ts +17 -0
- package/dist/composables/keyboard-scroll.js +58 -0
- package/dist/composables/keyboard-scroll.js.map +1 -0
- package/dist/composables/sticky-header.d.ts +8 -0
- package/dist/composables/sticky-header.js +13 -2
- package/dist/composables/sticky-header.js.map +1 -1
- package/dist/composables/tables/data-table/page-scroll.d.ts +30 -0
- package/dist/composables/tables/data-table/page-scroll.js +113 -0
- package/dist/composables/tables/data-table/page-scroll.js.map +1 -0
- package/dist/consts/colors.d.ts +4 -0
- package/dist/consts/colors.js +1 -37
- package/dist/consts/colors.js.map +1 -1
- package/dist/consts/tokens.d.ts +56 -0
- package/dist/consts/tokens.js +46 -0
- package/dist/consts/tokens.js.map +1 -0
- package/dist/consts/typography.d.ts +51 -18
- package/dist/index.d.ts +13 -0
- package/dist/index.js +12 -7
- package/dist/index.js.map +1 -1
- package/dist/library-icons.json +0 -10
- package/dist/style.css +5644 -4677
- package/dist/styles/colors.css +315 -0
- package/dist/styles/tokens.css +50 -0
- package/dist/tailwind.css +145 -0
- package/dist/theme/theme.css +403 -0
- package/dist/theme.css +403 -0
- package/dist/utils/helpers.d.ts +0 -8
- package/dist/utils/helpers.js +1 -17
- package/dist/utils/helpers.js.map +1 -1
- package/dist/utils/tv.js +13 -21
- package/dist/utils/tv.js.map +1 -1
- package/dist/web-types.json +271 -413
- package/package.json +17 -16
- package/dist/components/icons/LazyIcon.vue.d.ts +0 -8
- package/dist/components/logos/use-logo-sources.d.ts +0 -29
- package/dist/components/logos/use-logo-sources.js +0 -90
- package/dist/components/logos/use-logo-sources.js.map +0 -1
- package/dist/components/steppers/RuiStepperCustomIcon.js +0 -7
- package/dist/components/steppers/RuiStepperCustomIcon.js.map +0 -1
- package/dist/components/steppers/RuiStepperCustomIcon.vue.d.ts +0 -8
- package/dist/components/steppers/RuiStepperCustomIcon.vue_vue_type_script_setup_true_lang.js +0 -43
- package/dist/components/steppers/RuiStepperCustomIcon.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/composables/colors/common.d.ts +0 -20
- package/dist/composables/colors/index.d.ts +0 -3
- package/dist/composables/colors/text-input.d.ts +0 -27
- package/dist/composables/forms/auto-complete/index.js +0 -5
- package/dist/composables/forms/use-label-with-quote.d.ts +0 -2
- package/dist/composables/popper.d.ts +0 -16
- package/dist/composables/popper.js +0 -23
- package/dist/composables/popper.js.map +0 -1
- package/dist/consts/forms/auto-complete/index.d.ts +0 -4
- package/dist/theme/index.d.ts +0 -5
- package/dist/theme/index.js +0 -162
- package/dist/theme/index.js.map +0 -1
- package/dist/utils/forms/auto-complete/index.d.ts +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sticky-header.js","names":[],"sources":["../../src/composables/sticky-header.ts"],"sourcesContent":["import type { MaybeRefOrGetter, Ref, ShallowRef } from 'vue';\n\nexport interface UseStickyTableHeaderRefs {\n table: Readonly<ShallowRef<HTMLTableElement | null>>;\n}\n\ninterface StickyElements {\n head: HTMLElement;\n theadClone: HTMLElement;\n root: HTMLTableElement;\n}\n\ninterface UseStickyTableHeaderReturn {\n stick: Readonly<Ref<boolean>>;\n}\n\nconst SELECTORS = {\n head: ':scope > thead[data-id=head-main]',\n headClone: ':scope > thead[data-id=head-clone]',\n row: ':scope > tbody > tr:not([hidden])',\n th: ':scope > th',\n} as const;\n\nconst BORDER_PRECISION = -0.5;\n\nfunction queryHeadRow(root: HTMLTableElement, selector: string): HTMLTableRowElement | null {\n return root.querySelector(`${selector} > tr`);\n}\n\nfunction queryColumns(row: HTMLTableRowElement | null): HTMLElement[] {\n if (!row)\n return [];\n return Array.from(row.querySelectorAll<HTMLElement>(SELECTORS.th));\n}\n\nfunction readColumnWidths(columns: HTMLElement[]): number[] {\n return columns.map(col => col.getBoundingClientRect().width);\n}\n\nfunction applyColumnWidths(columns: HTMLElement[], widths: number[]): void {\n for (const [i, column] of columns.entries()) {\n const width = widths[i];\n if (width !== undefined)\n column.style.width = `${width}px`;\n }\n}\n\nfunction positionHeadAtRest(head: HTMLElement): void {\n head.style.left = `${BORDER_PRECISION}px`;\n head.style.top = '0';\n}\n\ninterface StuckPosition {\n clonedRect: DOMRect;\n tableRect: DOMRect;\n lastRowHeight: number;\n top: number;\n origin: Point;\n}\n\nfunction positionHeadStuck(head: HTMLElement, { clonedRect, lastRowHeight, origin, tableRect, top }: StuckPosition): void {\n head.style.left = `${clonedRect.left - origin.left + BORDER_PRECISION}px`;\n\n const isNearBottom = tableRect.bottom <= lastRowHeight + clonedRect.height + top;\n const viewportTop = isNearBottom ? tableRect.bottom - lastRowHeight - clonedRect.height : top;\n head.style.top = `${viewportTop - origin.top}px`;\n}\n\nfunction isInStickyRange(tableRect: DOMRect, top: number): boolean {\n return tableRect.top <= top && tableRect.bottom > top;\n}\n\ninterface Point {\n left: number;\n top: number;\n}\n\n/**\n * The nearest ancestor that currently scrolls vertically, e.g. a dialog or drawer body, or\n * `undefined` when only the page does. One that could scroll but has nothing to (a card body on a\n * page) is skipped, as is the table's own scroller, which only scrolls sideways.\n */\nfunction findScrollParent(element: HTMLElement): HTMLElement | undefined {\n let parent = element.parentElement;\n while (parent && parent !== document.body && parent !== document.documentElement) {\n const { overflowY } = getComputedStyle(parent);\n if ((overflowY === 'auto' || overflowY === 'scroll') && parent.scrollHeight > parent.clientHeight)\n return parent;\n parent = parent.parentElement;\n }\n return undefined;\n}\n\nfunction createsFixedContainingBlock(style: CSSStyleDeclaration): boolean {\n return style.transform !== 'none'\n || style.perspective !== 'none'\n || style.filter !== 'none'\n || (style.backdropFilter !== undefined && style.backdropFilter !== 'none')\n || /transform|perspective|filter/.test(style.willChange)\n || /paint|layout|strict|content/.test(style.contain);\n}\n\n/**\n * Where a `position: fixed` descendant's `top: 0; left: 0` lands in the viewport. That is the\n * viewport origin, unless an ancestor (a centred dialog is translated) becomes its containing block.\n */\nfunction getFixedOrigin(element: HTMLElement): Point {\n let parent = element.parentElement;\n while (parent) {\n if (createsFixedContainingBlock(getComputedStyle(parent))) {\n const rect = parent.getBoundingClientRect();\n return { left: rect.left + parent.clientLeft, top: rect.top + parent.clientTop };\n }\n parent = parent.parentElement;\n }\n return { left: 0, top: 0 };\n}\n\nfunction getLastRowHeight(root: HTMLTableElement): number | undefined {\n const rows = root.querySelectorAll(SELECTORS.row);\n if (rows.length <= 1)\n return undefined;\n return rows.item(rows.length - 1)?.getBoundingClientRect().height ?? 0;\n}\n\n/**\n * Setup sticky table header\n */\nexport function useStickyTableHeader(\n sticky: MaybeRefOrGetter<boolean> = shallowRef(false),\n offsetTop: MaybeRefOrGetter<number | undefined>,\n tableRefs: UseStickyTableHeaderRefs,\n): UseStickyTableHeaderReturn {\n const { table } = tableRefs;\n const stick = shallowRef<boolean>(false);\n\n let resizeCleanups: (() => void)[] = [];\n let syncRafId: number | null = null;\n let rafId: number | null = null;\n\n function cleanupResizeObservers(): void {\n for (const cleanup of resizeCleanups)\n cleanup();\n resizeCleanups = [];\n }\n\n function cancelPendingSync(): void {\n if (syncRafId !== null)\n cancelAnimationFrame(syncRafId);\n syncRafId = null;\n }\n\n function scheduleSyncWidths(cloneColumns: HTMLElement[], mainColumns: HTMLElement[]): void {\n cancelPendingSync();\n\n // One frame is enough: the main thead is positioned, so its widths never feed back into the clone's\n syncRafId = requestAnimationFrame(() => {\n syncRafId = null;\n applyColumnWidths(mainColumns, readColumnWidths(cloneColumns));\n });\n }\n\n function observeColumnResizes(cloneColumns: HTMLElement[], mainColumns: HTMLElement[]): void {\n cleanupResizeObservers();\n\n for (const th of cloneColumns) {\n const { stop } = useResizeObserver(th, () => {\n scheduleSyncWidths(cloneColumns, mainColumns);\n });\n resizeCleanups.push(stop);\n }\n }\n\n function watchCellWidth(): void {\n const root = get(table);\n if (!toValue(sticky) || !root)\n return;\n\n const cloneRow = queryHeadRow(root, SELECTORS.headClone);\n const mainRow = queryHeadRow(root, SELECTORS.head);\n const cloneColumns = queryColumns(cloneRow);\n const mainColumns = queryColumns(mainRow);\n\n useMutationObserver(cloneRow, (mutations) => {\n const hasRelevantMutation = mutations.some(\n m => m.type === 'childList' || m.type === 'attributes',\n );\n if (hasRelevantMutation)\n observeColumnResizes(queryColumns(cloneRow), queryColumns(mainRow));\n }, { attributes: true, childList: true, subtree: true });\n\n observeColumnResizes(cloneColumns, mainColumns);\n }\n\n function queryStickyElements(): StickyElements | undefined {\n const root = get(table);\n if (!toValue(sticky) || !root)\n return undefined;\n\n const theadClone = root.querySelector<HTMLElement>(SELECTORS.headClone);\n const head = root.querySelector<HTMLElement>(SELECTORS.head);\n if (!theadClone || !head)\n return undefined;\n\n return { head, root, theadClone };\n }\n\n function toggleStickyClass(): void {\n const elements = queryStickyElements();\n if (!elements)\n return;\n\n const { head, root, theadClone } = elements;\n const clonedRect = theadClone.getBoundingClientRect();\n const tableRect = root.getBoundingClientRect();\n const pageTop = toValue(offsetTop) ?? 0;\n const scrollParent = findScrollParent(root);\n const top = scrollParent\n ? Math.max(scrollParent.getBoundingClientRect().top + scrollParent.clientTop, pageTop)\n : pageTop;\n\n head.style.width = `${clonedRect.width}px`;\n\n const lastRowHeight = getLastRowHeight(root);\n if (lastRowHeight === undefined) {\n set(stick, false);\n positionHeadAtRest(head);\n return;\n }\n\n if (isInStickyRange(tableRect, top)) {\n set(stick, true);\n positionHeadStuck(head, { clonedRect, lastRowHeight, origin: getFixedOrigin(head), tableRect, top });\n }\n else {\n set(stick, false);\n positionHeadAtRest(head);\n }\n }\n\n function throttledToggleStickyClass(): void {\n if (rafId !== null)\n return;\n rafId = requestAnimationFrame(() => {\n toggleStickyClass();\n rafId = null;\n });\n }\n\n function onScroll(event: Event): void {\n const root = get(table);\n const target = event.target;\n // scroll does not bubble, so this runs in capture for every scroll: only an ancestor's matters\n if (!root || !(target instanceof Node) || !target.contains(root))\n return;\n throttledToggleStickyClass();\n }\n\n onMounted(() => {\n toggleStickyClass();\n useEventListener(document, 'scroll', onScroll, { capture: true, passive: true });\n useEventListener(window, 'resize', throttledToggleStickyClass);\n watchCellWidth();\n });\n\n return {\n stick: readonly(stick),\n };\n}\n"],"mappings":";;;;AAgBA,IAAM,YAAY;CAChB,MAAM;CACN,WAAW;CACX,KAAK;CACL,IAAI;AACN;AAEA,IAAM,mBAAmB;AAEzB,SAAS,aAAa,MAAwB,UAA8C;CAC1F,OAAO,KAAK,cAAc,GAAG,SAAS,MAAM;AAC9C;AAEA,SAAS,aAAa,KAAgD;CACpE,IAAI,CAAC,KACH,OAAO,CAAC;CACV,OAAO,MAAM,KAAK,IAAI,iBAA8B,UAAU,EAAE,CAAC;AACnE;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gB,WAAW,GAAG,GAAG;GACnC,MAAI,OAAO,IAAI;GACf,kBAAkB,MAAM;IAAE;IAAY;IAAe,QAAQ,eAAe,IAAI;IAAG;IAAW;GAAI,CAAC;EACrG,OACK;GACH,MAAI,OAAO,KAAK;GAChB,mBAAmB,IAAI;EACzB;CACF;CAEA,SAAS,6BAAmC;EAC1C,IAAI,UAAU,MACZ;EACF,QAAQ,4BAA4B;GAClC,kBAAkB;GAClB,QAAQ;EACV,CAAC;CACH;CAEA,SAAS,SAAS,OAAoB;EACpC,MAAM,OAAO,MAAI,KAAK;EACtB,MAAM,SAAS,MAAM;EAErB,IAAI,CAAC,QAAQ,EAAE,kBAAkB,SAAS,CAAC,OAAO,SAAS,IAAI,GAC7D;EACF,2BAA2B;CAC7B;CAEA,gBAAgB;EACd,kBAAkB;EAClB,iBAAiB,UAAU,UAAU,UAAU;GAAE,SAAS;GAAM,SAAS;EAAK,CAAC;EAC/E,iBAAiB,QAAQ,UAAU,0BAA0B;EAC7D,eAAe;CACjB,CAAC;CAED,OAAO,EACL,OAAO,SAAS,KAAK,EACvB;AACF"}
|
|
1
|
+
{"version":3,"file":"sticky-header.js","names":[],"sources":["../../src/composables/sticky-header.ts"],"sourcesContent":["import type { MaybeRefOrGetter, Ref, ShallowRef } from 'vue';\n\nexport interface UseStickyTableHeaderRefs {\n table: Readonly<ShallowRef<HTMLTableElement | null>>;\n}\n\ninterface StickyElements {\n head: HTMLElement;\n theadClone: HTMLElement;\n root: HTMLTableElement;\n}\n\ninterface UseStickyTableHeaderReturn {\n stick: Readonly<Ref<boolean>>;\n}\n\nconst SELECTORS = {\n head: ':scope > thead[data-id=head-main]',\n headClone: ':scope > thead[data-id=head-clone]',\n row: ':scope > tbody > tr:not([hidden])',\n th: ':scope > th',\n} as const;\n\nconst BORDER_PRECISION = -0.5;\n\nfunction queryHeadRow(root: HTMLTableElement, selector: string): HTMLTableRowElement | null {\n return root.querySelector(`${selector} > tr`);\n}\n\nfunction queryColumns(row: HTMLTableRowElement | null): HTMLElement[] {\n if (!row)\n return [];\n return Array.from(row.querySelectorAll<HTMLElement>(SELECTORS.th));\n}\n\nfunction readColumnWidths(columns: HTMLElement[]): number[] {\n return columns.map(col => col.getBoundingClientRect().width);\n}\n\nfunction applyColumnWidths(columns: HTMLElement[], widths: number[]): void {\n for (const [i, column] of columns.entries()) {\n const width = widths[i];\n if (width !== undefined)\n column.style.width = `${width}px`;\n }\n}\n\nfunction positionHeadAtRest(head: HTMLElement): void {\n head.style.left = `${BORDER_PRECISION}px`;\n head.style.top = '0';\n}\n\ninterface StuckPosition {\n clonedRect: DOMRect;\n tableRect: DOMRect;\n lastRowHeight: number;\n top: number;\n origin: Point;\n}\n\nfunction positionHeadStuck(head: HTMLElement, { clonedRect, lastRowHeight, origin, tableRect, top }: StuckPosition): void {\n head.style.left = `${clonedRect.left - origin.left + BORDER_PRECISION}px`;\n\n const isNearBottom = tableRect.bottom <= lastRowHeight + clonedRect.height + top;\n const viewportTop = isNearBottom ? tableRect.bottom - lastRowHeight - clonedRect.height : top;\n head.style.top = `${viewportTop - origin.top}px`;\n}\n\nfunction isInStickyRange(tableRect: DOMRect, top: number): boolean {\n return tableRect.top <= top && tableRect.bottom > top;\n}\n\ninterface Point {\n left: number;\n top: number;\n}\n\n/**\n * The nearest ancestor that currently scrolls vertically, e.g. a dialog or drawer body, or\n * `undefined` when only the page does. One that could scroll but has nothing to (a card body on a\n * page) is skipped, as is the table's own scroller, which only scrolls sideways.\n */\nfunction findScrollParent(element: HTMLElement): HTMLElement | undefined {\n let parent = element.parentElement;\n while (parent && parent !== document.body && parent !== document.documentElement) {\n const { overflowY } = getComputedStyle(parent);\n if ((overflowY === 'auto' || overflowY === 'scroll') && parent.scrollHeight > parent.clientHeight)\n return parent;\n parent = parent.parentElement;\n }\n return undefined;\n}\n\nfunction isSet(value: string | undefined): boolean {\n return value !== undefined && value !== '' && value !== 'none';\n}\n\n/**\n * Whether an element becomes the containing block of its `position: fixed`\n * descendants. The individual `translate`, `rotate` and `scale` properties\n * count like `transform`: Tailwind 4 writes its translate utilities to\n * `translate`, so a dialog centred with `-translate-x-1/2` leaves `transform`\n * at `none`.\n */\nexport function createsFixedContainingBlock(style: CSSStyleDeclaration): boolean {\n return isSet(style.transform)\n || isSet(style.translate)\n || isSet(style.rotate)\n || isSet(style.scale)\n || isSet(style.perspective)\n || isSet(style.filter)\n || isSet(style.backdropFilter)\n || /transform|translate|rotate|scale|perspective|filter/.test(style.willChange)\n || /paint|layout|strict|content/.test(style.contain);\n}\n\n/**\n * Where a `position: fixed` descendant's `top: 0; left: 0` lands in the viewport. That is the\n * viewport origin, unless an ancestor (a centred dialog is translated) becomes its containing block.\n */\nfunction getFixedOrigin(element: HTMLElement): Point {\n let parent = element.parentElement;\n while (parent) {\n if (createsFixedContainingBlock(getComputedStyle(parent))) {\n const rect = parent.getBoundingClientRect();\n return { left: rect.left + parent.clientLeft, top: rect.top + parent.clientTop };\n }\n parent = parent.parentElement;\n }\n return { left: 0, top: 0 };\n}\n\nfunction getLastRowHeight(root: HTMLTableElement): number | undefined {\n const rows = root.querySelectorAll(SELECTORS.row);\n if (rows.length <= 1)\n return undefined;\n return rows.item(rows.length - 1)?.getBoundingClientRect().height ?? 0;\n}\n\n/**\n * Setup sticky table header\n */\nexport function useStickyTableHeader(\n sticky: MaybeRefOrGetter<boolean> = shallowRef(false),\n offsetTop: MaybeRefOrGetter<number | undefined>,\n tableRefs: UseStickyTableHeaderRefs,\n): UseStickyTableHeaderReturn {\n const { table } = tableRefs;\n const stick = shallowRef<boolean>(false);\n\n let resizeCleanups: (() => void)[] = [];\n let syncRafId: number | null = null;\n let rafId: number | null = null;\n\n function cleanupResizeObservers(): void {\n for (const cleanup of resizeCleanups)\n cleanup();\n resizeCleanups = [];\n }\n\n function cancelPendingSync(): void {\n if (syncRafId !== null)\n cancelAnimationFrame(syncRafId);\n syncRafId = null;\n }\n\n function scheduleSyncWidths(cloneColumns: HTMLElement[], mainColumns: HTMLElement[]): void {\n cancelPendingSync();\n\n // One frame is enough: the main thead is positioned, so its widths never feed back into the clone's\n syncRafId = requestAnimationFrame(() => {\n syncRafId = null;\n applyColumnWidths(mainColumns, readColumnWidths(cloneColumns));\n // the head's own width too: left stale, it squeezes the columns and leaves an untinted strip at the end\n toggleStickyClass();\n });\n }\n\n function observeColumnResizes(cloneColumns: HTMLElement[], mainColumns: HTMLElement[]): void {\n cleanupResizeObservers();\n\n for (const th of cloneColumns) {\n const { stop } = useResizeObserver(th, () => {\n scheduleSyncWidths(cloneColumns, mainColumns);\n });\n resizeCleanups.push(stop);\n }\n }\n\n function watchCellWidth(): void {\n const root = get(table);\n if (!toValue(sticky) || !root)\n return;\n\n const cloneRow = queryHeadRow(root, SELECTORS.headClone);\n const mainRow = queryHeadRow(root, SELECTORS.head);\n const cloneColumns = queryColumns(cloneRow);\n const mainColumns = queryColumns(mainRow);\n\n useMutationObserver(cloneRow, (mutations) => {\n const hasRelevantMutation = mutations.some(\n m => m.type === 'childList' || m.type === 'attributes',\n );\n if (hasRelevantMutation)\n observeColumnResizes(queryColumns(cloneRow), queryColumns(mainRow));\n }, { attributes: true, childList: true, subtree: true });\n\n observeColumnResizes(cloneColumns, mainColumns);\n }\n\n function queryStickyElements(): StickyElements | undefined {\n const root = get(table);\n if (!toValue(sticky) || !root)\n return undefined;\n\n const theadClone = root.querySelector<HTMLElement>(SELECTORS.headClone);\n const head = root.querySelector<HTMLElement>(SELECTORS.head);\n if (!theadClone || !head)\n return undefined;\n\n return { head, root, theadClone };\n }\n\n function toggleStickyClass(): void {\n const elements = queryStickyElements();\n if (!elements)\n return;\n\n const { head, root, theadClone } = elements;\n const clonedRect = theadClone.getBoundingClientRect();\n const tableRect = root.getBoundingClientRect();\n const pageTop = toValue(offsetTop) ?? 0;\n const scrollParent = findScrollParent(root);\n const top = scrollParent\n ? Math.max(scrollParent.getBoundingClientRect().top + scrollParent.clientTop, pageTop)\n : pageTop;\n\n head.style.width = `${clonedRect.width}px`;\n\n const lastRowHeight = getLastRowHeight(root);\n if (lastRowHeight === undefined) {\n set(stick, false);\n positionHeadAtRest(head);\n return;\n }\n\n if (isInStickyRange(tableRect, top)) {\n set(stick, true);\n positionHeadStuck(head, { clonedRect, lastRowHeight, origin: getFixedOrigin(head), tableRect, top });\n }\n else {\n set(stick, false);\n positionHeadAtRest(head);\n }\n }\n\n function throttledToggleStickyClass(): void {\n if (rafId !== null)\n return;\n rafId = requestAnimationFrame(() => {\n toggleStickyClass();\n rafId = null;\n });\n }\n\n function onScroll(event: Event): void {\n const root = get(table);\n const target = event.target;\n // scroll does not bubble, so this runs in capture for every scroll: only an ancestor's matters\n if (!root || !(target instanceof Node) || !target.contains(root))\n return;\n throttledToggleStickyClass();\n }\n\n onMounted(() => {\n toggleStickyClass();\n useEventListener(document, 'scroll', onScroll, { capture: true, passive: true });\n useEventListener(window, 'resize', throttledToggleStickyClass);\n watchCellWidth();\n });\n\n return {\n stick: readonly(stick),\n };\n}\n"],"mappings":";;;;AAgBA,IAAM,YAAY;CAChB,MAAM;CACN,WAAW;CACX,KAAK;CACL,IAAI;AACN;AAEA,IAAM,mBAAmB;AAEzB,SAAS,aAAa,MAAwB,UAA8C;CAC1F,OAAO,KAAK,cAAc,GAAG,SAAS,MAAM;AAC9C;AAEA,SAAS,aAAa,KAAgD;CACpE,IAAI,CAAC,KACH,OAAO,CAAC;CACV,OAAO,MAAM,KAAK,IAAI,iBAA8B,UAAU,EAAE,CAAC;AACnE;AAEA,SAAS,iBAAiB,SAAkC;CAC1D,OAAO,QAAQ,KAAI,QAAO,IAAI,sBAAsB,CAAC,CAAC,KAAK;AAC7D;AAEA,SAAS,kBAAkB,SAAwB,QAAwB;CACzE,KAAK,MAAM,CAAC,GAAG,WAAW,QAAQ,QAAQ,GAAG;EAC3C,MAAM,QAAQ,OAAO;EACrB,IAAI,UAAU,KAAA,GACZ,OAAO,MAAM,QAAQ,GAAG,MAAM;CAClC;AACF;AAEA,SAAS,mBAAmB,MAAyB;CACnD,KAAK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AK;GAChB,mBAAmB,IAAI;EACzB;CACF;CAEA,SAAS,6BAAmC;EAC1C,IAAI,UAAU,MACZ;EACF,QAAQ,4BAA4B;GAClC,kBAAkB;GAClB,QAAQ;EACV,CAAC;CACH;CAEA,SAAS,SAAS,OAAoB;EACpC,MAAM,OAAO,MAAI,KAAK;EACtB,MAAM,SAAS,MAAM;EAErB,IAAI,CAAC,QAAQ,EAAE,kBAAkB,SAAS,CAAC,OAAO,SAAS,IAAI,GAC7D;EACF,2BAA2B;CAC7B;CAEA,gBAAgB;EACd,kBAAkB;EAClB,iBAAiB,UAAU,UAAU,UAAU;GAAE,SAAS;GAAM,SAAS;EAAK,CAAC;EAC/E,iBAAiB,QAAQ,UAAU,0BAA0B;EAC7D,eAAe;CACjB,CAAC;CAED,OAAO,EACL,OAAO,SAAS,KAAK,EACvB;AACF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { MaybeComputedElementRef } from '@vueuse/core';
|
|
2
|
+
import type { MaybeRefOrGetter, Ref } from 'vue';
|
|
3
|
+
export interface UsePageScrollReturn {
|
|
4
|
+
/** Scroll the table's top into view, if it has scrolled above the visible area. */
|
|
5
|
+
revealTableTop: () => Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* After a page change, brings the table's first row back into view so the new page reads from the
|
|
9
|
+
* top. It scrolls only when the table's top sits above the visible area, as it does after paging
|
|
10
|
+
* from the bottom bar of a long page; a table that already shows its top stays put, so paging never
|
|
11
|
+
* makes the view jump.
|
|
12
|
+
*/
|
|
13
|
+
export declare function usePageScroll(wrapper: Readonly<Ref<HTMLElement | null | undefined>>, stickyOffset: MaybeRefOrGetter<number | undefined>): UsePageScrollReturn;
|
|
14
|
+
/**
|
|
15
|
+
* Whether the pagination bar may stick: true once the top {@link STICK_AFTER}px of the table are
|
|
16
|
+
* inside its scrolling area. It starts true, so a page without IntersectionObserver keeps the bar
|
|
17
|
+
* sticky.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useStickyPaginationBar(wrapper: Readonly<Ref<HTMLElement | null | undefined>>, enabled: MaybeRefOrGetter<boolean>): Readonly<Ref<boolean>>;
|
|
20
|
+
/**
|
|
21
|
+
* Publishes how much of the view's bottom a stuck pagination bar covers, as `--rui-sticky-bottom` on
|
|
22
|
+
* the document root, so the page's own floating parts (a dock, a FAB) can rise above the bar instead of
|
|
23
|
+
* covering its page buttons. Only a bar stuck to the page counts: one stuck inside a scrolling area
|
|
24
|
+
* sits under nothing the page floats.
|
|
25
|
+
*
|
|
26
|
+
* @param sentinel - an empty element at the bar's own place after the rows; while it is below the view, the bar is stuck
|
|
27
|
+
* @param bar - the bar, measured for its height
|
|
28
|
+
* @param canStick - whether the bar may stick at all
|
|
29
|
+
*/
|
|
30
|
+
export declare function useStickyBottomInset(sentinel: Readonly<Ref<HTMLElement | null | undefined>>, bar: MaybeComputedElementRef, canStick: MaybeRefOrGetter<boolean>): void;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { nextTick, onMounted, onScopeDispose, shallowRef, toValue, watchEffect } from "vue";
|
|
2
|
+
import { useElementSize, useIntersectionObserver } from "@vueuse/core";
|
|
3
|
+
import { get as get$1, set as set$1 } from "@vueuse/shared";
|
|
4
|
+
//#region src/composables/tables/data-table/page-scroll.ts
|
|
5
|
+
/**
|
|
6
|
+
* How much of a table, from its top, must be on screen before its pagination bar sticks: the
|
|
7
|
+
* column header and the first rows. A table just scrolling in from below keeps its bar under the
|
|
8
|
+
* rows, rather than showing the bar on top of the header.
|
|
9
|
+
*/
|
|
10
|
+
var STICK_AFTER = 128;
|
|
11
|
+
/**
|
|
12
|
+
* The nearest ancestor that scrolls vertically. `undefined` means the page itself does, through
|
|
13
|
+
* the window or a scrolling `<body>`, which is where a sticky offset such as an app bar applies.
|
|
14
|
+
*/
|
|
15
|
+
function findScroller(element) {
|
|
16
|
+
let node = element.parentElement;
|
|
17
|
+
while (node && node !== document.body && node !== document.documentElement) {
|
|
18
|
+
const { overflowY } = getComputedStyle(node);
|
|
19
|
+
if ((overflowY === "auto" || overflowY === "scroll") && node.scrollHeight > node.clientHeight) return node;
|
|
20
|
+
node = node.parentElement;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function scrollPageBy(top) {
|
|
24
|
+
const body = document.body;
|
|
25
|
+
if (body.scrollHeight > body.clientHeight && ["auto", "scroll"].includes(getComputedStyle(body).overflowY)) body.scrollBy({ top });
|
|
26
|
+
else window.scrollBy({ top });
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* After a page change, brings the table's first row back into view so the new page reads from the
|
|
30
|
+
* top. It scrolls only when the table's top sits above the visible area, as it does after paging
|
|
31
|
+
* from the bottom bar of a long page; a table that already shows its top stays put, so paging never
|
|
32
|
+
* makes the view jump.
|
|
33
|
+
*/
|
|
34
|
+
function usePageScroll(wrapper, stickyOffset) {
|
|
35
|
+
async function revealTableTop() {
|
|
36
|
+
await nextTick();
|
|
37
|
+
const element = get$1(wrapper);
|
|
38
|
+
if (!element) return;
|
|
39
|
+
const scroller = findScroller(element);
|
|
40
|
+
const viewTop = scroller ? scroller.getBoundingClientRect().top : toValue(stickyOffset) ?? 0;
|
|
41
|
+
const distance = element.getBoundingClientRect().top - viewTop;
|
|
42
|
+
if (distance >= 0) return;
|
|
43
|
+
if (scroller) scroller.scrollBy({ top: distance });
|
|
44
|
+
else scrollPageBy(distance);
|
|
45
|
+
}
|
|
46
|
+
return { revealTableTop };
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Whether the pagination bar may stick: true once the top {@link STICK_AFTER}px of the table are
|
|
50
|
+
* inside its scrolling area. It starts true, so a page without IntersectionObserver keeps the bar
|
|
51
|
+
* sticky.
|
|
52
|
+
*/
|
|
53
|
+
function useStickyPaginationBar(wrapper, enabled) {
|
|
54
|
+
const canStick = shallowRef(true);
|
|
55
|
+
const root = shallowRef();
|
|
56
|
+
onMounted(() => {
|
|
57
|
+
const element = get$1(wrapper);
|
|
58
|
+
if (element) set$1(root, findScroller(element));
|
|
59
|
+
});
|
|
60
|
+
useIntersectionObserver(() => toValue(enabled) ? get$1(wrapper) : void 0, ([entry]) => {
|
|
61
|
+
if (!entry) return;
|
|
62
|
+
set$1(canStick, entry.isIntersecting || entry.boundingClientRect.bottom <= (entry.rootBounds?.top ?? 0));
|
|
63
|
+
}, {
|
|
64
|
+
root,
|
|
65
|
+
rootMargin: `0px 0px -${STICK_AFTER}px 0px`
|
|
66
|
+
});
|
|
67
|
+
return canStick;
|
|
68
|
+
}
|
|
69
|
+
/** The height of each pagination bar stuck to the page, by table; the page's floating parts clear the tallest. */
|
|
70
|
+
var stuckBarHeights = /* @__PURE__ */ new Map();
|
|
71
|
+
function publishStickyBottom() {
|
|
72
|
+
if (typeof document === "undefined") return;
|
|
73
|
+
const style = document.documentElement.style;
|
|
74
|
+
if (stuckBarHeights.size === 0) style.removeProperty("--rui-sticky-bottom");
|
|
75
|
+
else style.setProperty("--rui-sticky-bottom", `${Math.max(...stuckBarHeights.values())}px`);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Publishes how much of the view's bottom a stuck pagination bar covers, as `--rui-sticky-bottom` on
|
|
79
|
+
* the document root, so the page's own floating parts (a dock, a FAB) can rise above the bar instead of
|
|
80
|
+
* covering its page buttons. Only a bar stuck to the page counts: one stuck inside a scrolling area
|
|
81
|
+
* sits under nothing the page floats.
|
|
82
|
+
*
|
|
83
|
+
* @param sentinel - an empty element at the bar's own place after the rows; while it is below the view, the bar is stuck
|
|
84
|
+
* @param bar - the bar, measured for its height
|
|
85
|
+
* @param canStick - whether the bar may stick at all
|
|
86
|
+
*/
|
|
87
|
+
function useStickyBottomInset(sentinel, bar, canStick) {
|
|
88
|
+
const id = Symbol("sticky-pagination-bar");
|
|
89
|
+
const belowView = shallowRef(false);
|
|
90
|
+
const pageLevel = shallowRef(false);
|
|
91
|
+
const { height } = useElementSize(bar, void 0, { box: "border-box" });
|
|
92
|
+
onMounted(() => {
|
|
93
|
+
const element = get$1(sentinel);
|
|
94
|
+
set$1(pageLevel, !!element && !findScroller(element));
|
|
95
|
+
});
|
|
96
|
+
useIntersectionObserver(sentinel, ([entry]) => {
|
|
97
|
+
if (!entry) return;
|
|
98
|
+
set$1(belowView, !entry.isIntersecting && entry.boundingClientRect.top >= (entry.rootBounds?.bottom ?? Number.POSITIVE_INFINITY));
|
|
99
|
+
});
|
|
100
|
+
watchEffect(() => {
|
|
101
|
+
if (get$1(pageLevel) && toValue(canStick) && get$1(belowView) && get$1(height) > 0) stuckBarHeights.set(id, get$1(height));
|
|
102
|
+
else stuckBarHeights.delete(id);
|
|
103
|
+
publishStickyBottom();
|
|
104
|
+
});
|
|
105
|
+
onScopeDispose(() => {
|
|
106
|
+
stuckBarHeights.delete(id);
|
|
107
|
+
publishStickyBottom();
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
//#endregion
|
|
111
|
+
export { usePageScroll, useStickyBottomInset, useStickyPaginationBar };
|
|
112
|
+
|
|
113
|
+
//# sourceMappingURL=page-scroll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-scroll.js","names":[],"sources":["../../../../src/composables/tables/data-table/page-scroll.ts"],"sourcesContent":["import type { MaybeComputedElementRef } from '@vueuse/core';\nimport type { MaybeRefOrGetter, Ref } from 'vue';\n\nexport interface UsePageScrollReturn {\n /** Scroll the table's top into view, if it has scrolled above the visible area. */\n revealTableTop: () => Promise<void>;\n}\n\n/**\n * How much of a table, from its top, must be on screen before its pagination bar sticks: the\n * column header and the first rows. A table just scrolling in from below keeps its bar under the\n * rows, rather than showing the bar on top of the header.\n */\nconst STICK_AFTER = 128;\n\n/**\n * The nearest ancestor that scrolls vertically. `undefined` means the page itself does, through\n * the window or a scrolling `<body>`, which is where a sticky offset such as an app bar applies.\n */\nfunction findScroller(element: HTMLElement): HTMLElement | undefined {\n let node = element.parentElement;\n while (node && node !== document.body && node !== document.documentElement) {\n const { overflowY } = getComputedStyle(node);\n if ((overflowY === 'auto' || overflowY === 'scroll') && node.scrollHeight > node.clientHeight)\n return node;\n node = node.parentElement;\n }\n return undefined;\n}\n\nfunction scrollPageBy(top: number): void {\n const body = document.body;\n if (body.scrollHeight > body.clientHeight && ['auto', 'scroll'].includes(getComputedStyle(body).overflowY))\n body.scrollBy({ top });\n else\n window.scrollBy({ top });\n}\n\n/**\n * After a page change, brings the table's first row back into view so the new page reads from the\n * top. It scrolls only when the table's top sits above the visible area, as it does after paging\n * from the bottom bar of a long page; a table that already shows its top stays put, so paging never\n * makes the view jump.\n */\nexport function usePageScroll(\n wrapper: Readonly<Ref<HTMLElement | null | undefined>>,\n stickyOffset: MaybeRefOrGetter<number | undefined>,\n): UsePageScrollReturn {\n async function revealTableTop(): Promise<void> {\n await nextTick();\n const element = get(wrapper);\n if (!element)\n return;\n\n const scroller = findScroller(element);\n const viewTop = scroller ? scroller.getBoundingClientRect().top : (toValue(stickyOffset) ?? 0);\n const distance = element.getBoundingClientRect().top - viewTop;\n if (distance >= 0)\n return;\n\n if (scroller)\n scroller.scrollBy({ top: distance });\n else\n scrollPageBy(distance);\n }\n\n return { revealTableTop };\n}\n\n/**\n * Whether the pagination bar may stick: true once the top {@link STICK_AFTER}px of the table are\n * inside its scrolling area. It starts true, so a page without IntersectionObserver keeps the bar\n * sticky.\n */\nexport function useStickyPaginationBar(\n wrapper: Readonly<Ref<HTMLElement | null | undefined>>,\n enabled: MaybeRefOrGetter<boolean>,\n): Readonly<Ref<boolean>> {\n const canStick = shallowRef<boolean>(true);\n const root = shallowRef<HTMLElement>();\n\n onMounted(() => {\n const element = get(wrapper);\n if (element)\n set(root, findScroller(element));\n });\n\n useIntersectionObserver(\n () => (toValue(enabled) ? get(wrapper) : undefined),\n ([entry]) => {\n if (!entry)\n return;\n // also true once the table has scrolled past the top, when the bar is out of view anyway\n set(canStick, entry.isIntersecting || entry.boundingClientRect.bottom <= (entry.rootBounds?.top ?? 0));\n },\n { root, rootMargin: `0px 0px -${STICK_AFTER}px 0px` },\n );\n\n return canStick;\n}\n\n/** The height of each pagination bar stuck to the page, by table; the page's floating parts clear the tallest. */\nconst stuckBarHeights = new Map<symbol, number>();\n\nfunction publishStickyBottom(): void {\n if (typeof document === 'undefined')\n return;\n const style = document.documentElement.style;\n if (stuckBarHeights.size === 0)\n style.removeProperty('--rui-sticky-bottom');\n else\n style.setProperty('--rui-sticky-bottom', `${Math.max(...stuckBarHeights.values())}px`);\n}\n\n/**\n * Publishes how much of the view's bottom a stuck pagination bar covers, as `--rui-sticky-bottom` on\n * the document root, so the page's own floating parts (a dock, a FAB) can rise above the bar instead of\n * covering its page buttons. Only a bar stuck to the page counts: one stuck inside a scrolling area\n * sits under nothing the page floats.\n *\n * @param sentinel - an empty element at the bar's own place after the rows; while it is below the view, the bar is stuck\n * @param bar - the bar, measured for its height\n * @param canStick - whether the bar may stick at all\n */\nexport function useStickyBottomInset(\n sentinel: Readonly<Ref<HTMLElement | null | undefined>>,\n bar: MaybeComputedElementRef,\n canStick: MaybeRefOrGetter<boolean>,\n): void {\n const id = Symbol('sticky-pagination-bar');\n const belowView = shallowRef<boolean>(false);\n const pageLevel = shallowRef<boolean>(false);\n const { height } = useElementSize(bar, undefined, { box: 'border-box' });\n\n onMounted(() => {\n const element = get(sentinel);\n set(pageLevel, !!element && !findScroller(element));\n });\n\n useIntersectionObserver(sentinel, ([entry]) => {\n if (!entry)\n return;\n // no root bounds (a cross-origin frame) reads as not stuck, which leaves the floating parts where they are\n set(belowView, !entry.isIntersecting && entry.boundingClientRect.top >= (entry.rootBounds?.bottom ?? Number.POSITIVE_INFINITY));\n });\n\n watchEffect(() => {\n if (get(pageLevel) && toValue(canStick) && get(belowView) && get(height) > 0)\n stuckBarHeights.set(id, get(height));\n else\n stuckBarHeights.delete(id);\n publishStickyBottom();\n });\n\n onScopeDispose(() => {\n stuckBarHeights.delete(id);\n publishStickyBottom();\n });\n}\n"],"mappings":";;;;;;;;;AAaA,IAAM,cAAc;;;;;AAMpB,SAAS,a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ey` is left, because consumers still use
|
|
3
|
+
* it widely; new code takes the zinc `neutral` ramp, and the other Material hues were dropped in 3.0.
|
|
4
|
+
*/
|
|
1
5
|
export declare const baseColors: string[];
|
|
2
6
|
export declare const baseColorsIntensities: string[];
|
|
3
7
|
/**
|
package/dist/consts/colors.js
CHANGED
|
@@ -1,40 +1,4 @@
|
|
|
1
1
|
//#region src/consts/colors.ts
|
|
2
|
-
var baseColors = [
|
|
3
|
-
"grey",
|
|
4
|
-
"indigo",
|
|
5
|
-
"deep-purple",
|
|
6
|
-
"amber",
|
|
7
|
-
"orange",
|
|
8
|
-
"pink",
|
|
9
|
-
"deep-orange",
|
|
10
|
-
"green",
|
|
11
|
-
"red",
|
|
12
|
-
"light-green",
|
|
13
|
-
"purple",
|
|
14
|
-
"lime",
|
|
15
|
-
"light-blue",
|
|
16
|
-
"yellow",
|
|
17
|
-
"cyan",
|
|
18
|
-
"teal",
|
|
19
|
-
"blue",
|
|
20
|
-
"blue-gray"
|
|
21
|
-
];
|
|
22
|
-
var baseColorsIntensities = [
|
|
23
|
-
"50",
|
|
24
|
-
"100",
|
|
25
|
-
"200",
|
|
26
|
-
"300",
|
|
27
|
-
"400",
|
|
28
|
-
"500",
|
|
29
|
-
"600",
|
|
30
|
-
"700",
|
|
31
|
-
"800",
|
|
32
|
-
"900",
|
|
33
|
-
"a100",
|
|
34
|
-
"a200",
|
|
35
|
-
"a400",
|
|
36
|
-
"a700"
|
|
37
|
-
];
|
|
38
2
|
/**
|
|
39
3
|
* The available context colors.
|
|
40
4
|
* Keep in sync with build-web-types.mjs
|
|
@@ -48,6 +12,6 @@ var contextColors = [
|
|
|
48
12
|
"success"
|
|
49
13
|
];
|
|
50
14
|
//#endregion
|
|
51
|
-
export {
|
|
15
|
+
export { contextColors };
|
|
52
16
|
|
|
53
17
|
//# sourceMappingURL=colors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors.js","names":[],"sources":["../../src/consts/colors.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"colors.js","names":[],"sources":["../../src/consts/colors.ts"],"sourcesContent":["/**\n * The Material palette the library kept from 2.x. Only `grey` is left, because consumers still use\n * it widely; new code takes the zinc `neutral` ramp, and the other Material hues were dropped in 3.0.\n */\nexport const baseColors = [\n 'grey',\n];\n\nexport const baseColorsIntensities = [\n '50',\n '100',\n '200',\n '300',\n '400',\n '500',\n '600',\n '700',\n '800',\n '900',\n 'a100',\n 'a200',\n 'a400',\n 'a700',\n];\n\n/**\n * The available context colors.\n * Keep in sync with build-web-types.mjs\n */\nexport const contextColors = [\n 'primary',\n 'secondary',\n 'error',\n 'warning',\n 'info',\n 'success',\n] as const;\n\nexport type ContextColorsType = (typeof contextColors)[number];\n\nexport const contextColorsIntensities = [\n { name: 'Regular', prefix: '' },\n { name: 'Darker', prefix: '-darker' },\n { name: 'Lighter', prefix: '-lighter' },\n];\n"],"mappings":";;;;;AA6BA,IAAa,gBAAgB;CAC3B;CACA;CACA;CACA;CACA;CACA;AACF"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The theme's role tokens, named here so the generated theme and the class
|
|
3
|
+
* merger agree on them: `rounded-rui-control` and `shadow-rui-menu` only
|
|
4
|
+
* dedupe against `rounded-full` or `shadow-lg` when the merger knows the names.
|
|
5
|
+
*/
|
|
6
|
+
export declare const radiusRoles: readonly ["control", "panel", "card", "sm", "lg"];
|
|
7
|
+
export type RadiusRole = (typeof radiusRoles)[number];
|
|
8
|
+
export declare const shadowRoles: readonly ["menu", "drawer", "tooltip", "control"];
|
|
9
|
+
export type ShadowRole = (typeof shadowRoles)[number];
|
|
10
|
+
/**
|
|
11
|
+
* Surfaces by height: the page, a card, a menu, a drawer or notification. Held
|
|
12
|
+
* as bare channels in `--rui-*`, like the palette.
|
|
13
|
+
*/
|
|
14
|
+
export declare const surfaceColors: readonly ["background", "surface", "menu", "overlay"];
|
|
15
|
+
/** Lines: dividers between rows, and the edge of an outlined control. Held as full colors. */
|
|
16
|
+
export declare const lineColors: readonly ["divider", "outline"];
|
|
17
|
+
/**
|
|
18
|
+
* State layers: translucent fills for a hovered or pressed row, item or chip. Held as full
|
|
19
|
+
* colors. The `state-layer` utility lays one over a fill as a background image, which tints
|
|
20
|
+
* the fill without touching the text, as a `brightness` filter would.
|
|
21
|
+
*/
|
|
22
|
+
export declare const stateColors: readonly ["hover", "pressed"];
|
|
23
|
+
/**
|
|
24
|
+
* Surfaces between the others: `surface-muted` for tracks, wells and quiet chips (a step darker
|
|
25
|
+
* than the card), `surface-sunken` for an inset panel inside a card. Bare channels, per theme.
|
|
26
|
+
*/
|
|
27
|
+
export declare const insetSurfaceColors: readonly ["surface-muted", "surface-sunken"];
|
|
28
|
+
/**
|
|
29
|
+
* The tints of each context color: `subtle` (5%) for a large area like a banner, `soft` (10%) for
|
|
30
|
+
* a selected row or a badge, `border` (30%) for its edge.
|
|
31
|
+
*/
|
|
32
|
+
export declare const contextTints: {
|
|
33
|
+
readonly subtle: 5;
|
|
34
|
+
readonly soft: 10;
|
|
35
|
+
readonly border: 30;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* A categorical palette for charts and legends, eight hues that stay apart from each other and
|
|
39
|
+
* from the status colors, plus a neutral `chart-other` for the rest.
|
|
40
|
+
*/
|
|
41
|
+
export declare const chartColors: readonly ["chart-1", "chart-2", "chart-3", "chart-4", "chart-5", "chart-6", "chart-7", "chart-8", "chart-other"];
|
|
42
|
+
/**
|
|
43
|
+
* The stacking layers, lowest first, as `--rui-z-*` and `z-rui-*`. Everything the library floats
|
|
44
|
+
* sits on one of them, so an app's own fixed parts can slot between instead of guessing a number.
|
|
45
|
+
*/
|
|
46
|
+
export declare const zLayers: readonly ["raised", "floating", "app-bar", "drawer", "dialog", "menu", "tooltip", "toast", "blocking"];
|
|
47
|
+
export type ZLayer = (typeof zLayers)[number];
|
|
48
|
+
/** RuiDialog's width presets, as `--rui-dialog-*` and `max-w-rui-dialog-*`. */
|
|
49
|
+
export declare const dialogSizes: readonly ["sm", "md", "lg", "xl", "2xl"];
|
|
50
|
+
export type DialogSize = (typeof dialogSizes)[number];
|
|
51
|
+
/**
|
|
52
|
+
* The neutral ramp, `rui-neutral-50` to `rui-neutral-950`, for the greys that
|
|
53
|
+
* are not Material's `rui-grey`. Its hue is the one place the restyle picks
|
|
54
|
+
* between zinc and slate.
|
|
55
|
+
*/
|
|
56
|
+
export declare const neutralShades: readonly ["50", "100", "200", "300", "400", "500", "600", "700", "800", "900", "950"];
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//#region src/consts/tokens.ts
|
|
2
|
+
/**
|
|
3
|
+
* The theme's role tokens, named here so the generated theme and the class
|
|
4
|
+
* merger agree on them: `rounded-rui-control` and `shadow-rui-menu` only
|
|
5
|
+
* dedupe against `rounded-full` or `shadow-lg` when the merger knows the names.
|
|
6
|
+
*/
|
|
7
|
+
var radiusRoles = [
|
|
8
|
+
"control",
|
|
9
|
+
"panel",
|
|
10
|
+
"card",
|
|
11
|
+
"sm",
|
|
12
|
+
"lg"
|
|
13
|
+
];
|
|
14
|
+
var shadowRoles = [
|
|
15
|
+
"menu",
|
|
16
|
+
"drawer",
|
|
17
|
+
"tooltip",
|
|
18
|
+
"control"
|
|
19
|
+
];
|
|
20
|
+
/**
|
|
21
|
+
* The stacking layers, lowest first, as `--rui-z-*` and `z-rui-*`. Everything the library floats
|
|
22
|
+
* sits on one of them, so an app's own fixed parts can slot between instead of guessing a number.
|
|
23
|
+
*/
|
|
24
|
+
var zLayers = [
|
|
25
|
+
"raised",
|
|
26
|
+
"floating",
|
|
27
|
+
"app-bar",
|
|
28
|
+
"drawer",
|
|
29
|
+
"dialog",
|
|
30
|
+
"menu",
|
|
31
|
+
"tooltip",
|
|
32
|
+
"toast",
|
|
33
|
+
"blocking"
|
|
34
|
+
];
|
|
35
|
+
/** RuiDialog's width presets, as `--rui-dialog-*` and `max-w-rui-dialog-*`. */
|
|
36
|
+
var dialogSizes = [
|
|
37
|
+
"sm",
|
|
38
|
+
"md",
|
|
39
|
+
"lg",
|
|
40
|
+
"xl",
|
|
41
|
+
"2xl"
|
|
42
|
+
];
|
|
43
|
+
//#endregion
|
|
44
|
+
export { dialogSizes, radiusRoles, shadowRoles, zLayers };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","names":[],"sources":["../../src/consts/tokens.ts"],"sourcesContent":["/**\n * The theme's role tokens, named here so the generated theme and the class\n * merger agree on them: `rounded-rui-control` and `shadow-rui-menu` only\n * dedupe against `rounded-full` or `shadow-lg` when the merger knows the names.\n */\nexport const radiusRoles = ['control', 'panel', 'card', 'sm', 'lg'] as const;\n\nexport type RadiusRole = (typeof radiusRoles)[number];\n\nexport const shadowRoles = ['menu', 'drawer', 'tooltip', 'control'] as const;\n\nexport type ShadowRole = (typeof shadowRoles)[number];\n\n/**\n * Surfaces by height: the page, a card, a menu, a drawer or notification. Held\n * as bare channels in `--rui-*`, like the palette.\n */\nexport const surfaceColors = ['background', 'surface', 'menu', 'overlay'] as const;\n\n/** Lines: dividers between rows, and the edge of an outlined control. Held as full colors. */\nexport const lineColors = ['divider', 'outline'] as const;\n\n/**\n * State layers: translucent fills for a hovered or pressed row, item or chip. Held as full\n * colors. The `state-layer` utility lays one over a fill as a background image, which tints\n * the fill without touching the text, as a `brightness` filter would.\n */\nexport const stateColors = ['hover', 'pressed'] as const;\n\n/**\n * Surfaces between the others: `surface-muted` for tracks, wells and quiet chips (a step darker\n * than the card), `surface-sunken` for an inset panel inside a card. Bare channels, per theme.\n */\nexport const insetSurfaceColors = ['surface-muted', 'surface-sunken'] as const;\n\n/**\n * The tints of each context color: `subtle` (5%) for a large area like a banner, `soft` (10%) for\n * a selected row or a badge, `border` (30%) for its edge.\n */\nexport const contextTints = { subtle: 5, soft: 10, border: 30 } as const;\n\n/**\n * A categorical palette for charts and legends, eight hues that stay apart from each other and\n * from the status colors, plus a neutral `chart-other` for the rest.\n */\nexport const chartColors = ['chart-1', 'chart-2', 'chart-3', 'chart-4', 'chart-5', 'chart-6', 'chart-7', 'chart-8', 'chart-other'] as const;\n\n/**\n * The stacking layers, lowest first, as `--rui-z-*` and `z-rui-*`. Everything the library floats\n * sits on one of them, so an app's own fixed parts can slot between instead of guessing a number.\n */\nexport const zLayers = ['raised', 'floating', 'app-bar', 'drawer', 'dialog', 'menu', 'tooltip', 'toast', 'blocking'] as const;\n\nexport type ZLayer = (typeof zLayers)[number];\n\n/** RuiDialog's width presets, as `--rui-dialog-*` and `max-w-rui-dialog-*`. */\nexport const dialogSizes = ['sm', 'md', 'lg', 'xl', '2xl'] as const;\n\nexport type DialogSize = (typeof dialogSizes)[number];\n\n/**\n * The neutral ramp, `rui-neutral-50` to `rui-neutral-950`, for the greys that\n * are not Material's `rui-grey`. Its hue is the one place the restyle picks\n * between zinc and slate.\n */\nexport const neutralShades = ['50', '100', '200', '300', '400', '500', '600', '700', '800', '900', '950'] as const;\n"],"mappings":";;;;;;AAKA,IAAa,cAAc;CAAC;CAAW;CAAS;CAAQ;CAAM;AAAI;AAIlE,IAAa,cAAc;CAAC;CAAQ;CAAU;CAAW;AAAS;;;;;AA0ClE,IAAa,UAAU;CAAC;CAAU;CAAY;CAAW;CAAU;CAAU;CAAQ;CAAW;CAAS;AAAU;;AAKnH,IAAa,cAAc;CAAC;CAAM;CAAM;CAAM;CAAM;AAAK"}
|
|
@@ -1,38 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The type scale, largest first, as the typography docs page lists it: each utility with its size,
|
|
3
|
+
* line height and weight in pixels, and what it is for.
|
|
4
|
+
*/
|
|
1
5
|
export declare const typographyClasses: readonly [{
|
|
2
|
-
readonly className: "text-body-1";
|
|
3
|
-
readonly name: "Body 1";
|
|
4
|
-
}, {
|
|
5
|
-
readonly className: "text-body-2";
|
|
6
|
-
readonly name: "Body 2";
|
|
7
|
-
}, {
|
|
8
|
-
readonly className: "text-subtitle-1";
|
|
9
|
-
readonly name: "Subtitle 1";
|
|
10
|
-
}, {
|
|
11
|
-
readonly className: "text-subtitle-2";
|
|
12
|
-
readonly name: "Subtitle 2";
|
|
13
|
-
}, {
|
|
14
|
-
readonly className: "text-caption";
|
|
15
|
-
readonly name: "Caption";
|
|
16
|
-
}, {
|
|
17
|
-
readonly className: "text-overline";
|
|
18
|
-
readonly name: "Overline";
|
|
19
|
-
}, {
|
|
20
6
|
readonly className: "text-h1";
|
|
21
7
|
readonly name: "H1";
|
|
8
|
+
readonly spec: "60 / 72 semibold";
|
|
9
|
+
readonly use: "Marketing heroes";
|
|
22
10
|
}, {
|
|
23
11
|
readonly className: "text-h2";
|
|
24
12
|
readonly name: "H2";
|
|
13
|
+
readonly spec: "48 / 56 semibold";
|
|
14
|
+
readonly use: "Landing page sections";
|
|
25
15
|
}, {
|
|
26
16
|
readonly className: "text-h3";
|
|
27
17
|
readonly name: "H3";
|
|
18
|
+
readonly spec: "36 / 44 semibold";
|
|
19
|
+
readonly use: "Large numbers, empty states";
|
|
28
20
|
}, {
|
|
29
21
|
readonly className: "text-h4";
|
|
30
22
|
readonly name: "H4";
|
|
23
|
+
readonly spec: "30 / 38 semibold";
|
|
24
|
+
readonly use: "Page titles on wide screens";
|
|
31
25
|
}, {
|
|
32
26
|
readonly className: "text-h5";
|
|
33
27
|
readonly name: "H5";
|
|
28
|
+
readonly spec: "24 / 32 semibold";
|
|
29
|
+
readonly use: "Page titles";
|
|
34
30
|
}, {
|
|
35
31
|
readonly className: "text-h6";
|
|
36
32
|
readonly name: "H6";
|
|
33
|
+
readonly spec: "20 / 32 semibold";
|
|
34
|
+
readonly use: "Card and dialog titles";
|
|
35
|
+
}, {
|
|
36
|
+
readonly className: "text-subtitle-1";
|
|
37
|
+
readonly name: "Subtitle 1";
|
|
38
|
+
readonly spec: "16 / 28 medium";
|
|
39
|
+
readonly use: "Section headings";
|
|
40
|
+
}, {
|
|
41
|
+
readonly className: "text-subtitle-2";
|
|
42
|
+
readonly name: "Subtitle 2";
|
|
43
|
+
readonly spec: "14 / 20 medium";
|
|
44
|
+
readonly use: "Labels, table headers";
|
|
45
|
+
}, {
|
|
46
|
+
readonly className: "text-body-1";
|
|
47
|
+
readonly name: "Body 1";
|
|
48
|
+
readonly spec: "16 / 24 regular";
|
|
49
|
+
readonly use: "Running text";
|
|
50
|
+
}, {
|
|
51
|
+
readonly className: "text-body-2";
|
|
52
|
+
readonly name: "Body 2";
|
|
53
|
+
readonly spec: "14 / 20 regular";
|
|
54
|
+
readonly use: "Controls, tables, dense text";
|
|
55
|
+
}, {
|
|
56
|
+
readonly className: "text-caption";
|
|
57
|
+
readonly name: "Caption";
|
|
58
|
+
readonly spec: "12 / 20 regular";
|
|
59
|
+
readonly use: "Hints, timestamps, help text";
|
|
60
|
+
}, {
|
|
61
|
+
readonly className: "text-caption-2";
|
|
62
|
+
readonly name: "Caption 2";
|
|
63
|
+
readonly spec: "10 / 16 regular";
|
|
64
|
+
readonly use: "Dense tags, axis labels";
|
|
65
|
+
}, {
|
|
66
|
+
readonly className: "text-overline";
|
|
67
|
+
readonly name: "Overline";
|
|
68
|
+
readonly spec: "12 / 32 medium, tracked";
|
|
69
|
+
readonly use: "Eyebrows above a heading";
|
|
37
70
|
}];
|
|
38
71
|
export type TypographyClass = (typeof typographyClasses)[number];
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import type { App } from 'vue';
|
|
2
2
|
import type { InitThemeOptions } from './types/theme.js';
|
|
3
|
+
import { type FieldOptions } from './composables/defaults/field.js';
|
|
4
|
+
import { type LogoOptions } from './composables/defaults/logo.js';
|
|
3
5
|
import { type TableOptions } from './composables/defaults/table.js';
|
|
4
6
|
import { StepperState } from './types/stepper.js';
|
|
5
7
|
import './style.css';
|
|
6
8
|
export * from './components/index.js';
|
|
9
|
+
export { activatorHandlers, type ActivatorHandlers } from './components/overlays/menu/activator-handlers.js';
|
|
7
10
|
export * from './composables/index.js';
|
|
11
|
+
export { type FieldOptions, type LabelPlacement, provideFieldDefaults } from './composables/defaults/field.js';
|
|
12
|
+
export type { LogoOptions, LogoResolver } from './composables/defaults/logo.js';
|
|
8
13
|
export { contextColors, type ContextColorsType } from './consts/colors.js';
|
|
9
14
|
export { translationKeys } from './i18n/keys.js';
|
|
10
15
|
export * from './icons/index.js';
|
|
@@ -18,12 +23,20 @@ export interface RuiOptions {
|
|
|
18
23
|
theme?: InitThemeOptions;
|
|
19
24
|
defaults?: {
|
|
20
25
|
table?: Partial<TableOptions>;
|
|
26
|
+
/** `labelPlacement` for every text field, text area, select and picker; `top` when unset. */
|
|
27
|
+
field?: Partial<FieldOptions>;
|
|
21
28
|
};
|
|
29
|
+
/**
|
|
30
|
+
* Where `RuiLogo` gets the image for its `logo` prop. Without it every
|
|
31
|
+
* `RuiLogo` shows the bundled logo, and the library makes no network request.
|
|
32
|
+
*/
|
|
33
|
+
logo?: LogoOptions;
|
|
22
34
|
}
|
|
23
35
|
export declare function createRui(options?: RuiOptions): {
|
|
24
36
|
defaults: Readonly<{
|
|
25
37
|
icons: import("./composables/icons.js").UseIconsReturn;
|
|
26
38
|
table: TableOptions;
|
|
39
|
+
field: FieldOptions;
|
|
27
40
|
}>;
|
|
28
41
|
install: (app: App) => void;
|
|
29
42
|
};
|