@rotki/ui-library 3.2.0 → 3.3.0
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/dist/components/accordions/accordion/RuiAccordion.js.map +1 -1
- package/dist/components/accordions/accordion/RuiAccordion.vue.d.ts +4 -2
- 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.d.ts +26 -9
- package/dist/components/accordions/accordions/RuiAccordions.vue_vue_type_script_setup_true_lang.js +11 -10
- 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.d.ts +4 -2
- 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.d.ts +4 -2
- 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 +3 -2
- package/dist/components/avatars/RuiAvatarGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/buttons/button/RuiButton.js.map +1 -1
- package/dist/components/buttons/button/RuiButton.vue.d.ts +2 -1
- package/dist/components/buttons/button/RuiButton.vue_vue_type_script_setup_true_lang.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 +10 -4
- package/dist/components/buttons/button-group/RuiButtonGroup.vue_vue_type_script_setup_true_lang.js +7 -8
- package/dist/components/buttons/button-group/RuiButtonGroup.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 +3 -3
- 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 +3 -3
- 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.d.ts +3 -3
- package/dist/components/calendar/RuiCalendarMenu.vue_vue_type_script_setup_true_lang.js +7 -4
- package/dist/components/calendar/RuiCalendarMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/calendar/state.d.ts +8 -1
- package/dist/components/calendar/state.js +13 -1
- package/dist/components/calendar/state.js.map +1 -1
- package/dist/components/cards/RuiCard.js.map +1 -1
- package/dist/components/cards/RuiCard.vue.d.ts +3 -1
- 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.d.ts +3 -1
- 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 +4 -2
- package/dist/components/chips/RuiChip.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.d.ts +5 -2
- 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 +39 -30
- package/dist/components/date-time-picker/RuiDateTimePicker.vue_vue_type_script_setup_true_lang.js +8 -3
- 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.d.ts +2 -1
- 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 +2 -1
- package/dist/components/date-time-picker/RuiTimezoneSelect.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/divider/RuiDivider.js.map +1 -1
- package/dist/components/divider/RuiDivider.vue.d.ts +3 -1
- package/dist/components/divider/RuiDivider.vue_vue_type_script_setup_true_lang.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 +11 -5
- package/dist/components/forms/auto-complete/RuiAutoComplete.vue_vue_type_script_setup_true_lang.js +5 -0
- 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.d.ts +2 -1
- 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 -2
- package/dist/components/forms/auto-complete/RuiAutoCompleteOptionList.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/forms/auto-complete/auto-complete-props.d.ts +0 -1
- package/dist/components/forms/category-picker/RuiCategoryPicker.js.map +1 -1
- package/dist/components/forms/category-picker/RuiCategoryPicker.vue.d.ts +2 -1
- package/dist/components/forms/category-picker/RuiCategoryPicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/forms/checkbox/RuiCheckbox.js.map +1 -1
- package/dist/components/forms/checkbox/RuiCheckbox.vue.d.ts +2 -1
- package/dist/components/forms/checkbox/RuiCheckbox.vue_vue_type_script_setup_true_lang.js +4 -1
- 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.d.ts +2 -1
- package/dist/components/forms/checkbox/checkbox-group/RuiCheckboxGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/forms/file-upload/RuiFileUpload.js.map +1 -1
- package/dist/components/forms/file-upload/RuiFileUpload.vue.d.ts +36 -29
- package/dist/components/forms/file-upload/RuiFileUpload.vue_vue_type_script_setup_true_lang.js +5 -0
- 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.d.ts +5 -3
- package/dist/components/forms/radio-button/radio/RuiRadio.vue_vue_type_script_setup_true_lang.js +7 -8
- 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.d.ts +5 -3
- package/dist/components/forms/radio-button/radio-group/RuiRadioGroup.vue_vue_type_script_setup_true_lang.js +9 -10
- 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.d.ts +9 -2
- 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 +10 -4
- package/dist/components/forms/select/RuiMenuSelect.vue_vue_type_script_setup_true_lang.js +5 -0
- 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 +22 -11
- package/dist/components/forms/select/RuiSimpleSelect.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/forms/slider/RuiSlider.js.map +1 -1
- package/dist/components/forms/slider/RuiSlider.vue.d.ts +2 -1
- package/dist/components/forms/slider/RuiSlider.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/forms/switch/RuiSwitch.js.map +1 -1
- package/dist/components/forms/switch/RuiSwitch.vue.d.ts +2 -1
- 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 -1
- package/dist/components/forms/text-area/RuiTextArea.vue_vue_type_script_setup_true_lang.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 -1
- package/dist/components/forms/text-field/RuiTextField.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.d.ts +3 -1
- package/dist/components/icons/RuiIcon.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/index.d.ts +2 -2
- package/dist/components/loaders/RuiSkeletonLoader.js.map +1 -1
- package/dist/components/loaders/RuiSkeletonLoader.vue.d.ts +3 -1
- 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 +3 -1
- package/dist/components/logos/RuiLogo.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/overlays/badge/RuiBadge.js.map +1 -1
- package/dist/components/overlays/badge/RuiBadge.vue.d.ts +3 -1
- package/dist/components/overlays/badge/RuiBadge.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/overlays/bottom-sheet/RuiBottomSheet.js.map +1 -1
- package/dist/components/overlays/bottom-sheet/RuiBottomSheet.vue.d.ts +11 -5
- package/dist/components/overlays/bottom-sheet/RuiBottomSheet.vue_vue_type_script_setup_true_lang.js +6 -7
- package/dist/components/overlays/bottom-sheet/RuiBottomSheet.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 +5 -3
- 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 +2 -1
- package/dist/components/overlays/menu/RuiMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/overlays/navigation-drawer/RuiNavigationDrawer.js.map +1 -1
- package/dist/components/overlays/navigation-drawer/RuiNavigationDrawer.vue.d.ts +2 -1
- 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.d.ts +2 -1
- 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 +4 -2
- package/dist/components/overlays/tooltip/RuiTooltip.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/progress/RuiProgress.js.map +1 -1
- package/dist/components/progress/RuiProgress.vue.d.ts +3 -1
- 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.d.ts +2 -1
- 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 +3 -1
- package/dist/components/steppers/RuiStepper.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 +14 -19
- package/dist/components/tables/RuiDataTable.vue_vue_type_script_setup_true_lang.js +25 -29
- 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.d.ts +3 -1
- 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.d.ts +4 -2
- 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.d.ts +3 -1
- package/dist/components/tables/RuiTableEmptyState.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/tables/RuiTableErrorState.js.map +1 -1
- package/dist/components/tables/RuiTableErrorState.vue.d.ts +4 -2
- package/dist/components/tables/RuiTableErrorState.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.d.ts +3 -2
- package/dist/components/tables/RuiTableHead.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/components/tables/RuiTableHead.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/tables/RuiTableLoadingState.js.map +1 -1
- package/dist/components/tables/RuiTableLoadingState.vue.d.ts +3 -1
- package/dist/components/tables/RuiTableLoadingState.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.d.ts +2 -1
- package/dist/components/tables/RuiTablePagination.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/tables/data-table/RuiDataTableCell.js.map +1 -1
- package/dist/components/tables/data-table/RuiDataTableCell.vue_vue_type_script_setup_true_lang.js +2 -4
- package/dist/components/tables/data-table/RuiDataTableCell.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.d.ts +1 -1
- package/dist/components/tables/data-table/RuiDataTableMobileSort.vue_vue_type_script_setup_true_lang.js +2 -3
- package/dist/components/tables/data-table/RuiDataTableMobileSort.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/tables/data-table/context.d.ts +6 -6
- package/dist/components/tables/data-table/context.js +1 -1
- package/dist/components/tables/data-table/context.js.map +1 -1
- package/dist/components/tables/table-props.d.ts +9 -0
- package/dist/components/tables/table-props.js +13 -1
- package/dist/components/tables/table-props.js.map +1 -1
- package/dist/components/tabs/tab/RuiTab.js.map +1 -1
- package/dist/components/tabs/tab/RuiTab.vue.d.ts +4 -2
- 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 +3 -1
- 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.d.ts +5 -12
- package/dist/components/tabs/tab-items/RuiTabItems.vue_vue_type_script_setup_true_lang.js +8 -14
- package/dist/components/tabs/tab-items/RuiTabItems.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/tabs/tabs/RuiTabs.js.map +1 -1
- package/dist/components/tabs/tabs/RuiTabs.vue.d.ts +26 -14
- package/dist/components/tabs/tabs/RuiTabs.vue_vue_type_script_setup_true_lang.js +11 -13
- package/dist/components/tabs/tabs/RuiTabs.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/time-picker/RuiTimePicker.js.map +1 -1
- package/dist/components/time-picker/RuiTimePicker.vue.d.ts +2 -1
- package/dist/components/time-picker/RuiTimePicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/composables/dropdown-menu.js.map +1 -1
- package/dist/composables/forms/auto-complete/search.js.map +1 -1
- package/dist/composables/forms/auto-complete/value.d.ts +1 -1
- package/dist/composables/forms/auto-complete/value.js.map +1 -1
- package/dist/composables/prop-model.d.ts +21 -0
- package/dist/composables/prop-model.js +33 -0
- package/dist/composables/prop-model.js.map +1 -0
- package/dist/composables/tables/data-table/columns.d.ts +2 -1
- package/dist/composables/tables/data-table/columns.js.map +1 -1
- package/dist/composables/tables/data-table/types.d.ts +35 -0
- package/dist/composables/tables/data-table/types.js.map +1 -1
- package/dist/composables/use-rui-i18n.d.ts +6 -3
- package/dist/composables/use-rui-i18n.js +1 -1
- package/dist/composables/use-rui-i18n.js.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +14 -6
- package/dist/index.js.map +1 -1
- package/dist/types/attributes.d.ts +9 -0
- package/dist/utils/blockie.js +10 -9
- package/dist/utils/blockie.js.map +1 -1
- package/dist/web-types.json +280 -110
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuiAccordion.js","names":["_sfc_main"],"sources":["../../../../src/components/accordions/accordion/RuiAccordion.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { VueClassValue } from '@/types/class-value';\nimport Icon from '@/components/icons/RuiIcon.vue';\nimport { useClipWhileResizing } from '@/composables/clip-while-resizing';\nimport { cn } from '@/utils/tv';\nimport { accordionStyles } from './accordion-styles';\n\nexport interface RuiAccordionClassNames {\n root?: VueClassValue;\n header?: VueClassValue;\n content?: VueClassValue;\n}\n\nexport interface AccordionProps {\n open?: boolean;\n eager?: boolean;\n headerGrow?: boolean;\n classNames?: RuiAccordionClassNames;\n}\n\ndefineOptions({\n name: 'RuiAccordion',\n inheritAttrs: false,\n});\n\nconst {\n open = false,\n eager = false,\n headerGrow = false,\n classNames,\n} = defineProps<AccordionProps
|
|
1
|
+
{"version":3,"file":"RuiAccordion.js","names":["_sfc_main"],"sources":["../../../../src/components/accordions/accordion/RuiAccordion.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from 'vue';\nimport type { VueClassValue } from '@/types/class-value';\nimport Icon from '@/components/icons/RuiIcon.vue';\nimport { useClipWhileResizing } from '@/composables/clip-while-resizing';\nimport { cn } from '@/utils/tv';\nimport { accordionStyles } from './accordion-styles';\n\nexport interface RuiAccordionClassNames {\n root?: VueClassValue;\n header?: VueClassValue;\n content?: VueClassValue;\n}\n\nexport interface AccordionProps {\n open?: boolean;\n eager?: boolean;\n headerGrow?: boolean;\n classNames?: RuiAccordionClassNames;\n}\n\ndefineOptions({\n name: 'RuiAccordion',\n inheritAttrs: false,\n});\n\nconst {\n open = false,\n eager = false,\n headerGrow = false,\n classNames,\n} = defineProps<AccordionProps & /* @vue-ignore */ Omit<HTMLAttributes, keyof AccordionProps | 'onClick'>>();\n\nconst emit = defineEmits<{\n click: [];\n}>();\n\ndefineSlots<{\n header?: (props: { open: boolean }) => any;\n default?: () => any;\n}>();\n\nconst inner = useTemplateRef<HTMLDivElement>('inner');\nconst content = useTemplateRef<HTMLDivElement>('content');\n\nconst triggerId = useId();\nconst contentId = useId();\nconst { height: innerHeight } = useElementSize(inner);\n\nconst contentHeight = computed<string>(() => (open ? `${get(innerHeight)}px` : '0px'));\n\nconst resizing = useClipWhileResizing(content, contentHeight);\n\n// a closed `eager` panel keeps its content at height 0, so it clips; an open one only while it resizes, so sticky content works\nconst clipped = computed<boolean>(() => !open || get(resizing));\n\nfunction toggle(): void {\n emit('click');\n}\n\nfunction onKeydown(event: KeyboardEvent): void {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n toggle();\n }\n}\n</script>\n\n<template>\n <div\n :class=\"accordionStyles({ class: cn(classNames?.root ?? $attrs.class) })\"\n :data-state=\"open ? 'open' : 'closed'\"\n data-accordion\n v-bind=\"{ ...$attrs, class: undefined }\"\n >\n <!-- rounded only while focused: a permanent radius bent any border an app draws on the header -->\n <div\n v-if=\"$slots.header\"\n :id=\"triggerId\"\n class=\"group flex gap-2 items-center cursor-pointer outline-hidden focus-visible:focus-ring focus-visible:rounded-rui-control\"\n :class=\"[classNames?.header, { 'w-full': headerGrow }]\"\n role=\"button\"\n tabindex=\"0\"\n :aria-expanded=\"open\"\n :aria-controls=\"contentId\"\n data-accordion-trigger\n @click=\"toggle()\"\n @keydown=\"onKeydown($event)\"\n >\n <div :class=\"{ grow: headerGrow }\">\n <slot\n name=\"header\"\n :open=\"open\"\n />\n </div>\n <Icon\n class=\"shrink-0 text-rui-text-secondary transition-[rotate,color] duration-200 ease-out group-hover:text-rui-text motion-reduce:transition-none\"\n :class=\"{ '-rotate-180': open }\"\n name=\"lu-chevron-down\"\n :size=\"16\"\n />\n </div>\n <div\n v-if=\"open || eager\"\n :id=\"contentId\"\n ref=\"content\"\n class=\"grow transition-[height] duration-200 ease-out w-full motion-reduce:transition-none\"\n :class=\"[{ 'overflow-hidden': clipped }, classNames?.content]\"\n :data-clipped=\"clipped || undefined\"\n :style=\"{ height: contentHeight }\"\n role=\"region\"\n :aria-labelledby=\"triggerId\"\n data-accordion-content\n >\n <div ref=\"inner\">\n <slot name=\"default\" />\n </div>\n </div>\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'vue';
|
|
1
2
|
import type { VueClassValue } from '../../../types/class-value.js';
|
|
2
3
|
export interface RuiAccordionClassNames {
|
|
3
4
|
root?: VueClassValue;
|
|
@@ -10,15 +11,16 @@ export interface AccordionProps {
|
|
|
10
11
|
headerGrow?: boolean;
|
|
11
12
|
classNames?: RuiAccordionClassNames;
|
|
12
13
|
}
|
|
14
|
+
type __VLS_Props = AccordionProps & /* @vue-ignore */ Omit<HTMLAttributes, keyof AccordionProps | 'onClick'>;
|
|
13
15
|
type __VLS_Slots = {
|
|
14
16
|
header?: (props: {
|
|
15
17
|
open: boolean;
|
|
16
18
|
}) => any;
|
|
17
19
|
default?: () => any;
|
|
18
20
|
};
|
|
19
|
-
declare const __VLS_base: import("vue").DefineComponent<
|
|
21
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
20
22
|
click: () => any;
|
|
21
|
-
}, string, import("vue").PublicProps, Readonly<
|
|
23
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
22
24
|
onClick?: (() => any) | undefined;
|
|
23
25
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
24
26
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
package/dist/components/accordions/accordion/RuiAccordion.vue_vue_type_script_setup_true_lang.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuiAccordion.vue_vue_type_script_setup_true_lang.js","names":["$attrs","$slots","_openBlock","_createElementBlock","_mergeProps","_unref","_normalizeClass","_createElementVNode","_renderSlot","_createVNode","Icon","_createCommentVNode","_normalizeStyle"],"sources":["../../../../src/components/accordions/accordion/RuiAccordion.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { VueClassValue } from '@/types/class-value';\nimport Icon from '@/components/icons/RuiIcon.vue';\nimport { useClipWhileResizing } from '@/composables/clip-while-resizing';\nimport { cn } from '@/utils/tv';\nimport { accordionStyles } from './accordion-styles';\n\nexport interface RuiAccordionClassNames {\n root?: VueClassValue;\n header?: VueClassValue;\n content?: VueClassValue;\n}\n\nexport interface AccordionProps {\n open?: boolean;\n eager?: boolean;\n headerGrow?: boolean;\n classNames?: RuiAccordionClassNames;\n}\n\ndefineOptions({\n name: 'RuiAccordion',\n inheritAttrs: false,\n});\n\nconst {\n open = false,\n eager = false,\n headerGrow = false,\n classNames,\n} = defineProps<AccordionProps
|
|
1
|
+
{"version":3,"file":"RuiAccordion.vue_vue_type_script_setup_true_lang.js","names":["$attrs","$slots","_openBlock","_createElementBlock","_mergeProps","_unref","_normalizeClass","_createElementVNode","_renderSlot","_createVNode","Icon","_createCommentVNode","_normalizeStyle"],"sources":["../../../../src/components/accordions/accordion/RuiAccordion.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from 'vue';\nimport type { VueClassValue } from '@/types/class-value';\nimport Icon from '@/components/icons/RuiIcon.vue';\nimport { useClipWhileResizing } from '@/composables/clip-while-resizing';\nimport { cn } from '@/utils/tv';\nimport { accordionStyles } from './accordion-styles';\n\nexport interface RuiAccordionClassNames {\n root?: VueClassValue;\n header?: VueClassValue;\n content?: VueClassValue;\n}\n\nexport interface AccordionProps {\n open?: boolean;\n eager?: boolean;\n headerGrow?: boolean;\n classNames?: RuiAccordionClassNames;\n}\n\ndefineOptions({\n name: 'RuiAccordion',\n inheritAttrs: false,\n});\n\nconst {\n open = false,\n eager = false,\n headerGrow = false,\n classNames,\n} = defineProps<AccordionProps & /* @vue-ignore */ Omit<HTMLAttributes, keyof AccordionProps | 'onClick'>>();\n\nconst emit = defineEmits<{\n click: [];\n}>();\n\ndefineSlots<{\n header?: (props: { open: boolean }) => any;\n default?: () => any;\n}>();\n\nconst inner = useTemplateRef<HTMLDivElement>('inner');\nconst content = useTemplateRef<HTMLDivElement>('content');\n\nconst triggerId = useId();\nconst contentId = useId();\nconst { height: innerHeight } = useElementSize(inner);\n\nconst contentHeight = computed<string>(() => (open ? `${get(innerHeight)}px` : '0px'));\n\nconst resizing = useClipWhileResizing(content, contentHeight);\n\n// a closed `eager` panel keeps its content at height 0, so it clips; an open one only while it resizes, so sticky content works\nconst clipped = computed<boolean>(() => !open || get(resizing));\n\nfunction toggle(): void {\n emit('click');\n}\n\nfunction onKeydown(event: KeyboardEvent): void {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n toggle();\n }\n}\n</script>\n\n<template>\n <div\n :class=\"accordionStyles({ class: cn(classNames?.root ?? $attrs.class) })\"\n :data-state=\"open ? 'open' : 'closed'\"\n data-accordion\n v-bind=\"{ ...$attrs, class: undefined }\"\n >\n <!-- rounded only while focused: a permanent radius bent any border an app draws on the header -->\n <div\n v-if=\"$slots.header\"\n :id=\"triggerId\"\n class=\"group flex gap-2 items-center cursor-pointer outline-hidden focus-visible:focus-ring focus-visible:rounded-rui-control\"\n :class=\"[classNames?.header, { 'w-full': headerGrow }]\"\n role=\"button\"\n tabindex=\"0\"\n :aria-expanded=\"open\"\n :aria-controls=\"contentId\"\n data-accordion-trigger\n @click=\"toggle()\"\n @keydown=\"onKeydown($event)\"\n >\n <div :class=\"{ grow: headerGrow }\">\n <slot\n name=\"header\"\n :open=\"open\"\n />\n </div>\n <Icon\n class=\"shrink-0 text-rui-text-secondary transition-[rotate,color] duration-200 ease-out group-hover:text-rui-text motion-reduce:transition-none\"\n :class=\"{ '-rotate-180': open }\"\n name=\"lu-chevron-down\"\n :size=\"16\"\n />\n </div>\n <div\n v-if=\"open || eager\"\n :id=\"contentId\"\n ref=\"content\"\n class=\"grow transition-[height] duration-200 ease-out w-full motion-reduce:transition-none\"\n :class=\"[{ 'overflow-hidden': clipped }, classNames?.content]\"\n :data-clipped=\"clipped || undefined\"\n :style=\"{ height: contentHeight }\"\n role=\"region\"\n :aria-labelledby=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AAA,MAAA,WAAE,OAAM;IACb,WAAO,OAAA,OAAA,OAAA,MAAA,WAAE,UAAU,MAAM;GAE1BE,GAAAA,CAAAA,mBAKM,OAAA,EALA,OAAKD,eAAA,EAAA,MAAU,QAAA,WAAU,CAAA,EAAA,GAAA,CAC7BE,WAGE,KAAA,QAAA,UAAA,EADC,MAAM,QAAA,KAAI,CAAA,CAAA,GAAA,CAAA,GAGfC,YAKEC,iBAAA;IAJA,OAAKJ,eAAA,CAAC,4IAA0I,EAAA,eACvH,QAAA,KAAI,CAAA,CAAA;IAC7B,MAAK;IACJ,MAAM;GAIH,GAAA,MAAA,GAAA,CAAA,OAAA,CAAA,CAAA,GAAA,IAAA,UAAA,KAAA,mBAAA,IAAA,IAAA,GAAA,QAAA,QAAQ,QAAA,SADhBJ,UAAA,GAAAC,mBAeM,OAAA;;IAbH,IAAIE,MAAA,SAAA;IACD,SAAA;IAAJ,KAAI;IACJ,OAAKC,eAAA,CAAC,uFAAqF,CAAA,EAAA,mBAC7DD,MAAA,OAAA,EAAO,GAAI,QAAA,YAAY,OAAO,CAAA,CAAA;IAC3D,gBAAcA,MAAA,OAAA,KAAW,KAAA;IACzB,OAAKO,eAAA,EAAA,QAAYP,MAAA,aAAA,EAAa,CAAA;IAC/B,MAAK;IACJ,mBAAiBA,MAAA,SAAA;IAClB,0BAAA;GAEAE,GAAAA,CAAAA,mBAEM,OAAA;IAFG,SAAA;IAAJ,KAAI;GACPC,GAAAA,CAAAA,WAAuB,KAAA,QAAA,SAAA,CAAA,GAAA,GAAA,CAAA,GAAA,IAAA,UAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,GAAA,IAAA,UAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuiAccordions.js","names":["_sfc_main"],"sources":["../../../../src/components/accordions/accordions/RuiAccordions.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { Fragment, isVNode } from 'vue';\n\nexport interface Props {\n multiple?: boolean;\n}\n\ndefineOptions({\n name: 'RuiAccordions',\n inheritAttrs: false,\n});\n\nconst modelValue =
|
|
1
|
+
{"version":3,"file":"RuiAccordions.js","names":["_sfc_main"],"sources":["../../../../src/components/accordions/accordions/RuiAccordions.vue"],"sourcesContent":["<script lang=\"ts\" setup generic=\"T extends number | number[]\">\nimport { Fragment, type HTMLAttributes, isVNode, type Ref } from 'vue';\nimport { type ModelValueEmits, usePropModel } from '@/composables/prop-model';\n\nexport interface Props {\n multiple?: boolean;\n}\n\ndefineOptions({\n name: 'RuiAccordions',\n inheritAttrs: false,\n});\n\nconst {\n multiple = false,\n modelValue: modelValueProp,\n} = defineProps<Props & {\n /**\n * The open panel's index, `-1` for none; with `multiple`, the open indices in an array. `T` is the\n * bound value's type, so a `Ref<number[]>` takes the update as is. Unbound, it reads as `-1`.\n *\n * @defaultValue -1\n */\n modelValue?: T;\n} & /* @vue-ignore */ Omit<HTMLAttributes, keyof Props>>();\n\ndefineEmits<ModelValueEmits<T>>();\n\n/*\n * A prop and an event rather than `defineModel`: the `-1` default is no `T`, and without a default\n * the update would be typed with an `undefined` it never carries. The component writes through the\n * wider ref.\n */\nconst modelValue: Ref<number | number[] | undefined> = usePropModel('modelValue', () => modelValueProp);\n\nconst internalValue = ref<number[] | number>();\n\nconst slots = useSlots();\n\n/**\n * Unwraps the Fragments a `v-for` or `<template>` makes, so each accordion gets its own index.\n * The placeholder a false `v-if` leaves keeps its index, so hiding one does not renumber the rest.\n *\n * @param nodes - the slot's top-level vnodes\n * @returns the accordions in order\n */\nfunction flattenSlotContent(nodes: VNode[]): VNode[] {\n return nodes.flatMap((node) => {\n if (node.type === Fragment && Array.isArray(node.children))\n return flattenSlotContent(node.children.filter(isVNode));\n\n return [node];\n });\n}\n\nconst children = computed<VNode[]>(() => {\n const accordions = flattenSlotContent(slots.default?.() ?? []);\n const currentValue = get(internalValue);\n\n return accordions.map((accordion, index) => {\n const open =\n multiple && Array.isArray(currentValue)\n ? currentValue.includes(index)\n : currentValue === index;\n\n return {\n ...accordion,\n props: {\n open,\n ...accordion.props,\n },\n };\n });\n});\n\nfunction updateValue(newModelValue: number): void {\n let newValue: number[] | number;\n const internal = get(internalValue);\n if (multiple && Array.isArray(internal)) {\n const temp = [...internal];\n const index = temp.indexOf(newModelValue);\n if (index === -1)\n temp.push(newModelValue);\n else temp.splice(index, 1);\n newValue = temp;\n }\n else {\n if (internal === newModelValue)\n newValue = -1;\n else newValue = newModelValue;\n }\n set(modelValue, newValue);\n set(internalValue, newValue);\n}\n\nwatch(\n [modelValue, () => multiple],\n ([value, isMultiple]) => {\n let internal: number | number[] = value ?? -1;\n if (isMultiple && !Array.isArray(internal))\n internal = internal === -1 ? [] : [internal];\n else if (!isMultiple && Array.isArray(internal))\n internal = internal[0] ?? -1;\n\n set(internalValue, internal);\n },\n { immediate: true },\n);\n</script>\n\n<template>\n <div v-bind=\"$attrs\">\n <component\n :is=\"child\"\n v-for=\"(child, i) in children\"\n :key=\"i\"\n @click=\"updateValue(i)\"\n />\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -1,15 +1,32 @@
|
|
|
1
|
+
import { type HTMLAttributes } from 'vue';
|
|
1
2
|
export interface Props {
|
|
2
3
|
multiple?: boolean;
|
|
3
4
|
}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
declare const __VLS_export: <T extends number | number[]>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
6
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<(Props & {
|
|
7
|
+
/**
|
|
8
|
+
* The open panel's index, `-1` for none; with `multiple`, the open indices in an array. `T` is the
|
|
9
|
+
* bound value's type, so a `Ref<number[]>` takes the update as is. Unbound, it reads as `-1`.
|
|
10
|
+
*
|
|
11
|
+
* @defaultValue -1
|
|
12
|
+
*/
|
|
13
|
+
modelValue?: T;
|
|
14
|
+
} & Omit<HTMLAttributes, "multiple">) & {
|
|
15
|
+
"onUpdate:modelValue"?: ((value: T) => any) | undefined;
|
|
16
|
+
}> & (typeof globalThis extends {
|
|
17
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
18
|
+
} ? P : {});
|
|
19
|
+
expose: (exposed: {}) => void;
|
|
20
|
+
attrs: any;
|
|
21
|
+
slots: {};
|
|
22
|
+
emit: (evt: "update:modelValue", value: T) => void;
|
|
23
|
+
}>) => import("vue").VNode & {
|
|
24
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
7
25
|
};
|
|
8
|
-
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
9
|
-
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
|
-
"update:modelValue": (value: number | number[]) => any;
|
|
11
|
-
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
12
|
-
"onUpdate:modelValue"?: ((value: number | number[]) => any) | undefined;
|
|
13
|
-
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
26
|
declare const _default: typeof __VLS_export;
|
|
15
27
|
export default _default;
|
|
28
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
29
|
+
[K in keyof T]: T[K];
|
|
30
|
+
} : {
|
|
31
|
+
[K in keyof T as K]: T[K];
|
|
32
|
+
}) & {};
|
package/dist/components/accordions/accordions/RuiAccordions.vue_vue_type_script_setup_true_lang.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { get, set } from "../../../vendor/@vueuse/shared/dist/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { usePropModel } from "../../../composables/prop-model.js";
|
|
3
|
+
import { Fragment, computed, createBlock, createElementBlock, defineComponent, guardReactiveProps, isVNode, normalizeProps, openBlock, ref, renderList, resolveDynamicComponent, unref, useSlots, watch } from "vue";
|
|
3
4
|
//#region src/components/accordions/accordions/RuiAccordions.vue?vue&type=script&setup=true&lang.ts
|
|
4
5
|
var RuiAccordions_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
5
6
|
name: "RuiAccordions",
|
|
6
7
|
inheritAttrs: false,
|
|
7
8
|
__name: "RuiAccordions",
|
|
8
|
-
props:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
9
|
+
props: {
|
|
10
|
+
multiple: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: false
|
|
13
|
+
},
|
|
14
|
+
modelValue: {}
|
|
15
|
+
},
|
|
15
16
|
emits: ["update:modelValue"],
|
|
16
17
|
setup(__props) {
|
|
17
|
-
const modelValue =
|
|
18
|
+
const modelValue = usePropModel("modelValue", () => __props.modelValue);
|
|
18
19
|
const internalValue = ref();
|
|
19
20
|
const slots = useSlots();
|
|
20
21
|
/**
|
|
@@ -59,7 +60,7 @@ var RuiAccordions_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
|
|
|
59
60
|
set(internalValue, newValue);
|
|
60
61
|
}
|
|
61
62
|
watch([modelValue, () => __props.multiple], ([value, isMultiple]) => {
|
|
62
|
-
let internal = value;
|
|
63
|
+
let internal = value ?? -1;
|
|
63
64
|
if (isMultiple && !Array.isArray(internal)) internal = internal === -1 ? [] : [internal];
|
|
64
65
|
else if (!isMultiple && Array.isArray(internal)) internal = internal[0] ?? -1;
|
|
65
66
|
set(internalValue, internal);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuiAccordions.vue_vue_type_script_setup_true_lang.js","names":["$attrs","
|
|
1
|
+
{"version":3,"file":"RuiAccordions.vue_vue_type_script_setup_true_lang.js","names":["$attrs","_openBlock","_createElementBlock","_normalizeProps","_guardReactiveProps","_Fragment","_renderList","_unref","_createBlock","_resolveDynamicComponent"],"sources":["../../../../src/components/accordions/accordions/RuiAccordions.vue"],"sourcesContent":["<script lang=\"ts\" setup generic=\"T extends number | number[]\">\nimport { Fragment, type HTMLAttributes, isVNode, type Ref } from 'vue';\nimport { type ModelValueEmits, usePropModel } from '@/composables/prop-model';\n\nexport interface Props {\n multiple?: boolean;\n}\n\ndefineOptions({\n name: 'RuiAccordions',\n inheritAttrs: false,\n});\n\nconst {\n multiple = false,\n modelValue: modelValueProp,\n} = defineProps<Props & {\n /**\n * The open panel's index, `-1` for none; with `multiple`, the open indices in an array. `T` is the\n * bound value's type, so a `Ref<number[]>` takes the update as is. Unbound, it reads as `-1`.\n *\n * @defaultValue -1\n */\n modelValue?: T;\n} & /* @vue-ignore */ Omit<HTMLAttributes, keyof Props>>();\n\ndefineEmits<ModelValueEmits<T>>();\n\n/*\n * A prop and an event rather than `defineModel`: the `-1` default is no `T`, and without a default\n * the update would be typed with an `undefined` it never carries. The component writes through the\n * wider ref.\n */\nconst modelValue: Ref<number | number[] | undefined> = usePropModel('modelValue', () => modelValueProp);\n\nconst internalValue = ref<number[] | number>();\n\nconst slots = useSlots();\n\n/**\n * Unwraps the Fragments a `v-for` or `<template>` makes, so each accordion gets its own index.\n * The placeholder a false `v-if` leaves keeps its index, so hiding one does not renumber the rest.\n *\n * @param nodes - the slot's top-level vnodes\n * @returns the accordions in order\n */\nfunction flattenSlotContent(nodes: VNode[]): VNode[] {\n return nodes.flatMap((node) => {\n if (node.type === Fragment && Array.isArray(node.children))\n return flattenSlotContent(node.children.filter(isVNode));\n\n return [node];\n });\n}\n\nconst children = computed<VNode[]>(() => {\n const accordions = flattenSlotContent(slots.default?.() ?? []);\n const currentValue = get(internalValue);\n\n return accordions.map((accordion, index) => {\n const open =\n multiple && Array.isArray(currentValue)\n ? currentValue.includes(index)\n : currentValue === index;\n\n return {\n ...accordion,\n props: {\n open,\n ...accordion.props,\n },\n };\n });\n});\n\nfunction updateValue(newModelValue: number): void {\n let newValue: number[] | number;\n const internal = get(internalValue);\n if (multiple && Array.isArray(internal)) {\n const temp = [...internal];\n const index = temp.indexOf(newModelValue);\n if (index === -1)\n temp.push(newModelValue);\n else temp.splice(index, 1);\n newValue = temp;\n }\n else {\n if (internal === newModelValue)\n newValue = -1;\n else newValue = newModelValue;\n }\n set(modelValue, newValue);\n set(internalValue, newValue);\n}\n\nwatch(\n [modelValue, () => multiple],\n ([value, isMultiple]) => {\n let internal: number | number[] = value ?? -1;\n if (isMultiple && !Array.isArray(internal))\n internal = internal === -1 ? [] : [internal];\n else if (!isMultiple && Array.isArray(internal))\n internal = internal[0] ?? -1;\n\n set(internalValue, internal);\n },\n { immediate: true },\n);\n</script>\n\n<template>\n <div v-bind=\"$attrs\">\n <component\n :is=\"child\"\n v-for=\"(child, i) in children\"\n :key=\"i\"\n @click=\"updateValue(i)\"\n />\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;EAiCA,MAAM,aAAiD,aAAa,oBAAoB,QAAA,UAAc;EAEtG,MAAM,gBAAgB,IAAuB;EAE7C,MAAM,QAAQ,SAAS;;;;;;;;EASvB,SAAS,mBAAmB,OAAyB;GACnD,OAAO,MAAM,SAAS,SAAS;IAC7B,IAAI,KAAK,SAAS,YAAY,MAAM,QAAQ,KAAK,QAAQ,GACvD,OAAO,mBAAmB,KAAK,SAAS,OAAO,OAAO,CAAC;IAEzD,OAAO,CAAC,IAAI;GACd,CAAC;EACH;EAEA,MAAM,WAAW,eAAwB;GACvC,MAAM,aAAa,mBAAmB,MAAM,UAAU,KAAK,CAAC,CAAC;GAC7D,MAAM,eAAe,IAAI,aAAa;GAEtC,OAAO,WAAW,KAAK,WAAW,UAAU;IAC1C,MAAM,OACJ,QAAA,YAAY,MAAM,QAAQ,YAAY,IAClC,aAAa,SAAS,KAAK,IAC3B,iBAAiB;IAEvB,OAAO;KACL,GAAG;KACH,OAAO;MACL;MACA,GAAG,UAAU;KACf;IACF;GACF,CAAC;EACH,CAAC;EAED,SAAS,YAAY,eAA6B;GAChD,IAAI;GACJ,MAAM,WAAW,IAAI,aAAa;GAClC,IAAI,QAAA,YAAY,MAAM,QAAQ,QAAQ,GAAG;IACvC,MAAM,OAAO,CAAC,GAAG,QAAQ;IACzB,MAAM,QAAQ,KAAK,QAAQ,aAAa;IACxC,IAAI,UAAU,IACZ,KAAK,KAAK,aAAa;SACpB,KAAK,OAAO,OAAO,CAAC;IACzB,WAAW;GACb,OAEE,IAAI,aAAa,eACf,WAAW;QACR,WAAW;GAElB,IAAI,YAAY,QAAQ;GACxB,IAAI,eAAe,QAAQ;EAC7B;EAEA,MACE,CAAC,kBAAkB,QAAA,QAAQ,IAC1B,CAAC,OAAO,gBAAgB;GACvB,IAAI,WAA8B,SAAS;GAC3C,IAAI,cAAc,CAAC,MAAM,QAAQ,QAAQ,GACvC,WAAW,aAAa,KAAK,CAAC,IAAI,CAAC,QAAQ;QACxC,IAAI,CAAC,cAAc,MAAM,QAAQ,QAAQ,GAC5C,WAAW,SAAS,MAAM;GAE5B,IAAI,eAAe,QAAQ;EAC7B,GACA,EAAE,WAAW,KAAK,CACpB;;GAIE,OAAAC,UAAA,GAAAC,mBAOM,OAAAC,eAAAC,mBAPOJ,KAAAA,MAAM,CAAA,GAAA,EACjBC,UAAA,IAAA,GAAAC,mBAKEG,UAAA,MAAAC,WAHqBC,MAAA,QAAA,IAAb,OAAO,MAAC;IAFlB,OAAAN,UAAA,GAAAO,YAKEC,wBAJK,KAAK,GAAA;KAET,KAAK;KACL,UAAK,WAAE,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuiAlert.js","names":["_sfc_main"],"sources":["../../../src/components/alerts/RuiAlert.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { ContextColorsType } from '@/consts/colors';\nimport type { RuiIcons } from '@/icons';\nimport RuiButton from '@/components/buttons/button/RuiButton.vue';\nimport RuiIcon from '@/components/icons/RuiIcon.vue';\nimport { alertStyles } from './alert-styles';\n\nexport interface Props {\n title?: string;\n description?: string;\n type?: ContextColorsType;\n icon?: RuiIcons;\n variant?: 'default' | 'filled' | 'outlined';\n actionText?: string;\n closeable?: boolean;\n}\n\ndefineOptions({\n name: 'RuiAlert',\n inheritAttrs: false,\n});\n\nconst {\n title = '',\n description = '',\n type = 'primary',\n icon = undefined,\n variant = 'default',\n actionText = '',\n closeable = false,\n} = defineProps<Props
|
|
1
|
+
{"version":3,"file":"RuiAlert.js","names":["_sfc_main"],"sources":["../../../src/components/alerts/RuiAlert.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { HTMLAttributes } from 'vue';\nimport type { ContextColorsType } from '@/consts/colors';\nimport type { RuiIcons } from '@/icons';\nimport RuiButton from '@/components/buttons/button/RuiButton.vue';\nimport RuiIcon from '@/components/icons/RuiIcon.vue';\nimport { alertStyles } from './alert-styles';\n\nexport interface Props {\n title?: string;\n description?: string;\n type?: ContextColorsType;\n icon?: RuiIcons;\n variant?: 'default' | 'filled' | 'outlined';\n actionText?: string;\n closeable?: boolean;\n}\n\ndefineOptions({\n name: 'RuiAlert',\n inheritAttrs: false,\n});\n\nconst {\n title = '',\n description = '',\n type = 'primary',\n icon = undefined,\n variant = 'default',\n actionText = '',\n closeable = false,\n} = defineProps<Props & /* @vue-ignore */ Omit<HTMLAttributes, keyof Props>>();\n\nconst emit = defineEmits<{\n action: [];\n close: [];\n}>();\n\nconst slots = defineSlots<{\n title?: () => any;\n default?: () => any;\n}>();\n\nconst ui = computed<ReturnType<typeof alertStyles>>(() => alertStyles({ variant, type, titled: !!slots.title || !!title }));\n\nconst usedIcon = computed<RuiIcons | undefined>(() => {\n if (icon)\n return icon;\n\n const iconMap: Record<ContextColorsType, RuiIcons | undefined> = {\n primary: undefined,\n secondary: undefined,\n warning: 'lu-triangle-alert',\n info: 'lu-info',\n error: 'lu-circle-alert',\n success: 'lu-circle-check',\n };\n\n return iconMap[type];\n});\n</script>\n\n<template>\n <div\n :class=\"ui.root()\"\n v-bind=\"$attrs\"\n :data-variant=\"variant\"\n :data-type=\"type\"\n >\n <div :class=\"ui.content()\">\n <div\n v-if=\"usedIcon\"\n :class=\"ui.icon()\"\n >\n <RuiIcon\n :name=\"usedIcon\"\n size=\"20\"\n />\n </div>\n <div :class=\"ui.texts()\">\n <div\n v-if=\"$slots.title || title\"\n :class=\"{\n 'font-medium': !!title,\n }\"\n >\n <slot name=\"title\">\n {{ title }}\n </slot>\n </div>\n\n <div\n v-if=\"$slots.default || description\"\n class=\"text-body-2\"\n >\n <slot>\n {{ description }}\n </slot>\n </div>\n </div>\n </div>\n <div v-if=\"actionText\">\n <RuiButton\n variant=\"text\"\n size=\"sm\"\n :color=\"variant === 'filled' ? undefined : type\"\n :class=\"ui.action()\"\n data-id=\"alert-action\"\n @click=\"emit('action')\"\n >\n {{ actionText }}\n </RuiButton>\n </div>\n <div v-if=\"closeable\">\n <RuiButton\n :color=\"variant === 'filled' ? undefined : type\"\n size=\"sm\"\n icon\n variant=\"text\"\n :class=\"ui.close()\"\n data-id=\"alert-close\"\n @click=\"emit('close')\"\n >\n <RuiIcon\n name=\"lu-x\"\n size=\"20\"\n />\n </RuiButton>\n </div>\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'vue';
|
|
1
2
|
import type { ContextColorsType } from '../../consts/colors.js';
|
|
2
3
|
import type { RuiIcons } from '../../icons/index.js';
|
|
3
4
|
export interface Props {
|
|
@@ -9,14 +10,15 @@ export interface Props {
|
|
|
9
10
|
actionText?: string;
|
|
10
11
|
closeable?: boolean;
|
|
11
12
|
}
|
|
13
|
+
type __VLS_Props = Props & /* @vue-ignore */ Omit<HTMLAttributes, keyof Props>;
|
|
12
14
|
type __VLS_Slots = {
|
|
13
15
|
title?: () => any;
|
|
14
16
|
default?: () => any;
|
|
15
17
|
};
|
|
16
|
-
declare const __VLS_base: import("vue").DefineComponent<
|
|
18
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
17
19
|
close: () => any;
|
|
18
20
|
action: () => any;
|
|
19
|
-
}, string, import("vue").PublicProps, Readonly<
|
|
21
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
20
22
|
onClose?: (() => any) | undefined;
|
|
21
23
|
onAction?: (() => any) | undefined;
|
|
22
24
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuiAlert.vue_vue_type_script_setup_true_lang.js","names":["$attrs","$slots","_useSlots","_openBlock","_createElementBlock","_mergeProps","_unref","_createElementVNode","_normalizeClass","_createVNode","RuiIcon","_createCommentVNode","_renderSlot","_createTextVNode","_toDisplayString","RuiButton","_withCtx"],"sources":["../../../src/components/alerts/RuiAlert.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { ContextColorsType } from '@/consts/colors';\nimport type { RuiIcons } from '@/icons';\nimport RuiButton from '@/components/buttons/button/RuiButton.vue';\nimport RuiIcon from '@/components/icons/RuiIcon.vue';\nimport { alertStyles } from './alert-styles';\n\nexport interface Props {\n title?: string;\n description?: string;\n type?: ContextColorsType;\n icon?: RuiIcons;\n variant?: 'default' | 'filled' | 'outlined';\n actionText?: string;\n closeable?: boolean;\n}\n\ndefineOptions({\n name: 'RuiAlert',\n inheritAttrs: false,\n});\n\nconst {\n title = '',\n description = '',\n type = 'primary',\n icon = undefined,\n variant = 'default',\n actionText = '',\n closeable = false,\n} = defineProps<Props
|
|
1
|
+
{"version":3,"file":"RuiAlert.vue_vue_type_script_setup_true_lang.js","names":["$attrs","$slots","_useSlots","_openBlock","_createElementBlock","_mergeProps","_unref","_createElementVNode","_normalizeClass","_createVNode","RuiIcon","_createCommentVNode","_renderSlot","_createTextVNode","_toDisplayString","RuiButton","_withCtx"],"sources":["../../../src/components/alerts/RuiAlert.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { HTMLAttributes } from 'vue';\nimport type { ContextColorsType } from '@/consts/colors';\nimport type { RuiIcons } from '@/icons';\nimport RuiButton from '@/components/buttons/button/RuiButton.vue';\nimport RuiIcon from '@/components/icons/RuiIcon.vue';\nimport { alertStyles } from './alert-styles';\n\nexport interface Props {\n title?: string;\n description?: string;\n type?: ContextColorsType;\n icon?: RuiIcons;\n variant?: 'default' | 'filled' | 'outlined';\n actionText?: string;\n closeable?: boolean;\n}\n\ndefineOptions({\n name: 'RuiAlert',\n inheritAttrs: false,\n});\n\nconst {\n title = '',\n description = '',\n type = 'primary',\n icon = undefined,\n variant = 'default',\n actionText = '',\n closeable = false,\n} = defineProps<Props & /* @vue-ignore */ Omit<HTMLAttributes, keyof Props>>();\n\nconst emit = defineEmits<{\n action: [];\n close: [];\n}>();\n\nconst slots = defineSlots<{\n title?: () => any;\n default?: () => any;\n}>();\n\nconst ui = computed<ReturnType<typeof alertStyles>>(() => alertStyles({ variant, type, titled: !!slots.title || !!title }));\n\nconst usedIcon = computed<RuiIcons | undefined>(() => {\n if (icon)\n return icon;\n\n const iconMap: Record<ContextColorsType, RuiIcons | undefined> = {\n primary: undefined,\n secondary: undefined,\n warning: 'lu-triangle-alert',\n info: 'lu-info',\n error: 'lu-circle-alert',\n success: 'lu-circle-check',\n };\n\n return iconMap[type];\n});\n</script>\n\n<template>\n <div\n :class=\"ui.root()\"\n v-bind=\"$attrs\"\n :data-variant=\"variant\"\n :data-type=\"type\"\n >\n <div :class=\"ui.content()\">\n <div\n v-if=\"usedIcon\"\n :class=\"ui.icon()\"\n >\n <RuiIcon\n :name=\"usedIcon\"\n size=\"20\"\n />\n </div>\n <div :class=\"ui.texts()\">\n <div\n v-if=\"$slots.title || title\"\n :class=\"{\n 'font-medium': !!title,\n }\"\n >\n <slot name=\"title\">\n {{ title }}\n </slot>\n </div>\n\n <div\n v-if=\"$slots.default || description\"\n class=\"text-body-2\"\n >\n <slot>\n {{ description }}\n </slot>\n </div>\n </div>\n </div>\n <div v-if=\"actionText\">\n <RuiButton\n variant=\"text\"\n size=\"sm\"\n :color=\"variant === 'filled' ? undefined : type\"\n :class=\"ui.action()\"\n data-id=\"alert-action\"\n @click=\"emit('action')\"\n >\n {{ actionText }}\n </RuiButton>\n </div>\n <div v-if=\"closeable\">\n <RuiButton\n :color=\"variant === 'filled' ? undefined : type\"\n size=\"sm\"\n icon\n variant=\"text\"\n :class=\"ui.close()\"\n data-id=\"alert-close\"\n @click=\"emit('close')\"\n >\n <RuiIcon\n name=\"lu-x\"\n size=\"20\"\n />\n </RuiButton>\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCA,MAAM,OAAO;EAKb,MAAM,QAAQE,SAAA;EAKd,MAAM,KAAK,eAA+C,YAAY;GAAE,SAAM,QAAA;GAAG,MAAG,QAAA;GAAG,QAAQ,CAAC,CAAC,MAAM,SAAS,CAAC,CAAC,QAAA;EAAM,CAAC,CAAC;EAE1H,MAAM,WAAW,eAAqC;GACpD,IAAI,QAAA,MACF,OAAO,QAAA;GAWT,OAAO;IARL,SAAS,KAAA;IACT,WAAW,KAAA;IACX,SAAS;IACT,MAAM;IACN,OAAO;IACP,SAAS;GAGJ,EAAQ,QAAA;EACjB,CAAC;;GAIC,OAAAC,UAAA,GAAAC,mBAkEM,OAlENC,WAkEM,EAjEH,OAAOC,MAAA,EAAA,CAAE,CAAC,KAAI,EACPN,GAAAA,KAAAA,QAAM;IACb,gBAAc,QAAA;IACd,aAAW,QAAA;;IAEZO,mBA+BM,OAAA,EA/BA,OAAKC,eAAEF,MAAA,EAAA,CAAE,CAAC,QAAO,CAAA,EAAA,GAAA,CAEbA,MAAA,QAAA,KADRH,UAAA,GAAAC,mBAQM,OAAA;;KANH,OAAKI,eAAEF,MAAA,EAAA,CAAE,CAAC,KAAI,CAAA;IAEfG,GAAAA,CAAAA,YAGEC,iBAAA;KAFC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QAAA;KAC3C,MAAK;KACL,MAAA;KACA,SAAQ;KACP,OAAKP,eAAEF,MAAA,EAAA,CAAE,CAAC,MAAK,CAAA;KAChB,WAAQ;KACP,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,KAAI,OAAA;;KAEZ,SAAAU,cAGE,CAHFP,YAGEC,iBAAA;MAFA,MAAK;MACL,MAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuiAvatar.js","names":["_sfc_main"],"sources":["../../../src/components/avatars/RuiAvatar.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { ContextColorsType } from '@/consts/colors';\nimport type { RuiIcons } from '@/icons';\nimport { get, set } from '@vueuse/shared';\nimport {\n type AvatarSize,\n type AvatarVariant,\n computeAvatarText,\n computeInitials,\n resolveAvatarIconPx,\n resolveAvatarSizePx,\n resolveAvatarTextSize,\n} from '@/components/avatars/avatar-props';\nimport { useAvatarGroup } from '@/components/avatars/use-avatar-group';\nimport RuiIcon from '@/components/icons/RuiIcon.vue';\nimport { avatarStyles } from './avatar-styles';\n\nexport interface Props {\n src?: string | null;\n alt?: string;\n text?: string | null;\n icon?: RuiIcons | null;\n size?: AvatarSize | number;\n variant?: AvatarVariant;\n color?: 'default' | ContextColorsType;\n loading?: 'lazy' | 'eager';\n}\n\ndefineOptions({\n name: 'RuiAvatar',\n});\n\nconst {\n src = null,\n alt = '',\n text = null,\n icon = null,\n size,\n variant,\n color = 'default',\n loading = 'lazy',\n} = defineProps<Props
|
|
1
|
+
{"version":3,"file":"RuiAvatar.js","names":["_sfc_main"],"sources":["../../../src/components/avatars/RuiAvatar.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from 'vue';\nimport type { ContextColorsType } from '@/consts/colors';\nimport type { RuiIcons } from '@/icons';\nimport { get, set } from '@vueuse/shared';\nimport {\n type AvatarSize,\n type AvatarVariant,\n computeAvatarText,\n computeInitials,\n resolveAvatarIconPx,\n resolveAvatarSizePx,\n resolveAvatarTextSize,\n} from '@/components/avatars/avatar-props';\nimport { useAvatarGroup } from '@/components/avatars/use-avatar-group';\nimport RuiIcon from '@/components/icons/RuiIcon.vue';\nimport { avatarStyles } from './avatar-styles';\n\nexport interface Props {\n src?: string | null;\n alt?: string;\n text?: string | null;\n icon?: RuiIcons | null;\n size?: AvatarSize | number;\n variant?: AvatarVariant;\n color?: 'default' | ContextColorsType;\n loading?: 'lazy' | 'eager';\n}\n\ndefineOptions({\n name: 'RuiAvatar',\n});\n\nconst {\n src = null,\n alt = '',\n text = null,\n icon = null,\n size,\n variant,\n color = 'default',\n loading = 'lazy',\n} = defineProps<Props & /* @vue-ignore */ Omit<HTMLAttributes, keyof Props | 'onLoad' | 'onError'>>();\n\nconst emit = defineEmits<{\n load: [event: Event];\n error: [event: Event];\n}>();\n\nconst slots = defineSlots<{\n default?: () => any;\n}>();\n\nconst group = useAvatarGroup();\n\nconst resolvedSize = computed<AvatarSize | number>(() => {\n if (size !== undefined)\n return size;\n if (group)\n return get(group).size;\n return 'md';\n});\n\nconst resolvedVariant = computed<AvatarVariant>(() => {\n if (variant !== undefined)\n return variant;\n if (group)\n return get(group).variant;\n return 'circular';\n});\n\n// A numeric size borrows the text scale of the nearest token below it\nconst textSize = computed<AvatarSize>(() => resolveAvatarTextSize(get(resolvedSize)));\n\nconst sizePx = computed<number>(() => resolveAvatarSizePx(get(resolvedSize)));\nconst iconPx = computed<number>(() => resolveAvatarIconPx(get(resolvedSize)));\n\nconst errored = ref<boolean>(false);\n\nwatch(() => src, () => {\n set(errored, false);\n});\n\nconst initials = computed<string>(() => {\n const explicit = computeAvatarText(text);\n if (explicit)\n return explicit;\n return computeInitials(alt);\n});\n\ntype DisplayMode = 'image' | 'slot' | 'initials' | 'icon' | 'empty';\n\nconst displayMode = computed<DisplayMode>(() => {\n if (src && !get(errored))\n return 'image';\n if (slots.default)\n return 'slot';\n if (icon)\n return 'icon';\n if (get(initials))\n return 'initials';\n return 'empty';\n});\n\nconst decorative = computed<boolean>(() => alt === '' && !text);\n\nconst ariaLabel = computed<string | undefined>(() => {\n if (get(displayMode) === 'image')\n return undefined;\n if (get(decorative))\n return undefined;\n return text ?? alt ?? undefined;\n});\n\nconst rootStyle = computed<Record<string, string>>(() => {\n const px = `${get(sizePx)}px`;\n return { width: px, height: px };\n});\n\nconst ui = computed<ReturnType<typeof avatarStyles>>(() => avatarStyles({\n variant: get(resolvedVariant),\n color,\n size: get(textSize),\n}));\n\nfunction onLoad(event: Event): void {\n set(errored, false);\n emit('load', event);\n}\n\nfunction onError(event: Event): void {\n set(errored, true);\n emit('error', event);\n}\n</script>\n\n<template>\n <span\n :class=\"ui.root()\"\n :style=\"rootStyle\"\n :role=\"ariaLabel ? 'img' : undefined\"\n :aria-label=\"ariaLabel\"\n :aria-hidden=\"displayMode !== 'image' && decorative ? 'true' : undefined\"\n :data-id=\"$attrs['data-id'] ?? 'avatar-root'\"\n :data-size=\"typeof resolvedSize === 'string' ? resolvedSize : undefined\"\n :data-variant=\"resolvedVariant\"\n :data-color=\"color\"\n >\n <img\n v-if=\"displayMode === 'image' && src\"\n :class=\"ui.image()\"\n :src=\"src\"\n :alt=\"alt\"\n :loading=\"loading\"\n :width=\"sizePx\"\n :height=\"sizePx\"\n data-id=\"avatar-image\"\n @load=\"onLoad($event)\"\n @error=\"onError($event)\"\n />\n <span\n v-else\n :class=\"ui.fallback()\"\n data-id=\"avatar-fallback\"\n aria-hidden=\"true\"\n >\n <slot v-if=\"displayMode === 'slot'\" />\n <span\n v-else-if=\"displayMode === 'initials'\"\n :class=\"ui.initials()\"\n data-id=\"avatar-initials\"\n >\n {{ initials }}\n </span>\n <RuiIcon\n v-else-if=\"displayMode === 'icon' && icon\"\n :name=\"icon\"\n :size=\"iconPx\"\n data-id=\"avatar-icon\"\n />\n <span v-else> </span>\n </span>\n </span>\n</template>\n"],"mappings":""}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'vue';
|
|
1
2
|
import type { ContextColorsType } from '../../consts/colors.js';
|
|
2
3
|
import type { RuiIcons } from '../../icons/index.js';
|
|
3
4
|
import { type AvatarSize, type AvatarVariant } from './avatar-props.js';
|
|
@@ -11,13 +12,14 @@ export interface Props {
|
|
|
11
12
|
color?: 'default' | ContextColorsType;
|
|
12
13
|
loading?: 'lazy' | 'eager';
|
|
13
14
|
}
|
|
15
|
+
type __VLS_Props = Props & /* @vue-ignore */ Omit<HTMLAttributes, keyof Props | 'onLoad' | 'onError'>;
|
|
14
16
|
type __VLS_Slots = {
|
|
15
17
|
default?: () => any;
|
|
16
18
|
};
|
|
17
|
-
declare const __VLS_base: import("vue").DefineComponent<
|
|
19
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
18
20
|
error: (event: Event) => any;
|
|
19
21
|
load: (event: Event) => any;
|
|
20
|
-
}, string, import("vue").PublicProps, Readonly<
|
|
22
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
21
23
|
onError?: ((event: Event) => any) | undefined;
|
|
22
24
|
onLoad?: ((event: Event) => any) | undefined;
|
|
23
25
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuiAvatar.vue_vue_type_script_setup_true_lang.js","names":["$attrs","_useSlots","_openBlock","_createElementBlock","_normalizeClass","_unref","_normalizeStyle","_renderSlot","_toDisplayString","_createBlock","RuiIcon"],"sources":["../../../src/components/avatars/RuiAvatar.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { ContextColorsType } from '@/consts/colors';\nimport type { RuiIcons } from '@/icons';\nimport { get, set } from '@vueuse/shared';\nimport {\n type AvatarSize,\n type AvatarVariant,\n computeAvatarText,\n computeInitials,\n resolveAvatarIconPx,\n resolveAvatarSizePx,\n resolveAvatarTextSize,\n} from '@/components/avatars/avatar-props';\nimport { useAvatarGroup } from '@/components/avatars/use-avatar-group';\nimport RuiIcon from '@/components/icons/RuiIcon.vue';\nimport { avatarStyles } from './avatar-styles';\n\nexport interface Props {\n src?: string | null;\n alt?: string;\n text?: string | null;\n icon?: RuiIcons | null;\n size?: AvatarSize | number;\n variant?: AvatarVariant;\n color?: 'default' | ContextColorsType;\n loading?: 'lazy' | 'eager';\n}\n\ndefineOptions({\n name: 'RuiAvatar',\n});\n\nconst {\n src = null,\n alt = '',\n text = null,\n icon = null,\n size,\n variant,\n color = 'default',\n loading = 'lazy',\n} = defineProps<Props
|
|
1
|
+
{"version":3,"file":"RuiAvatar.vue_vue_type_script_setup_true_lang.js","names":["$attrs","_useSlots","_openBlock","_createElementBlock","_normalizeClass","_unref","_normalizeStyle","_renderSlot","_toDisplayString","_createBlock","RuiIcon"],"sources":["../../../src/components/avatars/RuiAvatar.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { HTMLAttributes } from 'vue';\nimport type { ContextColorsType } from '@/consts/colors';\nimport type { RuiIcons } from '@/icons';\nimport { get, set } from '@vueuse/shared';\nimport {\n type AvatarSize,\n type AvatarVariant,\n computeAvatarText,\n computeInitials,\n resolveAvatarIconPx,\n resolveAvatarSizePx,\n resolveAvatarTextSize,\n} from '@/components/avatars/avatar-props';\nimport { useAvatarGroup } from '@/components/avatars/use-avatar-group';\nimport RuiIcon from '@/components/icons/RuiIcon.vue';\nimport { avatarStyles } from './avatar-styles';\n\nexport interface Props {\n src?: string | null;\n alt?: string;\n text?: string | null;\n icon?: RuiIcons | null;\n size?: AvatarSize | number;\n variant?: AvatarVariant;\n color?: 'default' | ContextColorsType;\n loading?: 'lazy' | 'eager';\n}\n\ndefineOptions({\n name: 'RuiAvatar',\n});\n\nconst {\n src = null,\n alt = '',\n text = null,\n icon = null,\n size,\n variant,\n color = 'default',\n loading = 'lazy',\n} = defineProps<Props & /* @vue-ignore */ Omit<HTMLAttributes, keyof Props | 'onLoad' | 'onError'>>();\n\nconst emit = defineEmits<{\n load: [event: Event];\n error: [event: Event];\n}>();\n\nconst slots = defineSlots<{\n default?: () => any;\n}>();\n\nconst group = useAvatarGroup();\n\nconst resolvedSize = computed<AvatarSize | number>(() => {\n if (size !== undefined)\n return size;\n if (group)\n return get(group).size;\n return 'md';\n});\n\nconst resolvedVariant = computed<AvatarVariant>(() => {\n if (variant !== undefined)\n return variant;\n if (group)\n return get(group).variant;\n return 'circular';\n});\n\n// A numeric size borrows the text scale of the nearest token below it\nconst textSize = computed<AvatarSize>(() => resolveAvatarTextSize(get(resolvedSize)));\n\nconst sizePx = computed<number>(() => resolveAvatarSizePx(get(resolvedSize)));\nconst iconPx = computed<number>(() => resolveAvatarIconPx(get(resolvedSize)));\n\nconst errored = ref<boolean>(false);\n\nwatch(() => src, () => {\n set(errored, false);\n});\n\nconst initials = computed<string>(() => {\n const explicit = computeAvatarText(text);\n if (explicit)\n return explicit;\n return computeInitials(alt);\n});\n\ntype DisplayMode = 'image' | 'slot' | 'initials' | 'icon' | 'empty';\n\nconst displayMode = computed<DisplayMode>(() => {\n if (src && !get(errored))\n return 'image';\n if (slots.default)\n return 'slot';\n if (icon)\n return 'icon';\n if (get(initials))\n return 'initials';\n return 'empty';\n});\n\nconst decorative = computed<boolean>(() => alt === '' && !text);\n\nconst ariaLabel = computed<string | undefined>(() => {\n if (get(displayMode) === 'image')\n return undefined;\n if (get(decorative))\n return undefined;\n return text ?? alt ?? undefined;\n});\n\nconst rootStyle = computed<Record<string, string>>(() => {\n const px = `${get(sizePx)}px`;\n return { width: px, height: px };\n});\n\nconst ui = computed<ReturnType<typeof avatarStyles>>(() => avatarStyles({\n variant: get(resolvedVariant),\n color,\n size: get(textSize),\n}));\n\nfunction onLoad(event: Event): void {\n set(errored, false);\n emit('load', event);\n}\n\nfunction onError(event: Event): void {\n set(errored, true);\n emit('error', event);\n}\n</script>\n\n<template>\n <span\n :class=\"ui.root()\"\n :style=\"rootStyle\"\n :role=\"ariaLabel ? 'img' : undefined\"\n :aria-label=\"ariaLabel\"\n :aria-hidden=\"displayMode !== 'image' && decorative ? 'true' : undefined\"\n :data-id=\"$attrs['data-id'] ?? 'avatar-root'\"\n :data-size=\"typeof resolvedSize === 'string' ? resolvedSize : undefined\"\n :data-variant=\"resolvedVariant\"\n :data-color=\"color\"\n >\n <img\n v-if=\"displayMode === 'image' && src\"\n :class=\"ui.image()\"\n :src=\"src\"\n :alt=\"alt\"\n :loading=\"loading\"\n :width=\"sizePx\"\n :height=\"sizePx\"\n data-id=\"avatar-image\"\n @load=\"onLoad($event)\"\n @error=\"onError($event)\"\n />\n <span\n v-else\n :class=\"ui.fallback()\"\n data-id=\"avatar-fallback\"\n aria-hidden=\"true\"\n >\n <slot v-if=\"displayMode === 'slot'\" />\n <span\n v-else-if=\"displayMode === 'initials'\"\n :class=\"ui.initials()\"\n data-id=\"avatar-initials\"\n >\n {{ initials }}\n </span>\n <RuiIcon\n v-else-if=\"displayMode === 'icon' && icon\"\n :name=\"icon\"\n :size=\"iconPx\"\n data-id=\"avatar-icon\"\n />\n <span v-else> </span>\n </span>\n </span>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4CA,MAAM,OAAO;EAKb,MAAM,QAAQC,SAAA;EAId,MAAM,QAAQ,eAAe;EAE7B,MAAM,eAAe,eAAoC;GACvD,IAAI,QAAA,SAAS,KAAA,GACX,OAAO,QAAA;GACT,IAAI,OACF,OAAO,IAAI,KAAK,CAAC,CAAC;GACpB,OAAO;EACT,CAAC;EAED,MAAM,kBAAkB,eAA8B;GACpD,IAAI,QAAA,YAAY,KAAA,GACd,OAAO,QAAA;GACT,IAAI,OACF,OAAO,IAAI,KAAK,CAAC,CAAC;GACpB,OAAO;EACT,CAAC;EAGD,MAAM,WAAW,eAA2B,sBAAsB,IAAI,YAAY,CAAC,CAAC;EAEpF,MAAM,SAAS,eAAuB,oBAAoB,IAAI,YAAY,CAAC,CAAC;EAC5E,MAAM,SAAS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AA,MAAAA,GAAAA,CAAAA,QAAAA,MAAAA,CAAAA,MAAAA,UAAA,GAAAC,mBAA0B,QAAA,YAAb,MAAM,EAAA,GAAA,CAAA,EAAA,GAAA,IAAA,UAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuiAvatarGroup.js","names":["_sfc_main"],"sources":["../../../src/components/avatars/RuiAvatarGroup.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { get } from '@vueuse/shared';\nimport { Comment, defineComponent, Fragment, Text, type VNode } from 'vue';\nimport {\n avatarGroupInjectionKey,\n AvatarGroupSpacing,\n type AvatarSize,\n type AvatarVariant,\n resolveAvatarGroupSpacingPx,\n resolveAvatarSizePx,\n} from '@/components/avatars/avatar-props';\nimport RuiAvatar from '@/components/avatars/RuiAvatar.vue';\nimport { groupStyles } from './avatar-group-styles';\n\nexport interface Props {\n size?: AvatarSize | number;\n variant?: AvatarVariant;\n max?: number;\n total?: number;\n /**\n * How much each avatar overlaps the previous one. The tokens name the\n * amount of overlap, so `lg` overlaps the most and `sm` the least; they\n * scale with the avatar size. A number is the inline margin in pixels and\n * should be negative to overlap.\n */\n spacing?: AvatarGroupSpacing | number;\n}\n\ndefineOptions({\n name: 'RuiAvatarGroup',\n});\n\nconst {\n size,\n variant = 'circular',\n max,\n total,\n spacing = AvatarGroupSpacing.md,\n} = defineProps<Props
|
|
1
|
+
{"version":3,"file":"RuiAvatarGroup.js","names":["_sfc_main"],"sources":["../../../src/components/avatars/RuiAvatarGroup.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { get } from '@vueuse/shared';\nimport { Comment, defineComponent, Fragment, type HTMLAttributes, Text, type VNode } from 'vue';\nimport {\n avatarGroupInjectionKey,\n AvatarGroupSpacing,\n type AvatarSize,\n type AvatarVariant,\n resolveAvatarGroupSpacingPx,\n resolveAvatarSizePx,\n} from '@/components/avatars/avatar-props';\nimport RuiAvatar from '@/components/avatars/RuiAvatar.vue';\nimport { groupStyles } from './avatar-group-styles';\n\nexport interface Props {\n size?: AvatarSize | number;\n variant?: AvatarVariant;\n max?: number;\n total?: number;\n /**\n * How much each avatar overlaps the previous one. The tokens name the\n * amount of overlap, so `lg` overlaps the most and `sm` the least; they\n * scale with the avatar size. A number is the inline margin in pixels and\n * should be negative to overlap.\n */\n spacing?: AvatarGroupSpacing | number;\n}\n\ndefineOptions({\n name: 'RuiAvatarGroup',\n});\n\nconst {\n size,\n variant = 'circular',\n max,\n total,\n spacing = AvatarGroupSpacing.md,\n} = defineProps<Props & /* @vue-ignore */ Omit<HTMLAttributes, keyof Props>>();\n\nconst slots = defineSlots<{\n default?: () => VNode[];\n surplus?: (props: { count: number }) => any;\n}>();\n\nconst resolvedSize = computed<AvatarSize | number>(() => size ?? 'md');\n\nconst VNodeRenderer = defineComponent<{ vnode: VNode }>({\n props: ['vnode'],\n setup(props) {\n return (): VNode => props.vnode;\n },\n});\n\nprovide(avatarGroupInjectionKey, computed(() => ({ size: get(resolvedSize), variant })));\n\nfunction flattenChildren(nodes: VNode[] | undefined): VNode[] {\n if (!nodes)\n return [];\n const out: VNode[] = [];\n for (const node of nodes) {\n if (node.type === Comment)\n continue;\n if (node.type === Text && typeof node.children === 'string' && node.children.trim() === '')\n continue;\n if (node.type === Fragment && Array.isArray(node.children)) {\n const inner = node.children.filter((c): c is VNode => typeof c === 'object' && c !== null && 'type' in c);\n out.push(...flattenChildren(inner));\n continue;\n }\n out.push(node);\n }\n return out;\n}\n\nconst children = computed<VNode[]>(() => flattenChildren(slots.default?.()));\n\nconst visible = computed<VNode[]>(() => {\n if (max === undefined)\n return get(children);\n return get(children).slice(0, max);\n});\n\nconst surplusCount = computed<number>(() => {\n const totalCount = total ?? get(children).length;\n const shown = get(visible).length;\n return Math.max(0, totalCount - shown);\n});\n\nconst spacingPx = computed<number>(() => resolveAvatarGroupSpacingPx(spacing, get(resolvedSize)));\n\n// The configured spacing, which is already negative, so the items overlap\nconst ringOffsetPx = computed<number>(() => get(spacingPx));\n\nconst itemStyle = computed<Record<string, string>>(() => ({\n marginInlineStart: `${get(ringOffsetPx)}px`,\n}));\n\nconst firstItemStyle = computed<Record<string, string>>(() => ({\n marginInlineStart: '0',\n}));\n\nconst avatarPx = computed<number>(() => resolveAvatarSizePx(get(resolvedSize)));\n\nconst ui = computed<ReturnType<typeof groupStyles>>(() => groupStyles({ variant }));\n</script>\n\n<template>\n <div\n :class=\"ui.root()\"\n data-id=\"avatar-group\"\n :data-size=\"typeof resolvedSize === 'string' ? resolvedSize : undefined\"\n :data-variant=\"variant\"\n >\n <span\n v-for=\"(child, index) in visible\"\n :key=\"child.key ?? index\"\n :class=\"ui.item()\"\n :style=\"index === 0 ? firstItemStyle : itemStyle\"\n >\n <VNodeRenderer :vnode=\"child\" />\n </span>\n <span\n v-if=\"surplusCount > 0\"\n :class=\"ui.item()\"\n :style=\"visible.length === 0 ? firstItemStyle : itemStyle\"\n data-id=\"avatar-group-surplus\"\n >\n <slot\n name=\"surplus\"\n :count=\"surplusCount\"\n >\n <RuiAvatar\n :size=\"resolvedSize\"\n :variant=\"variant\"\n :alt=\"`+${surplusCount} more`\"\n :style=\"{ width: `${avatarPx}px`, height: `${avatarPx}px` }\"\n >\n <span :class=\"ui.surplus()\">+{{ surplusCount }}</span>\n </RuiAvatar>\n </slot>\n </span>\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type VNode } from 'vue';
|
|
1
|
+
import { type HTMLAttributes, type VNode } from 'vue';
|
|
2
2
|
import { AvatarGroupSpacing, type AvatarSize, type AvatarVariant } from './avatar-props.js';
|
|
3
3
|
export interface Props {
|
|
4
4
|
size?: AvatarSize | number;
|
|
@@ -13,13 +13,14 @@ export interface Props {
|
|
|
13
13
|
*/
|
|
14
14
|
spacing?: AvatarGroupSpacing | number;
|
|
15
15
|
}
|
|
16
|
+
type __VLS_Props = Props & /* @vue-ignore */ Omit<HTMLAttributes, keyof Props>;
|
|
16
17
|
type __VLS_Slots = {
|
|
17
18
|
default?: () => VNode[];
|
|
18
19
|
surplus?: (props: {
|
|
19
20
|
count: number;
|
|
20
21
|
}) => any;
|
|
21
22
|
};
|
|
22
|
-
declare const __VLS_base: import("vue").DefineComponent<
|
|
23
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
23
24
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
24
25
|
declare const _default: typeof __VLS_export;
|
|
25
26
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuiAvatarGroup.vue_vue_type_script_setup_true_lang.js","names":["_useSlots","_openBlock","_createElementBlock","_normalizeClass","_unref","_Fragment","_renderList","_normalizeStyle","_createVNode","_renderSlot","RuiAvatar","_withCtx","_createElementVNode","_toDisplayString","_createCommentVNode"],"sources":["../../../src/components/avatars/RuiAvatarGroup.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { get } from '@vueuse/shared';\nimport { Comment, defineComponent, Fragment, Text, type VNode } from 'vue';\nimport {\n avatarGroupInjectionKey,\n AvatarGroupSpacing,\n type AvatarSize,\n type AvatarVariant,\n resolveAvatarGroupSpacingPx,\n resolveAvatarSizePx,\n} from '@/components/avatars/avatar-props';\nimport RuiAvatar from '@/components/avatars/RuiAvatar.vue';\nimport { groupStyles } from './avatar-group-styles';\n\nexport interface Props {\n size?: AvatarSize | number;\n variant?: AvatarVariant;\n max?: number;\n total?: number;\n /**\n * How much each avatar overlaps the previous one. The tokens name the\n * amount of overlap, so `lg` overlaps the most and `sm` the least; they\n * scale with the avatar size. A number is the inline margin in pixels and\n * should be negative to overlap.\n */\n spacing?: AvatarGroupSpacing | number;\n}\n\ndefineOptions({\n name: 'RuiAvatarGroup',\n});\n\nconst {\n size,\n variant = 'circular',\n max,\n total,\n spacing = AvatarGroupSpacing.md,\n} = defineProps<Props
|
|
1
|
+
{"version":3,"file":"RuiAvatarGroup.vue_vue_type_script_setup_true_lang.js","names":["_useSlots","_openBlock","_createElementBlock","_normalizeClass","_unref","_Fragment","_renderList","_normalizeStyle","_createVNode","_renderSlot","RuiAvatar","_withCtx","_createElementVNode","_toDisplayString","_createCommentVNode"],"sources":["../../../src/components/avatars/RuiAvatarGroup.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { get } from '@vueuse/shared';\nimport { Comment, defineComponent, Fragment, type HTMLAttributes, Text, type VNode } from 'vue';\nimport {\n avatarGroupInjectionKey,\n AvatarGroupSpacing,\n type AvatarSize,\n type AvatarVariant,\n resolveAvatarGroupSpacingPx,\n resolveAvatarSizePx,\n} from '@/components/avatars/avatar-props';\nimport RuiAvatar from '@/components/avatars/RuiAvatar.vue';\nimport { groupStyles } from './avatar-group-styles';\n\nexport interface Props {\n size?: AvatarSize | number;\n variant?: AvatarVariant;\n max?: number;\n total?: number;\n /**\n * How much each avatar overlaps the previous one. The tokens name the\n * amount of overlap, so `lg` overlaps the most and `sm` the least; they\n * scale with the avatar size. A number is the inline margin in pixels and\n * should be negative to overlap.\n */\n spacing?: AvatarGroupSpacing | number;\n}\n\ndefineOptions({\n name: 'RuiAvatarGroup',\n});\n\nconst {\n size,\n variant = 'circular',\n max,\n total,\n spacing = AvatarGroupSpacing.md,\n} = defineProps<Props & /* @vue-ignore */ Omit<HTMLAttributes, keyof Props>>();\n\nconst slots = defineSlots<{\n default?: () => VNode[];\n surplus?: (props: { count: number }) => any;\n}>();\n\nconst resolvedSize = computed<AvatarSize | number>(() => size ?? 'md');\n\nconst VNodeRenderer = defineComponent<{ vnode: VNode }>({\n props: ['vnode'],\n setup(props) {\n return (): VNode => props.vnode;\n },\n});\n\nprovide(avatarGroupInjectionKey, computed(() => ({ size: get(resolvedSize), variant })));\n\nfunction flattenChildren(nodes: VNode[] | undefined): VNode[] {\n if (!nodes)\n return [];\n const out: VNode[] = [];\n for (const node of nodes) {\n if (node.type === Comment)\n continue;\n if (node.type === Text && typeof node.children === 'string' && node.children.trim() === '')\n continue;\n if (node.type === Fragment && Array.isArray(node.children)) {\n const inner = node.children.filter((c): c is VNode => typeof c === 'object' && c !== null && 'type' in c);\n out.push(...flattenChildren(inner));\n continue;\n }\n out.push(node);\n }\n return out;\n}\n\nconst children = computed<VNode[]>(() => flattenChildren(slots.default?.()));\n\nconst visible = computed<VNode[]>(() => {\n if (max === undefined)\n return get(children);\n return get(children).slice(0, max);\n});\n\nconst surplusCount = computed<number>(() => {\n const totalCount = total ?? get(children).length;\n const shown = get(visible).length;\n return Math.max(0, totalCount - shown);\n});\n\nconst spacingPx = computed<number>(() => resolveAvatarGroupSpacingPx(spacing, get(resolvedSize)));\n\n// The configured spacing, which is already negative, so the items overlap\nconst ringOffsetPx = computed<number>(() => get(spacingPx));\n\nconst itemStyle = computed<Record<string, string>>(() => ({\n marginInlineStart: `${get(ringOffsetPx)}px`,\n}));\n\nconst firstItemStyle = computed<Record<string, string>>(() => ({\n marginInlineStart: '0',\n}));\n\nconst avatarPx = computed<number>(() => resolveAvatarSizePx(get(resolvedSize)));\n\nconst ui = computed<ReturnType<typeof groupStyles>>(() => groupStyles({ variant }));\n</script>\n\n<template>\n <div\n :class=\"ui.root()\"\n data-id=\"avatar-group\"\n :data-size=\"typeof resolvedSize === 'string' ? resolvedSize : undefined\"\n :data-variant=\"variant\"\n >\n <span\n v-for=\"(child, index) in visible\"\n :key=\"child.key ?? index\"\n :class=\"ui.item()\"\n :style=\"index === 0 ? firstItemStyle : itemStyle\"\n >\n <VNodeRenderer :vnode=\"child\" />\n </span>\n <span\n v-if=\"surplusCount > 0\"\n :class=\"ui.item()\"\n :style=\"visible.length === 0 ? firstItemStyle : itemStyle\"\n data-id=\"avatar-group-surplus\"\n >\n <slot\n name=\"surplus\"\n :count=\"surplusCount\"\n >\n <RuiAvatar\n :size=\"resolvedSize\"\n :variant=\"variant\"\n :alt=\"`+${surplusCount} more`\"\n :style=\"{ width: `${avatarPx}px`, height: `${avatarPx}px` }\"\n >\n <span :class=\"ui.surplus()\">+{{ surplusCount }}</span>\n </RuiAvatar>\n </slot>\n </span>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;EAwCA,MAAM,QAAQA,SAAA;EAKd,MAAM,eAAe,eAAoC,QAAA,QAAQ,IAAI;EAErE,MAAM,gBAAgB,gBAAkC;GACtD,OAAO,CAAC,OAAO;GACf,MAAM,OAAO;IACX,aAAoB,MAAM;GAC5B;EACF,CAAC;EAED,QAAQ,yBAAyB,gBAAgB;GAAE,MAAM,IAAI,YAAY;GAAG,SAAM,QAAA;EAAE,EAAE,CAAC;EAEvF,SAAS,gBAAgB,OAAqC;GAC5D,IAAI,CAAC,OACH,OAAO,CAAC;GACV,MAAM,MAAe,CAAC;GACtB,KAAK,MAAM,QAAQ,OAAO;IACxB,IAAI,KAAK,SAAS,SAChB;IACF,IAAI,KAAK,SAAS,QAAQ,OAAO,KAAK,aAAa,YAAY,KAAK,SAAS,KAAK,MAAM,IACtF;IACF,IAAI,KAAK,SAAS,YAAY,MAAM,QAAQ,KAAK,QAAQ,GAAG;KAC1D,MAAM,QAAQ,KAAK,SAAS,QAAQ,MAAkB,OAAO,MAAM,YAAY,MAAM,QAAQ,UAAU,CAAC;KACxG,IAAI,KAAK,GAAG,gBAAgB,KAAK,CAAC;KAClC;IACF;IACA,IAAI,KAAK,IAAI;GACf;GACA,OAAO;EACT;EAEA,MAAM,WAAW,eAAwB,gBAAgB,MAAM,UAAU,CAAC,CAAC;EAE3E,MAAM,UAAU,eAAwB;GACtC,IAAI,QAAA,QAAQ,KAAA,GACV,OAAO,IAAI,QAAQ;GACrB,OAAO,IAAI,QAAQ,CAAC,CAAC,MAAM,GAAG,QAAA,GAAG;EACnC,CAAC;EAED,MAAM,eAAe,eAAuB;GAC1C,MAAM,aAAa,QAAA,SAAS,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AA,EAAA,CAAE,CAAC,KAAI,CAAA;IACd,OAAKG,eAAEH,MAAA,OAAA,CAAO,CAAC,WAAM,IAASA,MAAA,cAAA,IAAiBA,MAAA,SAAA,CAAS;IACzD,WAAQ;GAERK,GAAAA,CAAAA,WAYO,KAAA,QAAA,WAAA,EAVJ,OAAOL,MAAA,YAAA,EAAY,SAUf,CARLI,YAOYE,mBAAA;IANT,MAAMN,MAAA,YAAA;IACN,SAAS,QAAA;IACT,KAAG,IAAMA,MAAA,YAAA,EAAY;IACrB,OAAKG,eAAA;KAAA,OAAA,GAAcH,MAAA,QAAA,EAAQ;KAAA,QAAA,GAAiBA,MAAA,QAAA,EAAQ;IAAA,CAAA;;IAErD,SAAAO,cAAsD,CAAtDC,mBAAsD,QAAA,EAA/C,OAAKT,eAAEC,MAAA,EAAA,CAAE,CAAC,QAAO,CAAA,EAAI,GAAA,MAACS,gBAAGT,MAAA,YAAA,CAAY,GAAA,CAAA,CAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuiButton.js","names":["_sfc_main"],"sources":["../../../../src/components/buttons/button/RuiButton.vue"],"sourcesContent":["<script lang=\"ts\" generic=\"T = undefined\" setup>\nimport type { ContextColorsType } from '@/consts/colors';\nimport { ButtonGroupKey } from '@/components/buttons/button-group/button-group-context';\nimport { type ButtonCollapseBreakpoint, type ButtonSize, ButtonVariant, getButtonSpinnerSize } from '@/components/buttons/button/button-props';\nimport { buttonStyles } from '@/components/buttons/button/button-styles';\nimport RuiProgress from '@/components/progress/RuiProgress.vue';\nimport { cn } from '@/utils/tv';\n\nexport interface Props<T = undefined> {\n disabled?: boolean;\n loading?: boolean;\n color?: ContextColorsType;\n rounded?: boolean;\n variant?: ButtonVariant;\n icon?: boolean;\n active?: boolean;\n size?: ButtonSize;\n tag?: 'button' | 'a';\n type?: 'button' | 'submit';\n modelValue?: T;\n hideFocusIndicator?: boolean;\n /**\n * Below this breakpoint the button shows only its icons: the label becomes screen-reader text,\n * so it still names the button, and the button takes its icon-only padding. Give it a `prepend`\n * or `append` icon. Ignored on an `icon` button.\n */\n collapseBelow?: ButtonCollapseBreakpoint;\n}\n\ndefineOptions({\n name: 'RuiButton',\n inheritAttrs: false,\n});\n\nconst {\n disabled = false,\n loading = false,\n color = undefined,\n rounded = false,\n variant = ButtonVariant.default,\n icon = false,\n active = false,\n size = undefined,\n tag = 'button',\n type = 'button',\n modelValue = undefined,\n hideFocusIndicator = false,\n collapseBelow = undefined,\n} = defineProps<Props<T
|
|
1
|
+
{"version":3,"file":"RuiButton.js","names":["_sfc_main"],"sources":["../../../../src/components/buttons/button/RuiButton.vue"],"sourcesContent":["<script lang=\"ts\" generic=\"T = undefined\" setup>\nimport type { AnchorHTMLAttributes, ButtonHTMLAttributes } from 'vue';\nimport type { ContextColorsType } from '@/consts/colors';\nimport { ButtonGroupKey } from '@/components/buttons/button-group/button-group-context';\nimport { type ButtonCollapseBreakpoint, type ButtonSize, ButtonVariant, getButtonSpinnerSize } from '@/components/buttons/button/button-props';\nimport { buttonStyles } from '@/components/buttons/button/button-styles';\nimport RuiProgress from '@/components/progress/RuiProgress.vue';\nimport { cn } from '@/utils/tv';\n\nexport interface Props<T = undefined> {\n disabled?: boolean;\n loading?: boolean;\n color?: ContextColorsType;\n rounded?: boolean;\n variant?: ButtonVariant;\n icon?: boolean;\n active?: boolean;\n size?: ButtonSize;\n tag?: 'button' | 'a';\n type?: 'button' | 'submit';\n modelValue?: T;\n hideFocusIndicator?: boolean;\n /**\n * Below this breakpoint the button shows only its icons: the label becomes screen-reader text,\n * so it still names the button, and the button takes its icon-only padding. Give it a `prepend`\n * or `append` icon. Ignored on an `icon` button.\n */\n collapseBelow?: ButtonCollapseBreakpoint;\n}\n\n/**\n * What the rendered element takes through `$attrs`: a `<button>`, or an `<a>` when `tag` is `a`.\n */\ntype ButtonAttributes = ButtonHTMLAttributes & Pick<AnchorHTMLAttributes, 'href' | 'target' | 'rel' | 'download'>;\n\ndefineOptions({\n name: 'RuiButton',\n inheritAttrs: false,\n});\n\nconst {\n disabled = false,\n loading = false,\n color = undefined,\n rounded = false,\n variant = ButtonVariant.default,\n icon = false,\n active = false,\n size = undefined,\n tag = 'button',\n type = 'button',\n modelValue = undefined,\n hideFocusIndicator = false,\n collapseBelow = undefined,\n} = defineProps<Props<T> & /* @vue-ignore */ Omit<ButtonAttributes, keyof Props<T>>>();\n\nconst emit = defineEmits<{\n 'update:model-value': [value?: T];\n}>();\n\nconst slots = defineSlots<{\n prepend?: () => any;\n append?: () => any;\n default?: () => any;\n}>();\n\n// a RuiButtonGroup anywhere above, unless an overlay's content sits in between\nconst group = inject(ButtonGroupKey, undefined);\n\nconst btnValue = computed<T | undefined>(() => modelValue);\n\nconst resolvedVariant = computed<ButtonVariant>(() => group?.variant() ?? variant);\n\nconst resolvedSize = computed<ButtonSize | undefined>(() => size ?? group?.size());\n\nconst resolvedDisabled = computed<boolean>(() => disabled || (group?.disabled() ?? false));\n\n// a grouped button is pressed when the group's model holds its value; it needs one to take part\nconst resolvedActive = computed<boolean>(() => active || (!!group && modelValue !== undefined && group.isActive(modelValue)));\n\nconst resolvedColor = computed<ContextColorsType | undefined>(() => group?.color(get(resolvedActive)) ?? color);\n\nconst spinnerSize = computed<number>(() => getButtonSpinnerSize(get(resolvedSize)));\n\nconst ui = computed<ReturnType<typeof buttonStyles>>(() => buttonStyles({\n variant: get(resolvedVariant),\n color: get(resolvedColor) ?? 'grey',\n size: get(resolvedSize),\n rounded,\n icon,\n active: get(resolvedActive),\n loading,\n hideFocusIndicator,\n collapseBelow: icon ? undefined : collapseBelow,\n}));\n\nfunction onClick(): void {\n emit('update:model-value', get(btnValue));\n if (group && modelValue !== undefined)\n group.toggle(modelValue);\n}\n</script>\n\n<template>\n <component\n :is=\"tag\"\n :class=\"ui.root({ class: cn([group?.itemClass(), $attrs.class]) })\"\n :disabled=\"resolvedDisabled || loading\"\n :type=\"tag === 'button' ? type : undefined\"\n :data-variant=\"resolvedVariant\"\n :data-size=\"resolvedSize ?? 'md'\"\n :data-color=\"resolvedColor\"\n :data-active=\"resolvedActive || undefined\"\n :aria-busy=\"loading || undefined\"\n v-bind=\"{ ...$attrs, class: undefined }\"\n @click=\"onClick()\"\n >\n <!-- the button's aria-busy announces the wait, so the spinner stays out of the accessibility tree -->\n <RuiProgress\n v-if=\"loading\"\n circular\n data-spinner\n aria-hidden=\"true\"\n :class=\"ui.spinner()\"\n variant=\"indeterminate\"\n thickness=\"2\"\n :size=\"spinnerSize\"\n />\n <!-- while loading, the spinner stands in for the prepend icon; the label stays -->\n <slot\n v-if=\"!loading || icon\"\n name=\"prepend\"\n />\n <span\n v-if=\"slots.default\"\n :class=\"ui.label()\"\n data-id=\"btn-label\"\n >\n <slot />\n </span>\n <slot name=\"append\" />\n </component>\n</template>\n"],"mappings":""}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AnchorHTMLAttributes, ButtonHTMLAttributes } from 'vue';
|
|
1
2
|
import type { ContextColorsType } from '../../../consts/colors.js';
|
|
2
3
|
import { type ButtonCollapseBreakpoint, type ButtonSize, ButtonVariant } from './button-props.js';
|
|
3
4
|
export interface Props<T = undefined> {
|
|
@@ -21,7 +22,7 @@ export interface Props<T = undefined> {
|
|
|
21
22
|
collapseBelow?: ButtonCollapseBreakpoint;
|
|
22
23
|
}
|
|
23
24
|
declare const __VLS_export: <T = undefined>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
24
|
-
props: import("vue").PublicProps & __VLS_PrettifyLocal<Props<T> & {
|
|
25
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<(Props<T> & Omit<ButtonHTMLAttributes & Pick<AnchorHTMLAttributes, "target" | "href" | "rel" | "download">, keyof Props<T>>) & {
|
|
25
26
|
"onUpdate:model-value"?: ((value?: T | undefined) => any) | undefined;
|
|
26
27
|
}> & (typeof globalThis extends {
|
|
27
28
|
__VLS_PROPS_FALLBACK: infer P;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuiButton.vue_vue_type_script_setup_true_lang.js","names":["$attrs","_useSlots","_openBlock","_createBlock","_resolveDynamicComponent","_mergeProps","_unref","_withCtx","RuiProgress","_normalizeClass","_createCommentVNode","_renderSlot","_createElementBlock"],"sources":["../../../../src/components/buttons/button/RuiButton.vue"],"sourcesContent":["<script lang=\"ts\" generic=\"T = undefined\" setup>\nimport type { ContextColorsType } from '@/consts/colors';\nimport { ButtonGroupKey } from '@/components/buttons/button-group/button-group-context';\nimport { type ButtonCollapseBreakpoint, type ButtonSize, ButtonVariant, getButtonSpinnerSize } from '@/components/buttons/button/button-props';\nimport { buttonStyles } from '@/components/buttons/button/button-styles';\nimport RuiProgress from '@/components/progress/RuiProgress.vue';\nimport { cn } from '@/utils/tv';\n\nexport interface Props<T = undefined> {\n disabled?: boolean;\n loading?: boolean;\n color?: ContextColorsType;\n rounded?: boolean;\n variant?: ButtonVariant;\n icon?: boolean;\n active?: boolean;\n size?: ButtonSize;\n tag?: 'button' | 'a';\n type?: 'button' | 'submit';\n modelValue?: T;\n hideFocusIndicator?: boolean;\n /**\n * Below this breakpoint the button shows only its icons: the label becomes screen-reader text,\n * so it still names the button, and the button takes its icon-only padding. Give it a `prepend`\n * or `append` icon. Ignored on an `icon` button.\n */\n collapseBelow?: ButtonCollapseBreakpoint;\n}\n\ndefineOptions({\n name: 'RuiButton',\n inheritAttrs: false,\n});\n\nconst {\n disabled = false,\n loading = false,\n color = undefined,\n rounded = false,\n variant = ButtonVariant.default,\n icon = false,\n active = false,\n size = undefined,\n tag = 'button',\n type = 'button',\n modelValue = undefined,\n hideFocusIndicator = false,\n collapseBelow = undefined,\n} = defineProps<Props<T
|
|
1
|
+
{"version":3,"file":"RuiButton.vue_vue_type_script_setup_true_lang.js","names":["$attrs","_useSlots","_openBlock","_createBlock","_resolveDynamicComponent","_mergeProps","_unref","_withCtx","RuiProgress","_normalizeClass","_createCommentVNode","_renderSlot","_createElementBlock"],"sources":["../../../../src/components/buttons/button/RuiButton.vue"],"sourcesContent":["<script lang=\"ts\" generic=\"T = undefined\" setup>\nimport type { AnchorHTMLAttributes, ButtonHTMLAttributes } from 'vue';\nimport type { ContextColorsType } from '@/consts/colors';\nimport { ButtonGroupKey } from '@/components/buttons/button-group/button-group-context';\nimport { type ButtonCollapseBreakpoint, type ButtonSize, ButtonVariant, getButtonSpinnerSize } from '@/components/buttons/button/button-props';\nimport { buttonStyles } from '@/components/buttons/button/button-styles';\nimport RuiProgress from '@/components/progress/RuiProgress.vue';\nimport { cn } from '@/utils/tv';\n\nexport interface Props<T = undefined> {\n disabled?: boolean;\n loading?: boolean;\n color?: ContextColorsType;\n rounded?: boolean;\n variant?: ButtonVariant;\n icon?: boolean;\n active?: boolean;\n size?: ButtonSize;\n tag?: 'button' | 'a';\n type?: 'button' | 'submit';\n modelValue?: T;\n hideFocusIndicator?: boolean;\n /**\n * Below this breakpoint the button shows only its icons: the label becomes screen-reader text,\n * so it still names the button, and the button takes its icon-only padding. Give it a `prepend`\n * or `append` icon. Ignored on an `icon` button.\n */\n collapseBelow?: ButtonCollapseBreakpoint;\n}\n\n/**\n * What the rendered element takes through `$attrs`: a `<button>`, or an `<a>` when `tag` is `a`.\n */\ntype ButtonAttributes = ButtonHTMLAttributes & Pick<AnchorHTMLAttributes, 'href' | 'target' | 'rel' | 'download'>;\n\ndefineOptions({\n name: 'RuiButton',\n inheritAttrs: false,\n});\n\nconst {\n disabled = false,\n loading = false,\n color = undefined,\n rounded = false,\n variant = ButtonVariant.default,\n icon = false,\n active = false,\n size = undefined,\n tag = 'button',\n type = 'button',\n modelValue = undefined,\n hideFocusIndicator = false,\n collapseBelow = undefined,\n} = defineProps<Props<T> & /* @vue-ignore */ Omit<ButtonAttributes, keyof Props<T>>>();\n\nconst emit = defineEmits<{\n 'update:model-value': [value?: T];\n}>();\n\nconst slots = defineSlots<{\n prepend?: () => any;\n append?: () => any;\n default?: () => any;\n}>();\n\n// a RuiButtonGroup anywhere above, unless an overlay's content sits in between\nconst group = inject(ButtonGroupKey, undefined);\n\nconst btnValue = computed<T | undefined>(() => modelValue);\n\nconst resolvedVariant = computed<ButtonVariant>(() => group?.variant() ?? variant);\n\nconst resolvedSize = computed<ButtonSize | undefined>(() => size ?? group?.size());\n\nconst resolvedDisabled = computed<boolean>(() => disabled || (group?.disabled() ?? false));\n\n// a grouped button is pressed when the group's model holds its value; it needs one to take part\nconst resolvedActive = computed<boolean>(() => active || (!!group && modelValue !== undefined && group.isActive(modelValue)));\n\nconst resolvedColor = computed<ContextColorsType | undefined>(() => group?.color(get(resolvedActive)) ?? color);\n\nconst spinnerSize = computed<number>(() => getButtonSpinnerSize(get(resolvedSize)));\n\nconst ui = computed<ReturnType<typeof buttonStyles>>(() => buttonStyles({\n variant: get(resolvedVariant),\n color: get(resolvedColor) ?? 'grey',\n size: get(resolvedSize),\n rounded,\n icon,\n active: get(resolvedActive),\n loading,\n hideFocusIndicator,\n collapseBelow: icon ? undefined : collapseBelow,\n}));\n\nfunction onClick(): void {\n emit('update:model-value', get(btnValue));\n if (group && modelValue !== undefined)\n group.toggle(modelValue);\n}\n</script>\n\n<template>\n <component\n :is=\"tag\"\n :class=\"ui.root({ class: cn([group?.itemClass(), $attrs.class]) })\"\n :disabled=\"resolvedDisabled || loading\"\n :type=\"tag === 'button' ? type : undefined\"\n :data-variant=\"resolvedVariant\"\n :data-size=\"resolvedSize ?? 'md'\"\n :data-color=\"resolvedColor\"\n :data-active=\"resolvedActive || undefined\"\n :aria-busy=\"loading || undefined\"\n v-bind=\"{ ...$attrs, class: undefined }\"\n @click=\"onClick()\"\n >\n <!-- the button's aria-busy announces the wait, so the spinner stays out of the accessibility tree -->\n <RuiProgress\n v-if=\"loading\"\n circular\n data-spinner\n aria-hidden=\"true\"\n :class=\"ui.spinner()\"\n variant=\"indeterminate\"\n thickness=\"2\"\n :size=\"spinnerSize\"\n />\n <!-- while loading, the spinner stands in for the prepend icon; the label stays -->\n <slot\n v-if=\"!loading || icon\"\n name=\"prepend\"\n />\n <span\n v-if=\"slots.default\"\n :class=\"ui.label()\"\n data-id=\"btn-label\"\n >\n <slot />\n </span>\n <slot name=\"append\" />\n </component>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwDA,MAAM,OAAO;EAIb,MAAM,QAAQC,SAAA;EAOd,MAAM,QAAQ,OAAO,gBAAgB,KAAA,CAAS;EAE9C,MAAM,WAAW,eAA8B,QAAA,UAAU;EAEzD,MAAM,kBAAkB,eAA8B,OAAO,QAAQ,KAAK,QAAA,OAAO;EAEjF,MAAM,eAAe,eAAuC,QAAA,QAAQ,OAAO,KAAK,CAAC;EAEjF,MAAM,mBAAmB,eAAwB,QAAA,aAAa,OAAO,SAAS,KAAK,MAAM;EAGzF,MAAM,iBAAiB,eAAwB,QAAA,UAAW,CAAC,CAAC,SAAS,QAAA,eAAe,KAAA,KAAa,MAAM,SAAS,QAAA,UAAU,CAAE;EAE5H,MAAM,gBAAgB,eAA8C,OAAO,MAAM,IAAI,cAAc,CAAC,KAAK,QAAA,KAAK;EAE9G,MAAM,cAAc,eAAuB,qBAAqB,IAAI,YAAY,CAAC,CAAC;EAElF,MAAM,KAAK,eAAgD,aAAa;GACtE,SAAS,IAAI,eAAe;GAC5B,OAAO,IAAI,aAAa,KAAK;GAC7B,MAAM,IAAI,YAAY;GACtB,SAAM,QAAA;GACN,MAAG,QAAA;GACH,QAAQ,IAAI,cAAc;GAC1B,SAAM,QAAA;GACN,oBAAiB,QAAA;GACjB,eAAe,QAAA,OAAO,KAAA,IAAY,QAAA;EACpC,CAAC,CAAC;EAEF,SAAS,UAAgB;GACvB,KAAK,sBAAsB,IAAI,QAAQ,CAAC;GACxC,IAAI,SAAS,QAA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