mood-ui 0.14.1 → 0.15.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/README.md +1 -1
- package/dist/components/data-display/table/Table.cjs +1 -1
- package/dist/components/data-display/table/Table.cjs.map +1 -1
- package/dist/components/data-display/table/Table.mjs +1 -1
- package/dist/components/data-display/table/Table.mjs.map +1 -1
- package/dist/components/data-display/table/Table.vue_vue_type_script_setup_true_lang.cjs +37 -1
- package/dist/components/data-display/table/Table.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/data-display/table/Table.vue_vue_type_script_setup_true_lang.mjs +38 -2
- package/dist/components/data-display/table/Table.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/data-display/table/TablePagination.cjs.map +1 -1
- package/dist/components/data-display/table/TablePagination.mjs.map +1 -1
- package/dist/components/data-display/table/TablePagination.vue_vue_type_script_setup_true_lang.cjs +24 -16
- package/dist/components/data-display/table/TablePagination.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/data-display/table/TablePagination.vue_vue_type_script_setup_true_lang.mjs +24 -16
- package/dist/components/data-display/table/TablePagination.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/EmptyState.cjs.map +1 -1
- package/dist/components/feedback/EmptyState.mjs.map +1 -1
- package/dist/components/feedback/EmptyState.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/feedback/EmptyState.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/feedback/EmptyState.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/components/feedback/EmptyState.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/feedback/tour/Tour.vue_vue_type_script_setup_true_lang.cjs +369 -0
- package/dist/components/feedback/tour/Tour.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/components/feedback/tour/Tour.vue_vue_type_script_setup_true_lang.mjs +368 -0
- package/dist/components/feedback/tour/Tour.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
- package/dist/components/feedback/tour/Tour2.cjs +6 -0
- package/dist/components/feedback/tour/Tour2.cjs.map +1 -0
- package/dist/components/feedback/tour/Tour2.mjs +7 -0
- package/dist/components/feedback/tour/Tour2.mjs.map +1 -0
- package/dist/components/feedback/tour/TourCard.cjs +6 -0
- package/dist/components/feedback/tour/TourCard.cjs.map +1 -0
- package/dist/components/feedback/tour/TourCard.mjs +7 -0
- package/dist/components/feedback/tour/TourCard.mjs.map +1 -0
- package/dist/components/feedback/tour/TourCard.vue_vue_type_script_setup_true_lang.cjs +102 -0
- package/dist/components/feedback/tour/TourCard.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/components/feedback/tour/TourCard.vue_vue_type_script_setup_true_lang.mjs +101 -0
- package/dist/components/feedback/tour/TourCard.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
- package/dist/components/feedback/tour/tourAnchor.cjs +75 -0
- package/dist/components/feedback/tour/tourAnchor.cjs.map +1 -0
- package/dist/components/feedback/tour/tourAnchor.mjs +72 -0
- package/dist/components/feedback/tour/tourAnchor.mjs.map +1 -0
- package/dist/components/feedback/tour/tourPlace.cjs +108 -0
- package/dist/components/feedback/tour/tourPlace.cjs.map +1 -0
- package/dist/components/feedback/tour/tourPlace.mjs +107 -0
- package/dist/components/feedback/tour/tourPlace.mjs.map +1 -0
- package/dist/components/feedback/tour/tourShape.cjs +121 -0
- package/dist/components/feedback/tour/tourShape.cjs.map +1 -0
- package/dist/components/feedback/tour/tourShape.mjs +118 -0
- package/dist/components/feedback/tour/tourShape.mjs.map +1 -0
- package/dist/components/feedback/tour/useTourSpotlight.cjs +60 -0
- package/dist/components/feedback/tour/useTourSpotlight.cjs.map +1 -0
- package/dist/components/feedback/tour/useTourSpotlight.mjs +59 -0
- package/dist/components/feedback/tour/useTourSpotlight.mjs.map +1 -0
- package/dist/components/feedback/tour/useTourSteps.cjs +108 -0
- package/dist/components/feedback/tour/useTourSteps.cjs.map +1 -0
- package/dist/components/feedback/tour/useTourSteps.mjs +107 -0
- package/dist/components/feedback/tour/useTourSteps.mjs.map +1 -0
- package/dist/components/forms/Button.cjs +1 -1
- package/dist/components/forms/Button.cjs.map +1 -1
- package/dist/components/forms/Button.mjs +1 -1
- package/dist/components/forms/Button.mjs.map +1 -1
- package/dist/components/forms/Button.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/forms/Button.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/Button.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/components/forms/Button.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/FileInput.cjs +1 -1
- package/dist/components/forms/FileInput.cjs.map +1 -1
- package/dist/components/forms/FileInput.mjs +1 -1
- package/dist/components/forms/FileInput.mjs.map +1 -1
- package/dist/components/forms/FileInput.vue_vue_type_script_setup_true_lang.cjs +34 -17
- package/dist/components/forms/FileInput.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/FileInput.vue_vue_type_script_setup_true_lang.mjs +34 -17
- package/dist/components/forms/FileInput.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/MultiSelect.cjs +1 -1
- package/dist/components/forms/MultiSelect.cjs.map +1 -1
- package/dist/components/forms/MultiSelect.mjs +1 -1
- package/dist/components/forms/MultiSelect.mjs.map +1 -1
- package/dist/components/forms/MultiSelect.vue_vue_type_script_setup_true_lang.cjs +2 -1
- package/dist/components/forms/MultiSelect.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/MultiSelect.vue_vue_type_script_setup_true_lang.mjs +2 -1
- package/dist/components/forms/MultiSelect.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/TagInput.cjs.map +1 -1
- package/dist/components/forms/TagInput.mjs.map +1 -1
- package/dist/components/forms/TagInput.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/components/forms/TagInput.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/TagInput.vue_vue_type_script_setup_true_lang.mjs +1 -0
- package/dist/components/forms/TagInput.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/forms/Textarea.cjs.map +1 -1
- package/dist/components/forms/Textarea.mjs.map +1 -1
- package/dist/components/forms/Textarea.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/forms/Textarea.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/forms/Textarea.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/components/forms/Textarea.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/layout/Canvas.cjs +1 -1
- package/dist/components/layout/Canvas.cjs.map +1 -1
- package/dist/components/layout/Canvas.mjs +1 -1
- package/dist/components/layout/Canvas.mjs.map +1 -1
- package/dist/components/layout/Canvas.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/layout/Canvas.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/layout/Canvas.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/components/layout/Canvas.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/layout/PopoverPanel.cjs +1 -1
- package/dist/components/layout/PopoverPanel.cjs.map +1 -1
- package/dist/components/layout/PopoverPanel.mjs +1 -1
- package/dist/components/layout/PopoverPanel.mjs.map +1 -1
- package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/layout/popover/PopoverTrigger.cjs.map +1 -1
- package/dist/components/layout/popover/PopoverTrigger.mjs.map +1 -1
- package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/navigation/DropdownMenu.cjs +1 -1
- package/dist/components/navigation/DropdownMenu.cjs.map +1 -1
- package/dist/components/navigation/DropdownMenu.mjs +1 -1
- package/dist/components/navigation/DropdownMenu.mjs.map +1 -1
- package/dist/components/navigation/DropdownMenu.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/navigation/DropdownMenu.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/navigation/DropdownMenu.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/components/navigation/DropdownMenu.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/navigation/Switcher.cjs.map +1 -1
- package/dist/components/navigation/Switcher.mjs.map +1 -1
- package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.cjs +77 -45
- package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.mjs +77 -45
- package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/components/navigation/menu/MenuTrigger.cjs.map +1 -1
- package/dist/components/navigation/menu/MenuTrigger.mjs.map +1 -1
- package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/dist/composables/useField.cjs +28 -8
- package/dist/composables/useField.cjs.map +1 -1
- package/dist/composables/useField.mjs +28 -8
- package/dist/composables/useField.mjs.map +1 -1
- package/dist/config/ModoLocale.cjs +10 -1
- package/dist/config/ModoLocale.cjs.map +1 -1
- package/dist/config/ModoLocale.mjs +10 -1
- package/dist/config/ModoLocale.mjs.map +1 -1
- package/dist/config/locales/es.cjs +10 -1
- package/dist/config/locales/es.cjs.map +1 -1
- package/dist/config/locales/es.mjs +10 -1
- package/dist/config/locales/es.mjs.map +1 -1
- package/dist/index.cjs +4 -0
- package/dist/index.mjs +3 -1
- package/dist/mood-ui.css +289 -103
- package/dist/types/components/data-display/surface-card/SurfaceCardBody.vue.d.ts +1 -1
- package/dist/types/components/data-display/surface-card/SurfaceCardFooter.vue.d.ts +1 -1
- package/dist/types/components/data-display/surface-card/SurfaceCardHeader.vue.d.ts +1 -1
- package/dist/types/components/feedback/dialog/DialogContent.vue.d.ts +1 -1
- package/dist/types/components/feedback/tour/Tour.vue.d.ts +31 -0
- package/dist/types/components/feedback/tour/TourCard.vue.d.ts +25 -0
- package/dist/types/components/feedback/tour/index.d.ts +2 -0
- package/dist/types/components/feedback/tour/tourAnchor.d.ts +12 -0
- package/dist/types/components/feedback/tour/tourPlace.d.ts +60 -0
- package/dist/types/components/feedback/tour/tourShape.d.ts +36 -0
- package/dist/types/components/feedback/tour/useTourSpotlight.d.ts +14 -0
- package/dist/types/components/feedback/tour/useTourSteps.d.ts +31 -0
- package/dist/types/components/layout/Canvas.vue.d.ts +1 -1
- package/dist/types/components/layout/popover/PopoverContent.vue.d.ts +1 -1
- package/dist/types/components/navigation/menu/MenuContent.vue.d.ts +1 -1
- package/dist/types/composables/useField.d.ts +23 -0
- package/dist/types/config/ModoLocale.d.ts +14 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/interfaces/feedback/Tour.interface.d.ts +73 -0
- package/dist/types/interfaces/navigation/Switcher.interface.d.ts +5 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TablePagination.cjs","names":[],"sources":["../../../../src/components/data-display/table/TablePagination.vue"],"sourcesContent":["<script setup lang=\"ts\"> \n/** \n * TablePagination · standalone footer for `<Table>`. \n * \n * Layout (LTR): \n * [ rows-per-page Select ] [ range readout ] [ « ‹ › » ] \n * \n * Designed to be embedded inside `<Table>` automatically (when the host \n * passes `pagination`) or used standalone for custom layouts. Emits a \n * single `update:pagination` event with the *full* next state so v-model \n * stays simple. \n * \n * A11y: \n * - Wrapped in `<nav role=\"navigation\">` with `aria-label`. \n * - Each button gets a localized `aria-label`; current page is announced \n * via `aria-current=\"page\"` on the page readout. \n * - First/Last buttons are hidden when `hideEdgeButtons=true`. \n */ \nimport { computed } from 'vue'; \nimport { \n ChevronLeftIcon, \n ChevronRightIcon, \n ChevronDoubleLeftIcon, \n ChevronDoubleRightIcon, \n} from '@heroicons/vue/20/solid'; \nimport type { TablePagination as TablePaginationProps } from '../../../interfaces/data-display/table/TablePagination.interface'; \nimport type { TablePaginationState } from '../../../interfaces/data-display/table/Table.interface'; \nimport { useModoLocale, useResolvedRadius, useResolvedSize } from '../../../composables/useModoConfig'; \nimport { interpolate } from '../../../config/ModoLocale'; \nimport Select from '../../forms/Select.vue'; \nimport Button from '../../forms/Button.vue'; \n \nconst props = withDefaults(defineProps<TablePaginationProps>(), { \n pageSizeOptions: () => [10, 25, 50, 100], \n hidePageSize: false, \n hideEdgeButtons: false, \n disabled: false, \n embedded: false,\n}); \n \nconst resolvedSize = useResolvedSize(() => props.size); \nconst resolvedRadius = useResolvedRadius(() => props.radius); \n \nconst emit = defineEmits<{ \n 'update:pagination': [next: TablePaginationState]; \n}>(); \n \nconst loc = useModoLocale(); \n \nconst total = computed(() => props.pagination.total ?? 0); \nconst pageSize = computed(() => Math.max(1, props.pagination.pageSize || 1)); \nconst pageCount = computed(() => Math.max(1, Math.ceil(total.value / pageSize.value))); \n \nconst range = computed<[number, number]>(() => { \n if (total.value === 0) return [0, 0]; \n const from = (props.pagination.page - 1) * pageSize.value + 1; \n const to = Math.min(props.pagination.page * pageSize.value, total.value); \n return [from, to]; \n}); \n \nconst rangeText = computed(() => { \n if (props.pagination.total == null) { \n return interpolate(loc.value.table.pagination.rangeUnknown, { \n from: range.value[0], \n to: range.value[1], \n }); \n } \n return interpolate(loc.value.table.pagination.range, { \n from: range.value[0], \n to: range.value[1], \n total: total.value, \n }); \n}); \n \nconst pageText = computed(() => \n interpolate(loc.value.table.pagination.page, { \n current: props.pagination.page, \n total: pageCount.value, \n }), \n); \n \nconst isFirst = computed(() => props.pagination.page <= 1); \nconst isLast = computed(() => props.pagination.page >= pageCount.value); \n \nfunction emitNext(partial: Partial<TablePaginationState>) { \n emit('update:pagination', { ...props.pagination, ...partial }); \n} \n \nfunction go(to: number) { \n if (props.disabled) return; \n const clamped = Math.min(Math.max(1, to), pageCount.value); \n if (clamped === props.pagination.page) return; \n emitNext({ page: clamped }); \n} \n \nfunction onPageSizeChange(next: number) { \n if (props.disabled) return; \n // Reset to page 1 so the user always sees the top of the new slice. \n emitNext({ page: 1, pageSize: Number(next) }); \n} \n \nconst pageSizeSelectOptions = computed(() => {\n const unique = Array.from(new Set([...props.pageSizeOptions, pageSize.value])).sort(\n (a, b) => a - b,\n );\n return unique.map((n) => ({ value: n, label: String(n) }));\n}); \n \n/* ---------- Sizing tokens ---------- */ \nconst textSizeClass = computed(() => { \n if (resolvedSize.value === 'small') return 'text-[11px] leading-4'; \n if (resolvedSize.value === 'large') return 'text-body'; \n return 'text-caption'; \n}); \n\n/** Map pagination size to canonical mood-ui control size (`sm` by default). */ \nconst controlSize = computed<'xsmall' | 'small' | 'medium'>(() => { \n if (resolvedSize.value === 'small') return 'xsmall'; \n if (resolvedSize.value === 'large') return 'medium'; \n return 'small'; \n}); \n</script> \n \n<template> \n <nav \n :aria-label=\"ariaLabel ?? 'Pagination'\" \n :class=\"[ \n '
|
|
1
|
+
{"version":3,"file":"TablePagination.cjs","names":[],"sources":["../../../../src/components/data-display/table/TablePagination.vue"],"sourcesContent":["<script setup lang=\"ts\"> \n/** \n * TablePagination · standalone footer for `<Table>`. \n * \n * Layout (LTR): \n * [ rows-per-page Select ] [ range readout ] [ « ‹ › » ] \n * \n * Designed to be embedded inside `<Table>` automatically (when the host \n * passes `pagination`) or used standalone for custom layouts. Emits a \n * single `update:pagination` event with the *full* next state so v-model \n * stays simple. \n * \n * A11y: \n * - Wrapped in `<nav role=\"navigation\">` with `aria-label`. \n * - Each button gets a localized `aria-label`; current page is announced \n * via `aria-current=\"page\"` on the page readout. \n * - First/Last buttons are hidden when `hideEdgeButtons=true`. \n */ \nimport { computed } from 'vue'; \nimport { \n ChevronLeftIcon, \n ChevronRightIcon, \n ChevronDoubleLeftIcon, \n ChevronDoubleRightIcon, \n} from '@heroicons/vue/20/solid'; \nimport type { TablePagination as TablePaginationProps } from '../../../interfaces/data-display/table/TablePagination.interface'; \nimport type { TablePaginationState } from '../../../interfaces/data-display/table/Table.interface'; \nimport { useModoLocale, useResolvedRadius, useResolvedSize } from '../../../composables/useModoConfig'; \nimport { interpolate } from '../../../config/ModoLocale'; \nimport Select from '../../forms/Select.vue'; \nimport Button from '../../forms/Button.vue'; \n \nconst props = withDefaults(defineProps<TablePaginationProps>(), { \n pageSizeOptions: () => [10, 25, 50, 100], \n hidePageSize: false, \n hideEdgeButtons: false, \n disabled: false, \n embedded: false,\n}); \n \nconst resolvedSize = useResolvedSize(() => props.size); \nconst resolvedRadius = useResolvedRadius(() => props.radius); \n \nconst emit = defineEmits<{ \n 'update:pagination': [next: TablePaginationState]; \n}>(); \n \nconst loc = useModoLocale(); \n \nconst total = computed(() => props.pagination.total ?? 0); \nconst pageSize = computed(() => Math.max(1, props.pagination.pageSize || 1)); \nconst pageCount = computed(() => Math.max(1, Math.ceil(total.value / pageSize.value))); \n \nconst range = computed<[number, number]>(() => { \n if (total.value === 0) return [0, 0]; \n const from = (props.pagination.page - 1) * pageSize.value + 1; \n const to = Math.min(props.pagination.page * pageSize.value, total.value); \n return [from, to]; \n}); \n \nconst rangeText = computed(() => { \n if (props.pagination.total == null) { \n return interpolate(loc.value.table.pagination.rangeUnknown, { \n from: range.value[0], \n to: range.value[1], \n }); \n } \n return interpolate(loc.value.table.pagination.range, { \n from: range.value[0], \n to: range.value[1], \n total: total.value, \n }); \n}); \n \nconst pageText = computed(() => \n interpolate(loc.value.table.pagination.page, { \n current: props.pagination.page, \n total: pageCount.value, \n }), \n); \n \n// Compact readout for narrow containers (\"1 / 3\"). Both texts are rendered and\n// CSS (a container query on the nav) picks one, so SSR and the first paint\n// already match the final layout: no JS measuring, no jump.\nconst pageTextCompact = computed(() =>\n interpolate(loc.value.table.pagination.pageCompact, {\n current: props.pagination.page,\n total: pageCount.value,\n }),\n);\n\nconst isFirst = computed(() => props.pagination.page <= 1); \nconst isLast = computed(() => props.pagination.page >= pageCount.value); \n \nfunction emitNext(partial: Partial<TablePaginationState>) { \n emit('update:pagination', { ...props.pagination, ...partial }); \n} \n \nfunction go(to: number) { \n if (props.disabled) return; \n const clamped = Math.min(Math.max(1, to), pageCount.value); \n if (clamped === props.pagination.page) return; \n emitNext({ page: clamped }); \n} \n \nfunction onPageSizeChange(next: number) { \n if (props.disabled) return; \n // Reset to page 1 so the user always sees the top of the new slice. \n emitNext({ page: 1, pageSize: Number(next) }); \n} \n \nconst pageSizeSelectOptions = computed(() => {\n const unique = Array.from(new Set([...props.pageSizeOptions, pageSize.value])).sort(\n (a, b) => a - b,\n );\n return unique.map((n) => ({ value: n, label: String(n) }));\n}); \n \n/* ---------- Sizing tokens ---------- */ \nconst textSizeClass = computed(() => { \n if (resolvedSize.value === 'small') return 'text-[11px] leading-4'; \n if (resolvedSize.value === 'large') return 'text-body'; \n return 'text-caption'; \n}); \n\n/** Map pagination size to canonical mood-ui control size (`sm` by default). */ \nconst controlSize = computed<'xsmall' | 'small' | 'medium'>(() => { \n if (resolvedSize.value === 'small') return 'xsmall'; \n if (resolvedSize.value === 'large') return 'medium'; \n return 'small'; \n}); \n</script> \n \n<template> \n <!-- The nav is the container (`@container`): below 520px of ITS OWN width the\n layout goes compact, whatever the viewport. Everything stays on one line. -->\n <nav \n :aria-label=\"ariaLabel ?? 'Pagination'\" \n :class=\"[ \n '@container w-full', \n embedded ? 'bg-transparent' : 'bg-card border-t border-border', \n textSizeClass, \n ]\" \n > \n <div \n :class=\"[ \n 'flex flex-wrap items-center gap-3 px-3 py-2', \n '@max-[520px]:flex-nowrap @max-[520px]:gap-2 @max-[520px]:px-2', \n ]\" \n > \n <!-- Rows per page -->\n <div v-if=\"!hidePageSize\" class=\"flex items-center gap-2 min-w-0\"> \n <span class=\"text-muted-foreground whitespace-nowrap @max-[520px]:hidden\">{{ loc.table.pagination.rowsPerPage }}</span> \n <Select \n :model-value=\"pageSize\" \n :options=\"pageSizeSelectOptions\" \n :disabled=\"disabled\" \n :size=\"controlSize\" \n :radius=\"resolvedRadius\" \n :aria-label=\"loc.table.pagination.rowsPerPage\" \n @update:model-value=\"(v: any) => onPageSizeChange(Number(v))\" \n /> \n </div> \n \n <!-- Range readout + buttons (pushed to the right) --> \n <div class=\"ml-auto flex items-center gap-3 shrink-0 @max-[520px]:gap-0\"> \n <span class=\"text-muted-foreground tabular-nums whitespace-nowrap @max-[520px]:hidden\">{{ rangeText }}</span> \n \n <div class=\"flex items-center gap-1.5 @max-[520px]:gap-1\"> \n <Button \n v-if=\"!hideEdgeButtons\" \n variant=\"outline\" \n :size=\"controlSize\" \n :radius=\"resolvedRadius\" \n :icon=\"ChevronDoubleLeftIcon\" \n :ariaLabel=\"loc.table.pagination.first\" \n :disabled=\"disabled || isFirst\" \n @click=\"go(1)\" \n /> \n <Button \n variant=\"outline\" \n :size=\"controlSize\" \n :radius=\"resolvedRadius\" \n :icon=\"ChevronLeftIcon\" \n :ariaLabel=\"loc.table.pagination.previous\" \n :disabled=\"disabled || isFirst\" \n @click=\"go(pagination.page - 1)\" \n /> \n \n <span \n class=\"px-1.5 text-muted-foreground tabular-nums whitespace-nowrap @max-[520px]:px-1\" \n aria-current=\"page\" \n > \n <span class=\"@max-[520px]:hidden\">{{ pageText }}</span> \n <span class=\"hidden @max-[520px]:inline\">{{ pageTextCompact }}</span> \n </span> \n \n <Button \n variant=\"outline\" \n :size=\"controlSize\" \n :radius=\"resolvedRadius\" \n :icon=\"ChevronRightIcon\" \n :ariaLabel=\"loc.table.pagination.next\" \n :disabled=\"disabled || isLast\" \n @click=\"go(pagination.page + 1)\" \n /> \n <Button \n v-if=\"!hideEdgeButtons\" \n variant=\"outline\" \n :size=\"controlSize\" \n :radius=\"resolvedRadius\" \n :icon=\"ChevronDoubleRightIcon\" \n :ariaLabel=\"loc.table.pagination.last\" \n :disabled=\"disabled || isLast\" \n @click=\"go(pageCount)\" \n /> \n </div> \n </div> \n </div> \n </nav> \n</template>\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TablePagination.mjs","names":[],"sources":["../../../../src/components/data-display/table/TablePagination.vue"],"sourcesContent":["<script setup lang=\"ts\"> \n/** \n * TablePagination · standalone footer for `<Table>`. \n * \n * Layout (LTR): \n * [ rows-per-page Select ] [ range readout ] [ « ‹ › » ] \n * \n * Designed to be embedded inside `<Table>` automatically (when the host \n * passes `pagination`) or used standalone for custom layouts. Emits a \n * single `update:pagination` event with the *full* next state so v-model \n * stays simple. \n * \n * A11y: \n * - Wrapped in `<nav role=\"navigation\">` with `aria-label`. \n * - Each button gets a localized `aria-label`; current page is announced \n * via `aria-current=\"page\"` on the page readout. \n * - First/Last buttons are hidden when `hideEdgeButtons=true`. \n */ \nimport { computed } from 'vue'; \nimport { \n ChevronLeftIcon, \n ChevronRightIcon, \n ChevronDoubleLeftIcon, \n ChevronDoubleRightIcon, \n} from '@heroicons/vue/20/solid'; \nimport type { TablePagination as TablePaginationProps } from '../../../interfaces/data-display/table/TablePagination.interface'; \nimport type { TablePaginationState } from '../../../interfaces/data-display/table/Table.interface'; \nimport { useModoLocale, useResolvedRadius, useResolvedSize } from '../../../composables/useModoConfig'; \nimport { interpolate } from '../../../config/ModoLocale'; \nimport Select from '../../forms/Select.vue'; \nimport Button from '../../forms/Button.vue'; \n \nconst props = withDefaults(defineProps<TablePaginationProps>(), { \n pageSizeOptions: () => [10, 25, 50, 100], \n hidePageSize: false, \n hideEdgeButtons: false, \n disabled: false, \n embedded: false,\n}); \n \nconst resolvedSize = useResolvedSize(() => props.size); \nconst resolvedRadius = useResolvedRadius(() => props.radius); \n \nconst emit = defineEmits<{ \n 'update:pagination': [next: TablePaginationState]; \n}>(); \n \nconst loc = useModoLocale(); \n \nconst total = computed(() => props.pagination.total ?? 0); \nconst pageSize = computed(() => Math.max(1, props.pagination.pageSize || 1)); \nconst pageCount = computed(() => Math.max(1, Math.ceil(total.value / pageSize.value))); \n \nconst range = computed<[number, number]>(() => { \n if (total.value === 0) return [0, 0]; \n const from = (props.pagination.page - 1) * pageSize.value + 1; \n const to = Math.min(props.pagination.page * pageSize.value, total.value); \n return [from, to]; \n}); \n \nconst rangeText = computed(() => { \n if (props.pagination.total == null) { \n return interpolate(loc.value.table.pagination.rangeUnknown, { \n from: range.value[0], \n to: range.value[1], \n }); \n } \n return interpolate(loc.value.table.pagination.range, { \n from: range.value[0], \n to: range.value[1], \n total: total.value, \n }); \n}); \n \nconst pageText = computed(() => \n interpolate(loc.value.table.pagination.page, { \n current: props.pagination.page, \n total: pageCount.value, \n }), \n); \n \nconst isFirst = computed(() => props.pagination.page <= 1); \nconst isLast = computed(() => props.pagination.page >= pageCount.value); \n \nfunction emitNext(partial: Partial<TablePaginationState>) { \n emit('update:pagination', { ...props.pagination, ...partial }); \n} \n \nfunction go(to: number) { \n if (props.disabled) return; \n const clamped = Math.min(Math.max(1, to), pageCount.value); \n if (clamped === props.pagination.page) return; \n emitNext({ page: clamped }); \n} \n \nfunction onPageSizeChange(next: number) { \n if (props.disabled) return; \n // Reset to page 1 so the user always sees the top of the new slice. \n emitNext({ page: 1, pageSize: Number(next) }); \n} \n \nconst pageSizeSelectOptions = computed(() => {\n const unique = Array.from(new Set([...props.pageSizeOptions, pageSize.value])).sort(\n (a, b) => a - b,\n );\n return unique.map((n) => ({ value: n, label: String(n) }));\n}); \n \n/* ---------- Sizing tokens ---------- */ \nconst textSizeClass = computed(() => { \n if (resolvedSize.value === 'small') return 'text-[11px] leading-4'; \n if (resolvedSize.value === 'large') return 'text-body'; \n return 'text-caption'; \n}); \n\n/** Map pagination size to canonical mood-ui control size (`sm` by default). */ \nconst controlSize = computed<'xsmall' | 'small' | 'medium'>(() => { \n if (resolvedSize.value === 'small') return 'xsmall'; \n if (resolvedSize.value === 'large') return 'medium'; \n return 'small'; \n}); \n</script> \n \n<template> \n <nav \n :aria-label=\"ariaLabel ?? 'Pagination'\" \n :class=\"[ \n '
|
|
1
|
+
{"version":3,"file":"TablePagination.mjs","names":[],"sources":["../../../../src/components/data-display/table/TablePagination.vue"],"sourcesContent":["<script setup lang=\"ts\"> \n/** \n * TablePagination · standalone footer for `<Table>`. \n * \n * Layout (LTR): \n * [ rows-per-page Select ] [ range readout ] [ « ‹ › » ] \n * \n * Designed to be embedded inside `<Table>` automatically (when the host \n * passes `pagination`) or used standalone for custom layouts. Emits a \n * single `update:pagination` event with the *full* next state so v-model \n * stays simple. \n * \n * A11y: \n * - Wrapped in `<nav role=\"navigation\">` with `aria-label`. \n * - Each button gets a localized `aria-label`; current page is announced \n * via `aria-current=\"page\"` on the page readout. \n * - First/Last buttons are hidden when `hideEdgeButtons=true`. \n */ \nimport { computed } from 'vue'; \nimport { \n ChevronLeftIcon, \n ChevronRightIcon, \n ChevronDoubleLeftIcon, \n ChevronDoubleRightIcon, \n} from '@heroicons/vue/20/solid'; \nimport type { TablePagination as TablePaginationProps } from '../../../interfaces/data-display/table/TablePagination.interface'; \nimport type { TablePaginationState } from '../../../interfaces/data-display/table/Table.interface'; \nimport { useModoLocale, useResolvedRadius, useResolvedSize } from '../../../composables/useModoConfig'; \nimport { interpolate } from '../../../config/ModoLocale'; \nimport Select from '../../forms/Select.vue'; \nimport Button from '../../forms/Button.vue'; \n \nconst props = withDefaults(defineProps<TablePaginationProps>(), { \n pageSizeOptions: () => [10, 25, 50, 100], \n hidePageSize: false, \n hideEdgeButtons: false, \n disabled: false, \n embedded: false,\n}); \n \nconst resolvedSize = useResolvedSize(() => props.size); \nconst resolvedRadius = useResolvedRadius(() => props.radius); \n \nconst emit = defineEmits<{ \n 'update:pagination': [next: TablePaginationState]; \n}>(); \n \nconst loc = useModoLocale(); \n \nconst total = computed(() => props.pagination.total ?? 0); \nconst pageSize = computed(() => Math.max(1, props.pagination.pageSize || 1)); \nconst pageCount = computed(() => Math.max(1, Math.ceil(total.value / pageSize.value))); \n \nconst range = computed<[number, number]>(() => { \n if (total.value === 0) return [0, 0]; \n const from = (props.pagination.page - 1) * pageSize.value + 1; \n const to = Math.min(props.pagination.page * pageSize.value, total.value); \n return [from, to]; \n}); \n \nconst rangeText = computed(() => { \n if (props.pagination.total == null) { \n return interpolate(loc.value.table.pagination.rangeUnknown, { \n from: range.value[0], \n to: range.value[1], \n }); \n } \n return interpolate(loc.value.table.pagination.range, { \n from: range.value[0], \n to: range.value[1], \n total: total.value, \n }); \n}); \n \nconst pageText = computed(() => \n interpolate(loc.value.table.pagination.page, { \n current: props.pagination.page, \n total: pageCount.value, \n }), \n); \n \n// Compact readout for narrow containers (\"1 / 3\"). Both texts are rendered and\n// CSS (a container query on the nav) picks one, so SSR and the first paint\n// already match the final layout: no JS measuring, no jump.\nconst pageTextCompact = computed(() =>\n interpolate(loc.value.table.pagination.pageCompact, {\n current: props.pagination.page,\n total: pageCount.value,\n }),\n);\n\nconst isFirst = computed(() => props.pagination.page <= 1); \nconst isLast = computed(() => props.pagination.page >= pageCount.value); \n \nfunction emitNext(partial: Partial<TablePaginationState>) { \n emit('update:pagination', { ...props.pagination, ...partial }); \n} \n \nfunction go(to: number) { \n if (props.disabled) return; \n const clamped = Math.min(Math.max(1, to), pageCount.value); \n if (clamped === props.pagination.page) return; \n emitNext({ page: clamped }); \n} \n \nfunction onPageSizeChange(next: number) { \n if (props.disabled) return; \n // Reset to page 1 so the user always sees the top of the new slice. \n emitNext({ page: 1, pageSize: Number(next) }); \n} \n \nconst pageSizeSelectOptions = computed(() => {\n const unique = Array.from(new Set([...props.pageSizeOptions, pageSize.value])).sort(\n (a, b) => a - b,\n );\n return unique.map((n) => ({ value: n, label: String(n) }));\n}); \n \n/* ---------- Sizing tokens ---------- */ \nconst textSizeClass = computed(() => { \n if (resolvedSize.value === 'small') return 'text-[11px] leading-4'; \n if (resolvedSize.value === 'large') return 'text-body'; \n return 'text-caption'; \n}); \n\n/** Map pagination size to canonical mood-ui control size (`sm` by default). */ \nconst controlSize = computed<'xsmall' | 'small' | 'medium'>(() => { \n if (resolvedSize.value === 'small') return 'xsmall'; \n if (resolvedSize.value === 'large') return 'medium'; \n return 'small'; \n}); \n</script> \n \n<template> \n <!-- The nav is the container (`@container`): below 520px of ITS OWN width the\n layout goes compact, whatever the viewport. Everything stays on one line. -->\n <nav \n :aria-label=\"ariaLabel ?? 'Pagination'\" \n :class=\"[ \n '@container w-full', \n embedded ? 'bg-transparent' : 'bg-card border-t border-border', \n textSizeClass, \n ]\" \n > \n <div \n :class=\"[ \n 'flex flex-wrap items-center gap-3 px-3 py-2', \n '@max-[520px]:flex-nowrap @max-[520px]:gap-2 @max-[520px]:px-2', \n ]\" \n > \n <!-- Rows per page -->\n <div v-if=\"!hidePageSize\" class=\"flex items-center gap-2 min-w-0\"> \n <span class=\"text-muted-foreground whitespace-nowrap @max-[520px]:hidden\">{{ loc.table.pagination.rowsPerPage }}</span> \n <Select \n :model-value=\"pageSize\" \n :options=\"pageSizeSelectOptions\" \n :disabled=\"disabled\" \n :size=\"controlSize\" \n :radius=\"resolvedRadius\" \n :aria-label=\"loc.table.pagination.rowsPerPage\" \n @update:model-value=\"(v: any) => onPageSizeChange(Number(v))\" \n /> \n </div> \n \n <!-- Range readout + buttons (pushed to the right) --> \n <div class=\"ml-auto flex items-center gap-3 shrink-0 @max-[520px]:gap-0\"> \n <span class=\"text-muted-foreground tabular-nums whitespace-nowrap @max-[520px]:hidden\">{{ rangeText }}</span> \n \n <div class=\"flex items-center gap-1.5 @max-[520px]:gap-1\"> \n <Button \n v-if=\"!hideEdgeButtons\" \n variant=\"outline\" \n :size=\"controlSize\" \n :radius=\"resolvedRadius\" \n :icon=\"ChevronDoubleLeftIcon\" \n :ariaLabel=\"loc.table.pagination.first\" \n :disabled=\"disabled || isFirst\" \n @click=\"go(1)\" \n /> \n <Button \n variant=\"outline\" \n :size=\"controlSize\" \n :radius=\"resolvedRadius\" \n :icon=\"ChevronLeftIcon\" \n :ariaLabel=\"loc.table.pagination.previous\" \n :disabled=\"disabled || isFirst\" \n @click=\"go(pagination.page - 1)\" \n /> \n \n <span \n class=\"px-1.5 text-muted-foreground tabular-nums whitespace-nowrap @max-[520px]:px-1\" \n aria-current=\"page\" \n > \n <span class=\"@max-[520px]:hidden\">{{ pageText }}</span> \n <span class=\"hidden @max-[520px]:inline\">{{ pageTextCompact }}</span> \n </span> \n \n <Button \n variant=\"outline\" \n :size=\"controlSize\" \n :radius=\"resolvedRadius\" \n :icon=\"ChevronRightIcon\" \n :ariaLabel=\"loc.table.pagination.next\" \n :disabled=\"disabled || isLast\" \n @click=\"go(pagination.page + 1)\" \n /> \n <Button \n v-if=\"!hideEdgeButtons\" \n variant=\"outline\" \n :size=\"controlSize\" \n :radius=\"resolvedRadius\" \n :icon=\"ChevronDoubleRightIcon\" \n :ariaLabel=\"loc.table.pagination.last\" \n :disabled=\"disabled || isLast\" \n @click=\"go(pageCount)\" \n /> \n </div> \n </div> \n </div> \n </nav> \n</template>\n"],"mappings":""}
|
package/dist/components/data-display/table/TablePagination.vue_vue_type_script_setup_true_lang.cjs
CHANGED
|
@@ -7,18 +7,21 @@ let vue = require("vue");
|
|
|
7
7
|
let _heroicons_vue_20_solid = require("@heroicons/vue/20/solid");
|
|
8
8
|
//#region src/components/data-display/table/TablePagination.vue?vue&type=script&setup=true&lang.ts
|
|
9
9
|
var _hoisted_1 = ["aria-label"];
|
|
10
|
-
var _hoisted_2 = {
|
|
10
|
+
var _hoisted_2 = { class: /* @__PURE__ */ (0, vue.normalizeClass)(["flex flex-wrap items-center gap-3 px-3 py-2", "@max-[520px]:flex-nowrap @max-[520px]:gap-2 @max-[520px]:px-2"]) };
|
|
11
|
+
var _hoisted_3 = {
|
|
11
12
|
key: 0,
|
|
12
|
-
class: "flex items-center gap-2"
|
|
13
|
+
class: "flex items-center gap-2 min-w-0"
|
|
13
14
|
};
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
class: "px-1.5 text-muted-foreground tabular-nums",
|
|
15
|
+
var _hoisted_4 = { class: "text-muted-foreground whitespace-nowrap @max-[520px]:hidden" };
|
|
16
|
+
var _hoisted_5 = { class: "ml-auto flex items-center gap-3 shrink-0 @max-[520px]:gap-0" };
|
|
17
|
+
var _hoisted_6 = { class: "text-muted-foreground tabular-nums whitespace-nowrap @max-[520px]:hidden" };
|
|
18
|
+
var _hoisted_7 = { class: "flex items-center gap-1.5 @max-[520px]:gap-1" };
|
|
19
|
+
var _hoisted_8 = {
|
|
20
|
+
class: "px-1.5 text-muted-foreground tabular-nums whitespace-nowrap @max-[520px]:px-1",
|
|
20
21
|
"aria-current": "page"
|
|
21
22
|
};
|
|
23
|
+
var _hoisted_9 = { class: "@max-[520px]:hidden" };
|
|
24
|
+
var _hoisted_10 = { class: "hidden @max-[520px]:inline" };
|
|
22
25
|
var TablePagination_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
23
26
|
__name: "TablePagination",
|
|
24
27
|
props: {
|
|
@@ -95,6 +98,10 @@ var TablePagination_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ *
|
|
|
95
98
|
current: props.pagination.page,
|
|
96
99
|
total: pageCount.value
|
|
97
100
|
}));
|
|
101
|
+
const pageTextCompact = (0, vue.computed)(() => require_ModoLocale.interpolate(loc.value.table.pagination.pageCompact, {
|
|
102
|
+
current: props.pagination.page,
|
|
103
|
+
total: pageCount.value
|
|
104
|
+
}));
|
|
98
105
|
const isFirst = (0, vue.computed)(() => props.pagination.page <= 1);
|
|
99
106
|
const isLast = (0, vue.computed)(() => props.pagination.page >= pageCount.value);
|
|
100
107
|
function emitNext(partial) {
|
|
@@ -137,25 +144,26 @@ var TablePagination_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ *
|
|
|
137
144
|
return (0, vue.openBlock)(), (0, vue.createElementBlock)("nav", {
|
|
138
145
|
"aria-label": __props.ariaLabel ?? "Pagination",
|
|
139
146
|
class: (0, vue.normalizeClass)([
|
|
140
|
-
"
|
|
141
|
-
__props.embedded ? "
|
|
147
|
+
"@container w-full",
|
|
148
|
+
__props.embedded ? "bg-transparent" : "bg-card border-t border-border",
|
|
142
149
|
textSizeClass.value
|
|
143
150
|
])
|
|
144
|
-
}, [!__props.hidePageSize ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div",
|
|
151
|
+
}, [(0, vue.createElementVNode)("div", _hoisted_2, [!__props.hidePageSize ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_3, [(0, vue.createElementVNode)("span", _hoisted_4, (0, vue.toDisplayString)((0, vue.unref)(loc).table.pagination.rowsPerPage), 1), (0, vue.createVNode)(require_Select.default, {
|
|
145
152
|
"model-value": pageSize.value,
|
|
146
153
|
options: pageSizeSelectOptions.value,
|
|
147
154
|
disabled: __props.disabled,
|
|
148
155
|
size: controlSize.value,
|
|
149
156
|
radius: (0, vue.unref)(resolvedRadius),
|
|
150
|
-
"aria-label":
|
|
157
|
+
"aria-label": (0, vue.unref)(loc).table.pagination.rowsPerPage,
|
|
151
158
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = (v) => onPageSizeChange(Number(v)))
|
|
152
159
|
}, null, 8, [
|
|
153
160
|
"model-value",
|
|
154
161
|
"options",
|
|
155
162
|
"disabled",
|
|
156
163
|
"size",
|
|
157
|
-
"radius"
|
|
158
|
-
|
|
164
|
+
"radius",
|
|
165
|
+
"aria-label"
|
|
166
|
+
])])) : (0, vue.createCommentVNode)("", true), (0, vue.createElementVNode)("div", _hoisted_5, [(0, vue.createElementVNode)("span", _hoisted_6, (0, vue.toDisplayString)(rangeText.value), 1), (0, vue.createElementVNode)("div", _hoisted_7, [
|
|
159
167
|
!__props.hideEdgeButtons ? ((0, vue.openBlock)(), (0, vue.createBlock)(require_Button.default, {
|
|
160
168
|
key: 0,
|
|
161
169
|
variant: "outline",
|
|
@@ -187,7 +195,7 @@ var TablePagination_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ *
|
|
|
187
195
|
"ariaLabel",
|
|
188
196
|
"disabled"
|
|
189
197
|
]),
|
|
190
|
-
(0, vue.createElementVNode)("span",
|
|
198
|
+
(0, vue.createElementVNode)("span", _hoisted_8, [(0, vue.createElementVNode)("span", _hoisted_9, (0, vue.toDisplayString)(pageText.value), 1), (0, vue.createElementVNode)("span", _hoisted_10, (0, vue.toDisplayString)(pageTextCompact.value), 1)]),
|
|
191
199
|
(0, vue.createVNode)(require_Button.default, {
|
|
192
200
|
variant: "outline",
|
|
193
201
|
size: controlSize.value,
|
|
@@ -219,7 +227,7 @@ var TablePagination_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ *
|
|
|
219
227
|
"ariaLabel",
|
|
220
228
|
"disabled"
|
|
221
229
|
])) : (0, vue.createCommentVNode)("", true)
|
|
222
|
-
])])], 10, _hoisted_1);
|
|
230
|
+
])])])], 10, _hoisted_1);
|
|
223
231
|
};
|
|
224
232
|
}
|
|
225
233
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TablePagination.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../../../src/components/data-display/table/TablePagination.vue"],"sourcesContent":["<script setup lang=\"ts\"> \n/** \n * TablePagination · standalone footer for `<Table>`. \n * \n * Layout (LTR): \n * [ rows-per-page Select ] [ range readout ] [ « ‹ › » ] \n * \n * Designed to be embedded inside `<Table>` automatically (when the host \n * passes `pagination`) or used standalone for custom layouts. Emits a \n * single `update:pagination` event with the *full* next state so v-model \n * stays simple. \n * \n * A11y: \n * - Wrapped in `<nav role=\"navigation\">` with `aria-label`. \n * - Each button gets a localized `aria-label`; current page is announced \n * via `aria-current=\"page\"` on the page readout. \n * - First/Last buttons are hidden when `hideEdgeButtons=true`. \n */ \nimport { computed } from 'vue'; \nimport { \n ChevronLeftIcon, \n ChevronRightIcon, \n ChevronDoubleLeftIcon, \n ChevronDoubleRightIcon, \n} from '@heroicons/vue/20/solid'; \nimport type { TablePagination as TablePaginationProps } from '../../../interfaces/data-display/table/TablePagination.interface'; \nimport type { TablePaginationState } from '../../../interfaces/data-display/table/Table.interface'; \nimport { useModoLocale, useResolvedRadius, useResolvedSize } from '../../../composables/useModoConfig'; \nimport { interpolate } from '../../../config/ModoLocale'; \nimport Select from '../../forms/Select.vue'; \nimport Button from '../../forms/Button.vue'; \n \nconst props = withDefaults(defineProps<TablePaginationProps>(), { \n pageSizeOptions: () => [10, 25, 50, 100], \n hidePageSize: false, \n hideEdgeButtons: false, \n disabled: false, \n embedded: false,\n}); \n \nconst resolvedSize = useResolvedSize(() => props.size); \nconst resolvedRadius = useResolvedRadius(() => props.radius); \n \nconst emit = defineEmits<{ \n 'update:pagination': [next: TablePaginationState]; \n}>(); \n \nconst loc = useModoLocale(); \n \nconst total = computed(() => props.pagination.total ?? 0); \nconst pageSize = computed(() => Math.max(1, props.pagination.pageSize || 1)); \nconst pageCount = computed(() => Math.max(1, Math.ceil(total.value / pageSize.value))); \n \nconst range = computed<[number, number]>(() => { \n if (total.value === 0) return [0, 0]; \n const from = (props.pagination.page - 1) * pageSize.value + 1; \n const to = Math.min(props.pagination.page * pageSize.value, total.value); \n return [from, to]; \n}); \n \nconst rangeText = computed(() => { \n if (props.pagination.total == null) { \n return interpolate(loc.value.table.pagination.rangeUnknown, { \n from: range.value[0], \n to: range.value[1], \n }); \n } \n return interpolate(loc.value.table.pagination.range, { \n from: range.value[0], \n to: range.value[1], \n total: total.value, \n }); \n}); \n \nconst pageText = computed(() => \n interpolate(loc.value.table.pagination.page, { \n current: props.pagination.page, \n total: pageCount.value, \n }), \n); \n \nconst isFirst = computed(() => props.pagination.page <= 1); \nconst isLast = computed(() => props.pagination.page >= pageCount.value); \n \nfunction emitNext(partial: Partial<TablePaginationState>) { \n emit('update:pagination', { ...props.pagination, ...partial }); \n} \n \nfunction go(to: number) { \n if (props.disabled) return; \n const clamped = Math.min(Math.max(1, to), pageCount.value); \n if (clamped === props.pagination.page) return; \n emitNext({ page: clamped }); \n} \n \nfunction onPageSizeChange(next: number) { \n if (props.disabled) return; \n // Reset to page 1 so the user always sees the top of the new slice. \n emitNext({ page: 1, pageSize: Number(next) }); \n} \n \nconst pageSizeSelectOptions = computed(() => {\n const unique = Array.from(new Set([...props.pageSizeOptions, pageSize.value])).sort(\n (a, b) => a - b,\n );\n return unique.map((n) => ({ value: n, label: String(n) }));\n}); \n \n/* ---------- Sizing tokens ---------- */ \nconst textSizeClass = computed(() => { \n if (resolvedSize.value === 'small') return 'text-[11px] leading-4'; \n if (resolvedSize.value === 'large') return 'text-body'; \n return 'text-caption'; \n}); \n\n/** Map pagination size to canonical mood-ui control size (`sm` by default). */ \nconst controlSize = computed<'xsmall' | 'small' | 'medium'>(() => { \n if (resolvedSize.value === 'small') return 'xsmall'; \n if (resolvedSize.value === 'large') return 'medium'; \n return 'small'; \n}); \n</script> \n \n<template> \n <nav \n :aria-label=\"ariaLabel ?? 'Pagination'\" \n :class=\"[ \n 'flex flex-wrap items-center gap-3', \n embedded ? 'px-3 py-2 bg-transparent' : 'px-3 py-2 bg-card border-t border-border', \n textSizeClass, \n ]\" \n > \n <!-- Rows per page --> \n <div v-if=\"!hidePageSize\" class=\"flex items-center gap-2\"> \n <span class=\"text-muted-foreground\">{{ loc.table.pagination.rowsPerPage }}</span> \n <Select \n :model-value=\"pageSize\" \n :options=\"pageSizeSelectOptions\" \n :disabled=\"disabled\" \n :size=\"controlSize\" \n :radius=\"resolvedRadius\" \n aria-label=\"Rows per page\" \n @update:model-value=\"(v: any) => onPageSizeChange(Number(v))\" \n /> \n </div> \n \n <!-- Range readout (push to right) --> \n <div class=\"ml-auto flex items-center gap-3\"> \n <span class=\"text-muted-foreground tabular-nums\">{{ rangeText }}</span> \n \n <!-- Buttons --> \n <div class=\"flex items-center gap-1.5\"> \n <Button \n v-if=\"!hideEdgeButtons\" \n variant=\"outline\" \n :size=\"controlSize\" \n :radius=\"resolvedRadius\" \n :icon=\"ChevronDoubleLeftIcon\" \n :ariaLabel=\"loc.table.pagination.first\" \n :disabled=\"disabled || isFirst\" \n @click=\"go(1)\" \n /> \n <Button \n variant=\"outline\" \n :size=\"controlSize\" \n :radius=\"resolvedRadius\" \n :icon=\"ChevronLeftIcon\" \n :ariaLabel=\"loc.table.pagination.previous\" \n :disabled=\"disabled || isFirst\" \n @click=\"go(pagination.page - 1)\" \n /> \n \n <span \n class=\"px-1.5 text-muted-foreground tabular-nums\" \n aria-current=\"page\" \n >{{ pageText }}</span> \n \n <Button \n variant=\"outline\" \n :size=\"controlSize\" \n :radius=\"resolvedRadius\" \n :icon=\"ChevronRightIcon\" \n :ariaLabel=\"loc.table.pagination.next\" \n :disabled=\"disabled || isLast\" \n @click=\"go(pagination.page + 1)\" \n /> \n <Button \n v-if=\"!hideEdgeButtons\" \n variant=\"outline\" \n :size=\"controlSize\" \n :radius=\"resolvedRadius\" \n :icon=\"ChevronDoubleRightIcon\" \n :ariaLabel=\"loc.table.pagination.last\" \n :disabled=\"disabled || isLast\" \n @click=\"go(pageCount)\" \n /> \n </div> \n </div> \n </nav> \n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCA,MAAM,QAAQ;EAQd,MAAM,eAAe,sBAAA,sBAAsB,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AAA;KACtB,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,GAAG,QAAA,WAAW,OAAI,EAAA;;;;;;;;KAGnB,QAAA,oBAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,aAQT,eAAA,SAAA;;KAPE,SAAQ;KACP,MAAM,YAAA;KACN,SAAA,GAAA,IAAA,OAAQ,eAAc;KACtB,OAAA,GAAA,IAAA,OAAM,wBAAA,uBAAsB;KAC5B,YAAA,GAAA,IAAA,OAAW,IAAG,CAAC,MAAM,WAAW;KAChC,UAAU,QAAA,YAAY,OAAA;KACtB,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,GAAG,UAAA,MAAS"}
|
|
1
|
+
{"version":3,"file":"TablePagination.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../../../src/components/data-display/table/TablePagination.vue"],"sourcesContent":["<script setup lang=\"ts\"> \n/** \n * TablePagination · standalone footer for `<Table>`. \n * \n * Layout (LTR): \n * [ rows-per-page Select ] [ range readout ] [ « ‹ › » ] \n * \n * Designed to be embedded inside `<Table>` automatically (when the host \n * passes `pagination`) or used standalone for custom layouts. Emits a \n * single `update:pagination` event with the *full* next state so v-model \n * stays simple. \n * \n * A11y: \n * - Wrapped in `<nav role=\"navigation\">` with `aria-label`. \n * - Each button gets a localized `aria-label`; current page is announced \n * via `aria-current=\"page\"` on the page readout. \n * - First/Last buttons are hidden when `hideEdgeButtons=true`. \n */ \nimport { computed } from 'vue'; \nimport { \n ChevronLeftIcon, \n ChevronRightIcon, \n ChevronDoubleLeftIcon, \n ChevronDoubleRightIcon, \n} from '@heroicons/vue/20/solid'; \nimport type { TablePagination as TablePaginationProps } from '../../../interfaces/data-display/table/TablePagination.interface'; \nimport type { TablePaginationState } from '../../../interfaces/data-display/table/Table.interface'; \nimport { useModoLocale, useResolvedRadius, useResolvedSize } from '../../../composables/useModoConfig'; \nimport { interpolate } from '../../../config/ModoLocale'; \nimport Select from '../../forms/Select.vue'; \nimport Button from '../../forms/Button.vue'; \n \nconst props = withDefaults(defineProps<TablePaginationProps>(), { \n pageSizeOptions: () => [10, 25, 50, 100], \n hidePageSize: false, \n hideEdgeButtons: false, \n disabled: false, \n embedded: false,\n}); \n \nconst resolvedSize = useResolvedSize(() => props.size); \nconst resolvedRadius = useResolvedRadius(() => props.radius); \n \nconst emit = defineEmits<{ \n 'update:pagination': [next: TablePaginationState]; \n}>(); \n \nconst loc = useModoLocale(); \n \nconst total = computed(() => props.pagination.total ?? 0); \nconst pageSize = computed(() => Math.max(1, props.pagination.pageSize || 1)); \nconst pageCount = computed(() => Math.max(1, Math.ceil(total.value / pageSize.value))); \n \nconst range = computed<[number, number]>(() => { \n if (total.value === 0) return [0, 0]; \n const from = (props.pagination.page - 1) * pageSize.value + 1; \n const to = Math.min(props.pagination.page * pageSize.value, total.value); \n return [from, to]; \n}); \n \nconst rangeText = computed(() => { \n if (props.pagination.total == null) { \n return interpolate(loc.value.table.pagination.rangeUnknown, { \n from: range.value[0], \n to: range.value[1], \n }); \n } \n return interpolate(loc.value.table.pagination.range, { \n from: range.value[0], \n to: range.value[1], \n total: total.value, \n }); \n}); \n \nconst pageText = computed(() => \n interpolate(loc.value.table.pagination.page, { \n current: props.pagination.page, \n total: pageCount.value, \n }), \n); \n \n// Compact readout for narrow containers (\"1 / 3\"). Both texts are rendered and\n// CSS (a container query on the nav) picks one, so SSR and the first paint\n// already match the final layout: no JS measuring, no jump.\nconst pageTextCompact = computed(() =>\n interpolate(loc.value.table.pagination.pageCompact, {\n current: props.pagination.page,\n total: pageCount.value,\n }),\n);\n\nconst isFirst = computed(() => props.pagination.page <= 1); \nconst isLast = computed(() => props.pagination.page >= pageCount.value); \n \nfunction emitNext(partial: Partial<TablePaginationState>) { \n emit('update:pagination', { ...props.pagination, ...partial }); \n} \n \nfunction go(to: number) { \n if (props.disabled) return; \n const clamped = Math.min(Math.max(1, to), pageCount.value); \n if (clamped === props.pagination.page) return; \n emitNext({ page: clamped }); \n} \n \nfunction onPageSizeChange(next: number) { \n if (props.disabled) return; \n // Reset to page 1 so the user always sees the top of the new slice. \n emitNext({ page: 1, pageSize: Number(next) }); \n} \n \nconst pageSizeSelectOptions = computed(() => {\n const unique = Array.from(new Set([...props.pageSizeOptions, pageSize.value])).sort(\n (a, b) => a - b,\n );\n return unique.map((n) => ({ value: n, label: String(n) }));\n}); \n \n/* ---------- Sizing tokens ---------- */ \nconst textSizeClass = computed(() => { \n if (resolvedSize.value === 'small') return 'text-[11px] leading-4'; \n if (resolvedSize.value === 'large') return 'text-body'; \n return 'text-caption'; \n}); \n\n/** Map pagination size to canonical mood-ui control size (`sm` by default). */ \nconst controlSize = computed<'xsmall' | 'small' | 'medium'>(() => { \n if (resolvedSize.value === 'small') return 'xsmall'; \n if (resolvedSize.value === 'large') return 'medium'; \n return 'small'; \n}); \n</script> \n \n<template> \n <!-- The nav is the container (`@container`): below 520px of ITS OWN width the\n layout goes compact, whatever the viewport. Everything stays on one line. -->\n <nav \n :aria-label=\"ariaLabel ?? 'Pagination'\" \n :class=\"[ \n '@container w-full', \n embedded ? 'bg-transparent' : 'bg-card border-t border-border', \n textSizeClass, \n ]\" \n > \n <div \n :class=\"[ \n 'flex flex-wrap items-center gap-3 px-3 py-2', \n '@max-[520px]:flex-nowrap @max-[520px]:gap-2 @max-[520px]:px-2', \n ]\" \n > \n <!-- Rows per page -->\n <div v-if=\"!hidePageSize\" class=\"flex items-center gap-2 min-w-0\"> \n <span class=\"text-muted-foreground whitespace-nowrap @max-[520px]:hidden\">{{ loc.table.pagination.rowsPerPage }}</span> \n <Select \n :model-value=\"pageSize\" \n :options=\"pageSizeSelectOptions\" \n :disabled=\"disabled\" \n :size=\"controlSize\" \n :radius=\"resolvedRadius\" \n :aria-label=\"loc.table.pagination.rowsPerPage\" \n @update:model-value=\"(v: any) => onPageSizeChange(Number(v))\" \n /> \n </div> \n \n <!-- Range readout + buttons (pushed to the right) --> \n <div class=\"ml-auto flex items-center gap-3 shrink-0 @max-[520px]:gap-0\"> \n <span class=\"text-muted-foreground tabular-nums whitespace-nowrap @max-[520px]:hidden\">{{ rangeText }}</span> \n \n <div class=\"flex items-center gap-1.5 @max-[520px]:gap-1\"> \n <Button \n v-if=\"!hideEdgeButtons\" \n variant=\"outline\" \n :size=\"controlSize\" \n :radius=\"resolvedRadius\" \n :icon=\"ChevronDoubleLeftIcon\" \n :ariaLabel=\"loc.table.pagination.first\" \n :disabled=\"disabled || isFirst\" \n @click=\"go(1)\" \n /> \n <Button \n variant=\"outline\" \n :size=\"controlSize\" \n :radius=\"resolvedRadius\" \n :icon=\"ChevronLeftIcon\" \n :ariaLabel=\"loc.table.pagination.previous\" \n :disabled=\"disabled || isFirst\" \n @click=\"go(pagination.page - 1)\" \n /> \n \n <span \n class=\"px-1.5 text-muted-foreground tabular-nums whitespace-nowrap @max-[520px]:px-1\" \n aria-current=\"page\" \n > \n <span class=\"@max-[520px]:hidden\">{{ pageText }}</span> \n <span class=\"hidden @max-[520px]:inline\">{{ pageTextCompact }}</span> \n </span> \n \n <Button \n variant=\"outline\" \n :size=\"controlSize\" \n :radius=\"resolvedRadius\" \n :icon=\"ChevronRightIcon\" \n :ariaLabel=\"loc.table.pagination.next\" \n :disabled=\"disabled || isLast\" \n @click=\"go(pagination.page + 1)\" \n /> \n <Button \n v-if=\"!hideEdgeButtons\" \n variant=\"outline\" \n :size=\"controlSize\" \n :radius=\"resolvedRadius\" \n :icon=\"ChevronDoubleRightIcon\" \n :ariaLabel=\"loc.table.pagination.last\" \n :disabled=\"disabled || isLast\" \n @click=\"go(pageCount)\" \n /> \n </div> \n </div> \n </div> \n </nav> \n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCA,MAAM,QAAQ;EAQd,MAAM,eAAe,sBAAA,sBAAsB,MAAM,KAAK;EACtD,MAAM,iBAAiB,sBAAA,wBAAwB,MAAM,OAAO;EAE5D,MAAM,OAAO;EAI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AAA,IAAA,iBAA4C,gBAAA,MAAe,EAAA,EAAA,CAAA,CAAA;yBAW7D,eAAA,SAAA;KAPE,SAAQ;KACP,MAAM,YAAA;KACN,SAAA,GAAA,IAAA,OAAQ,eAAc;KACtB,OAAA,GAAA,IAAA,OAAM,wBAAA,iBAAgB;KACtB,YAAA,GAAA,IAAA,OAAW,IAAG,CAAC,MAAM,WAAW;KAChC,UAAU,QAAA,YAAY,OAAA;KACtB,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,GAAG,QAAA,WAAW,OAAI,EAAA;;;;;;;;KAGnB,QAAA,oBAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,aAQT,eAAA,SAAA;;KAPE,SAAQ;KACP,MAAM,YAAA;KACN,SAAA,GAAA,IAAA,OAAQ,eAAc;KACtB,OAAA,GAAA,IAAA,OAAM,wBAAA,uBAAsB;KAC5B,YAAA,GAAA,IAAA,OAAW,IAAG,CAAC,MAAM,WAAW;KAChC,UAAU,QAAA,YAAY,OAAA;KACtB,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,GAAG,UAAA,MAAS"}
|
package/dist/components/data-display/table/TablePagination.vue_vue_type_script_setup_true_lang.mjs
CHANGED
|
@@ -6,18 +6,21 @@ import { computed, createBlock, createCommentVNode, createElementBlock, createEl
|
|
|
6
6
|
import { ChevronDoubleLeftIcon, ChevronDoubleRightIcon, ChevronLeftIcon, ChevronRightIcon } from "@heroicons/vue/20/solid";
|
|
7
7
|
//#region src/components/data-display/table/TablePagination.vue?vue&type=script&setup=true&lang.ts
|
|
8
8
|
var _hoisted_1 = ["aria-label"];
|
|
9
|
-
var _hoisted_2 = {
|
|
9
|
+
var _hoisted_2 = { class: /* @__PURE__ */ normalizeClass(["flex flex-wrap items-center gap-3 px-3 py-2", "@max-[520px]:flex-nowrap @max-[520px]:gap-2 @max-[520px]:px-2"]) };
|
|
10
|
+
var _hoisted_3 = {
|
|
10
11
|
key: 0,
|
|
11
|
-
class: "flex items-center gap-2"
|
|
12
|
+
class: "flex items-center gap-2 min-w-0"
|
|
12
13
|
};
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
class: "px-1.5 text-muted-foreground tabular-nums",
|
|
14
|
+
var _hoisted_4 = { class: "text-muted-foreground whitespace-nowrap @max-[520px]:hidden" };
|
|
15
|
+
var _hoisted_5 = { class: "ml-auto flex items-center gap-3 shrink-0 @max-[520px]:gap-0" };
|
|
16
|
+
var _hoisted_6 = { class: "text-muted-foreground tabular-nums whitespace-nowrap @max-[520px]:hidden" };
|
|
17
|
+
var _hoisted_7 = { class: "flex items-center gap-1.5 @max-[520px]:gap-1" };
|
|
18
|
+
var _hoisted_8 = {
|
|
19
|
+
class: "px-1.5 text-muted-foreground tabular-nums whitespace-nowrap @max-[520px]:px-1",
|
|
19
20
|
"aria-current": "page"
|
|
20
21
|
};
|
|
22
|
+
var _hoisted_9 = { class: "@max-[520px]:hidden" };
|
|
23
|
+
var _hoisted_10 = { class: "hidden @max-[520px]:inline" };
|
|
21
24
|
var TablePagination_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
22
25
|
__name: "TablePagination",
|
|
23
26
|
props: {
|
|
@@ -94,6 +97,10 @@ var TablePagination_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ *
|
|
|
94
97
|
current: props.pagination.page,
|
|
95
98
|
total: pageCount.value
|
|
96
99
|
}));
|
|
100
|
+
const pageTextCompact = computed(() => interpolate(loc.value.table.pagination.pageCompact, {
|
|
101
|
+
current: props.pagination.page,
|
|
102
|
+
total: pageCount.value
|
|
103
|
+
}));
|
|
97
104
|
const isFirst = computed(() => props.pagination.page <= 1);
|
|
98
105
|
const isLast = computed(() => props.pagination.page >= pageCount.value);
|
|
99
106
|
function emitNext(partial) {
|
|
@@ -136,25 +143,26 @@ var TablePagination_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ *
|
|
|
136
143
|
return openBlock(), createElementBlock("nav", {
|
|
137
144
|
"aria-label": __props.ariaLabel ?? "Pagination",
|
|
138
145
|
class: normalizeClass([
|
|
139
|
-
"
|
|
140
|
-
__props.embedded ? "
|
|
146
|
+
"@container w-full",
|
|
147
|
+
__props.embedded ? "bg-transparent" : "bg-card border-t border-border",
|
|
141
148
|
textSizeClass.value
|
|
142
149
|
])
|
|
143
|
-
}, [!__props.hidePageSize ? (openBlock(), createElementBlock("div",
|
|
150
|
+
}, [createElementVNode("div", _hoisted_2, [!__props.hidePageSize ? (openBlock(), createElementBlock("div", _hoisted_3, [createElementVNode("span", _hoisted_4, toDisplayString(unref(loc).table.pagination.rowsPerPage), 1), createVNode(Select_default, {
|
|
144
151
|
"model-value": pageSize.value,
|
|
145
152
|
options: pageSizeSelectOptions.value,
|
|
146
153
|
disabled: __props.disabled,
|
|
147
154
|
size: controlSize.value,
|
|
148
155
|
radius: unref(resolvedRadius),
|
|
149
|
-
"aria-label":
|
|
156
|
+
"aria-label": unref(loc).table.pagination.rowsPerPage,
|
|
150
157
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = (v) => onPageSizeChange(Number(v)))
|
|
151
158
|
}, null, 8, [
|
|
152
159
|
"model-value",
|
|
153
160
|
"options",
|
|
154
161
|
"disabled",
|
|
155
162
|
"size",
|
|
156
|
-
"radius"
|
|
157
|
-
|
|
163
|
+
"radius",
|
|
164
|
+
"aria-label"
|
|
165
|
+
])])) : createCommentVNode("", true), createElementVNode("div", _hoisted_5, [createElementVNode("span", _hoisted_6, toDisplayString(rangeText.value), 1), createElementVNode("div", _hoisted_7, [
|
|
158
166
|
!__props.hideEdgeButtons ? (openBlock(), createBlock(Button_default, {
|
|
159
167
|
key: 0,
|
|
160
168
|
variant: "outline",
|
|
@@ -186,7 +194,7 @@ var TablePagination_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ *
|
|
|
186
194
|
"ariaLabel",
|
|
187
195
|
"disabled"
|
|
188
196
|
]),
|
|
189
|
-
createElementVNode("span",
|
|
197
|
+
createElementVNode("span", _hoisted_8, [createElementVNode("span", _hoisted_9, toDisplayString(pageText.value), 1), createElementVNode("span", _hoisted_10, toDisplayString(pageTextCompact.value), 1)]),
|
|
190
198
|
createVNode(Button_default, {
|
|
191
199
|
variant: "outline",
|
|
192
200
|
size: controlSize.value,
|
|
@@ -218,7 +226,7 @@ var TablePagination_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ *
|
|
|
218
226
|
"ariaLabel",
|
|
219
227
|
"disabled"
|
|
220
228
|
])) : createCommentVNode("", true)
|
|
221
|
-
])])], 10, _hoisted_1);
|
|
229
|
+
])])])], 10, _hoisted_1);
|
|
222
230
|
};
|
|
223
231
|
}
|
|
224
232
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TablePagination.vue_vue_type_script_setup_true_lang.mjs","names":[],"sources":["../../../../src/components/data-display/table/TablePagination.vue"],"sourcesContent":["<script setup lang=\"ts\"> \n/** \n * TablePagination · standalone footer for `<Table>`. \n * \n * Layout (LTR): \n * [ rows-per-page Select ] [ range readout ] [ « ‹ › » ] \n * \n * Designed to be embedded inside `<Table>` automatically (when the host \n * passes `pagination`) or used standalone for custom layouts. Emits a \n * single `update:pagination` event with the *full* next state so v-model \n * stays simple. \n * \n * A11y: \n * - Wrapped in `<nav role=\"navigation\">` with `aria-label`. \n * - Each button gets a localized `aria-label`; current page is announced \n * via `aria-current=\"page\"` on the page readout. \n * - First/Last buttons are hidden when `hideEdgeButtons=true`. \n */ \nimport { computed } from 'vue'; \nimport { \n ChevronLeftIcon, \n ChevronRightIcon, \n ChevronDoubleLeftIcon, \n ChevronDoubleRightIcon, \n} from '@heroicons/vue/20/solid'; \nimport type { TablePagination as TablePaginationProps } from '../../../interfaces/data-display/table/TablePagination.interface'; \nimport type { TablePaginationState } from '../../../interfaces/data-display/table/Table.interface'; \nimport { useModoLocale, useResolvedRadius, useResolvedSize } from '../../../composables/useModoConfig'; \nimport { interpolate } from '../../../config/ModoLocale'; \nimport Select from '../../forms/Select.vue'; \nimport Button from '../../forms/Button.vue'; \n \nconst props = withDefaults(defineProps<TablePaginationProps>(), { \n pageSizeOptions: () => [10, 25, 50, 100], \n hidePageSize: false, \n hideEdgeButtons: false, \n disabled: false, \n embedded: false,\n}); \n \nconst resolvedSize = useResolvedSize(() => props.size); \nconst resolvedRadius = useResolvedRadius(() => props.radius); \n \nconst emit = defineEmits<{ \n 'update:pagination': [next: TablePaginationState]; \n}>(); \n \nconst loc = useModoLocale(); \n \nconst total = computed(() => props.pagination.total ?? 0); \nconst pageSize = computed(() => Math.max(1, props.pagination.pageSize || 1)); \nconst pageCount = computed(() => Math.max(1, Math.ceil(total.value / pageSize.value))); \n \nconst range = computed<[number, number]>(() => { \n if (total.value === 0) return [0, 0]; \n const from = (props.pagination.page - 1) * pageSize.value + 1; \n const to = Math.min(props.pagination.page * pageSize.value, total.value); \n return [from, to]; \n}); \n \nconst rangeText = computed(() => { \n if (props.pagination.total == null) { \n return interpolate(loc.value.table.pagination.rangeUnknown, { \n from: range.value[0], \n to: range.value[1], \n }); \n } \n return interpolate(loc.value.table.pagination.range, { \n from: range.value[0], \n to: range.value[1], \n total: total.value, \n }); \n}); \n \nconst pageText = computed(() => \n interpolate(loc.value.table.pagination.page, { \n current: props.pagination.page, \n total: pageCount.value, \n }), \n); \n \nconst isFirst = computed(() => props.pagination.page <= 1); \nconst isLast = computed(() => props.pagination.page >= pageCount.value); \n \nfunction emitNext(partial: Partial<TablePaginationState>) { \n emit('update:pagination', { ...props.pagination, ...partial }); \n} \n \nfunction go(to: number) { \n if (props.disabled) return; \n const clamped = Math.min(Math.max(1, to), pageCount.value); \n if (clamped === props.pagination.page) return; \n emitNext({ page: clamped }); \n} \n \nfunction onPageSizeChange(next: number) { \n if (props.disabled) return; \n // Reset to page 1 so the user always sees the top of the new slice. \n emitNext({ page: 1, pageSize: Number(next) }); \n} \n \nconst pageSizeSelectOptions = computed(() => {\n const unique = Array.from(new Set([...props.pageSizeOptions, pageSize.value])).sort(\n (a, b) => a - b,\n );\n return unique.map((n) => ({ value: n, label: String(n) }));\n}); \n \n/* ---------- Sizing tokens ---------- */ \nconst textSizeClass = computed(() => { \n if (resolvedSize.value === 'small') return 'text-[11px] leading-4'; \n if (resolvedSize.value === 'large') return 'text-body'; \n return 'text-caption'; \n}); \n\n/** Map pagination size to canonical mood-ui control size (`sm` by default). */ \nconst controlSize = computed<'xsmall' | 'small' | 'medium'>(() => { \n if (resolvedSize.value === 'small') return 'xsmall'; \n if (resolvedSize.value === 'large') return 'medium'; \n return 'small'; \n}); \n</script> \n \n<template> \n <nav \n :aria-label=\"ariaLabel ?? 'Pagination'\" \n :class=\"[ \n 'flex flex-wrap items-center gap-3', \n embedded ? 'px-3 py-2 bg-transparent' : 'px-3 py-2 bg-card border-t border-border', \n textSizeClass, \n ]\" \n > \n <!-- Rows per page --> \n <div v-if=\"!hidePageSize\" class=\"flex items-center gap-2\"> \n <span class=\"text-muted-foreground\">{{ loc.table.pagination.rowsPerPage }}</span> \n <Select \n :model-value=\"pageSize\" \n :options=\"pageSizeSelectOptions\" \n :disabled=\"disabled\" \n :size=\"controlSize\" \n :radius=\"resolvedRadius\" \n aria-label=\"Rows per page\" \n @update:model-value=\"(v: any) => onPageSizeChange(Number(v))\" \n /> \n </div> \n \n <!-- Range readout (push to right) --> \n <div class=\"ml-auto flex items-center gap-3\"> \n <span class=\"text-muted-foreground tabular-nums\">{{ rangeText }}</span> \n \n <!-- Buttons --> \n <div class=\"flex items-center gap-1.5\"> \n <Button \n v-if=\"!hideEdgeButtons\" \n variant=\"outline\" \n :size=\"controlSize\" \n :radius=\"resolvedRadius\" \n :icon=\"ChevronDoubleLeftIcon\" \n :ariaLabel=\"loc.table.pagination.first\" \n :disabled=\"disabled || isFirst\" \n @click=\"go(1)\" \n /> \n <Button \n variant=\"outline\" \n :size=\"controlSize\" \n :radius=\"resolvedRadius\" \n :icon=\"ChevronLeftIcon\" \n :ariaLabel=\"loc.table.pagination.previous\" \n :disabled=\"disabled || isFirst\" \n @click=\"go(pagination.page - 1)\" \n /> \n \n <span \n class=\"px-1.5 text-muted-foreground tabular-nums\" \n aria-current=\"page\" \n >{{ pageText }}</span> \n \n <Button \n variant=\"outline\" \n :size=\"controlSize\" \n :radius=\"resolvedRadius\" \n :icon=\"ChevronRightIcon\" \n :ariaLabel=\"loc.table.pagination.next\" \n :disabled=\"disabled || isLast\" \n @click=\"go(pagination.page + 1)\" \n /> \n <Button \n v-if=\"!hideEdgeButtons\" \n variant=\"outline\" \n :size=\"controlSize\" \n :radius=\"resolvedRadius\" \n :icon=\"ChevronDoubleRightIcon\" \n :ariaLabel=\"loc.table.pagination.last\" \n :disabled=\"disabled || isLast\" \n @click=\"go(pageCount)\" \n /> \n </div> \n </div> \n </nav> \n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCA,MAAM,QAAQ;EAQd,MAAM,eAAe,sBAAsB,MAAM,KAAK;EACtD,MAAM,iBAAiB,wBAAwB,MAAM,OAAO;EAE5D,MAAM,OAAO;EAIb,MAAM,MAAM,eAAe;EAE3B,MAAM,QAAQ,eAAe,MAAM,WAAW,SAAS,EAAE;EACzD,MAAM,WAAW,eAAe,KAAK,IAAI,GAAG,MAAM,WAAW,YAAY,EAAE,CAAC;EAC5E,MAAM,YAAY,eAAe,KAAK,IAAI,GAAG,KAAK,KAAK,MAAM,QAAQ,SAAS,MAAM,CAAC,CAAC;EAEtF,MAAM,QAAQ,eAAiC;GAC3C,IAAI,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE;GAGpC,OAAO,EAFO,MAAM,WAAW,OAAO,KAAK,SAAS,QAAQ,GACjD,KAAK,IAAI,MAAM,WAAW,OAAO,SAAS,OAAO,MAAM,MACpD,CAAG;IACnB;EAEF,MAAM,YAAY,eAAe;GAC7B,IAAI,MAAM,WAAW,SAAS,MAC1B,OAAO,YAAY,IAAI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QE,gBAAA;KAPE,SAAQ;KACP,MAAM,YAAA;KACN,QAAQ,MAAA,eAAc;KACtB,MAAM,MAAA,iBAAgB;KACtB,WAAW,MAAA,IAAG,CAAC,MAAM,WAAW;KAChC,UAAU,QAAA,YAAY,OAAA;KACtB,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,GAAG,QAAA,WAAW,OAAI,EAAA;;;;;;;;KAGnB,QAAA,mBAAA,WAAA,EADX,YASE,gBAAA;;KAPE,SAAQ;KACP,MAAM,YAAA;KACN,QAAQ,MAAA,eAAc;KACtB,MAAM,MAAA,uBAAsB;KAC5B,WAAW,MAAA,IAAG,CAAC,MAAM,WAAW;KAChC,UAAU,QAAA,YAAY,OAAA;KACtB,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,GAAG,UAAA,MAAS"}
|
|
1
|
+
{"version":3,"file":"TablePagination.vue_vue_type_script_setup_true_lang.mjs","names":[],"sources":["../../../../src/components/data-display/table/TablePagination.vue"],"sourcesContent":["<script setup lang=\"ts\"> \n/** \n * TablePagination · standalone footer for `<Table>`. \n * \n * Layout (LTR): \n * [ rows-per-page Select ] [ range readout ] [ « ‹ › » ] \n * \n * Designed to be embedded inside `<Table>` automatically (when the host \n * passes `pagination`) or used standalone for custom layouts. Emits a \n * single `update:pagination` event with the *full* next state so v-model \n * stays simple. \n * \n * A11y: \n * - Wrapped in `<nav role=\"navigation\">` with `aria-label`. \n * - Each button gets a localized `aria-label`; current page is announced \n * via `aria-current=\"page\"` on the page readout. \n * - First/Last buttons are hidden when `hideEdgeButtons=true`. \n */ \nimport { computed } from 'vue'; \nimport { \n ChevronLeftIcon, \n ChevronRightIcon, \n ChevronDoubleLeftIcon, \n ChevronDoubleRightIcon, \n} from '@heroicons/vue/20/solid'; \nimport type { TablePagination as TablePaginationProps } from '../../../interfaces/data-display/table/TablePagination.interface'; \nimport type { TablePaginationState } from '../../../interfaces/data-display/table/Table.interface'; \nimport { useModoLocale, useResolvedRadius, useResolvedSize } from '../../../composables/useModoConfig'; \nimport { interpolate } from '../../../config/ModoLocale'; \nimport Select from '../../forms/Select.vue'; \nimport Button from '../../forms/Button.vue'; \n \nconst props = withDefaults(defineProps<TablePaginationProps>(), { \n pageSizeOptions: () => [10, 25, 50, 100], \n hidePageSize: false, \n hideEdgeButtons: false, \n disabled: false, \n embedded: false,\n}); \n \nconst resolvedSize = useResolvedSize(() => props.size); \nconst resolvedRadius = useResolvedRadius(() => props.radius); \n \nconst emit = defineEmits<{ \n 'update:pagination': [next: TablePaginationState]; \n}>(); \n \nconst loc = useModoLocale(); \n \nconst total = computed(() => props.pagination.total ?? 0); \nconst pageSize = computed(() => Math.max(1, props.pagination.pageSize || 1)); \nconst pageCount = computed(() => Math.max(1, Math.ceil(total.value / pageSize.value))); \n \nconst range = computed<[number, number]>(() => { \n if (total.value === 0) return [0, 0]; \n const from = (props.pagination.page - 1) * pageSize.value + 1; \n const to = Math.min(props.pagination.page * pageSize.value, total.value); \n return [from, to]; \n}); \n \nconst rangeText = computed(() => { \n if (props.pagination.total == null) { \n return interpolate(loc.value.table.pagination.rangeUnknown, { \n from: range.value[0], \n to: range.value[1], \n }); \n } \n return interpolate(loc.value.table.pagination.range, { \n from: range.value[0], \n to: range.value[1], \n total: total.value, \n }); \n}); \n \nconst pageText = computed(() => \n interpolate(loc.value.table.pagination.page, { \n current: props.pagination.page, \n total: pageCount.value, \n }), \n); \n \n// Compact readout for narrow containers (\"1 / 3\"). Both texts are rendered and\n// CSS (a container query on the nav) picks one, so SSR and the first paint\n// already match the final layout: no JS measuring, no jump.\nconst pageTextCompact = computed(() =>\n interpolate(loc.value.table.pagination.pageCompact, {\n current: props.pagination.page,\n total: pageCount.value,\n }),\n);\n\nconst isFirst = computed(() => props.pagination.page <= 1); \nconst isLast = computed(() => props.pagination.page >= pageCount.value); \n \nfunction emitNext(partial: Partial<TablePaginationState>) { \n emit('update:pagination', { ...props.pagination, ...partial }); \n} \n \nfunction go(to: number) { \n if (props.disabled) return; \n const clamped = Math.min(Math.max(1, to), pageCount.value); \n if (clamped === props.pagination.page) return; \n emitNext({ page: clamped }); \n} \n \nfunction onPageSizeChange(next: number) { \n if (props.disabled) return; \n // Reset to page 1 so the user always sees the top of the new slice. \n emitNext({ page: 1, pageSize: Number(next) }); \n} \n \nconst pageSizeSelectOptions = computed(() => {\n const unique = Array.from(new Set([...props.pageSizeOptions, pageSize.value])).sort(\n (a, b) => a - b,\n );\n return unique.map((n) => ({ value: n, label: String(n) }));\n}); \n \n/* ---------- Sizing tokens ---------- */ \nconst textSizeClass = computed(() => { \n if (resolvedSize.value === 'small') return 'text-[11px] leading-4'; \n if (resolvedSize.value === 'large') return 'text-body'; \n return 'text-caption'; \n}); \n\n/** Map pagination size to canonical mood-ui control size (`sm` by default). */ \nconst controlSize = computed<'xsmall' | 'small' | 'medium'>(() => { \n if (resolvedSize.value === 'small') return 'xsmall'; \n if (resolvedSize.value === 'large') return 'medium'; \n return 'small'; \n}); \n</script> \n \n<template> \n <!-- The nav is the container (`@container`): below 520px of ITS OWN width the\n layout goes compact, whatever the viewport. Everything stays on one line. -->\n <nav \n :aria-label=\"ariaLabel ?? 'Pagination'\" \n :class=\"[ \n '@container w-full', \n embedded ? 'bg-transparent' : 'bg-card border-t border-border', \n textSizeClass, \n ]\" \n > \n <div \n :class=\"[ \n 'flex flex-wrap items-center gap-3 px-3 py-2', \n '@max-[520px]:flex-nowrap @max-[520px]:gap-2 @max-[520px]:px-2', \n ]\" \n > \n <!-- Rows per page -->\n <div v-if=\"!hidePageSize\" class=\"flex items-center gap-2 min-w-0\"> \n <span class=\"text-muted-foreground whitespace-nowrap @max-[520px]:hidden\">{{ loc.table.pagination.rowsPerPage }}</span> \n <Select \n :model-value=\"pageSize\" \n :options=\"pageSizeSelectOptions\" \n :disabled=\"disabled\" \n :size=\"controlSize\" \n :radius=\"resolvedRadius\" \n :aria-label=\"loc.table.pagination.rowsPerPage\" \n @update:model-value=\"(v: any) => onPageSizeChange(Number(v))\" \n /> \n </div> \n \n <!-- Range readout + buttons (pushed to the right) --> \n <div class=\"ml-auto flex items-center gap-3 shrink-0 @max-[520px]:gap-0\"> \n <span class=\"text-muted-foreground tabular-nums whitespace-nowrap @max-[520px]:hidden\">{{ rangeText }}</span> \n \n <div class=\"flex items-center gap-1.5 @max-[520px]:gap-1\"> \n <Button \n v-if=\"!hideEdgeButtons\" \n variant=\"outline\" \n :size=\"controlSize\" \n :radius=\"resolvedRadius\" \n :icon=\"ChevronDoubleLeftIcon\" \n :ariaLabel=\"loc.table.pagination.first\" \n :disabled=\"disabled || isFirst\" \n @click=\"go(1)\" \n /> \n <Button \n variant=\"outline\" \n :size=\"controlSize\" \n :radius=\"resolvedRadius\" \n :icon=\"ChevronLeftIcon\" \n :ariaLabel=\"loc.table.pagination.previous\" \n :disabled=\"disabled || isFirst\" \n @click=\"go(pagination.page - 1)\" \n /> \n \n <span \n class=\"px-1.5 text-muted-foreground tabular-nums whitespace-nowrap @max-[520px]:px-1\" \n aria-current=\"page\" \n > \n <span class=\"@max-[520px]:hidden\">{{ pageText }}</span> \n <span class=\"hidden @max-[520px]:inline\">{{ pageTextCompact }}</span> \n </span> \n \n <Button \n variant=\"outline\" \n :size=\"controlSize\" \n :radius=\"resolvedRadius\" \n :icon=\"ChevronRightIcon\" \n :ariaLabel=\"loc.table.pagination.next\" \n :disabled=\"disabled || isLast\" \n @click=\"go(pagination.page + 1)\" \n /> \n <Button \n v-if=\"!hideEdgeButtons\" \n variant=\"outline\" \n :size=\"controlSize\" \n :radius=\"resolvedRadius\" \n :icon=\"ChevronDoubleRightIcon\" \n :ariaLabel=\"loc.table.pagination.last\" \n :disabled=\"disabled || isLast\" \n @click=\"go(pageCount)\" \n /> \n </div> \n </div> \n </div> \n </nav> \n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCA,MAAM,QAAQ;EAQd,MAAM,eAAe,sBAAsB,MAAM,K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B,MAAM,MAAA,uBAAsB;KAC5B,WAAW,MAAA,IAAG,CAAC,MAAM,WAAW;KAChC,UAAU,QAAA,YAAY,OAAA;KACtB,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,GAAG,UAAA,MAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmptyState.cjs","names":[],"sources":["../../../src/components/feedback/EmptyState.vue"],"sourcesContent":["<template> \n <div :class=\"['modo-empty-state flex flex-col', alignClasses, paddingClasses, surfaceClasses, radiusClasses]\" role=\"status\"> \n <div v-if=\"resolvedIcon\" :class=\"['modo-empty-state-icon mb-3', iconWrapClasses]\"> \n <component :is=\"resolvedIcon\" :class=\"iconSizeClass\" aria-hidden=\"true\" /> \n </div> \n \n <Typography \n v-if=\"title\" \n :variant=\"titleVariant\" \n :size=\"titleSize\" \n as=\"h3\" \n weight=\"semibold\" \n :class=\"centered ? 'text-center' : ''\" \n > \n {{ title }} \n </Typography> \n \n <Typography \n v-if=\"description\" \n variant=\"body\" \n :size=\"descriptionSize\" \n color=\"muted\" \n as=\"p\" \n :class=\"['mt-1 max-w-prose', centered ? 'text-center' : '']\" \n > \n {{ description }} \n </Typography> \n \n <div v-if=\"$slots.actions\" :class=\"['modo-empty-state-actions mt-5 flex flex-wrap gap-2', centered ? 'justify-center' : '']\"> \n <slot name=\"actions\" /> \n </div> \n \n <div v-if=\"$slots.default\" :class=\"['modo-empty-state-content mt-4', centered ? 'text-center' : '']\"> \n <slot /> \n </div> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed } from 'vue'; \nimport { InboxIcon } from '@heroicons/vue/24/outline'; \nimport Typography from '../data-display/Typography.vue'; \nimport type { EmptyState } from '../../interfaces/feedback/EmptyState.interface'; \nimport { useResolvedRadius, useResolvedSize } from '../../composables/useModoConfig'; \nimport type { ModoRadius } from '../../config/ModoConfig'; \n \nconst props = withDefaults(defineProps<EmptyState>(), { \n variant: 'subtle', \n centered: true, \n}); \n \nconst resolvedSize = useResolvedSize(() => props.size); \n \nconst resolvedRadius = useResolvedRadius(() => props.radius as ModoRadius | undefined); \n \n/* ------------------------------------------------------------------ */ \n/* Icon (default falls back to Inbox) */ \n/* ------------------------------------------------------------------ */ \n \nconst resolvedIcon = computed(() => props.icon ?? InboxIcon); \n \nconst iconSizeClass = computed(() => { \n switch (resolvedSize.value) { \n case 'small': return 'w-6 h-6'; \n case 'large': return 'w-12 h-12'; \n case 'medium': \n default: return 'w-9 h-9'; \n } \n}); \n \nconst iconWrapClasses = computed(() => { \n const base = 'inline-flex items-center justify-center text-muted-foreground'; \n if (resolvedSize.value === 'small') return [base, 'p-2 rounded-md bg-muted/60']; \n if (resolvedSize.value === 'large') return [base, 'p-4 rounded-xl bg-muted/60']; \n return [base, 'p-3 rounded-lg bg-muted/60']; \n}); \n \n/* ------------------------------------------------------------------ */ \n/* Typography sizing */ \n/* ------------------------------------------------------------------ */ \n \nconst titleVariant = computed(() => (resolvedSize.value === 'small' ? 'body' : 'title')); \nconst titleSize = computed(() => { \n if (resolvedSize.value === 'small') return 'medium'; \n if (resolvedSize.value === 'large') return 'medium'; \n return 'small'; \n}); \nconst descriptionSize = computed(() => (resolvedSize.value === 'small' ? 'small' : 'medium')); \n \n/* ------------------------------------------------------------------ */ \n/* Layout & surface */ \n/* ------------------------------------------------------------------ */ \n \nconst alignClasses = computed(() => (props.centered ? 'items-center' : 'items-start')); \n \nconst paddingClasses = computed(() => { \n switch (resolvedSize.value) { \n case 'small': return 'px-4 py-6'; \n case 'large': return 'px-8 py-16'; \n case 'medium': \n default: return 'px-6 py-10'; \n } \n}); \n \nconst surfaceClasses = computed(() => { \n switch (props.variant) { \n case 'solid': return 'bg-card border border-border'; \n case 'outline': return 'bg-transparent border border-dashed border-border'; \n case 'subtle': \n default: return ''; \n } \n}); \n \nconst radiusClasses = computed(() => { \n if (props.variant === 'subtle') return ''; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-xl'; \n case 'full': return 'rounded-
|
|
1
|
+
{"version":3,"file":"EmptyState.cjs","names":[],"sources":["../../../src/components/feedback/EmptyState.vue"],"sourcesContent":["<template> \n <div :class=\"['modo-empty-state flex flex-col', alignClasses, paddingClasses, surfaceClasses, radiusClasses]\" role=\"status\"> \n <div v-if=\"resolvedIcon\" :class=\"['modo-empty-state-icon mb-3', iconWrapClasses]\"> \n <component :is=\"resolvedIcon\" :class=\"iconSizeClass\" aria-hidden=\"true\" /> \n </div> \n \n <Typography \n v-if=\"title\" \n :variant=\"titleVariant\" \n :size=\"titleSize\" \n as=\"h3\" \n weight=\"semibold\" \n :class=\"centered ? 'text-center' : ''\" \n > \n {{ title }} \n </Typography> \n \n <Typography \n v-if=\"description\" \n variant=\"body\" \n :size=\"descriptionSize\" \n color=\"muted\" \n as=\"p\" \n :class=\"['mt-1 max-w-prose', centered ? 'text-center' : '']\" \n > \n {{ description }} \n </Typography> \n \n <div v-if=\"$slots.actions\" :class=\"['modo-empty-state-actions mt-5 flex flex-wrap gap-2', centered ? 'justify-center' : '']\"> \n <slot name=\"actions\" /> \n </div> \n \n <div v-if=\"$slots.default\" :class=\"['modo-empty-state-content mt-4', centered ? 'text-center' : '']\"> \n <slot /> \n </div> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed } from 'vue'; \nimport { InboxIcon } from '@heroicons/vue/24/outline'; \nimport Typography from '../data-display/Typography.vue'; \nimport type { EmptyState } from '../../interfaces/feedback/EmptyState.interface'; \nimport { useResolvedRadius, useResolvedSize } from '../../composables/useModoConfig'; \nimport type { ModoRadius } from '../../config/ModoConfig'; \n \nconst props = withDefaults(defineProps<EmptyState>(), { \n variant: 'subtle', \n centered: true, \n}); \n \nconst resolvedSize = useResolvedSize(() => props.size); \n \nconst resolvedRadius = useResolvedRadius(() => props.radius as ModoRadius | undefined); \n \n/* ------------------------------------------------------------------ */ \n/* Icon (default falls back to Inbox) */ \n/* ------------------------------------------------------------------ */ \n \nconst resolvedIcon = computed(() => props.icon ?? InboxIcon); \n \nconst iconSizeClass = computed(() => { \n switch (resolvedSize.value) { \n case 'small': return 'w-6 h-6'; \n case 'large': return 'w-12 h-12'; \n case 'medium': \n default: return 'w-9 h-9'; \n } \n}); \n \nconst iconWrapClasses = computed(() => { \n const base = 'inline-flex items-center justify-center text-muted-foreground'; \n if (resolvedSize.value === 'small') return [base, 'p-2 rounded-md bg-muted/60']; \n if (resolvedSize.value === 'large') return [base, 'p-4 rounded-xl bg-muted/60']; \n return [base, 'p-3 rounded-lg bg-muted/60']; \n}); \n \n/* ------------------------------------------------------------------ */ \n/* Typography sizing */ \n/* ------------------------------------------------------------------ */ \n \nconst titleVariant = computed(() => (resolvedSize.value === 'small' ? 'body' : 'title')); \nconst titleSize = computed(() => { \n if (resolvedSize.value === 'small') return 'medium'; \n if (resolvedSize.value === 'large') return 'medium'; \n return 'small'; \n}); \nconst descriptionSize = computed(() => (resolvedSize.value === 'small' ? 'small' : 'medium')); \n \n/* ------------------------------------------------------------------ */ \n/* Layout & surface */ \n/* ------------------------------------------------------------------ */ \n \nconst alignClasses = computed(() => (props.centered ? 'items-center' : 'items-start')); \n \nconst paddingClasses = computed(() => { \n switch (resolvedSize.value) { \n case 'small': return 'px-4 py-6'; \n case 'large': return 'px-8 py-16'; \n case 'medium': \n default: return 'px-6 py-10'; \n } \n}); \n \nconst surfaceClasses = computed(() => { \n switch (props.variant) { \n case 'solid': return 'bg-card border border-border'; \n case 'outline': return 'bg-transparent border border-dashed border-border'; \n case 'subtle': \n default: return ''; \n } \n}); \n \nconst radiusClasses = computed(() => { \n if (props.variant === 'subtle') return ''; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-xl'; \n // A large surface never goes past a card-like radius (Card's own `full`).\n case 'full': return 'rounded-3xl'; \n case 'medium': \n default: return 'rounded-md'; \n } \n}); \n</script>\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmptyState.mjs","names":[],"sources":["../../../src/components/feedback/EmptyState.vue"],"sourcesContent":["<template> \n <div :class=\"['modo-empty-state flex flex-col', alignClasses, paddingClasses, surfaceClasses, radiusClasses]\" role=\"status\"> \n <div v-if=\"resolvedIcon\" :class=\"['modo-empty-state-icon mb-3', iconWrapClasses]\"> \n <component :is=\"resolvedIcon\" :class=\"iconSizeClass\" aria-hidden=\"true\" /> \n </div> \n \n <Typography \n v-if=\"title\" \n :variant=\"titleVariant\" \n :size=\"titleSize\" \n as=\"h3\" \n weight=\"semibold\" \n :class=\"centered ? 'text-center' : ''\" \n > \n {{ title }} \n </Typography> \n \n <Typography \n v-if=\"description\" \n variant=\"body\" \n :size=\"descriptionSize\" \n color=\"muted\" \n as=\"p\" \n :class=\"['mt-1 max-w-prose', centered ? 'text-center' : '']\" \n > \n {{ description }} \n </Typography> \n \n <div v-if=\"$slots.actions\" :class=\"['modo-empty-state-actions mt-5 flex flex-wrap gap-2', centered ? 'justify-center' : '']\"> \n <slot name=\"actions\" /> \n </div> \n \n <div v-if=\"$slots.default\" :class=\"['modo-empty-state-content mt-4', centered ? 'text-center' : '']\"> \n <slot /> \n </div> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed } from 'vue'; \nimport { InboxIcon } from '@heroicons/vue/24/outline'; \nimport Typography from '../data-display/Typography.vue'; \nimport type { EmptyState } from '../../interfaces/feedback/EmptyState.interface'; \nimport { useResolvedRadius, useResolvedSize } from '../../composables/useModoConfig'; \nimport type { ModoRadius } from '../../config/ModoConfig'; \n \nconst props = withDefaults(defineProps<EmptyState>(), { \n variant: 'subtle', \n centered: true, \n}); \n \nconst resolvedSize = useResolvedSize(() => props.size); \n \nconst resolvedRadius = useResolvedRadius(() => props.radius as ModoRadius | undefined); \n \n/* ------------------------------------------------------------------ */ \n/* Icon (default falls back to Inbox) */ \n/* ------------------------------------------------------------------ */ \n \nconst resolvedIcon = computed(() => props.icon ?? InboxIcon); \n \nconst iconSizeClass = computed(() => { \n switch (resolvedSize.value) { \n case 'small': return 'w-6 h-6'; \n case 'large': return 'w-12 h-12'; \n case 'medium': \n default: return 'w-9 h-9'; \n } \n}); \n \nconst iconWrapClasses = computed(() => { \n const base = 'inline-flex items-center justify-center text-muted-foreground'; \n if (resolvedSize.value === 'small') return [base, 'p-2 rounded-md bg-muted/60']; \n if (resolvedSize.value === 'large') return [base, 'p-4 rounded-xl bg-muted/60']; \n return [base, 'p-3 rounded-lg bg-muted/60']; \n}); \n \n/* ------------------------------------------------------------------ */ \n/* Typography sizing */ \n/* ------------------------------------------------------------------ */ \n \nconst titleVariant = computed(() => (resolvedSize.value === 'small' ? 'body' : 'title')); \nconst titleSize = computed(() => { \n if (resolvedSize.value === 'small') return 'medium'; \n if (resolvedSize.value === 'large') return 'medium'; \n return 'small'; \n}); \nconst descriptionSize = computed(() => (resolvedSize.value === 'small' ? 'small' : 'medium')); \n \n/* ------------------------------------------------------------------ */ \n/* Layout & surface */ \n/* ------------------------------------------------------------------ */ \n \nconst alignClasses = computed(() => (props.centered ? 'items-center' : 'items-start')); \n \nconst paddingClasses = computed(() => { \n switch (resolvedSize.value) { \n case 'small': return 'px-4 py-6'; \n case 'large': return 'px-8 py-16'; \n case 'medium': \n default: return 'px-6 py-10'; \n } \n}); \n \nconst surfaceClasses = computed(() => { \n switch (props.variant) { \n case 'solid': return 'bg-card border border-border'; \n case 'outline': return 'bg-transparent border border-dashed border-border'; \n case 'subtle': \n default: return ''; \n } \n}); \n \nconst radiusClasses = computed(() => { \n if (props.variant === 'subtle') return ''; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-xl'; \n case 'full': return 'rounded-
|
|
1
|
+
{"version":3,"file":"EmptyState.mjs","names":[],"sources":["../../../src/components/feedback/EmptyState.vue"],"sourcesContent":["<template> \n <div :class=\"['modo-empty-state flex flex-col', alignClasses, paddingClasses, surfaceClasses, radiusClasses]\" role=\"status\"> \n <div v-if=\"resolvedIcon\" :class=\"['modo-empty-state-icon mb-3', iconWrapClasses]\"> \n <component :is=\"resolvedIcon\" :class=\"iconSizeClass\" aria-hidden=\"true\" /> \n </div> \n \n <Typography \n v-if=\"title\" \n :variant=\"titleVariant\" \n :size=\"titleSize\" \n as=\"h3\" \n weight=\"semibold\" \n :class=\"centered ? 'text-center' : ''\" \n > \n {{ title }} \n </Typography> \n \n <Typography \n v-if=\"description\" \n variant=\"body\" \n :size=\"descriptionSize\" \n color=\"muted\" \n as=\"p\" \n :class=\"['mt-1 max-w-prose', centered ? 'text-center' : '']\" \n > \n {{ description }} \n </Typography> \n \n <div v-if=\"$slots.actions\" :class=\"['modo-empty-state-actions mt-5 flex flex-wrap gap-2', centered ? 'justify-center' : '']\"> \n <slot name=\"actions\" /> \n </div> \n \n <div v-if=\"$slots.default\" :class=\"['modo-empty-state-content mt-4', centered ? 'text-center' : '']\"> \n <slot /> \n </div> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed } from 'vue'; \nimport { InboxIcon } from '@heroicons/vue/24/outline'; \nimport Typography from '../data-display/Typography.vue'; \nimport type { EmptyState } from '../../interfaces/feedback/EmptyState.interface'; \nimport { useResolvedRadius, useResolvedSize } from '../../composables/useModoConfig'; \nimport type { ModoRadius } from '../../config/ModoConfig'; \n \nconst props = withDefaults(defineProps<EmptyState>(), { \n variant: 'subtle', \n centered: true, \n}); \n \nconst resolvedSize = useResolvedSize(() => props.size); \n \nconst resolvedRadius = useResolvedRadius(() => props.radius as ModoRadius | undefined); \n \n/* ------------------------------------------------------------------ */ \n/* Icon (default falls back to Inbox) */ \n/* ------------------------------------------------------------------ */ \n \nconst resolvedIcon = computed(() => props.icon ?? InboxIcon); \n \nconst iconSizeClass = computed(() => { \n switch (resolvedSize.value) { \n case 'small': return 'w-6 h-6'; \n case 'large': return 'w-12 h-12'; \n case 'medium': \n default: return 'w-9 h-9'; \n } \n}); \n \nconst iconWrapClasses = computed(() => { \n const base = 'inline-flex items-center justify-center text-muted-foreground'; \n if (resolvedSize.value === 'small') return [base, 'p-2 rounded-md bg-muted/60']; \n if (resolvedSize.value === 'large') return [base, 'p-4 rounded-xl bg-muted/60']; \n return [base, 'p-3 rounded-lg bg-muted/60']; \n}); \n \n/* ------------------------------------------------------------------ */ \n/* Typography sizing */ \n/* ------------------------------------------------------------------ */ \n \nconst titleVariant = computed(() => (resolvedSize.value === 'small' ? 'body' : 'title')); \nconst titleSize = computed(() => { \n if (resolvedSize.value === 'small') return 'medium'; \n if (resolvedSize.value === 'large') return 'medium'; \n return 'small'; \n}); \nconst descriptionSize = computed(() => (resolvedSize.value === 'small' ? 'small' : 'medium')); \n \n/* ------------------------------------------------------------------ */ \n/* Layout & surface */ \n/* ------------------------------------------------------------------ */ \n \nconst alignClasses = computed(() => (props.centered ? 'items-center' : 'items-start')); \n \nconst paddingClasses = computed(() => { \n switch (resolvedSize.value) { \n case 'small': return 'px-4 py-6'; \n case 'large': return 'px-8 py-16'; \n case 'medium': \n default: return 'px-6 py-10'; \n } \n}); \n \nconst surfaceClasses = computed(() => { \n switch (props.variant) { \n case 'solid': return 'bg-card border border-border'; \n case 'outline': return 'bg-transparent border border-dashed border-border'; \n case 'subtle': \n default: return ''; \n } \n}); \n \nconst radiusClasses = computed(() => { \n if (props.variant === 'subtle') return ''; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-xl'; \n // A large surface never goes past a card-like radius (Card's own `full`).\n case 'full': return 'rounded-3xl'; \n case 'medium': \n default: return 'rounded-md'; \n } \n}); \n</script>\n"],"mappings":""}
|
|
@@ -64,7 +64,7 @@ var EmptyState_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0,
|
|
|
64
64
|
case "none": return "rounded-none";
|
|
65
65
|
case "small": return "rounded-sm";
|
|
66
66
|
case "large": return "rounded-xl";
|
|
67
|
-
case "full": return "rounded-
|
|
67
|
+
case "full": return "rounded-3xl";
|
|
68
68
|
default: return "rounded-md";
|
|
69
69
|
}
|
|
70
70
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmptyState.vue_vue_type_script_setup_true_lang.cjs","names":["$slots"],"sources":["../../../src/components/feedback/EmptyState.vue"],"sourcesContent":["<template> \n <div :class=\"['modo-empty-state flex flex-col', alignClasses, paddingClasses, surfaceClasses, radiusClasses]\" role=\"status\"> \n <div v-if=\"resolvedIcon\" :class=\"['modo-empty-state-icon mb-3', iconWrapClasses]\"> \n <component :is=\"resolvedIcon\" :class=\"iconSizeClass\" aria-hidden=\"true\" /> \n </div> \n \n <Typography \n v-if=\"title\" \n :variant=\"titleVariant\" \n :size=\"titleSize\" \n as=\"h3\" \n weight=\"semibold\" \n :class=\"centered ? 'text-center' : ''\" \n > \n {{ title }} \n </Typography> \n \n <Typography \n v-if=\"description\" \n variant=\"body\" \n :size=\"descriptionSize\" \n color=\"muted\" \n as=\"p\" \n :class=\"['mt-1 max-w-prose', centered ? 'text-center' : '']\" \n > \n {{ description }} \n </Typography> \n \n <div v-if=\"$slots.actions\" :class=\"['modo-empty-state-actions mt-5 flex flex-wrap gap-2', centered ? 'justify-center' : '']\"> \n <slot name=\"actions\" /> \n </div> \n \n <div v-if=\"$slots.default\" :class=\"['modo-empty-state-content mt-4', centered ? 'text-center' : '']\"> \n <slot /> \n </div> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed } from 'vue'; \nimport { InboxIcon } from '@heroicons/vue/24/outline'; \nimport Typography from '../data-display/Typography.vue'; \nimport type { EmptyState } from '../../interfaces/feedback/EmptyState.interface'; \nimport { useResolvedRadius, useResolvedSize } from '../../composables/useModoConfig'; \nimport type { ModoRadius } from '../../config/ModoConfig'; \n \nconst props = withDefaults(defineProps<EmptyState>(), { \n variant: 'subtle', \n centered: true, \n}); \n \nconst resolvedSize = useResolvedSize(() => props.size); \n \nconst resolvedRadius = useResolvedRadius(() => props.radius as ModoRadius | undefined); \n \n/* ------------------------------------------------------------------ */ \n/* Icon (default falls back to Inbox) */ \n/* ------------------------------------------------------------------ */ \n \nconst resolvedIcon = computed(() => props.icon ?? InboxIcon); \n \nconst iconSizeClass = computed(() => { \n switch (resolvedSize.value) { \n case 'small': return 'w-6 h-6'; \n case 'large': return 'w-12 h-12'; \n case 'medium': \n default: return 'w-9 h-9'; \n } \n}); \n \nconst iconWrapClasses = computed(() => { \n const base = 'inline-flex items-center justify-center text-muted-foreground'; \n if (resolvedSize.value === 'small') return [base, 'p-2 rounded-md bg-muted/60']; \n if (resolvedSize.value === 'large') return [base, 'p-4 rounded-xl bg-muted/60']; \n return [base, 'p-3 rounded-lg bg-muted/60']; \n}); \n \n/* ------------------------------------------------------------------ */ \n/* Typography sizing */ \n/* ------------------------------------------------------------------ */ \n \nconst titleVariant = computed(() => (resolvedSize.value === 'small' ? 'body' : 'title')); \nconst titleSize = computed(() => { \n if (resolvedSize.value === 'small') return 'medium'; \n if (resolvedSize.value === 'large') return 'medium'; \n return 'small'; \n}); \nconst descriptionSize = computed(() => (resolvedSize.value === 'small' ? 'small' : 'medium')); \n \n/* ------------------------------------------------------------------ */ \n/* Layout & surface */ \n/* ------------------------------------------------------------------ */ \n \nconst alignClasses = computed(() => (props.centered ? 'items-center' : 'items-start')); \n \nconst paddingClasses = computed(() => { \n switch (resolvedSize.value) { \n case 'small': return 'px-4 py-6'; \n case 'large': return 'px-8 py-16'; \n case 'medium': \n default: return 'px-6 py-10'; \n } \n}); \n \nconst surfaceClasses = computed(() => { \n switch (props.variant) { \n case 'solid': return 'bg-card border border-border'; \n case 'outline': return 'bg-transparent border border-dashed border-border'; \n case 'subtle': \n default: return ''; \n } \n}); \n \nconst radiusClasses = computed(() => { \n if (props.variant === 'subtle') return ''; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-xl'; \n case 'full': return 'rounded-
|
|
1
|
+
{"version":3,"file":"EmptyState.vue_vue_type_script_setup_true_lang.cjs","names":["$slots"],"sources":["../../../src/components/feedback/EmptyState.vue"],"sourcesContent":["<template> \n <div :class=\"['modo-empty-state flex flex-col', alignClasses, paddingClasses, surfaceClasses, radiusClasses]\" role=\"status\"> \n <div v-if=\"resolvedIcon\" :class=\"['modo-empty-state-icon mb-3', iconWrapClasses]\"> \n <component :is=\"resolvedIcon\" :class=\"iconSizeClass\" aria-hidden=\"true\" /> \n </div> \n \n <Typography \n v-if=\"title\" \n :variant=\"titleVariant\" \n :size=\"titleSize\" \n as=\"h3\" \n weight=\"semibold\" \n :class=\"centered ? 'text-center' : ''\" \n > \n {{ title }} \n </Typography> \n \n <Typography \n v-if=\"description\" \n variant=\"body\" \n :size=\"descriptionSize\" \n color=\"muted\" \n as=\"p\" \n :class=\"['mt-1 max-w-prose', centered ? 'text-center' : '']\" \n > \n {{ description }} \n </Typography> \n \n <div v-if=\"$slots.actions\" :class=\"['modo-empty-state-actions mt-5 flex flex-wrap gap-2', centered ? 'justify-center' : '']\"> \n <slot name=\"actions\" /> \n </div> \n \n <div v-if=\"$slots.default\" :class=\"['modo-empty-state-content mt-4', centered ? 'text-center' : '']\"> \n <slot /> \n </div> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed } from 'vue'; \nimport { InboxIcon } from '@heroicons/vue/24/outline'; \nimport Typography from '../data-display/Typography.vue'; \nimport type { EmptyState } from '../../interfaces/feedback/EmptyState.interface'; \nimport { useResolvedRadius, useResolvedSize } from '../../composables/useModoConfig'; \nimport type { ModoRadius } from '../../config/ModoConfig'; \n \nconst props = withDefaults(defineProps<EmptyState>(), { \n variant: 'subtle', \n centered: true, \n}); \n \nconst resolvedSize = useResolvedSize(() => props.size); \n \nconst resolvedRadius = useResolvedRadius(() => props.radius as ModoRadius | undefined); \n \n/* ------------------------------------------------------------------ */ \n/* Icon (default falls back to Inbox) */ \n/* ------------------------------------------------------------------ */ \n \nconst resolvedIcon = computed(() => props.icon ?? InboxIcon); \n \nconst iconSizeClass = computed(() => { \n switch (resolvedSize.value) { \n case 'small': return 'w-6 h-6'; \n case 'large': return 'w-12 h-12'; \n case 'medium': \n default: return 'w-9 h-9'; \n } \n}); \n \nconst iconWrapClasses = computed(() => { \n const base = 'inline-flex items-center justify-center text-muted-foreground'; \n if (resolvedSize.value === 'small') return [base, 'p-2 rounded-md bg-muted/60']; \n if (resolvedSize.value === 'large') return [base, 'p-4 rounded-xl bg-muted/60']; \n return [base, 'p-3 rounded-lg bg-muted/60']; \n}); \n \n/* ------------------------------------------------------------------ */ \n/* Typography sizing */ \n/* ------------------------------------------------------------------ */ \n \nconst titleVariant = computed(() => (resolvedSize.value === 'small' ? 'body' : 'title')); \nconst titleSize = computed(() => { \n if (resolvedSize.value === 'small') return 'medium'; \n if (resolvedSize.value === 'large') return 'medium'; \n return 'small'; \n}); \nconst descriptionSize = computed(() => (resolvedSize.value === 'small' ? 'small' : 'medium')); \n \n/* ------------------------------------------------------------------ */ \n/* Layout & surface */ \n/* ------------------------------------------------------------------ */ \n \nconst alignClasses = computed(() => (props.centered ? 'items-center' : 'items-start')); \n \nconst paddingClasses = computed(() => { \n switch (resolvedSize.value) { \n case 'small': return 'px-4 py-6'; \n case 'large': return 'px-8 py-16'; \n case 'medium': \n default: return 'px-6 py-10'; \n } \n}); \n \nconst surfaceClasses = computed(() => { \n switch (props.variant) { \n case 'solid': return 'bg-card border border-border'; \n case 'outline': return 'bg-transparent border border-dashed border-border'; \n case 'subtle': \n default: return ''; \n } \n}); \n \nconst radiusClasses = computed(() => { \n if (props.variant === 'subtle') return ''; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-xl'; \n // A large surface never goes past a card-like radius (Card's own `full`).\n case 'full': return 'rounded-3xl'; \n case 'medium': \n default: return 'rounded-md'; \n } \n}); \n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;EA8CA,MAAM,QAAQ;EAKd,MAAM,eAAe,sBAAA,sBAA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AAA,GAAA,IAAA,oBAAA,IAAA,KAAA;IAGhBA,KAAAA,OAAO,YAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAEZ,OAAA;;KAFsB,QAAA,GAAA,IAAA,gBAAK,CAAA,iCAAoC,QAAA,WAAQ,gBAAA,GAAA,CAAA;4BACjE,KAAA,QAAA,UAAA,CAAA,EAAA,EAAA,KAAA,GAAA,IAAA,oBAAA,IAAA,KAAA"}
|
|
@@ -63,7 +63,7 @@ var EmptyState_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
63
63
|
case "none": return "rounded-none";
|
|
64
64
|
case "small": return "rounded-sm";
|
|
65
65
|
case "large": return "rounded-xl";
|
|
66
|
-
case "full": return "rounded-
|
|
66
|
+
case "full": return "rounded-3xl";
|
|
67
67
|
default: return "rounded-md";
|
|
68
68
|
}
|
|
69
69
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmptyState.vue_vue_type_script_setup_true_lang.mjs","names":["$slots"],"sources":["../../../src/components/feedback/EmptyState.vue"],"sourcesContent":["<template> \n <div :class=\"['modo-empty-state flex flex-col', alignClasses, paddingClasses, surfaceClasses, radiusClasses]\" role=\"status\"> \n <div v-if=\"resolvedIcon\" :class=\"['modo-empty-state-icon mb-3', iconWrapClasses]\"> \n <component :is=\"resolvedIcon\" :class=\"iconSizeClass\" aria-hidden=\"true\" /> \n </div> \n \n <Typography \n v-if=\"title\" \n :variant=\"titleVariant\" \n :size=\"titleSize\" \n as=\"h3\" \n weight=\"semibold\" \n :class=\"centered ? 'text-center' : ''\" \n > \n {{ title }} \n </Typography> \n \n <Typography \n v-if=\"description\" \n variant=\"body\" \n :size=\"descriptionSize\" \n color=\"muted\" \n as=\"p\" \n :class=\"['mt-1 max-w-prose', centered ? 'text-center' : '']\" \n > \n {{ description }} \n </Typography> \n \n <div v-if=\"$slots.actions\" :class=\"['modo-empty-state-actions mt-5 flex flex-wrap gap-2', centered ? 'justify-center' : '']\"> \n <slot name=\"actions\" /> \n </div> \n \n <div v-if=\"$slots.default\" :class=\"['modo-empty-state-content mt-4', centered ? 'text-center' : '']\"> \n <slot /> \n </div> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed } from 'vue'; \nimport { InboxIcon } from '@heroicons/vue/24/outline'; \nimport Typography from '../data-display/Typography.vue'; \nimport type { EmptyState } from '../../interfaces/feedback/EmptyState.interface'; \nimport { useResolvedRadius, useResolvedSize } from '../../composables/useModoConfig'; \nimport type { ModoRadius } from '../../config/ModoConfig'; \n \nconst props = withDefaults(defineProps<EmptyState>(), { \n variant: 'subtle', \n centered: true, \n}); \n \nconst resolvedSize = useResolvedSize(() => props.size); \n \nconst resolvedRadius = useResolvedRadius(() => props.radius as ModoRadius | undefined); \n \n/* ------------------------------------------------------------------ */ \n/* Icon (default falls back to Inbox) */ \n/* ------------------------------------------------------------------ */ \n \nconst resolvedIcon = computed(() => props.icon ?? InboxIcon); \n \nconst iconSizeClass = computed(() => { \n switch (resolvedSize.value) { \n case 'small': return 'w-6 h-6'; \n case 'large': return 'w-12 h-12'; \n case 'medium': \n default: return 'w-9 h-9'; \n } \n}); \n \nconst iconWrapClasses = computed(() => { \n const base = 'inline-flex items-center justify-center text-muted-foreground'; \n if (resolvedSize.value === 'small') return [base, 'p-2 rounded-md bg-muted/60']; \n if (resolvedSize.value === 'large') return [base, 'p-4 rounded-xl bg-muted/60']; \n return [base, 'p-3 rounded-lg bg-muted/60']; \n}); \n \n/* ------------------------------------------------------------------ */ \n/* Typography sizing */ \n/* ------------------------------------------------------------------ */ \n \nconst titleVariant = computed(() => (resolvedSize.value === 'small' ? 'body' : 'title')); \nconst titleSize = computed(() => { \n if (resolvedSize.value === 'small') return 'medium'; \n if (resolvedSize.value === 'large') return 'medium'; \n return 'small'; \n}); \nconst descriptionSize = computed(() => (resolvedSize.value === 'small' ? 'small' : 'medium')); \n \n/* ------------------------------------------------------------------ */ \n/* Layout & surface */ \n/* ------------------------------------------------------------------ */ \n \nconst alignClasses = computed(() => (props.centered ? 'items-center' : 'items-start')); \n \nconst paddingClasses = computed(() => { \n switch (resolvedSize.value) { \n case 'small': return 'px-4 py-6'; \n case 'large': return 'px-8 py-16'; \n case 'medium': \n default: return 'px-6 py-10'; \n } \n}); \n \nconst surfaceClasses = computed(() => { \n switch (props.variant) { \n case 'solid': return 'bg-card border border-border'; \n case 'outline': return 'bg-transparent border border-dashed border-border'; \n case 'subtle': \n default: return ''; \n } \n}); \n \nconst radiusClasses = computed(() => { \n if (props.variant === 'subtle') return ''; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-xl'; \n case 'full': return 'rounded-
|
|
1
|
+
{"version":3,"file":"EmptyState.vue_vue_type_script_setup_true_lang.mjs","names":["$slots"],"sources":["../../../src/components/feedback/EmptyState.vue"],"sourcesContent":["<template> \n <div :class=\"['modo-empty-state flex flex-col', alignClasses, paddingClasses, surfaceClasses, radiusClasses]\" role=\"status\"> \n <div v-if=\"resolvedIcon\" :class=\"['modo-empty-state-icon mb-3', iconWrapClasses]\"> \n <component :is=\"resolvedIcon\" :class=\"iconSizeClass\" aria-hidden=\"true\" /> \n </div> \n \n <Typography \n v-if=\"title\" \n :variant=\"titleVariant\" \n :size=\"titleSize\" \n as=\"h3\" \n weight=\"semibold\" \n :class=\"centered ? 'text-center' : ''\" \n > \n {{ title }} \n </Typography> \n \n <Typography \n v-if=\"description\" \n variant=\"body\" \n :size=\"descriptionSize\" \n color=\"muted\" \n as=\"p\" \n :class=\"['mt-1 max-w-prose', centered ? 'text-center' : '']\" \n > \n {{ description }} \n </Typography> \n \n <div v-if=\"$slots.actions\" :class=\"['modo-empty-state-actions mt-5 flex flex-wrap gap-2', centered ? 'justify-center' : '']\"> \n <slot name=\"actions\" /> \n </div> \n \n <div v-if=\"$slots.default\" :class=\"['modo-empty-state-content mt-4', centered ? 'text-center' : '']\"> \n <slot /> \n </div> \n </div> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed } from 'vue'; \nimport { InboxIcon } from '@heroicons/vue/24/outline'; \nimport Typography from '../data-display/Typography.vue'; \nimport type { EmptyState } from '../../interfaces/feedback/EmptyState.interface'; \nimport { useResolvedRadius, useResolvedSize } from '../../composables/useModoConfig'; \nimport type { ModoRadius } from '../../config/ModoConfig'; \n \nconst props = withDefaults(defineProps<EmptyState>(), { \n variant: 'subtle', \n centered: true, \n}); \n \nconst resolvedSize = useResolvedSize(() => props.size); \n \nconst resolvedRadius = useResolvedRadius(() => props.radius as ModoRadius | undefined); \n \n/* ------------------------------------------------------------------ */ \n/* Icon (default falls back to Inbox) */ \n/* ------------------------------------------------------------------ */ \n \nconst resolvedIcon = computed(() => props.icon ?? InboxIcon); \n \nconst iconSizeClass = computed(() => { \n switch (resolvedSize.value) { \n case 'small': return 'w-6 h-6'; \n case 'large': return 'w-12 h-12'; \n case 'medium': \n default: return 'w-9 h-9'; \n } \n}); \n \nconst iconWrapClasses = computed(() => { \n const base = 'inline-flex items-center justify-center text-muted-foreground'; \n if (resolvedSize.value === 'small') return [base, 'p-2 rounded-md bg-muted/60']; \n if (resolvedSize.value === 'large') return [base, 'p-4 rounded-xl bg-muted/60']; \n return [base, 'p-3 rounded-lg bg-muted/60']; \n}); \n \n/* ------------------------------------------------------------------ */ \n/* Typography sizing */ \n/* ------------------------------------------------------------------ */ \n \nconst titleVariant = computed(() => (resolvedSize.value === 'small' ? 'body' : 'title')); \nconst titleSize = computed(() => { \n if (resolvedSize.value === 'small') return 'medium'; \n if (resolvedSize.value === 'large') return 'medium'; \n return 'small'; \n}); \nconst descriptionSize = computed(() => (resolvedSize.value === 'small' ? 'small' : 'medium')); \n \n/* ------------------------------------------------------------------ */ \n/* Layout & surface */ \n/* ------------------------------------------------------------------ */ \n \nconst alignClasses = computed(() => (props.centered ? 'items-center' : 'items-start')); \n \nconst paddingClasses = computed(() => { \n switch (resolvedSize.value) { \n case 'small': return 'px-4 py-6'; \n case 'large': return 'px-8 py-16'; \n case 'medium': \n default: return 'px-6 py-10'; \n } \n}); \n \nconst surfaceClasses = computed(() => { \n switch (props.variant) { \n case 'solid': return 'bg-card border border-border'; \n case 'outline': return 'bg-transparent border border-dashed border-border'; \n case 'subtle': \n default: return ''; \n } \n}); \n \nconst radiusClasses = computed(() => { \n if (props.variant === 'subtle') return ''; \n switch (resolvedRadius.value) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-xl'; \n // A large surface never goes past a card-like radius (Card's own `full`).\n case 'full': return 'rounded-3xl'; \n case 'medium': \n default: return 'rounded-md'; \n } \n}); \n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EA8CA,MAAM,QAAQ;EAKd,MAAM,eAAe,sBAAsB,MAAM,KAAK;EAEtD,MAAM,iBAAiB,wBAAwB,MAAM,OAAiC;EAMtF,MAAM,eAAe,eAAe,MAAM,QAAQ,UAAU;EAE5D,MAAM,gBAAgB,eAAe;GACjC,QAAQ,aAAa,OAArB;IACI,KAAK,SAAS,OAAO;IACrB,KAAK,SAAS,OAAO;IAErB,SAAS,OAAO;;IAEtB;EAEF,MAAM,kBAAkB,eAAe;GACnC,MAAM,OAAO;GACb,IAAI,aAAa,UAAU,SAAS,OAAO,CAAC,MAAM,6BAA6B;GAC/E,IAAI,aAAa,UAAU,SAAS,OAAO,CAAC,MAAM,6BAA6B;GAC/E,OAAO,CAAC,MAAM,6BAA6B;IAC7C;EAMF,MAAM,eAAe,eAAgB,aAAa,UAAU,UAAU,SAAS,QAAS;EACxF,MAAM,YAAY,eAAe;GAC7B,IAAI,aAAa,UAAU,SAAS,OAAO;GAC3C,IAAI,aAAa,UAAU,SAAS,OAAO;GAC3C,OAAO;IACT;EACF,MAAM,kBAAkB,eAAgB,aAAa,UAAU,UAAU,UAAU,SAAU;EAM7F,MAAM,eAAe,eAAgB,MAAM,WAAW,iBAAiB,cAAe;EAEtF,MAAM,iBAAiB,eAAe;GAClC,QAAQ,aA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