@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,198 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { useLabels } from "../../lib/labels.js";
|
|
3
|
+
import { useSplitAttrs } from "../../lib/attrs.js";
|
|
4
|
+
import { computed, createCommentVNode, createElementBlock, createElementVNode, defineComponent, mergeProps, normalizeClass, openBlock, renderSlot, toDisplayString, unref, useId } from "vue";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
//#region src/primitives/Indicator/Indicator.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
+
/**
|
|
8
|
+
* Indicator — the small marker pinned onto the corner of something else: a
|
|
9
|
+
* presence dot on an avatar, an unread count on a bell, a "needs attention"
|
|
10
|
+
* dot on a tab. The default slot is the thing being marked, and the marker
|
|
11
|
+
* positions itself over that child's corner.
|
|
12
|
+
*
|
|
13
|
+
* The boundary with Badge is the whole of the decision between them: **Badge
|
|
14
|
+
* sits in the flow beside content; Indicator is pinned onto content.** A count
|
|
15
|
+
* chip in a table cell is a Badge. The same count floating over a bell icon is
|
|
16
|
+
* an Indicator. Reach for Badge whenever the marker would take up room of its
|
|
17
|
+
* own, and for this whenever it would overhang something.
|
|
18
|
+
*
|
|
19
|
+
* What this component is by default is a bare colour, which is the one thing
|
|
20
|
+
* Loom's accessibility bar forbids outright. A green dot says nothing to a
|
|
21
|
+
* reader who cannot see it. So every marker that renders carries a visually
|
|
22
|
+
* hidden string — `label`, or a default derived from `status` or `count` — and
|
|
23
|
+
* a blank `label` falls back to that default rather than replacing it, which
|
|
24
|
+
* is what makes an unnamed indicator unreachable rather than merely
|
|
25
|
+
* discouraged. The shape layer in `STATUS_GLYPHS` covers the sighted reader
|
|
26
|
+
* the hidden string cannot.
|
|
27
|
+
*
|
|
28
|
+
* There is deliberately **no `aria-live` region here**, and the reason is that
|
|
29
|
+
* this component cannot know whether a change is news. An unread counter is
|
|
30
|
+
* usually fed by a poll, so a live region announces every tick over whatever
|
|
31
|
+
* the reader was doing; the same count is commonly pinned in two places at
|
|
32
|
+
* once, so it announces twice; and a polite region speaks on first render in
|
|
33
|
+
* several screen reader and browser pairs, which turns every page load into a
|
|
34
|
+
* recitation of the inbox. The marker is therefore static text a reader
|
|
35
|
+
* reaches on demand, and announcing a *change* stays with the consumer, who
|
|
36
|
+
* knows whether it followed something the reader just did.
|
|
37
|
+
*
|
|
38
|
+
* One consequence to design around: when the marked child is interactive, its
|
|
39
|
+
* accessible name is computed from the child, and this marker's text sits
|
|
40
|
+
* outside it — a bell button announces "Notifications, button" on focus and
|
|
41
|
+
* never mentions the three unread. The default slot exposes `labelId` for
|
|
42
|
+
* exactly that: bind it to the control's `aria-describedby` and the count is
|
|
43
|
+
* announced straight after the name, once, without being duplicated into it.
|
|
44
|
+
*/
|
|
45
|
+
var _hoisted_1 = ["data-placement"];
|
|
46
|
+
var _hoisted_2 = {
|
|
47
|
+
key: 0,
|
|
48
|
+
"aria-hidden": "true"
|
|
49
|
+
};
|
|
50
|
+
var _hoisted_3 = ["id"];
|
|
51
|
+
var indicatorVariants = cva("pointer-events-none absolute z-10 flex items-center justify-center select-none ring-2", {
|
|
52
|
+
variants: {
|
|
53
|
+
variant: {
|
|
54
|
+
dot: "h-3 w-3 rounded-full",
|
|
55
|
+
count: "h-5 min-w-5 rounded-full px-1.5 text-micro font-medium tabular"
|
|
56
|
+
},
|
|
57
|
+
placement: {
|
|
58
|
+
"top-right": "top-0 right-0 -translate-y-1/2 translate-x-1/2",
|
|
59
|
+
"top-left": "top-0 left-0 -translate-y-1/2 -translate-x-1/2",
|
|
60
|
+
"bottom-right": "right-0 bottom-0 translate-x-1/2 translate-y-1/2",
|
|
61
|
+
"bottom-left": "bottom-0 left-0 -translate-x-1/2 translate-y-1/2"
|
|
62
|
+
},
|
|
63
|
+
surface: {
|
|
64
|
+
background: "ring-background",
|
|
65
|
+
card: "ring-card",
|
|
66
|
+
sunken: "ring-sunken",
|
|
67
|
+
popover: "ring-popover"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
defaultVariants: {
|
|
71
|
+
variant: "dot",
|
|
72
|
+
placement: "top-right",
|
|
73
|
+
surface: "background"
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
/**
|
|
77
|
+
* The fill, keyed by Badge's colour names so a success dot and a success badge
|
|
78
|
+
* are the same green. These are the solid tokens where Badge uses a 12% wash:
|
|
79
|
+
* a wash reads fine across a chip and carries no signal at all across 12px.
|
|
80
|
+
*
|
|
81
|
+
* The paired `text-*` is what the count prints in and what the status glyph is
|
|
82
|
+
* punched out in, so one entry drives both layers.
|
|
83
|
+
*/
|
|
84
|
+
var indicatorToneVariants = cva("", {
|
|
85
|
+
variants: { tone: {
|
|
86
|
+
neutral: "bg-muted-foreground text-background",
|
|
87
|
+
primary: "bg-primary text-primary-foreground",
|
|
88
|
+
success: "bg-success text-success-foreground",
|
|
89
|
+
warning: "bg-warning text-warning-foreground",
|
|
90
|
+
info: "bg-info text-info-foreground",
|
|
91
|
+
destructive: "bg-destructive text-destructive-foreground",
|
|
92
|
+
accent: "bg-accent text-accent-foreground"
|
|
93
|
+
} },
|
|
94
|
+
defaultVariants: { tone: "primary" }
|
|
95
|
+
});
|
|
96
|
+
/** Which colour each presence state means, so `status` alone is enough. */
|
|
97
|
+
var STATUS_TONES = {
|
|
98
|
+
online: "success",
|
|
99
|
+
offline: "neutral",
|
|
100
|
+
busy: "destructive",
|
|
101
|
+
away: "warning"
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Loom's English, co-located with the component so it tree-shakes with it, and
|
|
105
|
+
* exported so a host can build a partial vocabulary against the real thing.
|
|
106
|
+
*/
|
|
107
|
+
var INDICATOR_LABELS = {
|
|
108
|
+
online: "Online",
|
|
109
|
+
offline: "Offline",
|
|
110
|
+
busy: "Busy",
|
|
111
|
+
away: "Away",
|
|
112
|
+
count: ({ count }) => `${String(count)} unread`,
|
|
113
|
+
attention: "Needs attention"
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* The shape layer, and it exists for the sighted reader the `sr-only` string
|
|
117
|
+
* below cannot help. Three of the four states are saturated — green, amber,
|
|
118
|
+
* red — which is the exact triple a red/green deficiency collapses, so `busy`
|
|
119
|
+
* wears a bar and `away` a hole and no two of them differ by hue alone.
|
|
120
|
+
* `offline` needs none: grey against any of the three is a saturation
|
|
121
|
+
* difference, not a hue one.
|
|
122
|
+
*/
|
|
123
|
+
var STATUS_GLYPHS = {
|
|
124
|
+
online: "",
|
|
125
|
+
offline: "",
|
|
126
|
+
busy: "h-0.5 w-1.5 rounded-full bg-current",
|
|
127
|
+
away: "h-1 w-1 rounded-full bg-current"
|
|
128
|
+
};
|
|
129
|
+
var Indicator_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
130
|
+
inheritAttrs: false,
|
|
131
|
+
__name: "Indicator",
|
|
132
|
+
props: {
|
|
133
|
+
variant: { default: "dot" },
|
|
134
|
+
count: { default: 0 },
|
|
135
|
+
max: { default: 99 },
|
|
136
|
+
status: {},
|
|
137
|
+
tone: {},
|
|
138
|
+
placement: { default: "top-right" },
|
|
139
|
+
label: {},
|
|
140
|
+
showZero: {
|
|
141
|
+
type: Boolean,
|
|
142
|
+
default: false
|
|
143
|
+
},
|
|
144
|
+
surface: { default: "background" },
|
|
145
|
+
labels: {}
|
|
146
|
+
},
|
|
147
|
+
setup(__props) {
|
|
148
|
+
const props = __props;
|
|
149
|
+
const text = useLabels("indicator", INDICATOR_LABELS, () => props.labels);
|
|
150
|
+
const { attrs, rest } = useSplitAttrs();
|
|
151
|
+
const labelId = useId();
|
|
152
|
+
/**
|
|
153
|
+
* The count as a whole, non-negative number. A negative count is a defect in
|
|
154
|
+
* the caller's data, and a pill reading "-1 unread" reports that defect to the
|
|
155
|
+
* reader rather than to the caller — falling back to "nothing to report" is
|
|
156
|
+
* the honest rendering of it.
|
|
157
|
+
*/
|
|
158
|
+
const total = computed(() => Math.max(0, Math.trunc(props.count)));
|
|
159
|
+
const visible = computed(() => props.variant === "dot" || total.value > 0 || props.showZero);
|
|
160
|
+
/** What the pill prints — the real figure up to `max`, then `<max>+`. */
|
|
161
|
+
const printed = computed(() => total.value > props.max ? `${String(props.max)}+` : String(total.value));
|
|
162
|
+
const tone = computed(() => props.tone ?? (props.status ? STATUS_TONES[props.status] : "primary"));
|
|
163
|
+
const glyph = computed(() => props.status ? STATUS_GLYPHS[props.status] : "");
|
|
164
|
+
/**
|
|
165
|
+
* The accessible name, and it is never empty by construction. The count case
|
|
166
|
+
* reports `total` rather than `printed`: clamping at `max` is a decision about
|
|
167
|
+
* how wide the pill is allowed to get, and a reader who cannot see the pill
|
|
168
|
+
* has no reason to inherit it — "132 unread" is the fact, "99+" is the layout.
|
|
169
|
+
*/
|
|
170
|
+
const name = computed(() => {
|
|
171
|
+
const given = props.label?.trim();
|
|
172
|
+
if (given) return given;
|
|
173
|
+
if (props.variant === "count") return text.value.count({ count: total.value });
|
|
174
|
+
return props.status ? text.value[props.status] : text.value.attention;
|
|
175
|
+
});
|
|
176
|
+
return (_ctx, _cache) => {
|
|
177
|
+
return openBlock(), createElementBlock("span", mergeProps(unref(rest), { class: unref(cn)("relative inline-flex align-middle", unref(attrs).class) }), [renderSlot(_ctx.$slots, "default", { labelId: unref(labelId) }), visible.value ? (openBlock(), createElementBlock("span", {
|
|
178
|
+
key: printed.value,
|
|
179
|
+
"data-placement": __props.placement,
|
|
180
|
+
class: normalizeClass(unref(cn)(unref(indicatorVariants)({
|
|
181
|
+
variant: __props.variant,
|
|
182
|
+
placement: __props.placement,
|
|
183
|
+
surface: __props.surface
|
|
184
|
+
}), unref(indicatorToneVariants)({ tone: tone.value }), __props.variant === "count" && "animate-scale-in"))
|
|
185
|
+
}, [__props.variant === "count" ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(printed.value), 1)) : glyph.value ? (openBlock(), createElementBlock("span", {
|
|
186
|
+
key: 1,
|
|
187
|
+
class: normalizeClass(glyph.value)
|
|
188
|
+
}, null, 2)) : createCommentVNode("", true), createElementVNode("span", {
|
|
189
|
+
id: unref(labelId),
|
|
190
|
+
class: "sr-only"
|
|
191
|
+
}, toDisplayString(name.value), 9, _hoisted_3)], 10, _hoisted_1)) : createCommentVNode("", true)], 16);
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
//#endregion
|
|
196
|
+
export { INDICATOR_LABELS, Indicator_vue_vue_type_script_setup_true_lang_default as default, indicatorToneVariants, indicatorVariants };
|
|
197
|
+
|
|
198
|
+
//# sourceMappingURL=Indicator.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Indicator.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/primitives/Indicator/Indicator.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { cva } from \"class-variance-authority\";\nimport type { LabelOf } from \"../../lib/labels\";\n\n/** A presence dot, or a number. */\nexport type IndicatorVariant = \"dot\" | \"count\";\n\n/** The four presence states a dot can report. */\nexport type IndicatorStatus = \"online\" | \"offline\" | \"busy\" | \"away\";\n\n/** Which corner of the marked element the marker straddles. */\nexport type IndicatorPlacement = \"top-right\" | \"top-left\" | \"bottom-right\" | \"bottom-left\";\n\n/**\n * The colour vocabulary, deliberately Badge's own names rather than a second\n * set — `accent` included, and it means here exactly what it means there:\n * a second semantic category distinct from primary, never decoration.\n */\nexport type IndicatorTone =\n \"neutral\" | \"primary\" | \"success\" | \"warning\" | \"info\" | \"destructive\" | \"accent\";\n\n/** The surface the marked element sits on, which the separating ring matches. */\nexport type IndicatorSurface = \"background\" | \"card\" | \"sunken\" | \"popover\";\n\nexport const indicatorVariants = cva(\n // `pointer-events-none` is load-bearing rather than tidy: the marker\n // overhangs the corner of whatever it marks, so without it the top-right\n // few pixels of a bell button stop being clickable.\n \"pointer-events-none absolute z-10 flex items-center justify-center select-none ring-2\",\n {\n variants: {\n variant: {\n // 12px leaves room for the status glyphs below to read as shapes\n // rather than as noise.\n dot: \"h-3 w-3 rounded-full\",\n // `min-w-5` and the padding together are what make one digit a circle\n // and three a pill, with no branch: \"1\" is narrower than the minimum\n // and lands on it, \"99+\" outgrows it and the radius turns the ends.\n count: \"h-5 min-w-5 rounded-full px-1.5 text-micro font-medium tabular\",\n } satisfies Record<IndicatorVariant, string>,\n placement: {\n \"top-right\": \"top-0 right-0 -translate-y-1/2 translate-x-1/2\",\n \"top-left\": \"top-0 left-0 -translate-y-1/2 -translate-x-1/2\",\n \"bottom-right\": \"right-0 bottom-0 translate-x-1/2 translate-y-1/2\",\n \"bottom-left\": \"bottom-0 left-0 -translate-x-1/2 translate-y-1/2\",\n } satisfies Record<IndicatorPlacement, string>,\n // The ring is what separates the marker from the photo, avatar or icon\n // underneath, the way a presence dot is punched out of a portrait. It\n // has to be the colour of what surrounds the pair, which only the caller\n // knows — hence a prop rather than a guess.\n surface: {\n background: \"ring-background\",\n card: \"ring-card\",\n sunken: \"ring-sunken\",\n popover: \"ring-popover\",\n } satisfies Record<IndicatorSurface, string>,\n },\n defaultVariants: { variant: \"dot\", placement: \"top-right\", surface: \"background\" },\n },\n);\n\n/**\n * The fill, keyed by Badge's colour names so a success dot and a success badge\n * are the same green. These are the solid tokens where Badge uses a 12% wash:\n * a wash reads fine across a chip and carries no signal at all across 12px.\n *\n * The paired `text-*` is what the count prints in and what the status glyph is\n * punched out in, so one entry drives both layers.\n */\nexport const indicatorToneVariants = cva(\"\", {\n variants: {\n tone: {\n neutral: \"bg-muted-foreground text-background\",\n primary: \"bg-primary text-primary-foreground\",\n success: \"bg-success text-success-foreground\",\n warning: \"bg-warning text-warning-foreground\",\n info: \"bg-info text-info-foreground\",\n destructive: \"bg-destructive text-destructive-foreground\",\n accent: \"bg-accent text-accent-foreground\",\n } satisfies Record<IndicatorTone, string>,\n },\n defaultVariants: { tone: \"primary\" },\n});\n\n/** Which colour each presence state means, so `status` alone is enough. */\nconst STATUS_TONES = {\n online: \"success\",\n offline: \"neutral\",\n busy: \"destructive\",\n away: \"warning\",\n} satisfies Record<IndicatorStatus, IndicatorTone>;\n\n/**\n * What a screen reader is told when the caller passes no `label` — which is\n * every string this component can utter, because a marker that renders nothing\n * but a coloured circle has no text of its own to fall back on.\n *\n * The four presence keys are named for the four `IndicatorStatus` members and\n * resolved by lookup, so a status added to the union without a name for it is a\n * compile error rather than an unnamed dot.\n *\n * `count` takes the number and not a formatted string: \"3 unread\" is a plural\n * category in most languages and a digit shape in several, and a component\n * whose whole job is to show a small integer has no business deciding either.\n * It also reports the *real* figure rather than the clamped `99+` — see the\n * comment on `name` below.\n */\nexport interface IndicatorLabels {\n /** The `online` dot. */\n readonly online: string;\n /** The `offline` dot. */\n readonly offline: string;\n /** The `busy` dot. */\n readonly busy: string;\n /** The `away` dot. */\n readonly away: string;\n /** The `count` pill, named for how many things it counts. */\n readonly count: LabelOf<{ count: number }>;\n /** A dot with no `status`: something changed here, and nothing more specific. */\n readonly attention: 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 INDICATOR_LABELS: IndicatorLabels = {\n online: \"Online\",\n offline: \"Offline\",\n busy: \"Busy\",\n away: \"Away\",\n count: ({ count }) => `${String(count)} unread`,\n attention: \"Needs attention\",\n};\n\n/**\n * The shape layer, and it exists for the sighted reader the `sr-only` string\n * below cannot help. Three of the four states are saturated — green, amber,\n * red — which is the exact triple a red/green deficiency collapses, so `busy`\n * wears a bar and `away` a hole and no two of them differ by hue alone.\n * `offline` needs none: grey against any of the three is a saturation\n * difference, not a hue one.\n */\nconst STATUS_GLYPHS = {\n online: \"\",\n offline: \"\",\n busy: \"h-0.5 w-1.5 rounded-full bg-current\",\n away: \"h-1 w-1 rounded-full bg-current\",\n} satisfies Record<IndicatorStatus, string>;\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, useId } from \"vue\";\nimport { cn } from \"../../lib/cn\";\nimport { useSplitAttrs } from \"../../lib/attrs\";\nimport { useLabels, type LabelOverrides } from \"../../lib/labels\";\n\n/**\n * Indicator — the small marker pinned onto the corner of something else: a\n * presence dot on an avatar, an unread count on a bell, a \"needs attention\"\n * dot on a tab. The default slot is the thing being marked, and the marker\n * positions itself over that child's corner.\n *\n * The boundary with Badge is the whole of the decision between them: **Badge\n * sits in the flow beside content; Indicator is pinned onto content.** A count\n * chip in a table cell is a Badge. The same count floating over a bell icon is\n * an Indicator. Reach for Badge whenever the marker would take up room of its\n * own, and for this whenever it would overhang something.\n *\n * What this component is by default is a bare colour, which is the one thing\n * Loom's accessibility bar forbids outright. A green dot says nothing to a\n * reader who cannot see it. So every marker that renders carries a visually\n * hidden string — `label`, or a default derived from `status` or `count` — and\n * a blank `label` falls back to that default rather than replacing it, which\n * is what makes an unnamed indicator unreachable rather than merely\n * discouraged. The shape layer in `STATUS_GLYPHS` covers the sighted reader\n * the hidden string cannot.\n *\n * There is deliberately **no `aria-live` region here**, and the reason is that\n * this component cannot know whether a change is news. An unread counter is\n * usually fed by a poll, so a live region announces every tick over whatever\n * the reader was doing; the same count is commonly pinned in two places at\n * once, so it announces twice; and a polite region speaks on first render in\n * several screen reader and browser pairs, which turns every page load into a\n * recitation of the inbox. The marker is therefore static text a reader\n * reaches on demand, and announcing a *change* stays with the consumer, who\n * knows whether it followed something the reader just did.\n *\n * One consequence to design around: when the marked child is interactive, its\n * accessible name is computed from the child, and this marker's text sits\n * outside it — a bell button announces \"Notifications, button\" on focus and\n * never mentions the three unread. The default slot exposes `labelId` for\n * exactly that: bind it to the control's `aria-describedby` and the count is\n * announced straight after the name, once, without being duplicated into it.\n */\nconst props = withDefaults(\n defineProps<{\n /** A presence dot, or a number in a pill. */\n variant?: IndicatorVariant;\n /** The number the pill prints, when `variant` is `count`. Zero hides the marker unless `showZero` is set. */\n count?: number;\n /** The highest number printed in full; anything above it prints as `<max>+`. The accessible text still carries the real figure. */\n max?: number;\n /** Presence, for a dot: it picks the colour and the shape, and names the dot for a screen reader. Omit it for a plain \"something changed\" dot. */\n status?: IndicatorStatus;\n /** The marker's colour, in Badge's own vocabulary. Defaults to whatever `status` implies, or to `primary` when there is no status. */\n tone?: IndicatorTone;\n /** Which corner of the marked element the marker straddles. */\n placement?: IndicatorPlacement;\n /** What a screen reader announces for the marker. Leave it unset for the derived default — \"Online\", \"3 unread\" — and set it whenever the count is not of unread things. Blank or whitespace falls back to the default rather than clearing it. */\n label?: string;\n /** Render the pill when the count is zero. Off by default, because a count of nothing is not news. */\n showZero?: boolean;\n /** The surface the marked element sits on, so the ring separating the marker from it matches what surrounds them. */\n surface?: IndicatorSurface;\n /**\n * Names for the markers this component derives on its own, as any subset\n * of `IndicatorLabels` — the rest stay as the host's `provideLoomLabels`\n * vocabulary left them, and then as Loom's English.\n *\n * This is the vocabulary, not the instance's name: `label` still beats it\n * and is what one bell counting drafts rather than unread mail reaches for.\n */\n labels?: LabelOverrides<IndicatorLabels>;\n }>(),\n {\n variant: \"dot\",\n count: 0,\n max: 99,\n placement: \"top-right\",\n showZero: false,\n surface: \"background\",\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(\"indicator\", INDICATOR_LABELS, () => props.labels);\n\n// One rendered node, and every fallthrough attribute belongs on it — but\n// `class` still has to go the long way round. A consumer replacing the root's\n// `inline-flex` with `block` cannot win by concatenation, because the winner\n// there is decided by the order of the two rules in the stylesheet rather than\n// by the order of the two names in the attribute; `cn()` is what resolves it.\ndefineOptions({ inheritAttrs: false });\nconst { attrs, rest } = useSplitAttrs();\n\n// Bound to the hidden label so an interactive child can point its\n// `aria-describedby` at it through the slot prop.\nconst labelId = useId();\n\n/**\n * The count as a whole, non-negative number. A negative count is a defect in\n * the caller's data, and a pill reading \"-1 unread\" reports that defect to the\n * reader rather than to the caller — falling back to \"nothing to report\" is\n * the honest rendering of it.\n */\nconst total = computed(() => Math.max(0, Math.trunc(props.count)));\n\nconst visible = computed(() => props.variant === \"dot\" || total.value > 0 || props.showZero);\n\n/** What the pill prints — the real figure up to `max`, then `<max>+`. */\nconst printed = computed(() =>\n total.value > props.max ? `${String(props.max)}+` : String(total.value),\n);\n\nconst tone = computed<IndicatorTone>(\n () => props.tone ?? (props.status ? STATUS_TONES[props.status] : \"primary\"),\n);\n\nconst glyph = computed(() => (props.status ? STATUS_GLYPHS[props.status] : \"\"));\n\n/**\n * The accessible name, and it is never empty by construction. The count case\n * reports `total` rather than `printed`: clamping at `max` is a decision about\n * how wide the pill is allowed to get, and a reader who cannot see the pill\n * has no reason to inherit it — \"132 unread\" is the fact, \"99+\" is the layout.\n */\nconst name = computed(() => {\n const given = props.label?.trim();\n if (given) return given;\n if (props.variant === \"count\") return text.value.count({ count: total.value });\n // Keyed by the status itself rather than through a lookup table of its own:\n // `IndicatorLabels` names its four presence keys after the four members of\n // `IndicatorStatus`, so a state added to the union with no name for it stops\n // compiling here instead of rendering an unnamed dot.\n return props.status ? text.value[props.status] : text.value.attention;\n});\n</script>\n\n<template>\n <span v-bind=\"rest\" :class=\"cn('relative inline-flex align-middle', attrs.class as string)\">\n <!-- A multi-line `@slot` comment comes back from vue-docgen with no description at all, so this one stays on one line. -->\n <!-- @slot The element being marked. `labelId` is the id of the marker's own hidden text — bind it to an interactive child's `aria-describedby` so the count is announced after that control's name. -->\n <slot :label-id=\"labelId\" />\n\n <!-- Keyed on what is printed rather than on the count, so `animate-scale-in`\n replays when a number a reader can see actually changes and stays put\n when 100 becomes 132 behind the same \"99+\". A dot's key never moves, so\n a dot never animates: presence settles into place on load, it does not\n arrive as news, and it must not pulse. -->\n <span\n v-if=\"visible\"\n :key=\"printed\"\n :data-placement=\"placement\"\n :class=\"\n cn(\n indicatorVariants({ variant, placement, surface }),\n indicatorToneVariants({ tone }),\n variant === 'count' && 'animate-scale-in',\n )\n \"\n >\n <!-- Hidden from assistive tech because the label below carries the real\n figure; left visible the pair would read as \"99+ 132 unread\". -->\n <span v-if=\"variant === 'count'\" aria-hidden=\"true\">{{ printed }}</span>\n <span v-else-if=\"glyph\" :class=\"glyph\" />\n\n <span :id=\"labelId\" class=\"sr-only\">{{ name }}</span>\n </span>\n </span>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,IAAa,oBAAoB,IAI/B,yFACA;CACE,UAAU;EACR,S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,IAAA,IAAA,CAAA,GAAA,EAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import Link_vue_vue_type_script_setup_true_lang_default, { linkVariants } from "./Link.vue_vue_type_script_setup_true_lang.js";
|
|
2
|
+
//#region src/primitives/Link/Link.vue
|
|
3
|
+
var Link_default = Link_vue_vue_type_script_setup_true_lang_default;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { Link_default as default, linkVariants };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=Link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Link.js","names":[],"sources":["../../../src/primitives/Link/Link.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { cva } from \"class-variance-authority\";\n\n/** The visual emphasis assigned to a link. */\nexport type LinkVariant = \"default\" | \"muted\" | \"accent\" | \"subtle\";\n\nexport const linkVariants = cva(\n \"inline-flex items-center gap-1 transition-colors duration-fast ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n {\n variants: {\n variant: {\n default: \"text-primary underline underline-offset-4 hover:text-primary/80\",\n muted: \"text-muted-foreground hover:text-foreground\",\n accent: \"text-accent underline underline-offset-4 hover:text-accent/80\",\n subtle:\n \"text-foreground/80 hover:text-foreground underline underline-offset-4 decoration-border hover:decoration-foreground/50\",\n } satisfies Record<LinkVariant, string>,\n underline: {\n true: \"\",\n false: \"no-underline\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n underline: true,\n },\n },\n);\n</script>\n\n<script setup lang=\"ts\">\nimport { cn } from \"../../lib/cn\";\n\nwithDefaults(\n defineProps<{\n /** Controls the link's visual emphasis. */\n variant?: LinkVariant;\n /** Draws an underline beneath the link label. */\n underline?: boolean;\n /** The destination the link navigates to. */\n href: string;\n /** Opens the destination in a new tab and marks it as an external link. */\n external?: boolean;\n /** Replaces the anchor with an unavailable, non-interactive span. */\n disabled?: boolean;\n }>(),\n {\n variant: \"default\",\n underline: true,\n external: false,\n disabled: false,\n },\n);\n</script>\n\n<template>\n <span\n v-if=\"disabled\"\n :class=\"\n cn(\n linkVariants({ variant, underline }),\n 'cursor-default pointer-events-none opacity-50',\n $attrs.class,\n )\n \"\n aria-disabled=\"true\"\n >\n <slot />\n </span>\n <a\n v-else\n :href=\"href\"\n :class=\"cn(linkVariants({ variant, underline }), $attrs.class)\"\n :target=\"external ? '_blank' : undefined\"\n :rel=\"external ? 'noopener noreferrer' : undefined\"\n >\n <slot />\n <svg\n v-if=\"external\"\n class=\"h-3.5 w-3.5 shrink-0\"\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <path d=\"M7 17 17 7\" />\n <path d=\"M7 7h10v10\" />\n </svg>\n </a>\n</template>\n"],"mappings":""}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** The visual emphasis assigned to a link. */
|
|
2
|
+
export type LinkVariant = "default" | "muted" | "accent" | "subtle";
|
|
3
|
+
export declare const linkVariants: (props?: ({
|
|
4
|
+
variant?: "accent" | "default" | "subtle" | "muted" | null | undefined;
|
|
5
|
+
underline?: boolean | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
9
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
10
|
+
/** Controls the link's visual emphasis. */
|
|
11
|
+
variant?: LinkVariant;
|
|
12
|
+
/** Draws an underline beneath the link label. */
|
|
13
|
+
underline?: boolean;
|
|
14
|
+
/** The destination the link navigates to. */
|
|
15
|
+
href: string;
|
|
16
|
+
/** Opens the destination in a new tab and marks it as an external link. */
|
|
17
|
+
external?: boolean;
|
|
18
|
+
/** Replaces the anchor with an unavailable, non-interactive span. */
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
21
|
+
/** Controls the link's visual emphasis. */
|
|
22
|
+
variant?: LinkVariant;
|
|
23
|
+
/** Draws an underline beneath the link label. */
|
|
24
|
+
underline?: boolean;
|
|
25
|
+
/** The destination the link navigates to. */
|
|
26
|
+
href: string;
|
|
27
|
+
/** Opens the destination in a new tab and marks it as an external link. */
|
|
28
|
+
external?: boolean;
|
|
29
|
+
/** Replaces the anchor with an unavailable, non-interactive span. */
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
}> & Readonly<{}>, {
|
|
32
|
+
disabled: boolean;
|
|
33
|
+
variant: LinkVariant;
|
|
34
|
+
underline: boolean;
|
|
35
|
+
external: boolean;
|
|
36
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
37
|
+
default?: (props: {}) => any;
|
|
38
|
+
} & {
|
|
39
|
+
default?: (props: {}) => any;
|
|
40
|
+
}>;
|
|
41
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
42
|
+
new (): {
|
|
43
|
+
$slots: S;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=Link.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Link.vue.d.ts","sourceRoot":"","sources":["../../../src/primitives/Link/Link.vue"],"names":[],"mappings":"AAwGA,8CAA8C;AAC9C,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEpE,eAAO,MAAM,YAAY;;;8EAqBxB,CAAC;wBACmB,OAAO,YAAY;AAAxC,wBAAyC;AACzC,QAAA,MAAM,YAAY;IAEd,2CAA2C;cACjC,WAAW;IACrB,iDAAiD;gBACrC,OAAO;IACnB,6CAA6C;UACvC,MAAM;IACZ,2EAA2E;eAChE,OAAO;IAClB,qEAAqE;eAC1D,OAAO;;IATlB,2CAA2C;cACjC,WAAW;IACrB,iDAAiD;gBACrC,OAAO;IACnB,6CAA6C;UACvC,MAAM;IACZ,2EAA2E;eAChE,OAAO;IAClB,qEAAqE;eAC1D,OAAO;;cAAP,OAAO;aARR,WAAW;eAET,OAAO;cAIR,OAAO;;cAyFR,CAAC,KAAK,IAAgB,KAAK,GAAG;;cAC9B,CAAC,KAAK,IAAgB,KAAK,GAAG;EAWxC,CAAC;AAWL,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { createCommentVNode, createElementBlock, createElementVNode, defineComponent, normalizeClass, openBlock, renderSlot, unref } from "vue";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
//#region src/primitives/Link/Link.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var _hoisted_1 = [
|
|
6
|
+
"href",
|
|
7
|
+
"target",
|
|
8
|
+
"rel"
|
|
9
|
+
];
|
|
10
|
+
var _hoisted_2 = {
|
|
11
|
+
key: 0,
|
|
12
|
+
class: "h-3.5 w-3.5 shrink-0",
|
|
13
|
+
width: "14",
|
|
14
|
+
height: "14",
|
|
15
|
+
viewBox: "0 0 24 24",
|
|
16
|
+
fill: "none",
|
|
17
|
+
stroke: "currentColor",
|
|
18
|
+
"stroke-width": "2",
|
|
19
|
+
"stroke-linecap": "round",
|
|
20
|
+
"stroke-linejoin": "round",
|
|
21
|
+
"aria-hidden": "true",
|
|
22
|
+
focusable: "false"
|
|
23
|
+
};
|
|
24
|
+
var linkVariants = cva("inline-flex items-center gap-1 transition-colors duration-fast ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background", {
|
|
25
|
+
variants: {
|
|
26
|
+
variant: {
|
|
27
|
+
default: "text-primary underline underline-offset-4 hover:text-primary/80",
|
|
28
|
+
muted: "text-muted-foreground hover:text-foreground",
|
|
29
|
+
accent: "text-accent underline underline-offset-4 hover:text-accent/80",
|
|
30
|
+
subtle: "text-foreground/80 hover:text-foreground underline underline-offset-4 decoration-border hover:decoration-foreground/50"
|
|
31
|
+
},
|
|
32
|
+
underline: {
|
|
33
|
+
true: "",
|
|
34
|
+
false: "no-underline"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
defaultVariants: {
|
|
38
|
+
variant: "default",
|
|
39
|
+
underline: true
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
var Link_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
43
|
+
__name: "Link",
|
|
44
|
+
props: {
|
|
45
|
+
variant: { default: "default" },
|
|
46
|
+
underline: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: true
|
|
49
|
+
},
|
|
50
|
+
href: {},
|
|
51
|
+
external: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: false
|
|
54
|
+
},
|
|
55
|
+
disabled: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: false
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
setup(__props) {
|
|
61
|
+
return (_ctx, _cache) => {
|
|
62
|
+
return __props.disabled ? (openBlock(), createElementBlock("span", {
|
|
63
|
+
key: 0,
|
|
64
|
+
class: normalizeClass(unref(cn)(unref(linkVariants)({
|
|
65
|
+
variant: __props.variant,
|
|
66
|
+
underline: __props.underline
|
|
67
|
+
}), "cursor-default pointer-events-none opacity-50", _ctx.$attrs.class)),
|
|
68
|
+
"aria-disabled": "true"
|
|
69
|
+
}, [renderSlot(_ctx.$slots, "default")], 2)) : (openBlock(), createElementBlock("a", {
|
|
70
|
+
key: 1,
|
|
71
|
+
href: __props.href,
|
|
72
|
+
class: normalizeClass(unref(cn)(unref(linkVariants)({
|
|
73
|
+
variant: __props.variant,
|
|
74
|
+
underline: __props.underline
|
|
75
|
+
}), _ctx.$attrs.class)),
|
|
76
|
+
target: __props.external ? "_blank" : void 0,
|
|
77
|
+
rel: __props.external ? "noopener noreferrer" : void 0
|
|
78
|
+
}, [renderSlot(_ctx.$slots, "default"), __props.external ? (openBlock(), createElementBlock("svg", _hoisted_2, [..._cache[0] || (_cache[0] = [createElementVNode("path", { d: "M7 17 17 7" }, null, -1), createElementVNode("path", { d: "M7 7h10v10" }, null, -1)])])) : createCommentVNode("", true)], 10, _hoisted_1));
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
//#endregion
|
|
83
|
+
export { Link_vue_vue_type_script_setup_true_lang_default as default, linkVariants };
|
|
84
|
+
|
|
85
|
+
//# sourceMappingURL=Link.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Link.vue_vue_type_script_setup_true_lang.js","names":["$attrs"],"sources":["../../../src/primitives/Link/Link.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { cva } from \"class-variance-authority\";\n\n/** The visual emphasis assigned to a link. */\nexport type LinkVariant = \"default\" | \"muted\" | \"accent\" | \"subtle\";\n\nexport const linkVariants = cva(\n \"inline-flex items-center gap-1 transition-colors duration-fast ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n {\n variants: {\n variant: {\n default: \"text-primary underline underline-offset-4 hover:text-primary/80\",\n muted: \"text-muted-foreground hover:text-foreground\",\n accent: \"text-accent underline underline-offset-4 hover:text-accent/80\",\n subtle:\n \"text-foreground/80 hover:text-foreground underline underline-offset-4 decoration-border hover:decoration-foreground/50\",\n } satisfies Record<LinkVariant, string>,\n underline: {\n true: \"\",\n false: \"no-underline\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n underline: true,\n },\n },\n);\n</script>\n\n<script setup lang=\"ts\">\nimport { cn } from \"../../lib/cn\";\n\nwithDefaults(\n defineProps<{\n /** Controls the link's visual emphasis. */\n variant?: LinkVariant;\n /** Draws an underline beneath the link label. */\n underline?: boolean;\n /** The destination the link navigates to. */\n href: string;\n /** Opens the destination in a new tab and marks it as an external link. */\n external?: boolean;\n /** Replaces the anchor with an unavailable, non-interactive span. */\n disabled?: boolean;\n }>(),\n {\n variant: \"default\",\n underline: true,\n external: false,\n disabled: false,\n },\n);\n</script>\n\n<template>\n <span\n v-if=\"disabled\"\n :class=\"\n cn(\n linkVariants({ variant, underline }),\n 'cursor-default pointer-events-none opacity-50',\n $attrs.class,\n )\n \"\n aria-disabled=\"true\"\n >\n <slot />\n </span>\n <a\n v-else\n :href=\"href\"\n :class=\"cn(linkVariants({ variant, underline }), $attrs.class)\"\n :target=\"external ? '_blank' : undefined\"\n :rel=\"external ? 'noopener noreferrer' : undefined\"\n >\n <slot />\n <svg\n v-if=\"external\"\n class=\"h-3.5 w-3.5 shrink-0\"\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <path d=\"M7 17 17 7\" />\n <path d=\"M7 7h10v10\" />\n </svg>\n </a>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAMA,IAAa,eAAe,IAC1B,oNACA;CACE,UAAU;EACR,SAAS;GACP,SAAS;GACT,OAAO;GACP,QAAQ;GACR,QACE;EACJ;EACA,WAAW;GACT,MAAM;GACN,OAAO;EACT;CACF;CACA,iBAAiB;EACf,SAAS;EACT,WAAW;CACb;AACF,CACF;;;;;;;;;;;;;;;;;;;;;GA8BU,OAAA,QAAA,YADR,UAAA,GAAA,mBAYO,QAAA;;IAVJ,OAAK,eAAS,MAAA,EAAA,CAAE,CAAU,MAAA,YAAA,CAAY,CAAA;KAAA,SAAG,QAAA;KAAO,WAAE,QAAA;IAAS,CAAA,GAAA,iDAAsEA,KAAAA,OAAO,KAAA,CAAA;IAOzI,iBAAc;GAEd,GAAA,CAAA,WAAQ,KAAA,QAAA,SAAA,CAAA,GAAA,CAAA,MAEV,UAAA,GAAA,mBAyBI,KAAA;;IAvBD,MAAM,QAAA;IACN,OAAK,eAAE,MAAA,EAAA,CAAE,CAAC,MAAA,YAAA,CAAY,CAAA;KAAA,SAAG,QAAA;KAAO,WAAE,QAAA;IAAS,CAAA,GAAKA,KAAAA,OAAO,KAAK,CAAA;IAC5D,QAAQ,QAAA,WAAQ,WAAc,KAAA;IAC9B,KAAK,QAAA,WAAQ,wBAA2B,KAAA;GAEzC,GAAA,CAAA,WAAQ,KAAA,QAAA,SAAA,GAEA,QAAA,YADR,UAAA,GAAA,mBAgBM,OAhBN,YAgBM,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAFJ,mBAAuB,QAAA,EAAjB,GAAE,aAAY,GAAA,MAAA,EAAA,GACpB,mBAAuB,QAAA,EAAjB,GAAE,aAAY,GAAA,MAAA,EAAA,CAAA,EAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,GAAA,IAAA,UAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menubar.js","names":[],"sources":["../../../src/primitives/Menubar/Menubar.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Menubar — the classic desktop-app menu strip (File · View · Help …).\n *\n * Data-driven: pass a `menus` array; the component owns open/close, hover-to-switch,\n * keyboard nav and click-outside. Selecting an item emits `select` with its `command`\n * id — the host maps that id to an action (keeps the primitive free of app logic).\n *\n * A11y: WAI-ARIA menubar semantics (roles + aria-expanded/haspopup) with Escape,\n * Arrow, Home/End and Enter/Space handling. When richer focus-trapping is needed we\n * can later delegate to Reka UI without changing this call-site contract.\n */\nexport interface MenubarItem {\n /** Visible label. */\n label: string;\n /** Command id emitted on select. Omit for a non-actionable row. */\n command?: string;\n /** Right-aligned accelerator hint, e.g. \"Ctrl+S\". */\n shortcut?: string;\n /** Render a divider instead of an item (label ignored). */\n separator?: boolean;\n disabled?: boolean;\n}\n\nexport interface MenubarMenu {\n id: string;\n label: string;\n items: MenubarItem[];\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { onMounted, onBeforeUnmount, ref, nextTick } from \"vue\";\nimport { listStaggerDelay } from \"../../lib/motion\";\n\nconst props = defineProps<{\n /** The top-level menus, left to right, each carrying its own item list. */\n menus: MenubarMenu[];\n}>();\nconst emit = defineEmits<{ (e: \"select\", command: string): void }>();\n\nconst openId = ref<string | null>(null);\nconst activeIndex = ref(-1); // highlighted item within the open menu\n\nconst openMenu = (menu: MenubarMenu | undefined) => menu?.items ?? [];\nconst firstEnabled = (items: MenubarItem[], from = 0, dir = 1): number => {\n for (let i = from; i >= 0 && i < items.length; i += dir) {\n const item = items[i];\n if (item && !item.separator && !item.disabled) return i;\n }\n return -1;\n};\n\nfunction toggle(id: string): void {\n openId.value = openId.value === id ? null : id;\n activeIndex.value = -1;\n}\nfunction hover(id: string): void {\n if (openId.value !== null && openId.value !== id) {\n openId.value = id;\n activeIndex.value = -1;\n }\n}\nfunction choose(item: MenubarItem): void {\n if (item.separator || item.disabled) return;\n close();\n if (item.command) emit(\"select\", item.command);\n}\nfunction close(): void {\n openId.value = null;\n activeIndex.value = -1;\n}\n\nfunction moveMenu(dir: 1 | -1): void {\n const ids = props.menus.map((m) => m.id);\n const cur = openId.value ? ids.indexOf(openId.value) : 0;\n const next = (cur + dir + ids.length) % ids.length;\n openId.value = ids[next] ?? null;\n activeIndex.value = -1;\n}\n\nasync function onTriggerKeydown(e: KeyboardEvent, menu: MenubarMenu): Promise<void> {\n switch (e.key) {\n case \"ArrowDown\":\n case \"Enter\":\n case \" \":\n e.preventDefault();\n openId.value = menu.id;\n await nextTick();\n activeIndex.value = firstEnabled(menu.items);\n break;\n case \"ArrowRight\":\n e.preventDefault();\n if (openId.value) moveMenu(1);\n break;\n case \"ArrowLeft\":\n e.preventDefault();\n if (openId.value) moveMenu(-1);\n break;\n case \"Escape\":\n close();\n break;\n }\n}\n\nfunction onMenuKeydown(e: KeyboardEvent, menu: MenubarMenu): void {\n const items = menu.items;\n switch (e.key) {\n case \"ArrowDown\":\n e.preventDefault();\n activeIndex.value = firstEnabled(items, Math.max(activeIndex.value, -1) + 1, 1);\n if (activeIndex.value === -1) activeIndex.value = firstEnabled(items, 0, 1);\n break;\n case \"ArrowUp\":\n e.preventDefault();\n activeIndex.value =\n activeIndex.value <= 0\n ? firstEnabled(items, items.length - 1, -1)\n : firstEnabled(items, activeIndex.value - 1, -1);\n break;\n case \"Home\":\n e.preventDefault();\n activeIndex.value = firstEnabled(items, 0, 1);\n break;\n case \"End\":\n e.preventDefault();\n activeIndex.value = firstEnabled(items, items.length - 1, -1);\n break;\n case \"ArrowRight\":\n e.preventDefault();\n moveMenu(1);\n break;\n case \"ArrowLeft\":\n e.preventDefault();\n moveMenu(-1);\n break;\n case \"Enter\":\n case \" \": {\n e.preventDefault();\n const item = activeIndex.value >= 0 ? items[activeIndex.value] : undefined;\n if (item) choose(item);\n break;\n }\n case \"Escape\":\n e.preventDefault();\n close();\n break;\n }\n}\n\nonMounted(() => window.addEventListener(\"click\", close));\nonBeforeUnmount(() => window.removeEventListener(\"click\", close));\n</script>\n\n<template>\n <div\n role=\"menubar\"\n class=\"flex items-center gap-0.5\"\n style=\"-webkit-app-region: no-drag\"\n @click.stop\n >\n <div v-for=\"menu in menus\" :key=\"menu.id\" class=\"relative\">\n <button\n :id=\"`menubar-trigger-${menu.id}`\"\n type=\"button\"\n role=\"menuitem\"\n :aria-haspopup=\"true\"\n :aria-expanded=\"openId === menu.id\"\n class=\"rounded-sm px-2 py-1 text-xs text-muted-foreground transition-colors duration-fast ease-out hover:bg-subtle hover:text-foreground focus-visible:bg-subtle focus-visible:text-foreground\"\n :class=\"openId === menu.id && 'bg-subtle text-foreground'\"\n @click.stop=\"toggle(menu.id)\"\n @mouseenter=\"hover(menu.id)\"\n @focus=\"hover(menu.id)\"\n @keydown=\"onTriggerKeydown($event, menu)\"\n >\n {{ menu.label }}\n </button>\n\n <div\n v-if=\"openId === menu.id\"\n role=\"menu\"\n :aria-label=\"menu.label\"\n tabindex=\"-1\"\n class=\"absolute left-0 top-full z-50 mt-1 min-w-[13rem] origin-top-left rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md animate-scale-in\"\n @click.stop\n @keydown=\"onMenuKeydown($event, menu)\"\n >\n <template v-for=\"(item, i) in openMenu(menu)\" :key=\"i\">\n <div v-if=\"item.separator\" role=\"separator\" class=\"my-1 h-px bg-border\" />\n <button\n v-else\n type=\"button\"\n role=\"menuitem\"\n :disabled=\"item.disabled\"\n :data-highlighted=\"activeIndex === i || undefined\"\n :style=\"{ animationDelay: listStaggerDelay(i) }\"\n class=\"flex w-full items-center justify-between gap-6 rounded-sm px-2 py-1.5 text-left text-xs text-foreground transition-colors duration-fast ease-out hover:bg-subtle disabled:pointer-events-none disabled:
|
|
1
|
+
{"version":3,"file":"Menubar.js","names":[],"sources":["../../../src/primitives/Menubar/Menubar.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Menubar — the classic desktop-app menu strip (File · View · Help …).\n *\n * Data-driven: pass a `menus` array; the component owns open/close, hover-to-switch,\n * keyboard nav and click-outside. Selecting an item emits `select` with its `command`\n * id — the host maps that id to an action (keeps the primitive free of app logic).\n *\n * A11y: WAI-ARIA menubar semantics (roles + aria-expanded/haspopup) with Escape,\n * Arrow, Home/End and Enter/Space handling. When richer focus-trapping is needed we\n * can later delegate to Reka UI without changing this call-site contract.\n */\nexport interface MenubarItem {\n /** Visible label. */\n label: string;\n /** Command id emitted on select. Omit for a non-actionable row. */\n command?: string;\n /** Right-aligned accelerator hint, e.g. \"Ctrl+S\". */\n shortcut?: string;\n /** Render a divider instead of an item (label ignored). */\n separator?: boolean;\n disabled?: boolean;\n}\n\nexport interface MenubarMenu {\n id: string;\n label: string;\n items: MenubarItem[];\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { onMounted, onBeforeUnmount, ref, nextTick } from \"vue\";\nimport { listStaggerDelay } from \"../../lib/motion\";\n\nconst props = defineProps<{\n /** The top-level menus, left to right, each carrying its own item list. */\n menus: MenubarMenu[];\n}>();\nconst emit = defineEmits<{ (e: \"select\", command: string): void }>();\n\nconst openId = ref<string | null>(null);\nconst activeIndex = ref(-1); // highlighted item within the open menu\n\nconst openMenu = (menu: MenubarMenu | undefined) => menu?.items ?? [];\nconst firstEnabled = (items: MenubarItem[], from = 0, dir = 1): number => {\n for (let i = from; i >= 0 && i < items.length; i += dir) {\n const item = items[i];\n if (item && !item.separator && !item.disabled) return i;\n }\n return -1;\n};\n\nfunction toggle(id: string): void {\n openId.value = openId.value === id ? null : id;\n activeIndex.value = -1;\n}\nfunction hover(id: string): void {\n if (openId.value !== null && openId.value !== id) {\n openId.value = id;\n activeIndex.value = -1;\n }\n}\nfunction choose(item: MenubarItem): void {\n if (item.separator || item.disabled) return;\n close();\n if (item.command) emit(\"select\", item.command);\n}\nfunction close(): void {\n openId.value = null;\n activeIndex.value = -1;\n}\n\nfunction moveMenu(dir: 1 | -1): void {\n const ids = props.menus.map((m) => m.id);\n const cur = openId.value ? ids.indexOf(openId.value) : 0;\n const next = (cur + dir + ids.length) % ids.length;\n openId.value = ids[next] ?? null;\n activeIndex.value = -1;\n}\n\nasync function onTriggerKeydown(e: KeyboardEvent, menu: MenubarMenu): Promise<void> {\n switch (e.key) {\n case \"ArrowDown\":\n case \"Enter\":\n case \" \":\n e.preventDefault();\n openId.value = menu.id;\n await nextTick();\n activeIndex.value = firstEnabled(menu.items);\n break;\n case \"ArrowRight\":\n e.preventDefault();\n if (openId.value) moveMenu(1);\n break;\n case \"ArrowLeft\":\n e.preventDefault();\n if (openId.value) moveMenu(-1);\n break;\n case \"Escape\":\n close();\n break;\n }\n}\n\nfunction onMenuKeydown(e: KeyboardEvent, menu: MenubarMenu): void {\n const items = menu.items;\n switch (e.key) {\n case \"ArrowDown\":\n e.preventDefault();\n activeIndex.value = firstEnabled(items, Math.max(activeIndex.value, -1) + 1, 1);\n if (activeIndex.value === -1) activeIndex.value = firstEnabled(items, 0, 1);\n break;\n case \"ArrowUp\":\n e.preventDefault();\n activeIndex.value =\n activeIndex.value <= 0\n ? firstEnabled(items, items.length - 1, -1)\n : firstEnabled(items, activeIndex.value - 1, -1);\n break;\n case \"Home\":\n e.preventDefault();\n activeIndex.value = firstEnabled(items, 0, 1);\n break;\n case \"End\":\n e.preventDefault();\n activeIndex.value = firstEnabled(items, items.length - 1, -1);\n break;\n case \"ArrowRight\":\n e.preventDefault();\n moveMenu(1);\n break;\n case \"ArrowLeft\":\n e.preventDefault();\n moveMenu(-1);\n break;\n case \"Enter\":\n case \" \": {\n e.preventDefault();\n const item = activeIndex.value >= 0 ? items[activeIndex.value] : undefined;\n if (item) choose(item);\n break;\n }\n case \"Escape\":\n e.preventDefault();\n close();\n break;\n }\n}\n\nonMounted(() => window.addEventListener(\"click\", close));\nonBeforeUnmount(() => window.removeEventListener(\"click\", close));\n</script>\n\n<template>\n <div\n role=\"menubar\"\n class=\"flex items-center gap-0.5\"\n style=\"-webkit-app-region: no-drag\"\n @click.stop\n >\n <div v-for=\"menu in menus\" :key=\"menu.id\" class=\"relative\">\n <button\n :id=\"`menubar-trigger-${menu.id}`\"\n type=\"button\"\n role=\"menuitem\"\n :aria-haspopup=\"true\"\n :aria-expanded=\"openId === menu.id\"\n class=\"rounded-sm px-2 py-1 text-xs text-muted-foreground transition-colors duration-fast ease-out hover:bg-subtle hover:text-foreground focus-visible:bg-subtle focus-visible:text-foreground\"\n :class=\"openId === menu.id && 'bg-subtle text-foreground'\"\n @click.stop=\"toggle(menu.id)\"\n @mouseenter=\"hover(menu.id)\"\n @focus=\"hover(menu.id)\"\n @keydown=\"onTriggerKeydown($event, menu)\"\n >\n {{ menu.label }}\n </button>\n\n <div\n v-if=\"openId === menu.id\"\n role=\"menu\"\n :aria-label=\"menu.label\"\n tabindex=\"-1\"\n class=\"absolute left-0 top-full z-50 mt-1 min-w-[13rem] origin-top-left rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md animate-scale-in\"\n @click.stop\n @keydown=\"onMenuKeydown($event, menu)\"\n >\n <template v-for=\"(item, i) in openMenu(menu)\" :key=\"i\">\n <div v-if=\"item.separator\" role=\"separator\" class=\"my-1 h-px bg-border\" />\n <!-- The row's colour, not its alpha, says it is unavailable. A menu\n row is nothing but its label, and `disabled:opacity-40` composited\n that label to 2.40:1 on the popover — a disabled row a reader\n cannot make out tells them nothing about what is unavailable,\n which is the only thing it is there to say. Muted instead: 5.76:1\n at rest, and a clear drop from the 15.46:1 an available row wears,\n so the state still reads at a glance. The shortcut beside it\n declares `text-muted-foreground` on its own element, so it lands\n on the same colour rather than inheriting this one. -->\n <button\n v-else\n type=\"button\"\n role=\"menuitem\"\n :disabled=\"item.disabled\"\n :data-highlighted=\"activeIndex === i || undefined\"\n :style=\"{ animationDelay: listStaggerDelay(i) }\"\n class=\"flex w-full items-center justify-between gap-6 rounded-sm px-2 py-1.5 text-left text-xs text-foreground transition-colors duration-fast ease-out hover:bg-subtle disabled:pointer-events-none disabled:text-muted-foreground data-[highlighted]:bg-subtle animate-fade-rise\"\n @click=\"choose(item)\"\n @mouseenter=\"activeIndex = i\"\n @focus=\"activeIndex = i\"\n >\n <span>{{ item.label }}</span>\n <span v-if=\"item.shortcut\" class=\"tabular text-[0.6875rem] text-muted-foreground\">\n {{ item.shortcut }}\n </span>\n </button>\n </template>\n </div>\n </div>\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menubar.vue.d.ts","sourceRoot":"","sources":["../../../src/primitives/Menubar/Menubar.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Menubar.vue.d.ts","sourceRoot":"","sources":["../../../src/primitives/Menubar/Menubar.vue"],"names":[],"mappings":"AAmOA;;;;;;;;;;GAUG;AACH,MAAM,WAAW,WAAW;IAC1B,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2DAA2D;IAC3D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB;wBACoB,OAAO,YAAY;AAAxC,wBAAyC;AACzC,QAAA,MAAM,YAAY;IAEhB,2EAA2E;WACpE,WAAW,EAAE;;;;IADpB,2EAA2E;WACpE,WAAW,EAAE;;;kFAiUlB,CAAC"}
|
|
@@ -168,7 +168,7 @@ var Menubar_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCo
|
|
|
168
168
|
disabled: item.disabled,
|
|
169
169
|
"data-highlighted": activeIndex.value === i || void 0,
|
|
170
170
|
style: normalizeStyle({ animationDelay: unref(listStaggerDelay)(i) }),
|
|
171
|
-
class: "flex w-full items-center justify-between gap-6 rounded-sm px-2 py-1.5 text-left text-xs text-foreground transition-colors duration-fast ease-out hover:bg-subtle disabled:pointer-events-none disabled:
|
|
171
|
+
class: "flex w-full items-center justify-between gap-6 rounded-sm px-2 py-1.5 text-left text-xs text-foreground transition-colors duration-fast ease-out hover:bg-subtle disabled:pointer-events-none disabled:text-muted-foreground data-[highlighted]:bg-subtle animate-fade-rise",
|
|
172
172
|
onClick: ($event) => choose(item),
|
|
173
173
|
onMouseenter: ($event) => activeIndex.value = i,
|
|
174
174
|
onFocus: ($event) => activeIndex.value = i
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menubar.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/primitives/Menubar/Menubar.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Menubar — the classic desktop-app menu strip (File · View · Help …).\n *\n * Data-driven: pass a `menus` array; the component owns open/close, hover-to-switch,\n * keyboard nav and click-outside. Selecting an item emits `select` with its `command`\n * id — the host maps that id to an action (keeps the primitive free of app logic).\n *\n * A11y: WAI-ARIA menubar semantics (roles + aria-expanded/haspopup) with Escape,\n * Arrow, Home/End and Enter/Space handling. When richer focus-trapping is needed we\n * can later delegate to Reka UI without changing this call-site contract.\n */\nexport interface MenubarItem {\n /** Visible label. */\n label: string;\n /** Command id emitted on select. Omit for a non-actionable row. */\n command?: string;\n /** Right-aligned accelerator hint, e.g. \"Ctrl+S\". */\n shortcut?: string;\n /** Render a divider instead of an item (label ignored). */\n separator?: boolean;\n disabled?: boolean;\n}\n\nexport interface MenubarMenu {\n id: string;\n label: string;\n items: MenubarItem[];\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { onMounted, onBeforeUnmount, ref, nextTick } from \"vue\";\nimport { listStaggerDelay } from \"../../lib/motion\";\n\nconst props = defineProps<{\n /** The top-level menus, left to right, each carrying its own item list. */\n menus: MenubarMenu[];\n}>();\nconst emit = defineEmits<{ (e: \"select\", command: string): void }>();\n\nconst openId = ref<string | null>(null);\nconst activeIndex = ref(-1); // highlighted item within the open menu\n\nconst openMenu = (menu: MenubarMenu | undefined) => menu?.items ?? [];\nconst firstEnabled = (items: MenubarItem[], from = 0, dir = 1): number => {\n for (let i = from; i >= 0 && i < items.length; i += dir) {\n const item = items[i];\n if (item && !item.separator && !item.disabled) return i;\n }\n return -1;\n};\n\nfunction toggle(id: string): void {\n openId.value = openId.value === id ? null : id;\n activeIndex.value = -1;\n}\nfunction hover(id: string): void {\n if (openId.value !== null && openId.value !== id) {\n openId.value = id;\n activeIndex.value = -1;\n }\n}\nfunction choose(item: MenubarItem): void {\n if (item.separator || item.disabled) return;\n close();\n if (item.command) emit(\"select\", item.command);\n}\nfunction close(): void {\n openId.value = null;\n activeIndex.value = -1;\n}\n\nfunction moveMenu(dir: 1 | -1): void {\n const ids = props.menus.map((m) => m.id);\n const cur = openId.value ? ids.indexOf(openId.value) : 0;\n const next = (cur + dir + ids.length) % ids.length;\n openId.value = ids[next] ?? null;\n activeIndex.value = -1;\n}\n\nasync function onTriggerKeydown(e: KeyboardEvent, menu: MenubarMenu): Promise<void> {\n switch (e.key) {\n case \"ArrowDown\":\n case \"Enter\":\n case \" \":\n e.preventDefault();\n openId.value = menu.id;\n await nextTick();\n activeIndex.value = firstEnabled(menu.items);\n break;\n case \"ArrowRight\":\n e.preventDefault();\n if (openId.value) moveMenu(1);\n break;\n case \"ArrowLeft\":\n e.preventDefault();\n if (openId.value) moveMenu(-1);\n break;\n case \"Escape\":\n close();\n break;\n }\n}\n\nfunction onMenuKeydown(e: KeyboardEvent, menu: MenubarMenu): void {\n const items = menu.items;\n switch (e.key) {\n case \"ArrowDown\":\n e.preventDefault();\n activeIndex.value = firstEnabled(items, Math.max(activeIndex.value, -1) + 1, 1);\n if (activeIndex.value === -1) activeIndex.value = firstEnabled(items, 0, 1);\n break;\n case \"ArrowUp\":\n e.preventDefault();\n activeIndex.value =\n activeIndex.value <= 0\n ? firstEnabled(items, items.length - 1, -1)\n : firstEnabled(items, activeIndex.value - 1, -1);\n break;\n case \"Home\":\n e.preventDefault();\n activeIndex.value = firstEnabled(items, 0, 1);\n break;\n case \"End\":\n e.preventDefault();\n activeIndex.value = firstEnabled(items, items.length - 1, -1);\n break;\n case \"ArrowRight\":\n e.preventDefault();\n moveMenu(1);\n break;\n case \"ArrowLeft\":\n e.preventDefault();\n moveMenu(-1);\n break;\n case \"Enter\":\n case \" \": {\n e.preventDefault();\n const item = activeIndex.value >= 0 ? items[activeIndex.value] : undefined;\n if (item) choose(item);\n break;\n }\n case \"Escape\":\n e.preventDefault();\n close();\n break;\n }\n}\n\nonMounted(() => window.addEventListener(\"click\", close));\nonBeforeUnmount(() => window.removeEventListener(\"click\", close));\n</script>\n\n<template>\n <div\n role=\"menubar\"\n class=\"flex items-center gap-0.5\"\n style=\"-webkit-app-region: no-drag\"\n @click.stop\n >\n <div v-for=\"menu in menus\" :key=\"menu.id\" class=\"relative\">\n <button\n :id=\"`menubar-trigger-${menu.id}`\"\n type=\"button\"\n role=\"menuitem\"\n :aria-haspopup=\"true\"\n :aria-expanded=\"openId === menu.id\"\n class=\"rounded-sm px-2 py-1 text-xs text-muted-foreground transition-colors duration-fast ease-out hover:bg-subtle hover:text-foreground focus-visible:bg-subtle focus-visible:text-foreground\"\n :class=\"openId === menu.id && 'bg-subtle text-foreground'\"\n @click.stop=\"toggle(menu.id)\"\n @mouseenter=\"hover(menu.id)\"\n @focus=\"hover(menu.id)\"\n @keydown=\"onTriggerKeydown($event, menu)\"\n >\n {{ menu.label }}\n </button>\n\n <div\n v-if=\"openId === menu.id\"\n role=\"menu\"\n :aria-label=\"menu.label\"\n tabindex=\"-1\"\n class=\"absolute left-0 top-full z-50 mt-1 min-w-[13rem] origin-top-left rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md animate-scale-in\"\n @click.stop\n @keydown=\"onMenuKeydown($event, menu)\"\n >\n <template v-for=\"(item, i) in openMenu(menu)\" :key=\"i\">\n <div v-if=\"item.separator\" role=\"separator\" class=\"my-1 h-px bg-border\" />\n <button\n v-else\n type=\"button\"\n role=\"menuitem\"\n :disabled=\"item.disabled\"\n :data-highlighted=\"activeIndex === i || undefined\"\n :style=\"{ animationDelay: listStaggerDelay(i) }\"\n class=\"flex w-full items-center justify-between gap-6 rounded-sm px-2 py-1.5 text-left text-xs text-foreground transition-colors duration-fast ease-out hover:bg-subtle disabled:pointer-events-none disabled:opacity-40 data-[highlighted]:bg-subtle animate-fade-rise\"\n @click=\"choose(item)\"\n @mouseenter=\"activeIndex = i\"\n @focus=\"activeIndex = i\"\n >\n <span>{{ item.label }}</span>\n <span v-if=\"item.shortcut\" class=\"tabular text-[0.6875rem] text-muted-foreground\">\n {{ item.shortcut }}\n </span>\n </button>\n </template>\n </div>\n </div>\n </div>\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AK,KAAA;MACvC,OAAK,eAAA,EAAA,gBAAoB,MAAA,gBAAA,CAAgB,CAAC,CAAC,EAAA,CAAA;MAC5C,OAAM;MACL,UAAK,WAAE,OAAO,IAAI;MAClB,eAAU,WAAE,YAAA,QAAc;MAC1B,UAAK,WAAE,YAAA,QAAc;KAEtB,GAAA,CAAA,mBAA6B,QAAA,MAAA,gBAApB,KAAK,KAAK,GAAA,CAAA,GACP,KAAK,YAAjB,UAAA,GAAA,mBAEO,QAFP,YAEO,gBADF,KAAK,QAAQ,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,GAAA,IAAA,UAAA,EAAA,GAAA,EAAA"}
|
|
1
|
+
{"version":3,"file":"Menubar.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/primitives/Menubar/Menubar.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Menubar — the classic desktop-app menu strip (File · View · Help …).\n *\n * Data-driven: pass a `menus` array; the component owns open/close, hover-to-switch,\n * keyboard nav and click-outside. Selecting an item emits `select` with its `command`\n * id — the host maps that id to an action (keeps the primitive free of app logic).\n *\n * A11y: WAI-ARIA menubar semantics (roles + aria-expanded/haspopup) with Escape,\n * Arrow, Home/End and Enter/Space handling. When richer focus-trapping is needed we\n * can later delegate to Reka UI without changing this call-site contract.\n */\nexport interface MenubarItem {\n /** Visible label. */\n label: string;\n /** Command id emitted on select. Omit for a non-actionable row. */\n command?: string;\n /** Right-aligned accelerator hint, e.g. \"Ctrl+S\". */\n shortcut?: string;\n /** Render a divider instead of an item (label ignored). */\n separator?: boolean;\n disabled?: boolean;\n}\n\nexport interface MenubarMenu {\n id: string;\n label: string;\n items: MenubarItem[];\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { onMounted, onBeforeUnmount, ref, nextTick } from \"vue\";\nimport { listStaggerDelay } from \"../../lib/motion\";\n\nconst props = defineProps<{\n /** The top-level menus, left to right, each carrying its own item list. */\n menus: MenubarMenu[];\n}>();\nconst emit = defineEmits<{ (e: \"select\", command: string): void }>();\n\nconst openId = ref<string | null>(null);\nconst activeIndex = ref(-1); // highlighted item within the open menu\n\nconst openMenu = (menu: MenubarMenu | undefined) => menu?.items ?? [];\nconst firstEnabled = (items: MenubarItem[], from = 0, dir = 1): number => {\n for (let i = from; i >= 0 && i < items.length; i += dir) {\n const item = items[i];\n if (item && !item.separator && !item.disabled) return i;\n }\n return -1;\n};\n\nfunction toggle(id: string): void {\n openId.value = openId.value === id ? null : id;\n activeIndex.value = -1;\n}\nfunction hover(id: string): void {\n if (openId.value !== null && openId.value !== id) {\n openId.value = id;\n activeIndex.value = -1;\n }\n}\nfunction choose(item: MenubarItem): void {\n if (item.separator || item.disabled) return;\n close();\n if (item.command) emit(\"select\", item.command);\n}\nfunction close(): void {\n openId.value = null;\n activeIndex.value = -1;\n}\n\nfunction moveMenu(dir: 1 | -1): void {\n const ids = props.menus.map((m) => m.id);\n const cur = openId.value ? ids.indexOf(openId.value) : 0;\n const next = (cur + dir + ids.length) % ids.length;\n openId.value = ids[next] ?? null;\n activeIndex.value = -1;\n}\n\nasync function onTriggerKeydown(e: KeyboardEvent, menu: MenubarMenu): Promise<void> {\n switch (e.key) {\n case \"ArrowDown\":\n case \"Enter\":\n case \" \":\n e.preventDefault();\n openId.value = menu.id;\n await nextTick();\n activeIndex.value = firstEnabled(menu.items);\n break;\n case \"ArrowRight\":\n e.preventDefault();\n if (openId.value) moveMenu(1);\n break;\n case \"ArrowLeft\":\n e.preventDefault();\n if (openId.value) moveMenu(-1);\n break;\n case \"Escape\":\n close();\n break;\n }\n}\n\nfunction onMenuKeydown(e: KeyboardEvent, menu: MenubarMenu): void {\n const items = menu.items;\n switch (e.key) {\n case \"ArrowDown\":\n e.preventDefault();\n activeIndex.value = firstEnabled(items, Math.max(activeIndex.value, -1) + 1, 1);\n if (activeIndex.value === -1) activeIndex.value = firstEnabled(items, 0, 1);\n break;\n case \"ArrowUp\":\n e.preventDefault();\n activeIndex.value =\n activeIndex.value <= 0\n ? firstEnabled(items, items.length - 1, -1)\n : firstEnabled(items, activeIndex.value - 1, -1);\n break;\n case \"Home\":\n e.preventDefault();\n activeIndex.value = firstEnabled(items, 0, 1);\n break;\n case \"End\":\n e.preventDefault();\n activeIndex.value = firstEnabled(items, items.length - 1, -1);\n break;\n case \"ArrowRight\":\n e.preventDefault();\n moveMenu(1);\n break;\n case \"ArrowLeft\":\n e.preventDefault();\n moveMenu(-1);\n break;\n case \"Enter\":\n case \" \": {\n e.preventDefault();\n const item = activeIndex.value >= 0 ? items[activeIndex.value] : undefined;\n if (item) choose(item);\n break;\n }\n case \"Escape\":\n e.preventDefault();\n close();\n break;\n }\n}\n\nonMounted(() => window.addEventListener(\"click\", close));\nonBeforeUnmount(() => window.removeEventListener(\"click\", close));\n</script>\n\n<template>\n <div\n role=\"menubar\"\n class=\"flex items-center gap-0.5\"\n style=\"-webkit-app-region: no-drag\"\n @click.stop\n >\n <div v-for=\"menu in menus\" :key=\"menu.id\" class=\"relative\">\n <button\n :id=\"`menubar-trigger-${menu.id}`\"\n type=\"button\"\n role=\"menuitem\"\n :aria-haspopup=\"true\"\n :aria-expanded=\"openId === menu.id\"\n class=\"rounded-sm px-2 py-1 text-xs text-muted-foreground transition-colors duration-fast ease-out hover:bg-subtle hover:text-foreground focus-visible:bg-subtle focus-visible:text-foreground\"\n :class=\"openId === menu.id && 'bg-subtle text-foreground'\"\n @click.stop=\"toggle(menu.id)\"\n @mouseenter=\"hover(menu.id)\"\n @focus=\"hover(menu.id)\"\n @keydown=\"onTriggerKeydown($event, menu)\"\n >\n {{ menu.label }}\n </button>\n\n <div\n v-if=\"openId === menu.id\"\n role=\"menu\"\n :aria-label=\"menu.label\"\n tabindex=\"-1\"\n class=\"absolute left-0 top-full z-50 mt-1 min-w-[13rem] origin-top-left rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md animate-scale-in\"\n @click.stop\n @keydown=\"onMenuKeydown($event, menu)\"\n >\n <template v-for=\"(item, i) in openMenu(menu)\" :key=\"i\">\n <div v-if=\"item.separator\" role=\"separator\" class=\"my-1 h-px bg-border\" />\n <!-- The row's colour, not its alpha, says it is unavailable. A menu\n row is nothing but its label, and `disabled:opacity-40` composited\n that label to 2.40:1 on the popover — a disabled row a reader\n cannot make out tells them nothing about what is unavailable,\n which is the only thing it is there to say. Muted instead: 5.76:1\n at rest, and a clear drop from the 15.46:1 an available row wears,\n so the state still reads at a glance. The shortcut beside it\n declares `text-muted-foreground` on its own element, so it lands\n on the same colour rather than inheriting this one. -->\n <button\n v-else\n type=\"button\"\n role=\"menuitem\"\n :disabled=\"item.disabled\"\n :data-highlighted=\"activeIndex === i || undefined\"\n :style=\"{ animationDelay: listStaggerDelay(i) }\"\n class=\"flex w-full items-center justify-between gap-6 rounded-sm px-2 py-1.5 text-left text-xs text-foreground transition-colors duration-fast ease-out hover:bg-subtle disabled:pointer-events-none disabled:text-muted-foreground data-[highlighted]:bg-subtle animate-fade-rise\"\n @click=\"choose(item)\"\n @mouseenter=\"activeIndex = i\"\n @focus=\"activeIndex = i\"\n >\n <span>{{ item.label }}</span>\n <span v-if=\"item.shortcut\" class=\"tabular text-[0.6875rem] text-muted-foreground\">\n {{ item.shortcut }}\n </span>\n </button>\n </template>\n </div>\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmCA,MAAM,QAAQ;EAId,MAAM,OAAO;EAEb,MAAM,SAAS,IAAmB,IAAI;EACtC,MAAM,cAAc,IAAI,EAAE;EAE1B,MAAM,YAAY,SAAkC,MAAM,SAAS,CAAC;EACpE,MAAM,gBAAgB,OAAsB,OAAO,GAAG,MAAM,MAAc;GACxE,KAAK,IAAI,IAAI,MAAM,KAAK,KAAK,IAAI,MAAM,QAAQ,KAAK,KAAK;IACvD,MAAM,OAAO,MAAM;IACnB,IAAI,QAAQ,CAAC,KAAK,aAAa,CAAC,KAAK,UAAU,OAAO;GACxD;GACA,OAAO;EACT;EAEA,SAAS,OAAO,IAAkB;GA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_vue_type_script_setup_true_lang_default from "./NumberField.vue_vue_type_script_setup_true_lang.js";
|
|
1
|
+
import NumberField_vue_vue_type_script_setup_true_lang_default, { NUMBER_FIELD_LABELS } from "./NumberField.vue_vue_type_script_setup_true_lang.js";
|
|
2
2
|
//#region src/primitives/NumberField/NumberField.vue
|
|
3
3
|
var NumberField_default = NumberField_vue_vue_type_script_setup_true_lang_default;
|
|
4
4
|
//#endregion
|
|
5
|
-
export { NumberField_default as default };
|
|
5
|
+
export { NUMBER_FIELD_LABELS, NumberField_default as default };
|
|
6
6
|
|
|
7
7
|
//# sourceMappingURL=NumberField.js.map
|