@ecoma-io/loom 0.1.0 → 0.2.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 +54 -57
- package/dist/blocks/AppHeader/AppHeader.js.map +1 -1
- package/dist/blocks/AppHeader/AppHeader.vue.d.ts +5 -6
- package/dist/blocks/AppHeader/AppHeader.vue.d.ts.map +1 -1
- package/dist/blocks/AppHeader/AppHeader.vue_vue_type_script_setup_true_lang.js +6 -7
- package/dist/blocks/AppHeader/AppHeader.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/blocks/DashboardGrid/DashboardGrid.vue.d.ts +1 -1
- package/dist/blocks/DashboardGrid/DashboardGrid.vue.d.ts.map +1 -1
- package/dist/blocks/DesktopAppShell/DesktopAppShell.js +7 -0
- package/dist/blocks/DesktopAppShell/DesktopAppShell.js.map +1 -0
- package/dist/blocks/DesktopAppShell/DesktopAppShell.vue.d.ts +102 -0
- package/dist/blocks/DesktopAppShell/DesktopAppShell.vue.d.ts.map +1 -0
- package/dist/blocks/DesktopAppShell/DesktopAppShell.vue_vue_type_script_setup_true_lang.js +74 -0
- package/dist/blocks/DesktopAppShell/DesktopAppShell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/blocks/ErrorState/ErrorState.js +7 -0
- package/dist/blocks/ErrorState/ErrorState.js.map +1 -0
- package/dist/blocks/ErrorState/ErrorState.vue.d.ts +44 -0
- package/dist/blocks/ErrorState/ErrorState.vue.d.ts.map +1 -0
- package/dist/blocks/ErrorState/ErrorState.vue_vue_type_script_setup_true_lang.js +60 -0
- package/dist/blocks/ErrorState/ErrorState.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/blocks/FormActions/FormActions.js +7 -0
- package/dist/blocks/FormActions/FormActions.js.map +1 -0
- package/dist/blocks/FormActions/FormActions.vue.d.ts +51 -0
- package/dist/blocks/FormActions/FormActions.vue.d.ts.map +1 -0
- package/dist/blocks/FormActions/FormActions.vue_vue_type_script_setup_true_lang.js +21 -0
- package/dist/blocks/FormActions/FormActions.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/blocks/FormSection/FormSection.js +7 -0
- package/dist/blocks/FormSection/FormSection.js.map +1 -0
- package/dist/blocks/FormSection/FormSection.vue.d.ts +85 -0
- package/dist/blocks/FormSection/FormSection.vue.d.ts.map +1 -0
- package/dist/blocks/FormSection/FormSection.vue_vue_type_script_setup_true_lang.js +62 -0
- package/dist/blocks/FormSection/FormSection.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/blocks/LoadingState/LoadingState.js +7 -0
- package/dist/blocks/LoadingState/LoadingState.js.map +1 -0
- package/dist/blocks/LoadingState/LoadingState.vue.d.ts +22 -0
- package/dist/blocks/LoadingState/LoadingState.vue.d.ts.map +1 -0
- package/dist/blocks/LoadingState/LoadingState.vue_vue_type_script_setup_true_lang.js +57 -0
- package/dist/blocks/LoadingState/LoadingState.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/blocks/MetricCard/MetricCard.js +7 -0
- package/dist/blocks/MetricCard/MetricCard.js.map +1 -0
- package/dist/blocks/MetricCard/MetricCard.vue.d.ts +59 -0
- package/dist/blocks/MetricCard/MetricCard.vue.d.ts.map +1 -0
- package/dist/blocks/MetricCard/MetricCard.vue_vue_type_script_setup_true_lang.js +63 -0
- package/dist/blocks/MetricCard/MetricCard.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/blocks/SidebarNav/SidebarNav.js.map +1 -1
- package/dist/blocks/SidebarNav/SidebarNav.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/blocks/TitleBar/TitleBar.js.map +1 -1
- package/dist/blocks/TitleBar/TitleBar.vue.d.ts +37 -3
- package/dist/blocks/TitleBar/TitleBar.vue.d.ts.map +1 -1
- package/dist/blocks/TitleBar/TitleBar.vue_vue_type_script_setup_true_lang.js +14 -14
- package/dist/blocks/TitleBar/TitleBar.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/blocks/ToastStack/ToastStack.js.map +1 -1
- package/dist/blocks/ToastStack/ToastStack.vue.d.ts +20 -0
- package/dist/blocks/ToastStack/ToastStack.vue.d.ts.map +1 -1
- package/dist/blocks/ToastStack/ToastStack.vue_vue_type_script_setup_true_lang.js +16 -5
- package/dist/blocks/ToastStack/ToastStack.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/composition/Center/Center.js +7 -0
- package/dist/composition/Center/Center.js.map +1 -0
- package/dist/composition/Center/Center.vue.d.ts +40 -0
- package/dist/composition/Center/Center.vue.d.ts.map +1 -0
- package/dist/composition/Center/Center.vue_vue_type_script_setup_true_lang.js +29 -0
- package/dist/composition/Center/Center.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/composition/Frame/Frame.js +7 -0
- package/dist/composition/Frame/Frame.js.map +1 -0
- package/dist/composition/Frame/Frame.vue.d.ts +35 -0
- package/dist/composition/Frame/Frame.vue.d.ts.map +1 -0
- package/dist/composition/Frame/Frame.vue_vue_type_script_setup_true_lang.js +29 -0
- package/dist/composition/Frame/Frame.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/composition/Grid/Grid.js +7 -0
- package/dist/composition/Grid/Grid.js.map +1 -0
- package/dist/composition/Grid/Grid.vue.d.ts +41 -0
- package/dist/composition/Grid/Grid.vue.d.ts.map +1 -0
- package/dist/composition/Grid/Grid.vue_vue_type_script_setup_true_lang.js +27 -0
- package/dist/composition/Grid/Grid.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/composition/Inline/Inline.js +7 -0
- package/dist/composition/Inline/Inline.js.map +1 -0
- package/dist/composition/Inline/Inline.vue.d.ts +46 -0
- package/dist/composition/Inline/Inline.vue.d.ts.map +1 -0
- package/dist/composition/Inline/Inline.vue_vue_type_script_setup_true_lang.js +35 -0
- package/dist/composition/Inline/Inline.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/composition/ScrollReel/ScrollReel.js +7 -0
- package/dist/composition/ScrollReel/ScrollReel.js.map +1 -0
- package/dist/composition/ScrollReel/ScrollReel.vue.d.ts +42 -0
- package/dist/composition/ScrollReel/ScrollReel.vue.d.ts.map +1 -0
- package/dist/composition/ScrollReel/ScrollReel.vue_vue_type_script_setup_true_lang.js +79 -0
- package/dist/composition/ScrollReel/ScrollReel.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/composition/Sidebar/Sidebar.js +7 -0
- package/dist/composition/Sidebar/Sidebar.js.map +1 -0
- package/dist/composition/Sidebar/Sidebar.vue.d.ts +52 -0
- package/dist/composition/Sidebar/Sidebar.vue.d.ts.map +1 -0
- package/dist/composition/Sidebar/Sidebar.vue_vue_type_script_setup_true_lang.js +36 -0
- package/dist/composition/Sidebar/Sidebar.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/composition/Split/Split.js +7 -0
- package/dist/composition/Split/Split.js.map +1 -0
- package/dist/composition/Split/Split.vue.d.ts +58 -0
- package/dist/composition/Split/Split.vue.d.ts.map +1 -0
- package/dist/composition/Split/Split.vue_vue_type_script_setup_true_lang.js +40 -0
- package/dist/composition/Split/Split.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/composition/Stack/Stack.js +7 -0
- package/dist/composition/Stack/Stack.js.map +1 -0
- package/dist/composition/Stack/Stack.vue.d.ts +43 -0
- package/dist/composition/Stack/Stack.vue.d.ts.map +1 -0
- package/dist/composition/Stack/Stack.vue_vue_type_script_setup_true_lang.js +30 -0
- package/dist/composition/Stack/Stack.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/index.d.ts +119 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +83 -5
- package/dist/layouts/AppShell/AppShell.js +7 -0
- package/dist/layouts/AppShell/AppShell.js.map +1 -0
- package/dist/layouts/AppShell/AppShell.vue.d.ts +51 -0
- package/dist/layouts/AppShell/AppShell.vue.d.ts.map +1 -0
- package/dist/layouts/AppShell/AppShell.vue_vue_type_script_setup_true_lang.js +47 -0
- package/dist/layouts/AppShell/AppShell.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/layouts/Centered/Centered.js +7 -0
- package/dist/layouts/Centered/Centered.js.map +1 -0
- package/dist/layouts/Centered/Centered.vue.d.ts +48 -0
- package/dist/layouts/Centered/Centered.vue.d.ts.map +1 -0
- package/dist/layouts/Centered/Centered.vue_vue_type_script_setup_true_lang.js +35 -0
- package/dist/layouts/Centered/Centered.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/layouts/Dashboard/Dashboard.js +7 -0
- package/dist/layouts/Dashboard/Dashboard.js.map +1 -0
- package/dist/layouts/Dashboard/Dashboard.vue.d.ts +60 -0
- package/dist/layouts/Dashboard/Dashboard.vue.d.ts.map +1 -0
- package/dist/layouts/Dashboard/Dashboard.vue_vue_type_script_setup_true_lang.js +64 -0
- package/dist/layouts/Dashboard/Dashboard.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/layouts/FormLayout/FormLayout.js +7 -0
- package/dist/layouts/FormLayout/FormLayout.js.map +1 -0
- package/dist/layouts/FormLayout/FormLayout.vue.d.ts +46 -0
- package/dist/layouts/FormLayout/FormLayout.vue.d.ts.map +1 -0
- package/dist/layouts/FormLayout/FormLayout.vue_vue_type_script_setup_true_lang.js +28 -0
- package/dist/layouts/FormLayout/FormLayout.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/layouts/MasterDetail/MasterDetail.js +7 -0
- package/dist/layouts/MasterDetail/MasterDetail.js.map +1 -0
- package/dist/layouts/MasterDetail/MasterDetail.vue.d.ts +49 -0
- package/dist/layouts/MasterDetail/MasterDetail.vue.d.ts.map +1 -0
- package/dist/layouts/MasterDetail/MasterDetail.vue_vue_type_script_setup_true_lang.js +42 -0
- package/dist/layouts/MasterDetail/MasterDetail.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/layouts/Reading/Reading.js +7 -0
- package/dist/layouts/Reading/Reading.js.map +1 -0
- package/dist/layouts/Reading/Reading.vue.d.ts +24 -0
- package/dist/layouts/Reading/Reading.vue.d.ts.map +1 -0
- package/dist/layouts/Reading/Reading.vue_vue_type_script_setup_true_lang.js +29 -0
- package/dist/layouts/Reading/Reading.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/layouts/Settings/Settings.js +7 -0
- package/dist/layouts/Settings/Settings.js.map +1 -0
- package/dist/layouts/Settings/Settings.vue.d.ts +39 -0
- package/dist/layouts/Settings/Settings.vue.d.ts.map +1 -0
- package/dist/layouts/Settings/Settings.vue_vue_type_script_setup_true_lang.js +35 -0
- package/dist/layouts/Settings/Settings.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/layouts/SplitLayout/SplitLayout.js +7 -0
- package/dist/layouts/SplitLayout/SplitLayout.js.map +1 -0
- package/dist/layouts/SplitLayout/SplitLayout.vue.d.ts +63 -0
- package/dist/layouts/SplitLayout/SplitLayout.vue.d.ts.map +1 -0
- package/dist/layouts/SplitLayout/SplitLayout.vue_vue_type_script_setup_true_lang.js +46 -0
- package/dist/layouts/SplitLayout/SplitLayout.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/lib/ancestor-disabled.d.ts +35 -0
- package/dist/lib/ancestor-disabled.d.ts.map +1 -0
- package/dist/lib/ancestor-disabled.js +86 -0
- package/dist/lib/ancestor-disabled.js.map +1 -0
- package/dist/lib/cn.d.ts.map +1 -1
- package/dist/lib/cn.js +46 -1
- package/dist/lib/cn.js.map +1 -1
- package/dist/lib/count-labels.d.ts +78 -0
- package/dist/lib/count-labels.d.ts.map +1 -0
- package/dist/lib/count-labels.js +29 -0
- package/dist/lib/count-labels.js.map +1 -0
- package/dist/lib/date-labels.d.ts +278 -0
- package/dist/lib/date-labels.d.ts.map +1 -0
- package/dist/lib/date-labels.js +157 -0
- package/dist/lib/date-labels.js.map +1 -0
- package/dist/lib/field-context.d.ts +178 -0
- package/dist/lib/field-context.d.ts.map +1 -0
- package/dist/lib/field-context.js +106 -0
- package/dist/lib/field-context.js.map +1 -0
- package/dist/lib/label-registry.d.ts +75 -0
- package/dist/lib/label-registry.d.ts.map +1 -0
- package/dist/lib/labels.d.ts +116 -0
- package/dist/lib/labels.d.ts.map +1 -0
- package/dist/lib/labels.js +84 -0
- package/dist/lib/labels.js.map +1 -0
- package/dist/lib/theme.d.ts +68 -0
- package/dist/lib/theme.d.ts.map +1 -0
- package/dist/node_modules/.pnpm/@internationalized_date@3.12.3/node_modules/@internationalized/date/dist/private/CalendarDate.js +236 -0
- package/dist/node_modules/.pnpm/@internationalized_date@3.12.3/node_modules/@internationalized/date/dist/private/CalendarDate.js.map +1 -0
- package/dist/node_modules/.pnpm/@internationalized_date@3.12.3/node_modules/@internationalized/date/dist/private/calendars/GregorianCalendar.js +117 -0
- package/dist/node_modules/.pnpm/@internationalized_date@3.12.3/node_modules/@internationalized/date/dist/private/calendars/GregorianCalendar.js.map +1 -0
- package/dist/node_modules/.pnpm/@internationalized_date@3.12.3/node_modules/@internationalized/date/dist/private/conversion.js +142 -0
- package/dist/node_modules/.pnpm/@internationalized_date@3.12.3/node_modules/@internationalized/date/dist/private/conversion.js.map +1 -0
- package/dist/node_modules/.pnpm/@internationalized_date@3.12.3/node_modules/@internationalized/date/dist/private/manipulation.js +280 -0
- package/dist/node_modules/.pnpm/@internationalized_date@3.12.3/node_modules/@internationalized/date/dist/private/manipulation.js.map +1 -0
- package/dist/node_modules/.pnpm/@internationalized_date@3.12.3/node_modules/@internationalized/date/dist/private/queries.js +40 -0
- package/dist/node_modules/.pnpm/@internationalized_date@3.12.3/node_modules/@internationalized/date/dist/private/queries.js.map +1 -0
- package/dist/node_modules/.pnpm/@internationalized_date@3.12.3/node_modules/@internationalized/date/dist/private/string.js +69 -0
- package/dist/node_modules/.pnpm/@internationalized_date@3.12.3/node_modules/@internationalized/date/dist/private/string.js.map +1 -0
- package/dist/node_modules/.pnpm/@internationalized_date@3.12.3/node_modules/@internationalized/date/dist/private/utils.js +8 -0
- package/dist/node_modules/.pnpm/@internationalized_date@3.12.3/node_modules/@internationalized/date/dist/private/utils.js.map +1 -0
- package/dist/primitives/Accordion/Accordion.js +7 -0
- package/dist/primitives/Accordion/Accordion.js.map +1 -0
- package/dist/primitives/Accordion/Accordion.vue.d.ts +68 -0
- package/dist/primitives/Accordion/Accordion.vue.d.ts.map +1 -0
- package/dist/primitives/Accordion/Accordion.vue_vue_type_script_setup_true_lang.js +67 -0
- package/dist/primitives/Accordion/Accordion.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/primitives/AlertDialog/AlertDialog.js +7 -0
- package/dist/primitives/AlertDialog/AlertDialog.js.map +1 -0
- package/dist/primitives/AlertDialog/AlertDialog.vue.d.ts +94 -0
- package/dist/primitives/AlertDialog/AlertDialog.vue.d.ts.map +1 -0
- package/dist/primitives/AlertDialog/AlertDialog.vue_vue_type_script_setup_true_lang.js +99 -0
- package/dist/primitives/AlertDialog/AlertDialog.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/primitives/Avatar/Avatar.js +2 -2
- package/dist/primitives/Avatar/Avatar.js.map +1 -1
- package/dist/primitives/Avatar/Avatar.vue.d.ts +30 -3
- package/dist/primitives/Avatar/Avatar.vue.d.ts.map +1 -1
- package/dist/primitives/Avatar/Avatar.vue_vue_type_script_setup_true_lang.js +95 -14
- package/dist/primitives/Avatar/Avatar.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/primitives/AvatarGroup/AvatarGroup.js +7 -0
- package/dist/primitives/AvatarGroup/AvatarGroup.js.map +1 -0
- package/dist/primitives/AvatarGroup/AvatarGroup.vue.d.ts +104 -0
- package/dist/primitives/AvatarGroup/AvatarGroup.vue.d.ts.map +1 -0
- package/dist/primitives/AvatarGroup/AvatarGroup.vue_vue_type_script_setup_true_lang.js +139 -0
- package/dist/primitives/AvatarGroup/AvatarGroup.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/primitives/Badge/Badge.js.map +1 -1
- package/dist/primitives/Badge/Badge.vue.d.ts +6 -6
- package/dist/primitives/Badge/Badge.vue.d.ts.map +1 -1
- package/dist/primitives/Badge/Badge.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/primitives/Badge/Badge.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/primitives/Breadcrumb/Breadcrumb.js +7 -0
- package/dist/primitives/Breadcrumb/Breadcrumb.js.map +1 -0
- package/dist/primitives/Breadcrumb/Breadcrumb.vue.d.ts +25 -0
- package/dist/primitives/Breadcrumb/Breadcrumb.vue.d.ts.map +1 -0
- package/dist/primitives/Breadcrumb/Breadcrumb.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/primitives/Breadcrumb/Breadcrumb.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/primitives/Button/Button.js +2 -2
- package/dist/primitives/Button/Button.js.map +1 -1
- package/dist/primitives/Button/Button.vue.d.ts +31 -8
- package/dist/primitives/Button/Button.vue.d.ts.map +1 -1
- package/dist/primitives/Button/Button.vue_vue_type_script_setup_true_lang.js +32 -16
- package/dist/primitives/Button/Button.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/primitives/Checkbox/Checkbox.js.map +1 -1
- package/dist/primitives/Checkbox/Checkbox.vue.d.ts +18 -3
- package/dist/primitives/Checkbox/Checkbox.vue.d.ts.map +1 -1
- package/dist/primitives/Checkbox/Checkbox.vue_vue_type_script_setup_true_lang.js +46 -7
- package/dist/primitives/Checkbox/Checkbox.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/primitives/Chip/Chip.js +7 -0
- package/dist/primitives/Chip/Chip.js.map +1 -0
- package/dist/primitives/Chip/Chip.vue.d.ts +79 -0
- package/dist/primitives/Chip/Chip.vue.d.ts.map +1 -0
- package/dist/primitives/Chip/Chip.vue_vue_type_script_setup_true_lang.js +139 -0
- package/dist/primitives/Chip/Chip.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/primitives/ColorPicker/ColorPicker.js +7 -0
- package/dist/primitives/ColorPicker/ColorPicker.js.map +1 -0
- package/dist/primitives/ColorPicker/ColorPicker.vue.d.ts +125 -0
- package/dist/primitives/ColorPicker/ColorPicker.vue.d.ts.map +1 -0
- package/dist/primitives/ColorPicker/ColorPicker.vue_vue_type_script_setup_true_lang.js +301 -0
- package/dist/primitives/ColorPicker/ColorPicker.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/primitives/Combobox/Combobox.js +7 -0
- package/dist/primitives/Combobox/Combobox.js.map +1 -0
- package/dist/primitives/Combobox/Combobox.vue.d.ts +205 -0
- package/dist/primitives/Combobox/Combobox.vue.d.ts.map +1 -0
- package/dist/primitives/Combobox/Combobox.vue_vue_type_script_setup_true_lang.js +345 -0
- package/dist/primitives/Combobox/Combobox.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/primitives/ContextMenu/ContextMenu.js +7 -0
- package/dist/primitives/ContextMenu/ContextMenu.js.map +1 -0
- package/dist/primitives/ContextMenu/ContextMenu.vue.d.ts +55 -0
- package/dist/primitives/ContextMenu/ContextMenu.vue.d.ts.map +1 -0
- package/dist/primitives/ContextMenu/ContextMenu.vue_vue_type_script_setup_true_lang.js +82 -0
- package/dist/primitives/ContextMenu/ContextMenu.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/primitives/DatePicker/DatePicker.js +7 -0
- package/dist/primitives/DatePicker/DatePicker.js.map +1 -0
- package/dist/primitives/DatePicker/DatePicker.vue.d.ts +102 -0
- package/dist/primitives/DatePicker/DatePicker.vue.d.ts.map +1 -0
- package/dist/primitives/DatePicker/DatePicker.vue_vue_type_script_setup_true_lang.js +292 -0
- package/dist/primitives/DatePicker/DatePicker.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/primitives/DateRangePicker/DateRangePicker.js +7 -0
- package/dist/primitives/DateRangePicker/DateRangePicker.js.map +1 -0
- package/dist/primitives/DateRangePicker/DateRangePicker.vue.d.ts +173 -0
- package/dist/primitives/DateRangePicker/DateRangePicker.vue.d.ts.map +1 -0
- package/dist/primitives/DateRangePicker/DateRangePicker.vue_vue_type_script_setup_true_lang.js +412 -0
- package/dist/primitives/DateRangePicker/DateRangePicker.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/primitives/DateTimePicker/DateTimePicker.js +7 -0
- package/dist/primitives/DateTimePicker/DateTimePicker.js.map +1 -0
- package/dist/primitives/DateTimePicker/DateTimePicker.vue.d.ts +113 -0
- package/dist/primitives/DateTimePicker/DateTimePicker.vue.d.ts.map +1 -0
- package/dist/primitives/DateTimePicker/DateTimePicker.vue_vue_type_script_setup_true_lang.js +358 -0
- package/dist/primitives/DateTimePicker/DateTimePicker.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/primitives/DateTimeRangePicker/DateTimeRangePicker.js +7 -0
- package/dist/primitives/DateTimeRangePicker/DateTimeRangePicker.js.map +1 -0
- package/dist/primitives/DateTimeRangePicker/DateTimeRangePicker.vue.d.ts +181 -0
- package/dist/primitives/DateTimeRangePicker/DateTimeRangePicker.vue.d.ts.map +1 -0
- package/dist/primitives/DateTimeRangePicker/DateTimeRangePicker.vue_vue_type_script_setup_true_lang.js +562 -0
- package/dist/primitives/DateTimeRangePicker/DateTimeRangePicker.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/primitives/Dialog/Dialog.js +2 -2
- package/dist/primitives/Dialog/Dialog.js.map +1 -1
- package/dist/primitives/Dialog/Dialog.vue.d.ts +39 -0
- package/dist/primitives/Dialog/Dialog.vue.d.ts.map +1 -1
- package/dist/primitives/Dialog/Dialog.vue_vue_type_script_setup_true_lang.js +14 -5
- package/dist/primitives/Dialog/Dialog.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/primitives/Drawer/Drawer.js +7 -0
- package/dist/primitives/Drawer/Drawer.js.map +1 -0
- package/dist/primitives/Drawer/Drawer.vue.d.ts +110 -0
- package/dist/primitives/Drawer/Drawer.vue.d.ts.map +1 -0
- package/dist/primitives/Drawer/Drawer.vue_vue_type_script_setup_true_lang.js +223 -0
- package/dist/primitives/Drawer/Drawer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/primitives/DropdownMenu/DropdownMenu.js.map +1 -1
- package/dist/primitives/DropdownMenu/DropdownMenu.vue.d.ts.map +1 -1
- package/dist/primitives/DropdownMenu/DropdownMenu.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/primitives/DropdownMenu/DropdownMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/primitives/Editable/Editable.js +7 -0
- package/dist/primitives/Editable/Editable.js.map +1 -0
- package/dist/primitives/Editable/Editable.vue.d.ts +200 -0
- package/dist/primitives/Editable/Editable.vue.d.ts.map +1 -0
- package/dist/primitives/Editable/Editable.vue_vue_type_script_setup_true_lang.js +275 -0
- package/dist/primitives/Editable/Editable.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/primitives/Field/Field.js.map +1 -1
- package/dist/primitives/Field/Field.vue.d.ts +32 -17
- package/dist/primitives/Field/Field.vue.d.ts.map +1 -1
- package/dist/primitives/Field/Field.vue_vue_type_script_setup_true_lang.js +51 -18
- package/dist/primitives/Field/Field.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/primitives/Fieldset/Fieldset.js +7 -0
- package/dist/primitives/Fieldset/Fieldset.js.map +1 -0
- package/dist/primitives/Fieldset/Fieldset.vue.d.ts +91 -0
- package/dist/primitives/Fieldset/Fieldset.vue.d.ts.map +1 -0
- package/dist/primitives/Fieldset/Fieldset.vue_vue_type_script_setup_true_lang.js +138 -0
- package/dist/primitives/Fieldset/Fieldset.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/primitives/FileUpload/FileUpload.js +7 -0
- package/dist/primitives/FileUpload/FileUpload.js.map +1 -0
- package/dist/primitives/FileUpload/FileUpload.vue.d.ts +132 -0
- package/dist/primitives/FileUpload/FileUpload.vue.d.ts.map +1 -0
- package/dist/primitives/FileUpload/FileUpload.vue_vue_type_script_setup_true_lang.js +359 -0
- package/dist/primitives/FileUpload/FileUpload.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/primitives/HoverCard/HoverCard.js +7 -0
- package/dist/primitives/HoverCard/HoverCard.js.map +1 -0
- package/dist/primitives/HoverCard/HoverCard.vue.d.ts +68 -0
- package/dist/primitives/HoverCard/HoverCard.vue.d.ts.map +1 -0
- package/dist/primitives/HoverCard/HoverCard.vue_vue_type_script_setup_true_lang.js +62 -0
- package/dist/primitives/HoverCard/HoverCard.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/primitives/IconButton/IconButton.js +7 -0
- package/dist/primitives/IconButton/IconButton.js.map +1 -0
- package/dist/primitives/IconButton/IconButton.vue.d.ts +45 -0
- package/dist/primitives/IconButton/IconButton.vue.d.ts.map +1 -0
- package/dist/primitives/IconButton/IconButton.vue_vue_type_script_setup_true_lang.js +58 -0
- package/dist/primitives/IconButton/IconButton.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/primitives/Indicator/Indicator.js +7 -0
- package/dist/primitives/Indicator/Indicator.js.map +1 -0
- package/dist/primitives/Indicator/Indicator.vue.d.ts +144 -0
- package/dist/primitives/Indicator/Indicator.vue.d.ts.map +1 -0
- package/dist/primitives/Indicator/Indicator.vue_vue_type_script_setup_true_lang.js +198 -0
- package/dist/primitives/Indicator/Indicator.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/primitives/Link/Link.js +7 -0
- package/dist/primitives/Link/Link.js.map +1 -0
- package/dist/primitives/Link/Link.vue.d.ts +46 -0
- package/dist/primitives/Link/Link.vue.d.ts.map +1 -0
- package/dist/primitives/Link/Link.vue_vue_type_script_setup_true_lang.js +85 -0
- package/dist/primitives/Link/Link.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/primitives/Menubar/Menubar.js.map +1 -1
- package/dist/primitives/Menubar/Menubar.vue.d.ts.map +1 -1
- package/dist/primitives/Menubar/Menubar.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/primitives/Menubar/Menubar.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/primitives/NumberField/NumberField.js +2 -2
- package/dist/primitives/NumberField/NumberField.js.map +1 -1
- package/dist/primitives/NumberField/NumberField.vue.d.ts +86 -25
- package/dist/primitives/NumberField/NumberField.vue.d.ts.map +1 -1
- package/dist/primitives/NumberField/NumberField.vue_vue_type_script_setup_true_lang.js +83 -39
- package/dist/primitives/NumberField/NumberField.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/primitives/OtpInput/OtpInput.js +7 -0
- package/dist/primitives/OtpInput/OtpInput.js.map +1 -0
- package/dist/primitives/OtpInput/OtpInput.vue.d.ts +110 -0
- package/dist/primitives/OtpInput/OtpInput.vue.d.ts.map +1 -0
- package/dist/primitives/OtpInput/OtpInput.vue_vue_type_script_setup_true_lang.js +130 -0
- package/dist/primitives/OtpInput/OtpInput.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/primitives/Pagination/Pagination.js +7 -0
- package/dist/primitives/Pagination/Pagination.js.map +1 -0
- package/dist/primitives/Pagination/Pagination.vue.d.ts +143 -0
- package/dist/primitives/Pagination/Pagination.vue.d.ts.map +1 -0
- package/dist/primitives/Pagination/Pagination.vue_vue_type_script_setup_true_lang.js +231 -0
- package/dist/primitives/Pagination/Pagination.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/primitives/Progress/Progress.js +2 -2
- package/dist/primitives/Progress/Progress.js.map +1 -1
- package/dist/primitives/Progress/Progress.vue.d.ts +81 -15
- package/dist/primitives/Progress/Progress.vue.d.ts.map +1 -1
- package/dist/primitives/Progress/Progress.vue_vue_type_script_setup_true_lang.js +88 -22
- package/dist/primitives/Progress/Progress.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/primitives/RadialProgress/RadialProgress.js +7 -0
- package/dist/primitives/RadialProgress/RadialProgress.js.map +1 -0
- package/dist/primitives/RadialProgress/RadialProgress.vue.d.ts +96 -0
- package/dist/primitives/RadialProgress/RadialProgress.vue.d.ts.map +1 -0
- package/dist/primitives/RadialProgress/RadialProgress.vue_vue_type_script_setup_true_lang.js +189 -0
- package/dist/primitives/RadialProgress/RadialProgress.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/primitives/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/primitives/RadioGroup/RadioGroup.vue.d.ts +7 -7
- package/dist/primitives/RadioGroup/RadioGroup.vue.d.ts.map +1 -1
- package/dist/primitives/RadioGroup/RadioGroup.vue_vue_type_script_setup_true_lang.js +26 -9
- package/dist/primitives/RadioGroup/RadioGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/primitives/Rating/Rating.js +7 -0
- package/dist/primitives/Rating/Rating.js.map +1 -0
- package/dist/primitives/Rating/Rating.vue.d.ts +113 -0
- package/dist/primitives/Rating/Rating.vue.d.ts.map +1 -0
- package/dist/primitives/Rating/Rating.vue_vue_type_script_setup_true_lang.js +282 -0
- package/dist/primitives/Rating/Rating.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/primitives/ScrollArea/ScrollArea.js +7 -0
- package/dist/primitives/ScrollArea/ScrollArea.js.map +1 -0
- package/dist/primitives/ScrollArea/ScrollArea.vue.d.ts +25 -0
- package/dist/primitives/ScrollArea/ScrollArea.vue.d.ts.map +1 -0
- package/dist/primitives/ScrollArea/ScrollArea.vue_vue_type_script_setup_true_lang.js +45 -0
- package/dist/primitives/ScrollArea/ScrollArea.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/primitives/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/primitives/SegmentedControl/SegmentedControl.vue.d.ts +5 -5
- package/dist/primitives/SegmentedControl/SegmentedControl.vue.d.ts.map +1 -1
- package/dist/primitives/SegmentedControl/SegmentedControl.vue_vue_type_script_setup_true_lang.js +51 -8
- package/dist/primitives/SegmentedControl/SegmentedControl.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/primitives/Select/Select.js.map +1 -1
- package/dist/primitives/Select/Select.vue.d.ts +10 -10
- package/dist/primitives/Select/Select.vue.d.ts.map +1 -1
- package/dist/primitives/Select/Select.vue_vue_type_script_setup_true_lang.js +105 -52
- package/dist/primitives/Select/Select.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/primitives/Skeleton/Skeleton.vue.d.ts +1 -1
- package/dist/primitives/Slider/Slider.js.map +1 -1
- package/dist/primitives/Slider/Slider.vue.d.ts +24 -4
- package/dist/primitives/Slider/Slider.vue.d.ts.map +1 -1
- package/dist/primitives/Slider/Slider.vue_vue_type_script_setup_true_lang.js +79 -9
- package/dist/primitives/Slider/Slider.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/primitives/SpeedDial/SpeedDial.js +7 -0
- package/dist/primitives/SpeedDial/SpeedDial.js.map +1 -0
- package/dist/primitives/SpeedDial/SpeedDial.vue.d.ts +58 -0
- package/dist/primitives/SpeedDial/SpeedDial.vue.d.ts.map +1 -0
- package/dist/primitives/SpeedDial/SpeedDial.vue_vue_type_script_setup_true_lang.js +175 -0
- package/dist/primitives/SpeedDial/SpeedDial.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/primitives/Stepper/Stepper.js +7 -0
- package/dist/primitives/Stepper/Stepper.js.map +1 -0
- package/dist/primitives/Stepper/Stepper.vue.d.ts +119 -0
- package/dist/primitives/Stepper/Stepper.vue.d.ts.map +1 -0
- package/dist/primitives/Stepper/Stepper.vue_vue_type_script_setup_true_lang.js +202 -0
- package/dist/primitives/Stepper/Stepper.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/primitives/Switch/Switch.js.map +1 -1
- package/dist/primitives/Switch/Switch.vue.d.ts +13 -3
- package/dist/primitives/Switch/Switch.vue.d.ts.map +1 -1
- package/dist/primitives/Switch/Switch.vue_vue_type_script_setup_true_lang.js +34 -5
- package/dist/primitives/Switch/Switch.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/primitives/Tabs/Tabs.js.map +1 -1
- package/dist/primitives/Tabs/Tabs.vue.d.ts.map +1 -1
- package/dist/primitives/Tabs/Tabs.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/primitives/Tabs/Tabs.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/primitives/TagsInput/TagsInput.js +7 -0
- package/dist/primitives/TagsInput/TagsInput.js.map +1 -0
- package/dist/primitives/TagsInput/TagsInput.vue.d.ts +156 -0
- package/dist/primitives/TagsInput/TagsInput.vue.d.ts.map +1 -0
- package/dist/primitives/TagsInput/TagsInput.vue_vue_type_script_setup_true_lang.js +387 -0
- package/dist/primitives/TagsInput/TagsInput.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/primitives/TextField/TextField.js +2 -2
- package/dist/primitives/TextField/TextField.js.map +1 -1
- package/dist/primitives/TextField/TextField.vue.d.ts +119 -10
- package/dist/primitives/TextField/TextField.vue.d.ts.map +1 -1
- package/dist/primitives/TextField/TextField.vue_vue_type_script_setup_true_lang.js +270 -21
- package/dist/primitives/TextField/TextField.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/primitives/Textarea/Textarea.js +2 -2
- package/dist/primitives/Textarea/Textarea.js.map +1 -1
- package/dist/primitives/Textarea/Textarea.vue.d.ts +114 -14
- package/dist/primitives/Textarea/Textarea.vue.d.ts.map +1 -1
- package/dist/primitives/Textarea/Textarea.vue_vue_type_script_setup_true_lang.js +216 -20
- package/dist/primitives/Textarea/Textarea.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/primitives/TimePicker/TimePicker.js +7 -0
- package/dist/primitives/TimePicker/TimePicker.js.map +1 -0
- package/dist/primitives/TimePicker/TimePicker.vue.d.ts +111 -0
- package/dist/primitives/TimePicker/TimePicker.vue.d.ts.map +1 -0
- package/dist/primitives/TimePicker/TimePicker.vue_vue_type_script_setup_true_lang.js +185 -0
- package/dist/primitives/TimePicker/TimePicker.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/primitives/Toast/Toast.js +2 -1
- package/dist/primitives/Toast/Toast.js.map +1 -1
- package/dist/primitives/Toast/Toast.vue.d.ts +29 -3
- package/dist/primitives/Toast/Toast.vue.d.ts.map +1 -1
- package/dist/primitives/Toast/Toast.vue_vue_type_script_setup_true_lang.js +17 -7
- package/dist/primitives/Toast/Toast.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/primitives/Toast/ToastItem.js +2 -2
- package/dist/primitives/Toast/ToastItem.js.map +1 -1
- package/dist/primitives/Toast/ToastItem.vue.d.ts +69 -12
- package/dist/primitives/Toast/ToastItem.vue.d.ts.map +1 -1
- package/dist/primitives/Toast/ToastItem.vue_vue_type_script_setup_true_lang.js +23 -23
- package/dist/primitives/Toast/ToastItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/primitives/Tooltip/Tooltip.vue.d.ts +1 -1
- package/dist/primitives/Tooltip/Tooltip.vue.d.ts.map +1 -1
- package/dist/primitives/WindowControls/WindowControls.js +2 -2
- package/dist/primitives/WindowControls/WindowControls.js.map +1 -1
- package/dist/primitives/WindowControls/WindowControls.vue.d.ts +66 -10
- package/dist/primitives/WindowControls/WindowControls.vue.d.ts.map +1 -1
- package/dist/primitives/WindowControls/WindowControls.vue_vue_type_script_setup_true_lang.js +23 -13
- package/dist/primitives/WindowControls/WindowControls.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/styles/global.css +116 -17
- package/dist/styles/theme.contrast.test.ts +460 -0
- package/dist/styles/theme.css +239 -41
- package/dist/theme.js +171 -0
- package/dist/theme.js.map +1 -0
- package/package.json +14 -4
- package/dist/icons/BrandMark.d.ts +0 -18
- package/dist/icons/BrandMark.d.ts.map +0 -1
- package/dist/icons/BrandMark.js +0 -47
- package/dist/icons/BrandMark.js.map +0 -1
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { optional } from "../../lib/props.js";
|
|
3
|
+
import { useLabels } from "../../lib/labels.js";
|
|
4
|
+
import { useSplitAttrs } from "../../lib/attrs.js";
|
|
5
|
+
import { buttonVariants } from "../Button/Button.vue_vue_type_script_setup_true_lang.js";
|
|
6
|
+
import { ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight } from "@lucide/vue";
|
|
7
|
+
import { Fragment, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeProps, nextTick, normalizeClass, openBlock, renderList, toDisplayString, unref, withCtx } from "vue";
|
|
8
|
+
import { PaginationEllipsis, PaginationFirst, PaginationLast, PaginationList, PaginationListItem, PaginationNext, PaginationPrev, PaginationRoot } from "reka-ui";
|
|
9
|
+
import { cva } from "class-variance-authority";
|
|
10
|
+
//#region src/primitives/Pagination/Pagination.vue?vue&type=script&setup=true&lang.ts
|
|
11
|
+
/**
|
|
12
|
+
* Pagination — moving through a paged result set, one page at a time or by
|
|
13
|
+
* jumping to a numbered one.
|
|
14
|
+
*
|
|
15
|
+
* It renders **buttons, never links**. Loom cannot know whether a consumer's
|
|
16
|
+
* pages are addressable URLs, and an `<a>` with no `href` is not a link at
|
|
17
|
+
* all — it is a div that lies to a screen reader and drops out of the tab
|
|
18
|
+
* order. A product whose pages are real, crawlable URLs wants its own
|
|
19
|
+
* `<a href>` row instead of this component; nothing here can be made to
|
|
20
|
+
* produce one.
|
|
21
|
+
*
|
|
22
|
+
* Reach for a different control when the list is not paged: an infinite feed
|
|
23
|
+
* wants a "load more" button, and a long list a reader scans rather than
|
|
24
|
+
* indexes wants a virtualised scroller.
|
|
25
|
+
*
|
|
26
|
+
* Built on Reka UI's Pagination, which owns the arithmetic — the page count,
|
|
27
|
+
* the sliding window of numbers around the current page, and where the
|
|
28
|
+
* ellipses fall. That window is fiddly enough at the boundaries that
|
|
29
|
+
* recomputing it here would only be a second, subtly different answer.
|
|
30
|
+
*/
|
|
31
|
+
var _hoisted_1 = { class: "sr-only" };
|
|
32
|
+
/**
|
|
33
|
+
* Loom's English, co-located with the component so it tree-shakes with it: a
|
|
34
|
+
* consumer who never imports Pagination ships none of these bytes.
|
|
35
|
+
*
|
|
36
|
+
* Exported so a host can build a partial vocabulary against the real thing
|
|
37
|
+
* rather than a transcription of it.
|
|
38
|
+
*/
|
|
39
|
+
var PAGINATION_LABELS = {
|
|
40
|
+
nav: "Pagination",
|
|
41
|
+
first: "First page",
|
|
42
|
+
previous: "Previous page",
|
|
43
|
+
next: "Next page",
|
|
44
|
+
last: "Last page",
|
|
45
|
+
page: ({ page }) => `Page ${String(page)}`,
|
|
46
|
+
position: ({ page, pageCount }) => `Page ${String(page)} of ${String(pageCount)}`,
|
|
47
|
+
ellipsis: "More pages"
|
|
48
|
+
};
|
|
49
|
+
var paginationVariants = cva("inline-flex items-center", {
|
|
50
|
+
variants: { variant: {
|
|
51
|
+
full: "gap-1",
|
|
52
|
+
compact: "gap-2",
|
|
53
|
+
simple: "gap-1"
|
|
54
|
+
} },
|
|
55
|
+
defaultVariants: { variant: "full" }
|
|
56
|
+
});
|
|
57
|
+
var Pagination_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
58
|
+
inheritAttrs: false,
|
|
59
|
+
__name: "Pagination",
|
|
60
|
+
props: {
|
|
61
|
+
page: {},
|
|
62
|
+
total: {},
|
|
63
|
+
itemsPerPage: { default: 10 },
|
|
64
|
+
variant: { default: "full" },
|
|
65
|
+
siblingCount: { default: 1 },
|
|
66
|
+
showEdges: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: true
|
|
69
|
+
},
|
|
70
|
+
disabled: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
default: false
|
|
73
|
+
},
|
|
74
|
+
labels: {}
|
|
75
|
+
},
|
|
76
|
+
emits: ["update:page"],
|
|
77
|
+
setup(__props, { emit: __emit }) {
|
|
78
|
+
const props = __props;
|
|
79
|
+
const emit = __emit;
|
|
80
|
+
const text = useLabels("pagination", PAGINATION_LABELS, () => props.labels);
|
|
81
|
+
const { attrs, rest: navAttrs } = useSplitAttrs();
|
|
82
|
+
const edgeClass = cn(buttonVariants({
|
|
83
|
+
variant: "ghost",
|
|
84
|
+
size: "icon-sm"
|
|
85
|
+
}), "disabled:cursor-not-allowed disabled:opacity-50");
|
|
86
|
+
function pageClass(selected) {
|
|
87
|
+
return cn(buttonVariants({
|
|
88
|
+
variant: selected ? "primary" : "ghost",
|
|
89
|
+
size: "sm"
|
|
90
|
+
}), "min-w-8 px-2 tabular", selected ? "disabled:cursor-not-allowed disabled:bg-primary-muted disabled:text-primary disabled:shadow-none" : "disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground");
|
|
91
|
+
}
|
|
92
|
+
/** Which edge control stands in for which, when the one that was pressed goes away. */
|
|
93
|
+
const MIRROR = {
|
|
94
|
+
first: "last",
|
|
95
|
+
prev: "next",
|
|
96
|
+
next: "prev",
|
|
97
|
+
last: "first"
|
|
98
|
+
};
|
|
99
|
+
let pressed = null;
|
|
100
|
+
function rememberKeyboardPress(event) {
|
|
101
|
+
const target = event.target;
|
|
102
|
+
pressed = event.detail === 0 ? target?.closest("button") ?? null : null;
|
|
103
|
+
}
|
|
104
|
+
function handOffFocus() {
|
|
105
|
+
const origin = pressed;
|
|
106
|
+
pressed = null;
|
|
107
|
+
if (!origin?.disabled) return;
|
|
108
|
+
const active = document.activeElement;
|
|
109
|
+
if (active !== origin && active !== document.body) return;
|
|
110
|
+
const nav = origin.closest("nav");
|
|
111
|
+
if (!nav) return;
|
|
112
|
+
const mirror = MIRROR[origin.getAttribute("data-edge") ?? ""];
|
|
113
|
+
(nav.querySelector("[aria-current=\"page\"]:not([disabled])") ?? (mirror ? nav.querySelector(`[data-edge="${mirror}"]:not([disabled])`) : null))?.focus();
|
|
114
|
+
}
|
|
115
|
+
function onPageChange(value) {
|
|
116
|
+
emit("update:page", value);
|
|
117
|
+
nextTick(handOffFocus);
|
|
118
|
+
}
|
|
119
|
+
return (_ctx, _cache) => {
|
|
120
|
+
return openBlock(), createBlock(unref(PaginationRoot), mergeProps({
|
|
121
|
+
...unref(navAttrs),
|
|
122
|
+
...unref(optional)({ page: __props.page })
|
|
123
|
+
}, {
|
|
124
|
+
total: __props.total,
|
|
125
|
+
"items-per-page": __props.itemsPerPage,
|
|
126
|
+
"sibling-count": __props.siblingCount,
|
|
127
|
+
"show-edges": __props.showEdges,
|
|
128
|
+
disabled: __props.disabled,
|
|
129
|
+
"aria-label": unref(text).nav,
|
|
130
|
+
class: unref(cn)(unref(paginationVariants)({ variant: __props.variant }), unref(attrs).class),
|
|
131
|
+
onClick: rememberKeyboardPress,
|
|
132
|
+
"onUpdate:page": onPageChange
|
|
133
|
+
}), {
|
|
134
|
+
default: withCtx(({ page: current, pageCount }) => [
|
|
135
|
+
__props.variant === "full" ? (openBlock(), createBlock(unref(PaginationFirst), {
|
|
136
|
+
key: 0,
|
|
137
|
+
"data-edge": "first",
|
|
138
|
+
"aria-label": unref(text).first,
|
|
139
|
+
class: normalizeClass(unref(edgeClass))
|
|
140
|
+
}, {
|
|
141
|
+
default: withCtx(() => [createVNode(unref(ChevronsLeft), {
|
|
142
|
+
class: "h-4 w-4",
|
|
143
|
+
"aria-hidden": "true"
|
|
144
|
+
})]),
|
|
145
|
+
_: 1
|
|
146
|
+
}, 8, ["aria-label", "class"])) : createCommentVNode("", true),
|
|
147
|
+
createVNode(unref(PaginationPrev), {
|
|
148
|
+
"data-edge": "prev",
|
|
149
|
+
"aria-label": unref(text).previous,
|
|
150
|
+
class: normalizeClass(unref(edgeClass))
|
|
151
|
+
}, {
|
|
152
|
+
default: withCtx(() => [createVNode(unref(ChevronLeft), {
|
|
153
|
+
class: "h-4 w-4",
|
|
154
|
+
"aria-hidden": "true"
|
|
155
|
+
})]),
|
|
156
|
+
_: 1
|
|
157
|
+
}, 8, ["aria-label", "class"]),
|
|
158
|
+
__props.variant === "full" ? (openBlock(), createBlock(unref(PaginationList), {
|
|
159
|
+
key: 1,
|
|
160
|
+
class: "flex items-center gap-1"
|
|
161
|
+
}, {
|
|
162
|
+
default: withCtx(({ items }) => [(openBlock(true), createElementBlock(Fragment, null, renderList(items, (item, index) => {
|
|
163
|
+
return openBlock(), createElementBlock(Fragment, { key: item.type === "page" ? `page-${item.value}` : `ellipsis-${index}` }, [item.type === "page" ? (openBlock(), createBlock(unref(PaginationListItem), {
|
|
164
|
+
key: 0,
|
|
165
|
+
value: item.value,
|
|
166
|
+
"aria-label": unref(text).page({ page: item.value }),
|
|
167
|
+
class: normalizeClass(pageClass(item.value === current))
|
|
168
|
+
}, null, 8, [
|
|
169
|
+
"value",
|
|
170
|
+
"aria-label",
|
|
171
|
+
"class"
|
|
172
|
+
])) : (openBlock(), createBlock(unref(PaginationEllipsis), {
|
|
173
|
+
key: 1,
|
|
174
|
+
as: "span",
|
|
175
|
+
class: "inline-flex h-8 min-w-8 select-none items-center justify-center text-sm text-muted-foreground"
|
|
176
|
+
}, {
|
|
177
|
+
default: withCtx(() => [_cache[0] || (_cache[0] = createElementVNode("span", { "aria-hidden": "true" }, "…", -1)), createElementVNode("span", _hoisted_1, toDisplayString(unref(text).ellipsis), 1)]),
|
|
178
|
+
_: 1
|
|
179
|
+
}))], 64);
|
|
180
|
+
}), 128))]),
|
|
181
|
+
_: 2
|
|
182
|
+
}, 1024)) : createCommentVNode("", true),
|
|
183
|
+
__props.variant !== "full" ? (openBlock(), createElementBlock("span", {
|
|
184
|
+
key: 2,
|
|
185
|
+
role: "status",
|
|
186
|
+
class: normalizeClass(__props.variant === "compact" ? "px-1 text-sm tabular text-muted-foreground" : "sr-only")
|
|
187
|
+
}, toDisplayString(unref(text).position({
|
|
188
|
+
page: current,
|
|
189
|
+
pageCount
|
|
190
|
+
})), 3)) : createCommentVNode("", true),
|
|
191
|
+
createVNode(unref(PaginationNext), {
|
|
192
|
+
"data-edge": "next",
|
|
193
|
+
"aria-label": unref(text).next,
|
|
194
|
+
class: normalizeClass(unref(edgeClass))
|
|
195
|
+
}, {
|
|
196
|
+
default: withCtx(() => [createVNode(unref(ChevronRight), {
|
|
197
|
+
class: "h-4 w-4",
|
|
198
|
+
"aria-hidden": "true"
|
|
199
|
+
})]),
|
|
200
|
+
_: 1
|
|
201
|
+
}, 8, ["aria-label", "class"]),
|
|
202
|
+
__props.variant === "full" ? (openBlock(), createBlock(unref(PaginationLast), {
|
|
203
|
+
key: 3,
|
|
204
|
+
"data-edge": "last",
|
|
205
|
+
"aria-label": unref(text).last,
|
|
206
|
+
class: normalizeClass(unref(edgeClass))
|
|
207
|
+
}, {
|
|
208
|
+
default: withCtx(() => [createVNode(unref(ChevronsRight), {
|
|
209
|
+
class: "h-4 w-4",
|
|
210
|
+
"aria-hidden": "true"
|
|
211
|
+
})]),
|
|
212
|
+
_: 1
|
|
213
|
+
}, 8, ["aria-label", "class"])) : createCommentVNode("", true)
|
|
214
|
+
]),
|
|
215
|
+
_: 1
|
|
216
|
+
}, 16, [
|
|
217
|
+
"total",
|
|
218
|
+
"items-per-page",
|
|
219
|
+
"sibling-count",
|
|
220
|
+
"show-edges",
|
|
221
|
+
"disabled",
|
|
222
|
+
"aria-label",
|
|
223
|
+
"class"
|
|
224
|
+
]);
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
//#endregion
|
|
229
|
+
export { PAGINATION_LABELS, Pagination_vue_vue_type_script_setup_true_lang_default as default, paginationVariants };
|
|
230
|
+
|
|
231
|
+
//# sourceMappingURL=Pagination.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Pagination.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/primitives/Pagination/Pagination.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { cva } from \"class-variance-authority\";\nimport type { LabelOf } from \"../../lib/labels\";\n\n/**\n * Everything this control publishes to assistive technology — including the six\n * names Reka would otherwise supply in English of its own accord.\n *\n * `first`, `previous`, `next`, `last` and `page` are not decoration. Reka's\n * `PaginationFirst` and its siblings write `aria-label=\"First Page\"` into their\n * own vnode props and expose no prop for it; `PaginationListItem` writes\n * `` `Page ${value}` ``. A binding on the Loom side arrives as a fallthrough\n * attribute, which Vue merges onto the root vnode *after* the render function\n * produced it, and `mergeProps` is last-write-wins for everything that is not\n * `class`, `style` or `on*`. So these replace Reka's rather than competing with\n * it — the same mechanism `DateRangePicker`'s cell triggers have relied on\n * since they landed, and `Pagination.test.ts` pins it by asserting the\n * *capitalisation* Loom uses and Reka does not.\n *\n * `page` and `position` take the numbers rather than a formatted string, so an\n * `ar-EG` host reaches `Intl.NumberFormat` for Eastern Arabic digits and a\n * language that orders \"of\" differently can order it differently. See\n * `LabelOf` in `src/lib/labels.ts`.\n */\nexport interface PaginationLabels {\n /**\n * The `<nav>` landmark's own name. A page commonly carries two of these —\n * above and below a table — and two `<nav>`s named the same thing are as\n * confusing to a screen reader as two named nothing, so give each one a name\n * that says which it is.\n */\n readonly nav: string;\n /** The button that jumps to page one. */\n readonly first: string;\n /** The button that steps back one page. */\n readonly previous: string;\n /** The button that steps on one page. */\n readonly next: string;\n /** The button that jumps to the last page. */\n readonly last: string;\n /** One numbered button in the `full` variant, named for the page it reaches. */\n readonly page: LabelOf<{ page: number }>;\n /** The position readout the `compact` and `simple` variants publish. */\n readonly position: LabelOf<{ page: number; pageCount: number }>;\n /** The ellipsis standing in for the pages the window had no room for. */\n readonly ellipsis: string;\n}\n\n/**\n * Loom's English, co-located with the component so it tree-shakes with it: a\n * consumer who never imports Pagination ships none of these bytes.\n *\n * Exported so a host can build a partial vocabulary against the real thing\n * rather than a transcription of it.\n */\nexport const PAGINATION_LABELS: PaginationLabels = {\n nav: \"Pagination\",\n first: \"First page\",\n previous: \"Previous page\",\n next: \"Next page\",\n last: \"Last page\",\n page: ({ page }) => `Page ${String(page)}`,\n position: ({ page, pageCount }) => `Page ${String(page)} of ${String(pageCount)}`,\n ellipsis: \"More pages\",\n};\n\n/**\n * How much of the paging apparatus is rendered. All three drive the same\n * model and carry the same semantics — they differ only in how much room the\n * navigation is worth on the surface it sits on.\n *\n * • `full` — the numbered row with ellipses, plus first/prev/next/last.\n * For a table where jumping to a known page is a real task.\n * • `compact` — prev, \"Page 3 of 12\", next. The position stays legible\n * without spending a whole row on it.\n * • `simple` — prev and next alone, for a feed nobody navigates by index.\n */\nexport type PaginationVariant = \"full\" | \"compact\" | \"simple\";\n\nexport const paginationVariants = cva(\"inline-flex items-center\", {\n // `satisfies` keeps the two halves honest: the union above is the name a\n // consumer imports and the documentation prints, the map below is the\n // classes. Adding a member to one and not the other stops compiling.\n variants: {\n variant: {\n // The numbered row is a run of same-size squares and reads as one strip\n // at gap-1; the compact form is a sentence between two controls and\n // needs the wider gap to stop reading as a third button.\n full: \"gap-1\",\n compact: \"gap-2\",\n simple: \"gap-1\",\n } satisfies Record<PaginationVariant, string>,\n },\n defaultVariants: { variant: \"full\" },\n});\n</script>\n\n<script setup lang=\"ts\">\nimport { nextTick } from \"vue\";\nimport {\n PaginationRoot,\n PaginationList,\n PaginationListItem,\n PaginationFirst,\n PaginationPrev,\n PaginationNext,\n PaginationLast,\n PaginationEllipsis,\n} from \"reka-ui\";\nimport { ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight } from \"@lucide/vue\";\nimport { buttonVariants } from \"../Button/Button.vue\";\nimport { cn } from \"../../lib/cn\";\nimport { optional } from \"../../lib/props\";\nimport { useSplitAttrs } from \"../../lib/attrs\";\nimport { useLabels, type LabelOverrides } from \"../../lib/labels\";\n\n/**\n * Pagination — moving through a paged result set, one page at a time or by\n * jumping to a numbered one.\n *\n * It renders **buttons, never links**. Loom cannot know whether a consumer's\n * pages are addressable URLs, and an `<a>` with no `href` is not a link at\n * all — it is a div that lies to a screen reader and drops out of the tab\n * order. A product whose pages are real, crawlable URLs wants its own\n * `<a href>` row instead of this component; nothing here can be made to\n * produce one.\n *\n * Reach for a different control when the list is not paged: an infinite feed\n * wants a \"load more\" button, and a long list a reader scans rather than\n * indexes wants a virtualised scroller.\n *\n * Built on Reka UI's Pagination, which owns the arithmetic — the page count,\n * the sliding window of numbers around the current page, and where the\n * ellipses fall. That window is fiddly enough at the boundaries that\n * recomputing it here would only be a second, subtly different answer.\n */\nconst props = withDefaults(\n defineProps<{\n /**\n * The current page, 1-based. Leave it unset to let the component keep its\n * own page and simply report changes.\n */\n page?: number;\n /** How many items exist in total, across every page. */\n total: number;\n /** How many items one page holds. With `total`, this is what fixes the page count. */\n itemsPerPage?: number;\n /** How much of the control renders: the numbered row, a position readout, or arrows alone. */\n variant?: PaginationVariant;\n /** How many numbers sit either side of the current page, in the `full` variant. */\n siblingCount?: number;\n /** Pins page 1 and the last page into the numbered row, with ellipses standing in for the gap. */\n showEdges?: boolean;\n /** Unavailable: every control dims and refuses to move the page. */\n disabled?: boolean;\n /**\n * Names for everything this control says out loud, as any subset of\n * `PaginationLabels` — the rest stay as the host's `provideLoomLabels`\n * vocabulary left them, and then as Loom's English.\n *\n * This is the per-instance correction, not the place to localise an\n * application: the case it exists for is the two paginations above and\n * below one table, which must not share `labels.nav`.\n */\n labels?: LabelOverrides<PaginationLabels>;\n }>(),\n {\n itemsPerPage: 10,\n variant: \"full\",\n siblingCount: 1,\n // Reka defaults this off, which drops the ellipses entirely and lets the\n // numbered row float free of both ends. The anchored form is what people\n // mean by a full pagination, so Loom turns it on.\n showEdges: true,\n disabled: false,\n },\n);\n\nconst emit = defineEmits<{\n /** The 1-based page the reader asked for. A controlled host decides whether to honour it. */\n \"update:page\": [page: number];\n}>();\n\n// `text`, not `labels`: the prop of that name is one of the three sources this\n// resolves, and a template reading the raw prop would be reading the overrides\n// rather than the answer.\nconst text = useLabels(\"pagination\", PAGINATION_LABELS, () => props.labels);\n\n// The root renders the `<nav>`, so every fallthrough attribute belongs on it —\n// there is no second node they could sensibly describe. `class` is pulled out\n// of that spread and merged through `cn()` instead: spreading it alongside the\n// nav's own `:class` only concatenates the two lists, so a caller's `gap-2`\n// would win or lose depending on which utility Tailwind happened to emit last.\ndefineOptions({ inheritAttrs: false });\nconst { attrs, rest: navAttrs } = useSplitAttrs();\n\n// The edge controls keep the dim, and they are the one place in this component\n// where it is still the right answer: their whole content is a chevron marked\n// `aria-hidden`, so there is no text for the alpha to take down with it and the\n// name a screen reader announces is an `aria-label` no paint can reach. WCAG\n// exempts an inactive control from 1.4.11 besides. Prev and First sit disabled\n// on page 1 for as long as a reader is on it, which is the other half of the\n// argument: a faded chevron is the conventional reading of \"no further this\n// way\", where a drained plate would draw the eye to the control that cannot be\n// used.\nconst edgeClass = cn(\n buttonVariants({ variant: \"ghost\", size: \"icon-sm\" }),\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n);\n\n// The page buttons borrow Button's own variants rather than restating its\n// press language, so the row cannot drift from every other pressable thing in\n// the library. `min-w-8` with tabular figures is what keeps the row from\n// reflowing as the numbers under it grow a digit.\nfunction pageClass(selected: boolean): string {\n return cn(\n buttonVariants({ variant: selected ? \"primary\" : \"ghost\", size: \"sm\" }),\n \"min-w-8 px-2 tabular\",\n // No `opacity` here, unlike the edges above, because this button's content\n // *is* text — the page number, the one thing a reader needs from a pager\n // that is briefly out of service. `disabled:opacity-50` composited the\n // ghost variant's `--color-muted-foreground` down to 2.05:1 and the current\n // page's white-on-primary label down to 2.48:1; halving the alpha more than\n // halves the contrast. Unavailability is painted in measured colours\n // instead.\n //\n // The two branches drain to different wells on purpose, which is Chip's\n // rule applied to a row of numbers: an unselected page falls to the neutral\n // well at 4.67:1, and the current page keeps the primary wash it already wears\n // at 6.84:1. Which page a reader is on is information, and a disabled pager\n // that forgets it has answered the question by refusing to answer it.\n selected\n ? \"disabled:cursor-not-allowed disabled:bg-primary-muted disabled:text-primary disabled:shadow-none\"\n : \"disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground\",\n );\n}\n\n/** Which edge control stands in for which, when the one that was pressed goes away. */\nconst MIRROR: Record<string, string | undefined> = {\n first: \"last\",\n prev: \"next\",\n next: \"prev\",\n last: \"first\",\n};\n\n// Reka disables Prev/First at page 1 and Next/Last at the last page, and that\n// is the honest state: a control that looks unavailable and still fires is\n// worse than one that is not there at all. The cost is real, though — a\n// browser blurs a button the instant it becomes disabled, so a reader holding\n// Enter on Next arrives at the last page with focus dumped on `<body>` and\n// their place in the document gone.\n//\n// So the control that fired the change hands focus on: to the current page\n// button where the variant has one — which announces \"Page 12, current page\",\n// the very thing the reader was trying to find out — and to its mirror control\n// otherwise, which is the nearest thing still able to move the page.\n//\n// Only for a keyboard activation. `detail === 0` is what separates a click\n// synthesised by Enter or Space from a pointer click, and a pointer user has\n// no focus position to lose; moving focus for them would raise a ring nobody\n// asked for.\nlet pressed: HTMLButtonElement | null = null;\n\nfunction rememberKeyboardPress(event: MouseEvent): void {\n const target = event.target as HTMLElement | null;\n pressed = event.detail === 0 ? (target?.closest<HTMLButtonElement>(\"button\") ?? null) : null;\n}\n\nfunction handOffFocus(): void {\n const origin = pressed;\n pressed = null;\n if (!origin?.disabled) return;\n\n // Only rescue focus that was actually lost. A browser leaves `<body>`\n // focused after disabling the button; jsdom leaves the button itself. Any\n // other active element means the reader has already moved on, and stealing\n // focus back from them would be the worse bug.\n const active = document.activeElement;\n if (active !== origin && active !== document.body) return;\n\n const nav = origin.closest(\"nav\");\n if (!nav) return;\n\n const mirror = MIRROR[origin.getAttribute(\"data-edge\") ?? \"\"];\n const target =\n nav.querySelector<HTMLButtonElement>('[aria-current=\"page\"]:not([disabled])') ??\n (mirror\n ? nav.querySelector<HTMLButtonElement>(`[data-edge=\"${mirror}\"]:not([disabled])`)\n : null);\n target?.focus();\n}\n\nfunction onPageChange(value: number): void {\n emit(\"update:page\", value);\n // After the re-render rather than before it: the button that was pressed\n // only becomes disabled once the new page has been applied.\n void nextTick(handOffFocus);\n}\n</script>\n\n<template>\n <PaginationRoot\n v-slot=\"{ page: current, pageCount }\"\n v-bind=\"{ ...navAttrs, ...optional({ page }) }\"\n :total=\"total\"\n :items-per-page=\"itemsPerPage\"\n :sibling-count=\"siblingCount\"\n :show-edges=\"showEdges\"\n :disabled=\"disabled\"\n :aria-label=\"text.nav\"\n :class=\"cn(paginationVariants({ variant }), attrs.class as string)\"\n @click=\"rememberKeyboardPress\"\n @update:page=\"onPageChange\"\n >\n <!-- Every `:aria-label` from here down replaces one Reka writes in English\n inside its own render function. It reaches the DOM node as a\n fallthrough attribute, which Vue merges last, so it is a replacement\n rather than a second name. Removing one does not fall back to nothing;\n it falls back to Reka's English, which is the failure this whole seam\n exists to close and which no test of Loom's own strings would catch. -->\n <PaginationFirst\n v-if=\"variant === 'full'\"\n data-edge=\"first\"\n :aria-label=\"text.first\"\n :class=\"edgeClass\"\n >\n <ChevronsLeft class=\"h-4 w-4\" aria-hidden=\"true\" />\n </PaginationFirst>\n\n <PaginationPrev data-edge=\"prev\" :aria-label=\"text.previous\" :class=\"edgeClass\">\n <ChevronLeft class=\"h-4 w-4\" aria-hidden=\"true\" />\n </PaginationPrev>\n\n <PaginationList v-if=\"variant === 'full'\" v-slot=\"{ items }\" class=\"flex items-center gap-1\">\n <!-- Keyed by page number, never by index. The row is furniture: a page\n that stays inside the window across a change keeps its own DOM node,\n so nothing remounts, nothing re-animates, and the numbers do not\n shuffle under a reader who has just pressed Next. -->\n <template\n v-for=\"(item, index) in items\"\n :key=\"item.type === 'page' ? `page-${item.value}` : `ellipsis-${index}`\"\n >\n <PaginationListItem\n v-if=\"item.type === 'page'\"\n :value=\"item.value\"\n :aria-label=\"text.page({ page: item.value })\"\n :class=\"pageClass(item.value === current)\"\n />\n <!-- The ellipsis is not a control, so it renders as a span rather than\n Reka's default div-with-a-glyph inside a row of buttons: nothing to\n focus, nothing that looks pressable, and the glyph itself hidden\n from assistive technology because \"horizontal ellipsis\" is not what\n it means. The words are what it means. -->\n <PaginationEllipsis\n v-else\n as=\"span\"\n class=\"inline-flex h-8 min-w-8 select-none items-center justify-center text-sm text-muted-foreground\"\n >\n <span aria-hidden=\"true\">…</span>\n <span class=\"sr-only\">{{ text.ellipsis }}</span>\n </PaginationEllipsis>\n </template>\n </PaginationList>\n\n <!-- The position, for the two variants that have no numbered row to read it\n off. `role=\"status\"` because pressing Next in those variants otherwise\n changes nothing a screen reader would notice — focus stays put and no\n `aria-current` moves. The `full` variant deliberately has no live\n region: its number row already carries the state, and announcing it\n again on top of the focus hand-off below would say everything twice. -->\n <!-- One string rather than three nodes with the numbers between them: a\n language that puts the count before the word, or drops the preposition\n entirely, cannot reorder markup this component emits. `tabular` moves\n from the two number spans to the whole readout, which is the only real\n cost — the \"of\" between them is now tabular too, and the row of digits\n it was steadying is not rendered in either of these variants. -->\n <span\n v-if=\"variant !== 'full'\"\n role=\"status\"\n :class=\"variant === 'compact' ? 'px-1 text-sm tabular text-muted-foreground' : 'sr-only'\"\n >\n {{ text.position({ page: current, pageCount }) }}\n </span>\n\n <PaginationNext data-edge=\"next\" :aria-label=\"text.next\" :class=\"edgeClass\">\n <ChevronRight class=\"h-4 w-4\" aria-hidden=\"true\" />\n </PaginationNext>\n\n <PaginationLast\n v-if=\"variant === 'full'\"\n data-edge=\"last\"\n :aria-label=\"text.last\"\n :class=\"edgeClass\"\n >\n <ChevronsRight class=\"h-4 w-4\" aria-hidden=\"true\" />\n </PaginationLast>\n </PaginationRoot>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDA,IAAa,oBAAsC;CACjD,KAAK;CACL,OAAO;CACP,UAAU;CACV,MAAM;CACN,MAAM;CACN,OAAO,EAAE,WAAW,QAAQ,OAAO,IAAI;CACvC,WAAW,EAAE,MAAM,gBAAgB,QAAQ,OAAO,IAAI,EAAE,MAAM,OAAO,SAAS;CAC9E,UAAU;AACZ;AAeA,IAAa,qBAAqB,IAAI,4BAA4B;CAIhE,UAAU,EACR,SAAS;EAIP,MAAM;EACN,SAAS;EACT,QAAQ;CACV,EACF;CACA,iBAAiB,EAAE,SAAS,OAAO;AACrC,CAAC;;;;;;;;;;;;;;;;;;;;;;EA0CD,MAAM,QAAQ;EA0Cd,MAAM,OAAO;EAQb,MAAM,OAAO,UAAU,cAAc,yBAAyB,MAAM,MAAM;EAQ1E,MAAM,EAAE,OAAO,MAAM,aAAa,cAAc;EAWhD,MAAM,YAAY,GAChB,eAAe;GAAE,SAAS;GAAS,MAAM;EAAU,CAAC,GACpD,iDACF;EAMA,SAAS,UAAU,UAA2B;GAC5C,OAAO,GACL,eAAe;IAAE,SAAS,WAAW,YAAY;IAAS,MAAM;GAAK,CAAC,GACtE,wBAcA,WACI,qGACA,8EACN;EACF;;EAGA,MAAM,SAA6C;GACjD,OAAO;GACP,MAAM;GACN,MAAM;GACN,MAAM;EACR;EAkBA,IAAI,UAAoC;EAExC,SAAS,sBAAsB,OAAyB;GACtD,MAAM,SAAS,MAAM;GACrB,UAAU,MAAM,WAAW,IAAK,QAAQ,QAA2B,QAAQ,KAAK,OAAQ;EAC1F;EAEA,SAAS,eAAqB;GAC5B,MAAM,SAAS;GACf,UAAU;GACV,IAAI,CAAC,QAAQ,UAAU;GAMvB,MAAM,SAAS,SAAS;GACxB,IAAI,WAAW,UAAU,WAAW,SAAS,MAAM;GAEnD,MAAM,MAAM,OAAO,QAAQ,KAAK;GAChC,IAAI,CAAC,KAAK;GAEV,MAAM,SAAS,OAAO,OAAO,aAAa,WAAW,KAAK;GAM1D,CAJE,IAAI,cAAiC,yCAAuC,MAC3E,SACG,IAAI,cAAiC,eAAe,OAAO,mBAAmB,IAC9E,MAAA,EACE,MAAM;EAChB;EAEA,SAAS,aAAa,OAAqB;GACzC,KAAK,eAAe,KAAK;GAGzB,SAAc,YAAY;EAC5B;;GAIE,OAAA,UAAA,GAAA,YA+FiB,MAAA,cAAA,GA/FjB,WA+FiB;IAAA,GA7FF,MAAA,QAAA;IAAQ,GAAK,MAAA,QAAA,CAAQ,CAAA,EAAA,MAAG,QAAA,KAAI,CAAA;GAAA,GAAA;IACxC,OAAO,QAAA;IACP,kBAAgB,QAAA;IAChB,iBAAe,QAAA;IACf,cAAY,QAAA;IACZ,UAAU,QAAA;IACV,cAAY,MAAA,IAAA,CAAI,CAAC;IACjB,OAAO,MAAA,EAAA,CAAE,CAAC,MAAA,kBAAA,CAAkB,CAAA,EAAA,SAAG,QAAA,QAAO,CAAA,GAAK,MAAA,KAAA,CAAK,CAAC,KAAK;IACtD,SAAO;IACP,iBAAa;;IAQd,SAAA,SAOkB,EAAA,MAzBF,SAAS,gBAAS;KAmB1B,QAAA,YAAO,UADf,UAAA,GAAA,YAOkB,MAAA,eAAA,GAAA;;MALhB,aAAU;MACT,cAAY,MAAA,IAAA,CAAI,CAAC;MACjB,OAAK,eAAE,MAAA,SAAA,CAAS;;MAEjB,SAAA,cAAmD,CAAnD,YAAmD,MAAA,YAAA,GAAA;OAArC,OAAM;OAAU,eAAY;;;;KAG5C,YAEiB,MAAA,cAAA,GAAA;MAFD,aAAU;MAAQ,cAAY,MAAA,IAAA,CAAI,CAAC;MAAW,OAAK,eAAE,MAAA,SAAA,CAAS;;MAC5E,SAAA,cAAkD,CAAlD,YAAkD,MAAA,WAAA,GAAA;OAArC,OAAM;OAAU,eAAY;;;;KAGrB,QAAA,YAAO,UAA7B,UAAA,GAAA,YA6BiB,MAAA,cAAA,GAAA;;MA7B4C,OAAM;;MAM/D,SAAA,SAA8B,EANkB,YAAK,EAKvD,UAAA,IAAA,GAAA,mBAuBW,UAAA,MAAA,WAtBe,QAAhB,MAAM,UAAK;OACb,OAAA,UAAA,GAAA,mBAAA,UAAA,EAAA,KAAA,KAAK,SAAI,SAAA,QAAsB,KAAK,UAAK,YAAiB,QAAA,GAAA,CAGxD,KAAK,SAAI,UADjB,UAAA,GAAA,YAKE,MAAA,kBAAA,GAAA;;QAHC,OAAO,KAAK;QACZ,cAAY,MAAA,IAAA,CAAI,CAAC,KAAI,EAAA,MAAS,KAAK,MAAK,CAAA;QACxC,OAAK,eAAE,UAAU,KAAK,UAAU,OAAO,CAAA;;;;;OAO1C,CAAA,MAAA,UAAA,GAAA,YAOqB,MAAA,kBAAA,GAAA;;QALnB,IAAG;QACH,OAAM;;QAEN,SAAA,cAAiC,CAAjC,OAAA,OAAA,OAAA,KAAA,mBAAiC,QAAA,EAA3B,eAAY,OAAM,GAAC,KAAC,EAAA,IAC1B,mBAAgD,QAAhD,YAAgD,gBAAvB,MAAA,IAAA,CAAI,CAAC,QAAQ,GAAA,CAAA,CAAA,CAAA;;;;;;KAkBpC,QAAA,YAAO,UADf,UAAA,GAAA,mBAMO,QAAA;;MAJL,MAAK;MACJ,OAAK,eAAE,QAAA,YAAO,YAAA,+CAAA,SAAA;KAEZ,GAAA,gBAAA,MAAA,IAAA,CAAI,CAAC,SAAQ;MAAA,MAAS;MAAS;KAAS,CAAA,CAAA,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA;KAG7C,YAEiB,MAAA,cAAA,GAAA;MAFD,aAAU;MAAQ,cAAY,MAAA,IAAA,CAAI,CAAC;MAAO,OAAK,eAAE,MAAA,SAAA,CAAS;;MACxE,SAAA,cAAmD,CAAnD,YAAmD,MAAA,YAAA,GAAA;OAArC,OAAM;OAAU,eAAY;;;;KAIpC,QAAA,YAAO,UADf,UAAA,GAAA,YAOiB,MAAA,cAAA,GAAA;;MALf,aAAU;MACT,cAAY,MAAA,IAAA,CAAI,CAAC;MACjB,OAAK,eAAE,MAAA,SAAA,CAAS;;MAEjB,SAAA,cAAoD,CAApD,YAAoD,MAAA,aAAA,GAAA;OAArC,OAAM;OAAU,eAAY"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import Progress_vue_vue_type_script_setup_true_lang_default from "./Progress.vue_vue_type_script_setup_true_lang.js";
|
|
1
|
+
import Progress_vue_vue_type_script_setup_true_lang_default, { PROGRESS_LABELS, progressVariants } from "./Progress.vue_vue_type_script_setup_true_lang.js";
|
|
2
2
|
//#region src/primitives/Progress/Progress.vue
|
|
3
3
|
var Progress_default = Progress_vue_vue_type_script_setup_true_lang_default;
|
|
4
4
|
//#endregion
|
|
5
|
-
export { Progress_default as default };
|
|
5
|
+
export { PROGRESS_LABELS, Progress_default as default, progressVariants };
|
|
6
6
|
|
|
7
7
|
//# sourceMappingURL=Progress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Progress.js","names":[],"sources":["../../../src/primitives/Progress/Progress.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { ProgressRoot, ProgressIndicator } from \"reka-ui\";\nimport { cn } from \"../../lib/cn\";\n\n/**\n * Progress — determinate progress bar for a task whose extent as a percentage\n * is known (upload %, step 3 of 5). `modelValue` null/undefined renders the\n * *indeterminate* state — an empty track, since there is no percentage yet to\n * paint. For a wait of unknown duration with no percentage at all, use\n * Spinner instead of guessing a Progress value.\n *\n * Built on Reka UI's Progress: role=\"progressbar\" + aria-valuenow/min/max set\n * on the root automatically. `ariaLabel`/`ariaLabelledby` are bound onto\n * ProgressRoot (fallthrough overrides Reka's own generated \"`NN%`\" label) so\n * the accessible name describes *what* is loading, not just how much.\n */\nconst props = withDefaults(\n defineProps<{\n /** The completed amount, 0–`max`; `null`/omitted renders indeterminate. */\n modelValue?: number | null;\n /** The value that reads as 100% complete. */\n max?: number;\n /** Accessible name describing the task, overriding Reka's default `NN%` label. */\n ariaLabel?: string;\n /** Accessible name sourced from another element's id, in place of `ariaLabel`. */\n ariaLabelledby?: string;\n }>(),\n {\n max: 100,\n },\n);\n\n/**\n * The value the bar itself is given, clamped into [0, max]; null while\n * indeterminate. The clamp has to happen here rather than only on the way to\n * the transform below: `aria-valuenow` is generated from whatever ProgressRoot\n * receives, so handing it the raw prop announces a number outside the range\n * `aria-valuemin`/`aria-valuemax` declare — \"150 percent\" read out over a bar\n * painted at 100.\n */\nconst value = computed<number | null>(() =>\n props.modelValue === null || props.modelValue === undefined\n ? null\n : Math.min(Math.max(props.modelValue, 0), props.max),\n);\n\n/** Percentage 0–100, derived from the clamped value; null while indeterminate. */\nconst pct = computed<number | null>(() =>\n value.value === null ? null : (value.value / props.max) * 100,\n);\n\ndefineExpose({ pct });\n</script>\n\n<template>\n <ProgressRoot\n :model-value=\"value\"\n :max=\"max\"\n :aria-label=\"ariaLabel\"\n :aria-labelledby=\"ariaLabelledby\"\n class=\"relative h-2 w-full overflow-hidden rounded-full bg-muted\"\n >\n <!-- Determinate: a full-width bar slid left by the remaining percentage\n (transform eased over --duration-slow). Indeterminate: a short segment\n sweeping the track on a loop, since there is no percentage to paint.\n Completion beat: at 100% the fill turns success (Loom dual-force\n law — a finished piece of work reads as done at a glance), eased in\n over the same --duration-slow lane via the background transition. -->\n <ProgressIndicator\n :class=\"\n cn(\n 'h-full',\n pct === 100 ? 'bg-success' : 'bg-primary',\n pct === null && 'w-1/3 animate-progress-indeterminate rounded-full',\n )\n \"\n :style=\"\n pct === null\n ? undefined\n : {\n transition:\n 'transform var(--duration-slow) var(--ease-out), background-color var(--duration-slow) var(--ease-out)',\n transform: `translateX(-${100 - pct}%)`,\n }\n \"\n />\n </ProgressRoot>\n</template>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"Progress.js","names":[],"sources":["../../../src/primitives/Progress/Progress.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { cva } from \"class-variance-authority\";\nimport type { LabelOf } from \"../../lib/labels\";\n\n/**\n * The one thing this bar prints, and the placeholder it prints instead when\n * there is no percentage yet.\n *\n * **`value` takes both raw numbers and no formatting at all.** A hand-built\n * `${Math.round(pct)}%` has already decided three things a component cannot\n * know: that the sign trails the digits — Turkish writes `%42` — that the\n * digits are Western Arabic, and that a percentage is the right reading of the\n * pair at all. Handed `value` and `max`, a host reaches\n * `Intl.NumberFormat(locale, { style: \"percent\" })` for the first two and can\n * answer \"3 of 4 steps\" instead of \"75%\" for the third.\n *\n * The rounding therefore lives in Loom's default rather than in the component,\n * so it is a wording choice a host replaces along with the words.\n */\nexport interface ProgressLabels {\n /** The readout beside the track, from the clamped value and the scale it is out of. */\n readonly value: LabelOf<{ value: number; max: number }>;\n /** What the readout prints while there is no percentage — never a false zero. */\n readonly indeterminate: string;\n}\n\n/**\n * Loom's English, co-located with the component so it tree-shakes with it, and\n * exported so a host can build a partial vocabulary against the real thing.\n */\nexport const PROGRESS_LABELS: ProgressLabels = {\n value: ({ value, max }) => `${String(Math.round((value / max) * 100))}%`,\n indeterminate: \"—\",\n};\n\n/**\n * The track's thickness. Deliberately *not* the shared control-height scale a\n * Select or a TextField uses: a bar is a stroke laid under a heading or inside\n * a table row, never a control a person clicks into, so lining it up with a\n * 36px input would only make it a slab. `md` is the thickness every caller got\n * before this prop existed and stays the default for exactly that reason.\n */\nexport type ProgressSize = \"sm\" | \"md\" | \"lg\";\n\nexport const progressVariants = cva(\"relative w-full overflow-hidden rounded-full bg-muted\", {\n variants: {\n size: {\n sm: \"h-1\",\n md: \"h-2\",\n lg: \"h-3\",\n } satisfies Record<ProgressSize, string>,\n },\n defaultVariants: { size: \"md\" },\n});\n</script>\n\n<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { ProgressRoot, ProgressIndicator } from \"reka-ui\";\nimport { cn } from \"../../lib/cn\";\nimport { useSplitAttrs } from \"../../lib/attrs\";\nimport { useLabels, type LabelOverrides } from \"../../lib/labels\";\n\n/**\n * Progress — determinate progress bar for a task whose extent as a percentage\n * is known (upload %, step 3 of 5). `modelValue` null/undefined renders the\n * *indeterminate* state — an empty track, since there is no percentage yet to\n * paint. For a wait of unknown duration with no percentage at all, use\n * Spinner instead of guessing a Progress value. For the same number drawn as\n * a ring — a dashboard tile, a quota, a score where the circle is the visual\n * — use RadialProgress, which mirrors this contract exactly.\n *\n * Built on Reka UI's Progress: role=\"progressbar\" + aria-valuenow/min/max set\n * on the root automatically. `ariaLabel`/`ariaLabelledby` are bound onto\n * ProgressRoot (fallthrough overrides Reka's own generated \"`NN%`\" label) so\n * the accessible name describes *what* is loading, not just how much.\n */\nconst props = withDefaults(\n defineProps<{\n /** The completed amount, 0–`max`; `null`/omitted renders indeterminate. */\n modelValue?: number | null;\n /** The value that reads as 100% complete. */\n max?: number;\n /** Track thickness. Its own scale, not the control-height scale — a bar is a stroke, not a form control. */\n size?: ProgressSize;\n /** Print the rounded percentage as text beside the track. While indeterminate it prints an em dash, never a number. */\n showValue?: boolean;\n /** Accessible name describing the task, overriding Reka's default `NN%` label. */\n ariaLabel?: string;\n /** Accessible name sourced from another element's id, in place of `ariaLabel`. */\n ariaLabelledby?: string;\n /**\n * How the readout is written, as any subset of `ProgressLabels` — the rest\n * stay as the host's `provideLoomLabels` vocabulary left them, and then as\n * Loom's English.\n *\n * The per-instance case is a bar counting something a percentage is the\n * wrong reading of: `value: ({ value, max }) => \\`Step ${value} of ${max}\\``.\n */\n labels?: LabelOverrides<ProgressLabels>;\n }>(),\n {\n max: 100,\n size: \"md\",\n showValue: false,\n },\n);\n\n// `text`, not `labels`: the prop of that name is one of the three sources this\n// resolves, and a template reading the raw prop would be reading the overrides\n// rather than the answer.\nconst text = useLabels(\"progress\", PROGRESS_LABELS, () => props.labels);\n\n/** The readout tracks the track: a 1px bar with 14px digits beside it is not one object. */\nconst VALUE_TEXT = {\n sm: \"text-micro\",\n md: \"text-xs\",\n lg: \"text-sm\",\n} satisfies Record<ProgressSize, string>;\n\n// `showValue` changes which node is outermost, so fallthrough can no longer be\n// left to Vue: `class` goes to whatever the caller sees as the component's box\n// — the flex row when there is a readout, the track itself when the track is\n// all there is — and everything else (aria-describedby, data-testid) goes to\n// ProgressRoot, which is the element carrying role=\"progressbar\" and therefore\n// the one those attributes are describing.\n//\n// The two branches are written out rather than always wrapping the track in a\n// row, because a bare Progress has to keep the exact box it had before\n// `showValue` existed — a wrapper, even an empty one, changes how it sits in\n// a flex or grid parent.\n//\n// Nothing may sit beside those two branches at the top level of the template,\n// comments included: a second root node turns the component into a fragment,\n// and the attributes routed by hand above then have nowhere single to land.\n//\n// Routing `class` through `cn()` also settles a fight that used to be decided\n// by stylesheet order: Vue's own fallthrough merge concatenates, so a caller's\n// `bg-primary` sat alongside the track's `bg-muted` rather than replacing it.\ndefineOptions({ inheritAttrs: false });\nconst { attrs, rest } = useSplitAttrs();\n\n/**\n * The value the bar itself is given, clamped into [0, max]; null while\n * indeterminate. The clamp has to happen here rather than only on the way to\n * the transform below: `aria-valuenow` is generated from whatever ProgressRoot\n * receives, so handing it the raw prop announces a number outside the range\n * `aria-valuemin`/`aria-valuemax` declare — \"150 percent\" read out over a bar\n * painted at 100.\n */\nconst value = computed<number | null>(() =>\n props.modelValue === null || props.modelValue === undefined\n ? null\n : Math.min(Math.max(props.modelValue, 0), props.max),\n);\n\n/** Percentage 0–100, derived from the clamped value; null while indeterminate. */\nconst pct = computed<number | null>(() =>\n value.value === null ? null : (value.value / props.max) * 100,\n);\n\n/**\n * Everything ProgressRoot is given in both branches of the template. `rest`\n * lands last so a caller passing a bare `aria-label` attribute still wins over\n * the prop, which is the precedence Vue's own fallthrough gave before this\n * component took the attributes over by hand.\n */\nconst rootAttrs = computed(() => ({\n modelValue: value.value,\n max: props.max,\n \"aria-label\": props.ariaLabel,\n \"aria-labelledby\": props.ariaLabelledby,\n ...rest.value,\n}));\n\n// Determinate: a full-width bar slid left by the remaining percentage\n// (transform eased over --duration-slow). Indeterminate: a short segment\n// sweeping the track on a loop, since there is no percentage to paint.\n// Completion beat: at 100% the fill turns success (Loom law — a\n// finished piece of work reads as done at a glance), eased in over the same\n// --duration-slow lane via the background transition.\nconst indicatorClass = computed(() =>\n cn(\n \"h-full\",\n pct.value === 100 ? \"bg-success\" : \"bg-primary\",\n pct.value === null && \"w-1/3 animate-progress-indeterminate rounded-full\",\n ),\n);\n\nconst indicatorStyle = computed(() =>\n pct.value === null\n ? undefined\n : {\n transition:\n \"transform var(--duration-slow) var(--ease-out), background-color var(--duration-slow) var(--ease-out)\",\n transform: `translateX(-${100 - pct.value}%)`,\n },\n);\n\n/**\n * An indeterminate bar has no percentage, so the readout prints the placeholder\n * rather than the `0%` a naive `pct ?? 0` would produce — \"we do not know yet\"\n * and \"none of it is done\" are different facts, and only one of them is true.\n *\n * The determinate branch hands over `value` and `max` rather than the\n * percentage it already computed for the transform: rounding, the position of\n * the per-cent sign and the shape of the digits are all the host's, and `pct`\n * is a division this component happens to need for the paint.\n */\nconst readout = computed(() =>\n value.value === null\n ? text.value.indeterminate\n : text.value.value({ value: value.value, max: props.max }),\n);\n\ndefineExpose({ pct });\n</script>\n\n<template>\n <ProgressRoot\n v-if=\"!showValue\"\n v-bind=\"rootAttrs\"\n :class=\"cn(progressVariants({ size }), attrs.class as string)\"\n >\n <ProgressIndicator :class=\"indicatorClass\" :style=\"indicatorStyle\" />\n </ProgressRoot>\n\n <div v-else :class=\"cn('flex w-full items-center gap-3', attrs.class as string)\">\n <ProgressRoot\n v-bind=\"rootAttrs\"\n :class=\"cn(progressVariants({ size }), 'w-auto min-w-0 flex-1')\"\n >\n <ProgressIndicator :class=\"indicatorClass\" :style=\"indicatorStyle\" />\n </ProgressRoot>\n <!-- Hidden from assistive tech: the progressbar already announces this\n number through `aria-valuenow`, and a visible copy beside it is read\n out a second time as loose text. Fixed width so the track does not\n resize itself every time the digit count changes. -->\n <span\n aria-hidden=\"true\"\n :class=\"cn('tabular w-10 shrink-0 text-right text-muted-foreground', VALUE_TEXT[size])\"\n >{{ readout }}</span\n >\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -1,30 +1,96 @@
|
|
|
1
|
+
import { type LabelOverrides } from "../../lib/labels";
|
|
2
|
+
import type { LabelOf } from "../../lib/labels";
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
3
|
-
* is
|
|
4
|
-
* *indeterminate* state — an empty track, since there is no percentage yet to
|
|
5
|
-
* paint. For a wait of unknown duration with no percentage at all, use
|
|
6
|
-
* Spinner instead of guessing a Progress value.
|
|
4
|
+
* The one thing this bar prints, and the placeholder it prints instead when
|
|
5
|
+
* there is no percentage yet.
|
|
7
6
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
7
|
+
* **`value` takes both raw numbers and no formatting at all.** A hand-built
|
|
8
|
+
* `${Math.round(pct)}%` has already decided three things a component cannot
|
|
9
|
+
* know: that the sign trails the digits — Turkish writes `%42` — that the
|
|
10
|
+
* digits are Western Arabic, and that a percentage is the right reading of the
|
|
11
|
+
* pair at all. Handed `value` and `max`, a host reaches
|
|
12
|
+
* `Intl.NumberFormat(locale, { style: "percent" })` for the first two and can
|
|
13
|
+
* answer "3 of 4 steps" instead of "75%" for the third.
|
|
14
|
+
*
|
|
15
|
+
* The rounding therefore lives in Loom's default rather than in the component,
|
|
16
|
+
* so it is a wording choice a host replaces along with the words.
|
|
17
|
+
*/
|
|
18
|
+
export interface ProgressLabels {
|
|
19
|
+
/** The readout beside the track, from the clamped value and the scale it is out of. */
|
|
20
|
+
readonly value: LabelOf<{
|
|
21
|
+
value: number;
|
|
22
|
+
max: number;
|
|
23
|
+
}>;
|
|
24
|
+
/** What the readout prints while there is no percentage — never a false zero. */
|
|
25
|
+
readonly indeterminate: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Loom's English, co-located with the component so it tree-shakes with it, and
|
|
29
|
+
* exported so a host can build a partial vocabulary against the real thing.
|
|
30
|
+
*/
|
|
31
|
+
export declare const PROGRESS_LABELS: ProgressLabels;
|
|
32
|
+
/**
|
|
33
|
+
* The track's thickness. Deliberately *not* the shared control-height scale a
|
|
34
|
+
* Select or a TextField uses: a bar is a stroke laid under a heading or inside
|
|
35
|
+
* a table row, never a control a person clicks into, so lining it up with a
|
|
36
|
+
* 36px input would only make it a slab. `md` is the thickness every caller got
|
|
37
|
+
* before this prop existed and stays the default for exactly that reason.
|
|
12
38
|
*/
|
|
13
|
-
type
|
|
39
|
+
export type ProgressSize = "sm" | "md" | "lg";
|
|
40
|
+
export declare const progressVariants: (props?: ({
|
|
41
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
42
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
43
|
+
declare const _default: typeof __VLS_export;
|
|
44
|
+
export default _default;
|
|
45
|
+
declare const __VLS_export: import("vue").DefineComponent<{
|
|
14
46
|
/** The completed amount, 0–`max`; `null`/omitted renders indeterminate. */
|
|
15
47
|
modelValue?: number | null;
|
|
16
48
|
/** The value that reads as 100% complete. */
|
|
17
49
|
max?: number;
|
|
50
|
+
/** Track thickness. Its own scale, not the control-height scale — a bar is a stroke, not a form control. */
|
|
51
|
+
size?: ProgressSize;
|
|
52
|
+
/** Print the rounded percentage as text beside the track. While indeterminate it prints an em dash, never a number. */
|
|
53
|
+
showValue?: boolean;
|
|
18
54
|
/** Accessible name describing the task, overriding Reka's default `NN%` label. */
|
|
19
55
|
ariaLabel?: string;
|
|
20
56
|
/** Accessible name sourced from another element's id, in place of `ariaLabel`. */
|
|
21
57
|
ariaLabelledby?: string;
|
|
22
|
-
|
|
23
|
-
|
|
58
|
+
/**
|
|
59
|
+
* How the readout is written, as any subset of `ProgressLabels` — the rest
|
|
60
|
+
* stay as the host's `provideLoomLabels` vocabulary left them, and then as
|
|
61
|
+
* Loom's English.
|
|
62
|
+
*
|
|
63
|
+
* The per-instance case is a bar counting something a percentage is the
|
|
64
|
+
* wrong reading of: `value: ({ value, max }) => \`Step ${value} of ${max}\``.
|
|
65
|
+
*/
|
|
66
|
+
labels?: LabelOverrides<ProgressLabels>;
|
|
67
|
+
}, {
|
|
24
68
|
pct: import("vue").ComputedRef<number | null>;
|
|
25
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<
|
|
69
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
70
|
+
/** The completed amount, 0–`max`; `null`/omitted renders indeterminate. */
|
|
71
|
+
modelValue?: number | null;
|
|
72
|
+
/** The value that reads as 100% complete. */
|
|
73
|
+
max?: number;
|
|
74
|
+
/** Track thickness. Its own scale, not the control-height scale — a bar is a stroke, not a form control. */
|
|
75
|
+
size?: ProgressSize;
|
|
76
|
+
/** Print the rounded percentage as text beside the track. While indeterminate it prints an em dash, never a number. */
|
|
77
|
+
showValue?: boolean;
|
|
78
|
+
/** Accessible name describing the task, overriding Reka's default `NN%` label. */
|
|
79
|
+
ariaLabel?: string;
|
|
80
|
+
/** Accessible name sourced from another element's id, in place of `ariaLabel`. */
|
|
81
|
+
ariaLabelledby?: string;
|
|
82
|
+
/**
|
|
83
|
+
* How the readout is written, as any subset of `ProgressLabels` — the rest
|
|
84
|
+
* stay as the host's `provideLoomLabels` vocabulary left them, and then as
|
|
85
|
+
* Loom's English.
|
|
86
|
+
*
|
|
87
|
+
* The per-instance case is a bar counting something a percentage is the
|
|
88
|
+
* wrong reading of: `value: ({ value, max }) => \`Step ${value} of ${max}\``.
|
|
89
|
+
*/
|
|
90
|
+
labels?: LabelOverrides<ProgressLabels>;
|
|
91
|
+
}> & Readonly<{}>, {
|
|
92
|
+
size: ProgressSize;
|
|
26
93
|
max: number;
|
|
94
|
+
showValue: boolean;
|
|
27
95
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
28
|
-
declare const _default: typeof __VLS_export;
|
|
29
|
-
export default _default;
|
|
30
96
|
//# sourceMappingURL=Progress.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Progress.vue.d.ts","sourceRoot":"","sources":["../../../src/primitives/Progress/Progress.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Progress.vue.d.ts","sourceRoot":"","sources":["../../../src/primitives/Progress/Progress.vue"],"names":[],"mappings":"AA4PA,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIlE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEhD;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,cAAc;IAC7B,uFAAuF;IACvF,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACxD,iFAAiF;IACjF,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,cAG7B,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE9C,eAAO,MAAM,gBAAgB;;8EAS3B,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AACzC,QAAA,MAAM,YAAY;IAgBd,2EAA2E;iBAC9D,MAAM,GAAG,IAAI;IAC1B,6CAA6C;UACvC,MAAM;IACZ,4GAA4G;WACrG,YAAY;IACnB,uHAAuH;gBAC3G,OAAO;IACnB,kFAAkF;gBACtE,MAAM;IAClB,kFAAkF;qBACjE,MAAM;IACvB;;;;;;;OAOG;aACM,cAAc,CAAC,cAAc,CAAC;;;;IApBvC,2EAA2E;iBAC9D,MAAM,GAAG,IAAI;IAC1B,6CAA6C;UACvC,MAAM;IACZ,4GAA4G;WACrG,YAAY;IACnB,uHAAuH;gBAC3G,OAAO;IACnB,kFAAkF;gBACtE,MAAM;IAClB,kFAAkF;qBACjE,MAAM;IACvB;;;;;;;OAOG;aACM,cAAc,CAAC,cAAc,CAAC;;UAfhC,YAAY;SAFb,MAAM;eAIA,OAAO;6EAoPnB,CAAC"}
|
|
@@ -1,29 +1,65 @@
|
|
|
1
1
|
import { cn } from "../../lib/cn.js";
|
|
2
|
-
import {
|
|
2
|
+
import { useLabels } from "../../lib/labels.js";
|
|
3
|
+
import { useSplitAttrs } from "../../lib/attrs.js";
|
|
4
|
+
import { computed, createBlock, createElementBlock, createElementVNode, createVNode, defineComponent, mergeProps, normalizeClass, normalizeStyle, openBlock, toDisplayString, unref, withCtx } from "vue";
|
|
3
5
|
import { ProgressIndicator, ProgressRoot } from "reka-ui";
|
|
6
|
+
import { cva } from "class-variance-authority";
|
|
4
7
|
//#region src/primitives/Progress/Progress.vue?vue&type=script&setup=true&lang.ts
|
|
5
8
|
/**
|
|
6
9
|
* Progress — determinate progress bar for a task whose extent as a percentage
|
|
7
10
|
* is known (upload %, step 3 of 5). `modelValue` null/undefined renders the
|
|
8
11
|
* *indeterminate* state — an empty track, since there is no percentage yet to
|
|
9
12
|
* paint. For a wait of unknown duration with no percentage at all, use
|
|
10
|
-
* Spinner instead of guessing a Progress value.
|
|
13
|
+
* Spinner instead of guessing a Progress value. For the same number drawn as
|
|
14
|
+
* a ring — a dashboard tile, a quota, a score where the circle is the visual
|
|
15
|
+
* — use RadialProgress, which mirrors this contract exactly.
|
|
11
16
|
*
|
|
12
17
|
* Built on Reka UI's Progress: role="progressbar" + aria-valuenow/min/max set
|
|
13
18
|
* on the root automatically. `ariaLabel`/`ariaLabelledby` are bound onto
|
|
14
19
|
* ProgressRoot (fallthrough overrides Reka's own generated "`NN%`" label) so
|
|
15
20
|
* the accessible name describes *what* is loading, not just how much.
|
|
16
21
|
*/
|
|
22
|
+
/**
|
|
23
|
+
* Loom's English, co-located with the component so it tree-shakes with it, and
|
|
24
|
+
* exported so a host can build a partial vocabulary against the real thing.
|
|
25
|
+
*/
|
|
26
|
+
var PROGRESS_LABELS = {
|
|
27
|
+
value: ({ value, max }) => `${String(Math.round(value / max * 100))}%`,
|
|
28
|
+
indeterminate: "—"
|
|
29
|
+
};
|
|
30
|
+
var progressVariants = cva("relative w-full overflow-hidden rounded-full bg-muted", {
|
|
31
|
+
variants: { size: {
|
|
32
|
+
sm: "h-1",
|
|
33
|
+
md: "h-2",
|
|
34
|
+
lg: "h-3"
|
|
35
|
+
} },
|
|
36
|
+
defaultVariants: { size: "md" }
|
|
37
|
+
});
|
|
17
38
|
var Progress_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
39
|
+
inheritAttrs: false,
|
|
18
40
|
__name: "Progress",
|
|
19
41
|
props: {
|
|
20
42
|
modelValue: {},
|
|
21
43
|
max: { default: 100 },
|
|
44
|
+
size: { default: "md" },
|
|
45
|
+
showValue: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: false
|
|
48
|
+
},
|
|
22
49
|
ariaLabel: {},
|
|
23
|
-
ariaLabelledby: {}
|
|
50
|
+
ariaLabelledby: {},
|
|
51
|
+
labels: {}
|
|
24
52
|
},
|
|
25
53
|
setup(__props, { expose: __expose }) {
|
|
26
54
|
const props = __props;
|
|
55
|
+
const text = useLabels("progress", PROGRESS_LABELS, () => props.labels);
|
|
56
|
+
/** The readout tracks the track: a 1px bar with 14px digits beside it is not one object. */
|
|
57
|
+
const VALUE_TEXT = {
|
|
58
|
+
sm: "text-micro",
|
|
59
|
+
md: "text-xs",
|
|
60
|
+
lg: "text-sm"
|
|
61
|
+
};
|
|
62
|
+
const { attrs, rest } = useSplitAttrs();
|
|
27
63
|
/**
|
|
28
64
|
* The value the bar itself is given, clamped into [0, max]; null while
|
|
29
65
|
* indeterminate. The clamp has to happen here rather than only on the way to
|
|
@@ -35,33 +71,63 @@ var Progress_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineC
|
|
|
35
71
|
const value = computed(() => props.modelValue === null || props.modelValue === void 0 ? null : Math.min(Math.max(props.modelValue, 0), props.max));
|
|
36
72
|
/** Percentage 0–100, derived from the clamped value; null while indeterminate. */
|
|
37
73
|
const pct = computed(() => value.value === null ? null : value.value / props.max * 100);
|
|
74
|
+
/**
|
|
75
|
+
* Everything ProgressRoot is given in both branches of the template. `rest`
|
|
76
|
+
* lands last so a caller passing a bare `aria-label` attribute still wins over
|
|
77
|
+
* the prop, which is the precedence Vue's own fallthrough gave before this
|
|
78
|
+
* component took the attributes over by hand.
|
|
79
|
+
*/
|
|
80
|
+
const rootAttrs = computed(() => ({
|
|
81
|
+
modelValue: value.value,
|
|
82
|
+
max: props.max,
|
|
83
|
+
"aria-label": props.ariaLabel,
|
|
84
|
+
"aria-labelledby": props.ariaLabelledby,
|
|
85
|
+
...rest.value
|
|
86
|
+
}));
|
|
87
|
+
const indicatorClass = computed(() => cn("h-full", pct.value === 100 ? "bg-success" : "bg-primary", pct.value === null && "w-1/3 animate-progress-indeterminate rounded-full"));
|
|
88
|
+
const indicatorStyle = computed(() => pct.value === null ? void 0 : {
|
|
89
|
+
transition: "transform var(--duration-slow) var(--ease-out), background-color var(--duration-slow) var(--ease-out)",
|
|
90
|
+
transform: `translateX(-${100 - pct.value}%)`
|
|
91
|
+
});
|
|
92
|
+
/**
|
|
93
|
+
* An indeterminate bar has no percentage, so the readout prints the placeholder
|
|
94
|
+
* rather than the `0%` a naive `pct ?? 0` would produce — "we do not know yet"
|
|
95
|
+
* and "none of it is done" are different facts, and only one of them is true.
|
|
96
|
+
*
|
|
97
|
+
* The determinate branch hands over `value` and `max` rather than the
|
|
98
|
+
* percentage it already computed for the transform: rounding, the position of
|
|
99
|
+
* the per-cent sign and the shape of the digits are all the host's, and `pct`
|
|
100
|
+
* is a division this component happens to need for the paint.
|
|
101
|
+
*/
|
|
102
|
+
const readout = computed(() => value.value === null ? text.value.indeterminate : text.value.value({
|
|
103
|
+
value: value.value,
|
|
104
|
+
max: props.max
|
|
105
|
+
}));
|
|
38
106
|
__expose({ pct });
|
|
39
107
|
return (_ctx, _cache) => {
|
|
40
|
-
return openBlock(), createBlock(unref(ProgressRoot), {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
}, {
|
|
108
|
+
return !__props.showValue ? (openBlock(), createBlock(unref(ProgressRoot), mergeProps({ key: 0 }, rootAttrs.value, { class: unref(cn)(unref(progressVariants)({ size: __props.size }), unref(attrs).class) }), {
|
|
109
|
+
default: withCtx(() => [createVNode(unref(ProgressIndicator), {
|
|
110
|
+
class: normalizeClass(indicatorClass.value),
|
|
111
|
+
style: normalizeStyle(indicatorStyle.value)
|
|
112
|
+
}, null, 8, ["class", "style"])]),
|
|
113
|
+
_: 1
|
|
114
|
+
}, 16, ["class"])) : (openBlock(), createElementBlock("div", {
|
|
115
|
+
key: 1,
|
|
116
|
+
class: normalizeClass(unref(cn)("flex w-full items-center gap-3", unref(attrs).class))
|
|
117
|
+
}, [createVNode(unref(ProgressRoot), mergeProps(rootAttrs.value, { class: unref(cn)(unref(progressVariants)({ size: __props.size }), "w-auto min-w-0 flex-1") }), {
|
|
47
118
|
default: withCtx(() => [createVNode(unref(ProgressIndicator), {
|
|
48
|
-
class: normalizeClass(
|
|
49
|
-
style: normalizeStyle(
|
|
50
|
-
transition: "transform var(--duration-slow) var(--ease-out), background-color var(--duration-slow) var(--ease-out)",
|
|
51
|
-
transform: `translateX(-${100 - pct.value}%)`
|
|
52
|
-
})
|
|
119
|
+
class: normalizeClass(indicatorClass.value),
|
|
120
|
+
style: normalizeStyle(indicatorStyle.value)
|
|
53
121
|
}, null, 8, ["class", "style"])]),
|
|
54
122
|
_: 1
|
|
55
|
-
},
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
"aria-labelledby"
|
|
60
|
-
]);
|
|
123
|
+
}, 16, ["class"]), createElementVNode("span", {
|
|
124
|
+
"aria-hidden": "true",
|
|
125
|
+
class: normalizeClass(unref(cn)("tabular w-10 shrink-0 text-right text-muted-foreground", VALUE_TEXT[__props.size]))
|
|
126
|
+
}, toDisplayString(readout.value), 3)], 2));
|
|
61
127
|
};
|
|
62
128
|
}
|
|
63
129
|
});
|
|
64
130
|
//#endregion
|
|
65
|
-
export { Progress_vue_vue_type_script_setup_true_lang_default as default };
|
|
131
|
+
export { PROGRESS_LABELS, Progress_vue_vue_type_script_setup_true_lang_default as default, progressVariants };
|
|
66
132
|
|
|
67
133
|
//# sourceMappingURL=Progress.vue_vue_type_script_setup_true_lang.js.map
|