@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.vue_vue_type_script_setup_true_lang.js","names":["$emit"],"sources":["../../../src/primitives/Select/Select.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { cva } from \"class-variance-authority\";\n\n/** One row of the list. `value` is what the model carries; `label` is what a reader sees. */\nexport interface SelectOption {\n /** The value bound to `v-model` when this row is chosen. Unique within the list. */\n value: string;\n /** The text shown on the row, and on the trigger once it is chosen. */\n label: string;\n /** Present but unchoosable — visible, skipped by the keyboard, unclickable. */\n disabled?: boolean;\n}\n\n/**\n * The trigger's height scale. It matches the text input scale exactly, so a\n * form row mixing a Select beside a text field never comes out uneven — which\n * is why reaching past `size` for an `h-*` class is always the wrong fix.\n */\nexport type SelectSize = \"sm\" | \"md\" | \"lg\";\n\nexport const selectVariants = cva(\n [\n \"group inline-flex w-full items-center justify-between gap-2 rounded-md border border-input bg-background text-foreground\",\n \"transition-[color,background-color,box-shadow] duration-fast ease-out hover:bg-subtle\",\n // Rim-lit at rest; the ring blooms on focus.\n \"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring\",\n \"disabled:cursor-not-allowed disabled:opacity-50 data-[placeholder]:text-muted-foreground\",\n ],\n {\n // `satisfies` keeps the two halves honest: the union above is the name a\n // consumer imports and the documentation prints, the map below is the\n // classes. Adding a member to one and not the other stops compiling.\n variants: {\n size: {\n sm: \"h-8 px-2.5 text-xs\",\n md: \"h-9 px-3 text-sm\",\n lg: \"h-11 px-4 text-base\",\n } satisfies Record<SelectSize, string>,\n },\n defaultVariants: { size: \"md\" },\n },\n);\n</script>\n\n<script setup lang=\"ts\">\nimport {\n SelectRoot,\n SelectTrigger,\n SelectValue,\n SelectIcon,\n SelectPortal,\n SelectContent,\n SelectViewport,\n SelectItem,\n SelectItemText,\n SelectItemIndicator,\n} from \"reka-ui\";\nimport { Check, ChevronDown } from \"@lucide/vue\";\nimport { cn } from \"../../lib/cn\";\nimport { listStaggerDelay } from \"../../lib/motion\";\nimport { useSplitAttrs } from \"../../lib/attrs\";\n\n/**\n * Select — pick one value out of a closed list, through a compact trigger and\n * a popover listbox. It suits roughly three to fifteen rows where one value is\n * always chosen: a language, a resolution, a quality preset.\n *\n * Below that, two to five options a reader should see all of at once are\n * better shown than hidden. Above it, a list long enough to need searching\n * wants a combobox, which is a different control rather than a longer version\n * of this one.\n *\n * Built on Reka UI's Select, which supplies the listbox semantics: arrow-key\n * navigation, first-character typeahead, Escape and outside-click to close, and\n * the `role=\"combobox\"` trigger wired to the listbox by `aria-expanded` and\n * `aria-controls`. The active row is tracked by moving real focus onto it, not\n * by `aria-activedescendant`.\n */\nwithDefaults(\n defineProps<{\n /** The chosen option's `value`. Leave it unset to show the placeholder. */\n modelValue?: string;\n /** The rows, in the order they are shown. */\n options: SelectOption[];\n /** Shown on the trigger while nothing is chosen. It is not an option. */\n placeholder?: string;\n /** Unavailable: dims the trigger and refuses to open. */\n disabled?: boolean;\n /** Error state: paints the destructive border and ring, and sets `aria-invalid`. */\n invalid?: boolean;\n /** Trigger height. It shares the text input scale so mixed form rows stay aligned. */\n size?: SelectSize;\n }>(),\n { disabled: false, invalid: false, size: \"md\" },\n);\n\ndefineEmits<{\n /** The chosen option's `value`. Fires once per choice; the list closes with it. */\n \"update:modelValue\": [value: string];\n}>();\n\n// The root renders no DOM node at all, so fallthrough attributes would be\n// dropped on the floor rather than landing anywhere. They go to the trigger,\n// which is the interactive element they describe.\n//\n// `class` is pulled out of that spread and merged through `cn()` instead.\n// Spreading it alongside the trigger's own `:class` only concatenates the two\n// lists — Vue's merge is generic, not Tailwind-aware — so a caller's `w-28`\n// silently loses to the trigger's own `w-full` depending on which utility\n// Tailwind happened to emit last.\ndefineOptions({ inheritAttrs: false });\nconst { attrs, rest: triggerAttrs } = useSplitAttrs();\n</script>\n\n<template>\n <SelectRoot\n :model-value=\"modelValue ?? ''\"\n :disabled=\"disabled\"\n @update:model-value=\"$emit('update:modelValue', String($event))\"\n >\n <SelectTrigger\n v-bind=\"triggerAttrs\"\n :aria-invalid=\"invalid || undefined\"\n :data-invalid=\"invalid || undefined\"\n :class=\"\n cn(\n selectVariants({ size }),\n !invalid && 'focus-visible:shadow-halo',\n invalid && 'border-destructive focus-visible:outline-destructive',\n attrs.class as string,\n )\n \"\n >\n <SelectValue :placeholder=\"placeholder ?? ''\" />\n <SelectIcon class=\"shrink-0 text-muted-foreground\">\n <ChevronDown\n class=\"h-4 w-4 transition-transform duration-fast ease-out group-data-[state=open]:rotate-180\"\n />\n </SelectIcon>\n </SelectTrigger>\n\n <SelectPortal>\n <SelectContent\n position=\"popper\"\n :side-offset=\"6\"\n :class=\"\n cn(\n 'z-50 min-w-[var(--reka-select-trigger-width)] overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md',\n // Scoped to the open state, never unconditional. Reka keeps the\n // closed content mounted while it waits for an animationend that a\n // mount-only animation never fires again — an invisible overlay\n // eating clicks. Scoping it makes the closed element compute\n // `animation-name: none`, which is the immediate-unmount branch.\n 'data-[state=open]:animate-fade-rise',\n )\n \"\n >\n <SelectViewport class=\"p-1\">\n <!-- The rows reveal one step after another, from the shared stagger\n vocabulary rather than a per-template delay of its own. -->\n <SelectItem\n v-for=\"(option, index) in options\"\n :key=\"option.value\"\n :value=\"option.value\"\n :disabled=\"option.disabled ?? false\"\n :style=\"{ animationDelay: listStaggerDelay(index) }\"\n :class=\"\n cn(\n 'relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-3 py-1.5 pr-8 text-sm text-foreground outline-none',\n 'transition-colors duration-fast ease-out',\n 'animate-fade-rise',\n 'data-[highlighted]:bg-subtle',\n 'data-[state=checked]:bg-primary-muted data-[state=checked]:text-primary',\n 'data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n )\n \"\n >\n <SelectItemText>{{ option.label }}</SelectItemText>\n <SelectItemIndicator class=\"absolute right-2 inline-flex items-center\">\n <Check class=\"h-4 w-4\" />\n </SelectItemIndicator>\n </SelectItem>\n </SelectViewport>\n </SelectContent>\n </SelectPortal>\n </SelectRoot>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAoBA,IAAa,iBAAiB,IAC5B;CACE;CACA;CAEA;CACA;AACF,GACA;CAIE,UAAU,EACR,MAAM;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;CACN,EACF;CACA,iBAAiB,EAAE,MAAM,KAAK;AAChC,CACF;;;;;;;;;;;;;;;;;;;;EAsEA,MAAM,EAAE,OAAO,MAAM,iBAAiB,cAAc;;GAIlD,OAAA,UAAA,GAAA,YAsEa,MAAA,UAAA,GAAA;IArEV,eAAa,QAAA,cAAU;IACvB,UAAU,QAAA;IACV,uBAAkB,OAAA,OAAA,OAAA,MAAA,WAAEA,KAAAA,MAAK,qBAAsB,OAAO,MAAM,CAAA;;IAE7D,SAAA,cAmBgB,CAnBhB,YAmBgB,MAAA,aAAA,GAnBhB,WACU,MAkBM,YAAA,GAlBM;KACnB,gBAAc,QAAA,WAAW,KAAA;KACzB,gBAAc,QAAA,WAAW,KAAA;KACzB,OAAgB,MAAA,EAAA,CAAE,CAAY,MAAA,cAAA,CAAc,CAAA,EAAA,MAAG,QAAA,KAAI,CAAA,GAAgB,CAAA,QAAA,WAAO,6BAA2C,QAAA,WAAO,wDAAsE,MAAA,KAAA,CAAK,CAAC,KAAA;;KASzM,SAAA,cAAgD,CAAhD,YAAgD,MAAA,WAAA,GAAA,EAAlC,aAAa,QAAA,eAAW,GAAA,GAAA,MAAA,GAAA,CAAA,aAAA,CAAA,GACtC,YAIa,MAAA,UAAA,GAAA,EAJD,OAAM,iCAAgC,GAAA;MAChD,SAAA,cAEE,CAFF,YAEE,MAAA,WAAA,GAAA,EADA,OAAM,yFAAwF,CAAA,CAAA,CAAA;;;;;;;;IAKpG,CAAA,GAAA,YA2Ce,MAAA,YAAA,GAAA,MAAA;KA1Cb,SAAA,cAyCgB,CAzChB,YAyCgB,MAAA,aAAA,GAAA;MAxCd,UAAS;MACR,eAAa;MACb,OAAK,eAAa,MAAA,EAAA,CAAE,CAAA,8IAAA,qCAAA,CAAA;;MAYrB,SAAA,cAyBiB,CAzBjB,YAyBiB,MAAA,cAAA,GAAA,EAzBD,OAAM,MAAK,GAAA;OAIvB,SAAA,cAAkC,EADpC,UAAA,IAAA,GAAA,mBAqBa,UAAA,MAAA,WApBe,QAAA,UAAlB,QAAQ,UAAK;QADvB,OAAA,UAAA,GAAA,YAqBa,MAAA,UAAA,GAAA;SAnBV,KAAK,OAAO;SACZ,OAAO,OAAO;SACd,UAAU,OAAO,YAAQ;SACzB,OAAK,eAAA,EAAA,gBAAoB,MAAA,gBAAA,CAAgB,CAAC,KAAK,EAAA,CAAA;SAC/C,OAAK,eAAiB,MAAA,EAAA,CAAE,CAAA,gIAAA,4CAAA,qBAAA,gCAAA,2EAAA,gEAAA,CAAA;;SAWzB,SAAA,cAAmD,CAAnD,YAAmD,MAAA,cAAA,GAAA,MAAA;UAAnC,SAAA,cAAkB,CAAf,gBAAA,gBAAA,OAAO,KAAK,GAAA,CAAA,CAAA,CAAA;;SAC/B,GAAA,IAAA,GAAA,YAEsB,MAAA,mBAAA,GAAA,EAFD,OAAM,4CAA2C,GAAA;UACpE,SAAA,cAAyB,CAAzB,YAAyB,MAAA,KAAA,GAAA,EAAlB,OAAM,UAAS,CAAA,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"Select.vue_vue_type_script_setup_true_lang.js","names":["$emit"],"sources":["../../../src/primitives/Select/Select.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { cva } from \"class-variance-authority\";\n\n/** One row of the list. `value` is what the model carries; `label` is what a reader sees. */\nexport interface SelectOption {\n /** The value bound to `v-model` when this row is chosen. Unique within the list. */\n value: string;\n /** The text shown on the row, and on the trigger once it is chosen. */\n label: string;\n /** Present but unchoosable — visible, skipped by the keyboard, unclickable. */\n disabled?: boolean;\n}\n\n/**\n * The trigger's height scale. It matches the text input scale exactly, so a\n * form row mixing a Select beside a text field never comes out uneven — which\n * is why reaching past `size` for an `h-*` class is always the wrong fix.\n */\nexport type SelectSize = \"sm\" | \"md\" | \"lg\";\n\nexport const selectVariants = cva(\n [\n \"group inline-flex w-full items-center justify-between gap-2 rounded-md border border-input bg-background text-foreground\",\n \"transition-[color,background-color,box-shadow] duration-fast ease-out hover:bg-subtle\",\n // Rim-lit at rest; the ring blooms on focus.\n \"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring\",\n // No `opacity` here, and that is the point. The trigger is the node that\n // carries the chosen label, and what a reader needs from an unavailable\n // Select is exactly that: what it is set to. `disabled:opacity-50`\n // composited `text-foreground` down to 3.06:1 on this fill — halving the\n // alpha more than halves the contrast. Unavailability is painted in\n // measured colours instead: the fill drains to the neutral well and the\n // label lands on `--color-muted-foreground`, 4.68:1 over it.\n //\n // Both survive their neighbours on this element. `hover:` sorts *before*\n // `disabled:` in Tailwind's variant order, so the disabled fill wins over\n // `hover:bg-subtle` rather than flickering under a pointer; and\n // `data-[placeholder]:text-muted-foreground` names the same colour, so the\n // two colour rules agree whatever the sort puts last.\n //\n // The third channel — the rim slackening from `input` to `border` — is\n // **not** here, and cannot be: a `disabled:` variant outranks a plain\n // `border-destructive` on specificity, so a Select that was both in error\n // and unavailable would lose its destructive rim to it. It is written as a\n // plain conditional in the template, where `cn()` can order the two.\n \"disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground\",\n \"data-[placeholder]:text-muted-foreground\",\n ],\n {\n // `satisfies` keeps the two halves honest: the union above is the name a\n // consumer imports and the documentation prints, the map below is the\n // classes. Adding a member to one and not the other stops compiling.\n variants: {\n size: {\n sm: \"h-8 px-2.5 text-xs\",\n md: \"h-9 px-3 text-sm\",\n lg: \"h-11 px-4 text-base\",\n } satisfies Record<SelectSize, string>,\n },\n defaultVariants: { size: \"md\" },\n },\n);\n</script>\n\n<script setup lang=\"ts\">\nimport {\n SelectRoot,\n SelectTrigger,\n SelectValue,\n SelectIcon,\n SelectPortal,\n SelectContent,\n SelectViewport,\n SelectItem,\n SelectItemText,\n SelectItemIndicator,\n} from \"reka-ui\";\nimport { computed } from \"vue\";\nimport { Check, ChevronDown } from \"@lucide/vue\";\nimport { cn } from \"../../lib/cn\";\nimport { listStaggerDelay } from \"../../lib/motion\";\nimport { useSplitAttrs } from \"../../lib/attrs\";\nimport { useFieldControl } from \"../../lib/field-context\";\n\n/**\n * Select — pick one value out of a closed list, through a compact trigger and\n * a popover listbox. It suits roughly three to fifteen rows where one value is\n * always chosen: a language, a resolution, a quality preset.\n *\n * Below that, two to five options a reader should see all of at once are\n * better shown than hidden. Above it, a list long enough to need searching\n * wants a combobox, which is a different control rather than a longer version\n * of this one.\n *\n * Built on Reka UI's Select, which supplies the listbox semantics: arrow-key\n * navigation, first-character typeahead, Escape and outside-click to close, and\n * the `role=\"combobox\"` trigger wired to the listbox by `aria-expanded` and\n * `aria-controls`. The active row is tracked by moving real focus onto it, not\n * by `aria-activedescendant`.\n *\n * Inside a [Field](../Field/Field.vue) it wires itself: the row's id, the id of\n * its hint or error line, `required`, `invalid`, `disabled` and the name the\n * chosen value is submitted under all arrive through `useFieldControl()`, so\n * `<Field label=\"Language\" error=\"…\"><Select … /></Field>` needs no attributes\n * at the call site. Both booleans below still win over the row when they are\n * set, in both directions — which is why they default to `undefined` rather\n * than `false`.\n *\n * A row's `readonly` is deliberately ignored. A read-only value is one a reader\n * may see and copy but not change, and a closed list has nothing to show that\n * the trigger is not already showing — so a read-only Select is a disabled\n * Select that lies about being reachable. Rows holding a value nobody may edit\n * want a disabled Select, or no control at all.\n *\n * The consequence is that the library's three resting appearances collapse to\n * two here. A TextField rests available, on show, or unavailable; this control\n * has no middle state, so the lifted `subtle` fill never appears on it and the\n * trigger goes straight from `background` to the drained fill, muted label and\n * slackened rim of the disabled row.\n */\nconst props = withDefaults(\n defineProps<{\n /** The chosen option's `value`. Leave it unset to show the placeholder. */\n modelValue?: string;\n /** The rows, in the order they are shown. */\n options: SelectOption[];\n /** Shown on the trigger while nothing is chosen. It is not an option. */\n placeholder?: string;\n /** Unavailable: dims the trigger and refuses to open. Unset defers to a wrapping Field. */\n disabled?: boolean | undefined;\n /** Error state: paints the destructive border and ring, and sets `aria-invalid`. Unset defers to a wrapping Field's `error`. */\n invalid?: boolean | undefined;\n /** Trigger height. It shares the text input scale so mixed form rows stay aligned. */\n size?: SelectSize;\n }>(),\n {\n // Not `false`, for either. `false` is a caller saying \"this control is fine\n // / enabled even though its row is not\"; absent is a caller saying nothing,\n // and only `undefined` survives to mean that past Vue's\n // absent-Boolean-casts-to-false rule — see TextField.vue, which carries the\n // full reasoning.\n disabled: undefined,\n invalid: undefined,\n size: \"md\",\n },\n);\n\ndefineEmits<{\n /** The chosen option's `value`. Fires once per choice; the list closes with it. */\n \"update:modelValue\": [value: string];\n}>();\n\n// The root renders no DOM node at all, so fallthrough attributes would be\n// dropped on the floor rather than landing anywhere. They go to the trigger,\n// which is the interactive element they describe.\n//\n// `class` is pulled out of that spread and merged through `cn()` instead.\n// Spreading it alongside the trigger's own `:class` only concatenates the two\n// lists — Vue's merge is generic, not Tailwind-aware — so a caller's `w-28`\n// silently loses to the trigger's own `w-full` depending on which utility\n// Tailwind happened to emit last.\ndefineOptions({ inheritAttrs: false });\nconst { attrs, rest: triggerAttrs } = useSplitAttrs();\n\n// `id` and `aria-describedby` reach this control as fallthrough attrs rather\n// than props, so they are read off `attrs` and handed in as this caller's own\n// values — a caller who sets either still beats the row, and the row's\n// description is merged into theirs rather than replacing it. `name`,\n// `readonly` and `required` are absent from this object because there is no\n// prop to oppose the row with; the row's answer stands unopposed, which is\n// what is wanted.\nconst field = useFieldControl(() => ({\n id: attrs.id as string | undefined,\n describedBy: attrs[\"aria-describedby\"] as string | undefined,\n disabled: props.disabled,\n invalid: props.invalid,\n}));\n\n// Two of the resolved keys do not travel with the bag, and both are Reka\n// facts rather than preferences.\n//\n// `aria-required` cannot be delivered this way at all: Reka's `Slot` merges an\n// as-child chain as `mergeProps(attrs, child.props)`, so the trigger's own\n// declaration — `aria-required` off the root's `required` prop — beats anything\n// arriving from outside, and a value spread here would be dropped silently.\n// The root's prop below is the only lever, and it is bound from the same\n// resolved value.\n//\n// `name` would be the `name` of a `<button type=\"button\">`, which no form\n// submission has ever included; the hidden input at the end of the template\n// carries the value instead.\nconst triggerFieldAttrs = computed(() => {\n // Removed from a copy rather than listed positively, so a key added to the\n // resolved bag later reaches this trigger without anyone remembering to come\n // back here.\n const aria: Record<string, unknown> = { ...field.attrs };\n delete aria.name;\n delete aria[\"aria-required\"];\n return aria;\n});\n</script>\n\n<template>\n <SelectRoot\n :model-value=\"modelValue ?? ''\"\n :disabled=\"field.disabled\"\n :required=\"field.required\"\n @update:model-value=\"$emit('update:modelValue', String($event))\"\n >\n <SelectTrigger\n v-bind=\"{ ...triggerAttrs, ...triggerFieldAttrs }\"\n :data-invalid=\"field.invalid || undefined\"\n :class=\"\n cn(\n selectVariants({ size }),\n !field.invalid && 'focus-visible:shadow-halo',\n // The border half of the disabled treatment, and it lives here rather\n // than beside the fill in the variant map for the reason written\n // there. Read as a pair with the line below: `cn()` resolves a border\n // colour by whichever class it saw last, so an unavailable trigger\n // that is also in error still shows the destructive rim.\n field.disabled && 'border-border',\n field.invalid && 'border-destructive focus-visible:outline-destructive',\n attrs.class as string,\n )\n \"\n >\n <SelectValue :placeholder=\"placeholder ?? ''\" />\n <SelectIcon class=\"shrink-0 text-muted-foreground\">\n <ChevronDown\n class=\"h-4 w-4 transition-transform duration-fast ease-out group-data-[state=open]:rotate-180\"\n />\n </SelectIcon>\n </SelectTrigger>\n\n <SelectPortal>\n <SelectContent\n position=\"popper\"\n :side-offset=\"6\"\n :class=\"\n cn(\n 'z-50 min-w-[var(--reka-select-trigger-width)] overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md',\n // Scoped to the open state, never unconditional. Reka keeps the\n // closed content mounted while it waits for an animationend that a\n // mount-only animation never fires again — an invisible overlay\n // eating clicks. Scoping it makes the closed element compute\n // `animation-name: none`, which is the immediate-unmount branch.\n 'data-[state=open]:animate-fade-rise',\n )\n \"\n >\n <SelectViewport class=\"p-1\">\n <!-- The rows reveal one step after another, from the shared stagger\n vocabulary rather than a per-template delay of its own. -->\n <SelectItem\n v-for=\"(option, index) in options\"\n :key=\"option.value\"\n :value=\"option.value\"\n :disabled=\"option.disabled ?? false\"\n :style=\"{ animationDelay: listStaggerDelay(index) }\"\n :class=\"\n cn(\n 'relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-3 py-1.5 pr-8 text-sm text-foreground outline-none',\n 'transition-colors duration-fast ease-out',\n 'animate-fade-rise',\n 'data-[highlighted]:bg-subtle',\n 'data-[state=checked]:bg-primary-muted data-[state=checked]:text-primary',\n // Inert, but still readable: a row a reader cannot pick is\n // still a row they have to read to understand why the list is\n // shaped the way it is. `data-[disabled]:opacity-50` took the\n // label to 3.13:1 on the popover; the colour on the text node\n // below leaves it at 5.76:1 and still visibly lighter than the\n // rows around it.\n 'data-[disabled]:pointer-events-none',\n )\n \"\n >\n <!-- The mute lives here rather than on the row, and it has to.\n `data-[disabled]:` sorts *before* `data-[state=checked]:` in\n Tailwind's variant order, so a disabled row that is also the\n chosen one would take `text-primary` from the container and a\n container colour is only inherited. Declared on the text node\n it wins whatever the row resolved to. -->\n <SelectItemText :class=\"option.disabled && 'text-muted-foreground'\">{{\n option.label\n }}</SelectItemText>\n <SelectItemIndicator class=\"absolute right-2 inline-flex items-center\">\n <Check class=\"h-4 w-4\" />\n </SelectItemIndicator>\n </SelectItem>\n </SelectViewport>\n </SelectContent>\n </SelectPortal>\n\n <!-- What a surrounding `<form>` reads, and only once a row has given this\n control a name. Reka can render a hidden native `<select>` from the\n root's own `name` instead, and two of its behaviours are wrong here: a\n native select always resolves to one of its options, so it would post\n the first row while the placeholder was still showing, and `required`\n on a visually-hidden control arms browser validation the library\n deliberately never arms — a submission blocked with \"an invalid form\n control is not focusable\" and no bubble anyone can see. A hidden input\n posts the model and nothing else. -->\n <input\n v-if=\"field.name\"\n type=\"hidden\"\n :name=\"field.name\"\n :value=\"modelValue ?? ''\"\n :disabled=\"field.disabled\"\n />\n </SelectRoot>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,IAAa,iBAAiB,IAC5B;CACE;CACA;CAEA;CAoBA;CACA;AACF,GACA;CAIE,UAAU,EACR,MAAM;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;CACN,EACF;CACA,iBAAiB,EAAE,MAAM,KAAK;AAChC,CACF;;;;;;;;;;;;;;;;;;;;EA2DA,MAAM,QAAQ;EA0Cd,MAAM,EAAE,OAAO,MAAM,iBAAiB,cAAc;EASpD,MAAM,QAAQ,uBAAuB;GACnC,IAAI,MAAM;GACV,aAAa,MAAM;GACnB,UAAU,MAAM;GAChB,SAAS,MAAM;EACjB,EAAE;EAeF,MAAM,oBAAoB,eAAe;GAIvC,MAAM,OAAgC,EAAE,GAAG,MAAM,MAAM;GACvD,OAAO,KAAK;GACZ,OAAO,KAAK;GACZ,OAAO;EACT,CAAC;;GAIC,OAAA,UAAA,GAAA,YA2Ga,MAAA,UAAA,GAAA;IA1GV,eAAa,QAAA,cAAU;IACvB,UAAU,MAAA,KAAA,CAAK,CAAC;IAChB,UAAU,MAAA,KAAA,CAAK,CAAC;IAChB,uBAAkB,OAAA,OAAA,OAAA,MAAA,WAAEA,KAAAA,MAAK,qBAAsB,OAAO,MAAM,CAAA;;IAE7D,SAAA,cAwBgB;KAxBhB,YAwBgB,MAAA,aAAA,GAxBhB,WAwBgB;MAAA,GAvBD,MAAA,YAAA;MAAY,GAAK,kBAAA;KAAiB,GAAA;MAC9C,gBAAc,MAAA,KAAA,CAAK,CAAC,WAAW,KAAA;MAC/B,OAAgB,MAAA,EAAA,CAAE,CAAY,MAAA,cAAA,CAAc,CAAA,EAAA,MAAG,QAAA,KAAI,CAAA,GAAgB,CAAA,MAAA,KAAA,CAAK,CAAC,WAAO,6BAA2a,MAAA,KAAA,CAAK,CAAC,YAAQ,iBAA+B,MAAA,KAAA,CAAK,CAAC,WAAO,wDAAsE,MAAA,KAAA,CAAK,CAAC,KAAA;;MAeloB,SAAA,cAAgD,CAAhD,YAAgD,MAAA,WAAA,GAAA,EAAlC,aAAa,QAAA,eAAW,GAAA,GAAA,MAAA,GAAA,CAAA,aAAA,CAAA,GACtC,YAIa,MAAA,UAAA,GAAA,EAJD,OAAM,iCAAgC,GAAA;OAChD,SAAA,cAEE,CAFF,YAEE,MAAA,WAAA,GAAA,EADA,OAAM,yFAAwF,CAAA,CAAA,CAAA;;;;;KAKpG,YAyDe,MAAA,YAAA,GAAA,MAAA;MAxDb,SAAA,cAuDgB,CAvDhB,YAuDgB,MAAA,aAAA,GAAA;OAtDd,UAAS;OACR,eAAa;OACb,OAAK,eAAa,MAAA,EAAA,CAAE,CAAA,8IAAA,qCAAA,CAAA;;OAYrB,SAAA,cAuCiB,CAvCjB,YAuCiB,MAAA,cAAA,GAAA,EAvCD,OAAM,MAAK,GAAA;QAIvB,SAAA,cAAkC,EADpC,UAAA,IAAA,GAAA,mBAmCa,UAAA,MAAA,WAlCe,QAAA,UAAlB,QAAQ,UAAK;SADvB,OAAA,UAAA,GAAA,YAmCa,MAAA,UAAA,GAAA;UAjCV,KAAK,OAAO;UACZ,OAAO,OAAO;UACd,UAAU,OAAO,YAAQ;UACzB,OAAK,eAAA,EAAA,gBAAoB,MAAA,gBAAA,CAAgB,CAAC,KAAK,EAAA,CAAA;UAC/C,OAAK,eAAiB,MAAA,EAAA,CAAE,CAAA,gIAAA,4CAAA,qBAAA,gCAAA,2EAAA,qCAAA,CAAA;;UAuBzB,SAAA,cAEmB,CAFnB,YAEmB,MAAA,cAAA,GAAA,EAFF,OAAK,eAAE,OAAO,YAAQ,uBAAA,EAAA,GAAA;WAA6B,SAAA,cAElE,CADA,gBAAA,gBAAA,OAAO,KAAK,GAAA,CAAA,CAAA,CAAA;;UAEd,GAAA,MAAA,CAAA,OAAA,CAAA,GAAA,YAEsB,MAAA,mBAAA,GAAA,EAFD,OAAM,4CAA2C,GAAA;WACpE,SAAA,cAAyB,CAAzB,YAAyB,MAAA,KAAA,GAAA,EAAlB,OAAM,UAAS,CAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;KAiBxB,MAAA,KAAA,CAAK,CAAC,QADd,UAAA,GAAA,mBAME,SAAA;;MAJA,MAAK;MACJ,MAAM,MAAA,KAAA,CAAK,CAAC;MACZ,OAAO,QAAA,cAAU;MACjB,UAAU,MAAA,KAAA,CAAK,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type SkeletonVariant = "text" | "circle" | "rect";
|
|
2
2
|
export declare const skeletonVariants: (props?: ({
|
|
3
|
-
variant?: "
|
|
3
|
+
variant?: "text" | "circle" | "rect" | null | undefined;
|
|
4
4
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
5
5
|
declare const _default: typeof __VLS_export;
|
|
6
6
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Slider.js","names":[],"sources":["../../../src/primitives/Slider/Slider.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, watch } from \"vue\";\nimport { SliderRoot, SliderTrack, SliderRange, SliderThumb } from \"reka-ui\";\nimport { cn } from \"../../lib/cn\";\nimport { useSplitAttrs } from \"../../lib/attrs\";\n\n/**\n * Slider — one continuous value inside a bounded range. Reach for it when the\n * range itself is the information: a volume, a ratio, a share of something\n * whole. A number that happens to be numeric but has no meaningful ceiling —\n * a coordinate, an angle — belongs in a NumberField instead.\n *\n * Built on Reka UI's Slider for the `role=\"slider\"` semantics, the pointer\n * drag and the arrow / Home / End stepping. Single-thumb only: Reka models the\n * value as an array, and this exposes a scalar.\n *\n * Two things are added here.\n *\n * The first is the drag buffer, and without it the component silently drops\n * changes. Given a defined model value Reka runs fully controlled, and its\n * release-time \"did this change?\" check compares against whatever it was last\n * fed — not against what it emitted. A host that correctly withholds transient\n * values until commit therefore leaves that check reading the pre-drag value\n * for the whole gesture, so it always answers no and the commit never fires.\n * `lastValue` below feeds Reka's own transient ticks back into its model, which\n * is exactly the fix NumberField applies for the same reason. Keyboard steps\n * need no buffer: Reka updates and commits inside one synchronous call, so it\n * compares against a value that is still old either way.\n *\n * The second is the abort path. Reka has no drag cancellation of its own — it\n * handles pointerdown, move and up, and commits whenever the release value\n * differs from the one it snapshotted — so Escape or a browser-issued\n * `pointercancel` mid-drag would still write one checkpoint on release. The\n * bail-out mirrors NumberField's: reset `lastValue` to the committed value, so\n * Reka's own comparison sees no change and never commits, and swallow the\n * still-captured pointer's remaining ticks until it releases.\n */\nconst props = withDefaults(\n defineProps<{\n /** The current value. Transient drag positions are reported before it changes. */\n modelValue?: number;\n /** The floor of the range, and where Home lands. */\n min?: number;\n /** The ceiling of the range, and where End lands. */\n max?: number;\n /** The granularity of one arrow-key step and of the drag's own snapping. */\n step?: number;\n /** Unavailable: dims the track and refuses both the pointer and the keyboard. */\n disabled?: boolean;\n }>(),\n { min: 0, max: 1, step: 0.01, disabled: false },\n);\n\nconst emit = defineEmits<{\n /** Transient: every position the thumb passes through during a drag. Not a checkpoint. */\n \"update:modelValue\": [value: number];\n /** Committed: once at the end of a gesture — drag release, or a keyboard step. */\n commit: [value: number];\n}>();\n\n// The root renders a real element, and it is the one a caller's `class` has to\n// land on — sizing and layout (`flex-1` to grow in a toolbar) are dead weight\n// on the thumb, which is a 16px absolutely-positioned circle no flex rule\n// reaches. Every other fallthrough attribute goes the other way, onto the\n// thumb: `aria-labelledby` describes the `role=\"slider\"` element, not the box\n// around it.\ndefineOptions({ inheritAttrs: false });\nconst { attrs, rest: thumbAttrs } = useSplitAttrs();\n\n// What the Reka root is fed as its own model value: seeded from the prop, then\n// advanced on every tick Reka emits, so its release-time check sees the drag's\n// real end position rather than the frozen prop.\nconst lastValue = ref(props.modelValue);\nwatch(\n () => props.modelValue,\n (value) => {\n lastValue.value = value;\n },\n);\n\nconst values = computed(() => (lastValue.value === undefined ? [] : [lastValue.value]));\n\nfunction onUpdate(next: number[] | undefined) {\n const value = next?.[0];\n if (value === undefined || aborted) return;\n lastValue.value = value;\n emit(\"update:modelValue\", value);\n}\n\nfunction onCommit(next: number[]) {\n if (next[0] !== undefined && !aborted) emit(\"commit\", next[0]);\n}\n\n// The abort path. Its window listeners live for the duration of one pointer\n// gesture and no longer.\nlet aborted = false;\nlet teardownDrag: (() => void) | undefined;\n\nfunction resetToCommitted() {\n if (lastValue.value === props.modelValue) return;\n lastValue.value = props.modelValue;\n // One transient tick carrying the committed value, so the host can restore\n // its pre-drag preview. Still never a checkpoint.\n if (props.modelValue !== undefined) emit(\"update:modelValue\", props.modelValue);\n}\n\nfunction onRootPointerDown() {\n if (props.disabled) return;\n aborted = false;\n const onDragKeydown = (keyEvent: KeyboardEvent) => {\n if (keyEvent.key !== \"Escape\" || aborted) return;\n keyEvent.preventDefault();\n keyEvent.stopPropagation();\n // Reka keeps the pointer captured until release, so `aborted` is what\n // stops the remaining move ticks from resurrecting the gesture.\n aborted = true;\n resetToCommitted();\n };\n const onPointerUp = () => {\n // This runs after Reka's own element-level release handling, so a\n // swallowed gesture has already settled by the time the abort re-arms.\n teardownDrag?.();\n aborted = false;\n };\n const onPointerCancel = () => {\n teardownDrag?.();\n aborted = false; // a cancelled pointer emits no further ticks\n resetToCommitted();\n };\n window.addEventListener(\"pointerup\", onPointerUp);\n window.addEventListener(\"pointercancel\", onPointerCancel);\n window.addEventListener(\"keydown\", onDragKeydown, true);\n teardownDrag = () => {\n window.removeEventListener(\"pointerup\", onPointerUp);\n window.removeEventListener(\"pointercancel\", onPointerCancel);\n window.removeEventListener(\"keydown\", onDragKeydown, true);\n teardownDrag = undefined;\n };\n}\n\nonBeforeUnmount(() => teardownDrag?.());\n</script>\n\n<template>\n <SliderRoot\n :model-value=\"values\"\n :min=\"min\"\n :max=\"max\"\n :step=\"step\"\n :disabled=\"disabled\"\n :class=\"\n cn(\n 'relative flex w-full touch-none items-center py-2 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50',\n attrs.class as string,\n )\n \"\n @pointerdown=\"onRootPointerDown\"\n @update:model-value=\"onUpdate\"\n @value-commit=\"onCommit\"\n >\n <SliderTrack class=\"relative h-1.5 w-full grow rounded-full bg-muted\">\n <!-- The filled range is a value a person set, so it is painted flat in\n the human force's colour rather than in a gradient. -->\n <SliderRange class=\"absolute h-full rounded-full bg-primary\" />\n </SliderTrack>\n <SliderThumb\n v-bind=\"thumbAttrs\"\n class=\"block h-4 w-4 rounded-full border-2 border-primary bg-background shadow-sm transition-transform duration-fast ease-spring hover:scale-110 active:scale-95 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring focus-visible:shadow-halo data-[disabled]:pointer-events-none\"\n />\n </SliderRoot>\n</template>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"Slider.js","names":[],"sources":["../../../src/primitives/Slider/Slider.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, useTemplateRef, watch } from \"vue\";\nimport { SliderRoot, SliderTrack, SliderRange, SliderThumb } from \"reka-ui\";\nimport { cn } from \"../../lib/cn\";\nimport { useSplitAttrs } from \"../../lib/attrs\";\nimport { useAncestorDisabled } from \"../../lib/ancestor-disabled\";\nimport { useFieldControl } from \"../../lib/field-context\";\n\n/**\n * Slider — one continuous value inside a bounded range. Reach for it when the\n * range itself is the information: a volume, a ratio, a share of something\n * whole. A number that happens to be numeric but has no meaningful ceiling —\n * a coordinate, an angle — belongs in a NumberField instead.\n *\n * Built on Reka UI's Slider for the `role=\"slider\"` semantics, the pointer\n * drag and the arrow / Home / End stepping. Single-thumb only: Reka models the\n * value as an array, and this exposes a scalar.\n *\n * Two things are added here.\n *\n * The first is the drag buffer, and without it the component silently drops\n * changes. Given a defined model value Reka runs fully controlled, and its\n * release-time \"did this change?\" check compares against whatever it was last\n * fed — not against what it emitted. A host that correctly withholds transient\n * values until commit therefore leaves that check reading the pre-drag value\n * for the whole gesture, so it always answers no and the commit never fires.\n * `lastValue` below feeds Reka's own transient ticks back into its model, which\n * is exactly the fix NumberField applies for the same reason. Keyboard steps\n * need no buffer: Reka updates and commits inside one synchronous call, so it\n * compares against a value that is still old either way.\n *\n * The second is the abort path. Reka has no drag cancellation of its own — it\n * handles pointerdown, move and up, and commits whenever the release value\n * differs from the one it snapshotted — so Escape or a browser-issued\n * `pointercancel` mid-drag would still write one checkpoint on release. The\n * bail-out mirrors NumberField's: reset `lastValue` to the committed value, so\n * Reka's own comparison sees no change and never commits, and swallow the\n * still-captured pointer's remaining ticks until it releases.\n *\n * Inside a [Field](../Field/Field.vue) it wires itself through\n * `useFieldControl()`: the row's id, the id of its hint or error line,\n * `required` and `invalid` all reach the thumb — which is the `role=\"slider\"`\n * element, and therefore the thing the row is talking about — and the row's\n * `name` reaches a hidden input, so\n * `<Field label=\"Volume\" error=\"…\"><Slider /></Field>` needs no attributes at\n * the call site. `disabled` still wins wherever it is set, in both directions,\n * which is why it defaults to `undefined` rather than `false`.\n *\n * **A row's label does not name it.** `<label for>` names a labelable element\n * and the thumb is a `span[role=\"slider\"]`, so the row's label resolves to it\n * and announces nobody. `aria-label`/`aria-labelledby` are still what name this\n * control, exactly as they were before — and they were always routed to the\n * thumb for the same reason the rest of this bag is.\n *\n * There is no `readonly`, and a row's is ignored rather than approximated. The\n * whole control is the drag: a track that shows a value and refuses to move is\n * a [Progress](../Progress/Progress.vue) bar wearing a thumb, and painting one\n * as live while swallowing every gesture is the state worse than either.\n */\nconst props = withDefaults(\n defineProps<{\n /** The current value. Transient drag positions are reported before it changes. */\n modelValue?: number;\n /** The floor of the range, and where Home lands. */\n min?: number;\n /** The ceiling of the range, and where End lands. */\n max?: number;\n /** The granularity of one arrow-key step and of the drag's own snapping. */\n step?: number;\n /** Unavailable: dims the track and refuses both the pointer and the keyboard. Unset defers to a wrapping Field. */\n disabled?: boolean | undefined;\n }>(),\n {\n min: 0,\n max: 1,\n step: 0.01,\n // Not `false`: absent has to stay tellable from `false` for a Field above\n // to disable the row and for `:disabled=\"false\"` to overrule one that does.\n // Vue casts an absent Boolean prop with no declared default to `false`,\n // which would leave the context wired and inert.\n disabled: undefined,\n },\n);\n\nconst emit = defineEmits<{\n /** Transient: every position the thumb passes through during a drag. Not a checkpoint. */\n \"update:modelValue\": [value: number];\n /** Committed: once at the end of a gesture — drag release, or a keyboard step. */\n commit: [value: number];\n}>();\n\n// The root renders a real element, and it is the one a caller's `class` has to\n// land on — sizing and layout (`flex-1` to grow in a toolbar) are dead weight\n// on the thumb, which is a 16px absolutely-positioned circle no flex rule\n// reaches. Every other fallthrough attribute goes the other way, onto the\n// thumb: `aria-labelledby` describes the `role=\"slider\"` element, not the box\n// around it.\ndefineOptions({ inheritAttrs: false });\nconst { attrs, rest: thumbAttrs } = useSplitAttrs();\n\n/**\n * The one control in the library the platform cannot disable for us.\n *\n * `<fieldset disabled>` reaches `<input>`, `<button>`, `<select>` and\n * `<textarea>` and stops there, and Reka renders this thumb as a\n * `<span role=\"slider\" tabindex=\"0\">`. Measured in jsdom, a Slider inside a\n * disabled group kept its tab stop and still moved its value on Home and End —\n * identical behaviour to an available one. Painting it unavailable without\n * this would produce the worse defect rather than fix the visible one: a\n * control that looks unreachable and answers the keyboard anyway.\n *\n * It is read off the DOM rather than taken from the Field context because\n * `Fieldset.vue` deliberately publishes no `disabled` there — see\n * `../../lib/ancestor-disabled.ts` for why a read cannot drift from the\n * attribute the way a second declaration would.\n */\nconst root = useTemplateRef<{ $el?: Element }>(\"root\");\nconst groupDisabled = useAncestorDisabled(() => root.value?.$el);\n\n// `id` and `aria-describedby` reach this control as fallthrough attrs rather\n// than props, so they are read off `attrs` and handed in as this caller's own\n// values — a caller who sets either still beats the row, and the row's\n// description is merged into theirs rather than replacing it. `name`,\n// `required` and `invalid` are absent from the object because there is no prop\n// to oppose the row with; the row's answer stands unopposed, which is what\n// wrapping the slider in a Field asked for.\nconst field = useFieldControl(() => ({\n id: attrs.id as string | undefined,\n describedBy: attrs[\"aria-describedby\"] as string | undefined,\n // The fieldset beats the prop in both directions, exactly as it does for a\n // native control: an `<input :disabled=\"false\">` inside a disabled group is\n // disabled too, so a Slider that said the same must not be the one exception.\n disabled: groupDisabled.value ? true : props.disabled,\n}));\n\n// The resolved bag lands on the thumb for the same reason every other\n// fallthrough attribute does — it is the `role=\"slider\"` element, and an id, a\n// description or an `aria-invalid` describes that, not the box around it.\n//\n// `name` is the one key that goes the other way: a name on a thumb submits\n// nothing, so it drives the hidden input inside the root instead. Removed from\n// a copy rather than listed positively, so a key added to the resolved bag\n// later reaches the thumb without anyone remembering to come back here.\nconst thumbFieldAttrs = computed(() => {\n const aria: Record<string, unknown> = { ...field.attrs };\n delete aria.name;\n return aria;\n});\n\n// What the Reka root is fed as its own model value: seeded from the prop, then\n// advanced on every tick Reka emits, so its release-time check sees the drag's\n// real end position rather than the frozen prop.\nconst lastValue = ref(props.modelValue);\nwatch(\n () => props.modelValue,\n (value) => {\n lastValue.value = value;\n },\n);\n\nconst values = computed(() => (lastValue.value === undefined ? [] : [lastValue.value]));\n\nfunction onUpdate(next: number[] | undefined) {\n const value = next?.[0];\n if (value === undefined || aborted) return;\n lastValue.value = value;\n emit(\"update:modelValue\", value);\n}\n\nfunction onCommit(next: number[]) {\n if (next[0] !== undefined && !aborted) emit(\"commit\", next[0]);\n}\n\n// The abort path. Its window listeners live for the duration of one pointer\n// gesture and no longer.\nlet aborted = false;\nlet teardownDrag: (() => void) | undefined;\n\nfunction resetToCommitted() {\n if (lastValue.value === props.modelValue) return;\n lastValue.value = props.modelValue;\n // One transient tick carrying the committed value, so the host can restore\n // its pre-drag preview. Still never a checkpoint.\n if (props.modelValue !== undefined) emit(\"update:modelValue\", props.modelValue);\n}\n\nfunction onRootPointerDown() {\n if (field.disabled) return;\n aborted = false;\n const onDragKeydown = (keyEvent: KeyboardEvent) => {\n if (keyEvent.key !== \"Escape\" || aborted) return;\n keyEvent.preventDefault();\n keyEvent.stopPropagation();\n // Reka keeps the pointer captured until release, so `aborted` is what\n // stops the remaining move ticks from resurrecting the gesture.\n aborted = true;\n resetToCommitted();\n };\n const onPointerUp = () => {\n // This runs after Reka's own element-level release handling, so a\n // swallowed gesture has already settled by the time the abort re-arms.\n teardownDrag?.();\n aborted = false;\n };\n const onPointerCancel = () => {\n teardownDrag?.();\n aborted = false; // a cancelled pointer emits no further ticks\n resetToCommitted();\n };\n window.addEventListener(\"pointerup\", onPointerUp);\n window.addEventListener(\"pointercancel\", onPointerCancel);\n window.addEventListener(\"keydown\", onDragKeydown, true);\n teardownDrag = () => {\n window.removeEventListener(\"pointerup\", onPointerUp);\n window.removeEventListener(\"pointercancel\", onPointerCancel);\n window.removeEventListener(\"keydown\", onDragKeydown, true);\n teardownDrag = undefined;\n };\n}\n\nonBeforeUnmount(() => teardownDrag?.());\n</script>\n\n<template>\n <SliderRoot\n ref=\"root\"\n :model-value=\"values\"\n :min=\"min\"\n :max=\"max\"\n :step=\"step\"\n :disabled=\"field.disabled\"\n :class=\"\n cn(\n // Unavailability is painted in measured greys, never as an alpha over\n // the available state: the filled range and the thumb's rim *are* the\n // value, and `opacity-50` here took the range from 7.53:1 to 2.36:1\n // on the page ground — below WCAG 1.4.11's 3:1 floor for a graphical\n // object required to understand the control. The two parts drain to\n // their own tokens below; `aria-valuenow` announces the number, but\n // nothing re-paints it for a sighted reader, so the pixels stay.\n 'relative flex w-full touch-none items-center py-2 data-[disabled]:cursor-not-allowed',\n attrs.class as string,\n )\n \"\n @pointerdown=\"onRootPointerDown\"\n @update:model-value=\"onUpdate\"\n @value-commit=\"onCommit\"\n >\n <!-- Reka would mint this itself from a `name` on the root, but it models\n the value as an array and posts it as `volume[0]`. This control\n exposes a scalar and a row's `name` has to post one: a field that\n spells itself differently depending on which control its row holds is\n exactly the surprise the Field context exists to remove.\n\n `lastValue` and not `modelValue`, so what is submitted is what the\n thumb is showing: a host that withholds transient values until commit\n leaves the prop behind for the length of a gesture. -->\n <input\n v-if=\"field.name !== undefined\"\n type=\"hidden\"\n :name=\"field.name\"\n :value=\"lastValue\"\n :disabled=\"field.disabled\"\n />\n <SliderTrack class=\"relative h-1.5 w-full grow rounded-full bg-muted\">\n <!-- The filled range is a value a person set, so it is painted flat in\n the primary colour rather than in a gradient. Unavailable, it\n falls to the neutral well like every other control's value, keyed\n off Reka's own `data-disabled` on this node: `muted-foreground` is\n 5.25:1 on the page ground and 4.67:1 against the `bg-muted` track\n it sits on, both measured. -->\n <SliderRange\n class=\"absolute h-full rounded-full bg-primary data-[disabled]:bg-muted-foreground\"\n />\n </SliderTrack>\n <!-- The thumb's position is the value, so its rim drains with the range —\n `muted-foreground` at 5.25:1 on the page ground — while its fill,\n which is the page's own ground, needs no dim. -->\n <SliderThumb\n v-bind=\"{ ...thumbAttrs, ...thumbFieldAttrs }\"\n class=\"block h-4 w-4 rounded-full border-2 border-primary bg-background shadow-sm transition-transform duration-fast ease-spring hover:scale-110 active:scale-95 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring focus-visible:shadow-halo data-[disabled]:pointer-events-none data-[disabled]:border-muted-foreground\"\n />\n </SliderRoot>\n</template>\n"],"mappings":""}
|
|
@@ -28,6 +28,26 @@
|
|
|
28
28
|
* bail-out mirrors NumberField's: reset `lastValue` to the committed value, so
|
|
29
29
|
* Reka's own comparison sees no change and never commits, and swallow the
|
|
30
30
|
* still-captured pointer's remaining ticks until it releases.
|
|
31
|
+
*
|
|
32
|
+
* Inside a [Field](../Field/Field.vue) it wires itself through
|
|
33
|
+
* `useFieldControl()`: the row's id, the id of its hint or error line,
|
|
34
|
+
* `required` and `invalid` all reach the thumb — which is the `role="slider"`
|
|
35
|
+
* element, and therefore the thing the row is talking about — and the row's
|
|
36
|
+
* `name` reaches a hidden input, so
|
|
37
|
+
* `<Field label="Volume" error="…"><Slider /></Field>` needs no attributes at
|
|
38
|
+
* the call site. `disabled` still wins wherever it is set, in both directions,
|
|
39
|
+
* which is why it defaults to `undefined` rather than `false`.
|
|
40
|
+
*
|
|
41
|
+
* **A row's label does not name it.** `<label for>` names a labelable element
|
|
42
|
+
* and the thumb is a `span[role="slider"]`, so the row's label resolves to it
|
|
43
|
+
* and announces nobody. `aria-label`/`aria-labelledby` are still what name this
|
|
44
|
+
* control, exactly as they were before — and they were always routed to the
|
|
45
|
+
* thumb for the same reason the rest of this bag is.
|
|
46
|
+
*
|
|
47
|
+
* There is no `readonly`, and a row's is ignored rather than approximated. The
|
|
48
|
+
* whole control is the drag: a track that shows a value and refuses to move is
|
|
49
|
+
* a [Progress](../Progress/Progress.vue) bar wearing a thumb, and painting one
|
|
50
|
+
* as live while swallowing every gesture is the state worse than either.
|
|
31
51
|
*/
|
|
32
52
|
type __VLS_Props = {
|
|
33
53
|
/** The current value. Transient drag positions are reported before it changes. */
|
|
@@ -38,8 +58,8 @@ type __VLS_Props = {
|
|
|
38
58
|
max?: number;
|
|
39
59
|
/** The granularity of one arrow-key step and of the drag's own snapping. */
|
|
40
60
|
step?: number;
|
|
41
|
-
/** Unavailable: dims the track and refuses both the pointer and the keyboard. */
|
|
42
|
-
disabled?: boolean;
|
|
61
|
+
/** Unavailable: dims the track and refuses both the pointer and the keyboard. Unset defers to a wrapping Field. */
|
|
62
|
+
disabled?: boolean | undefined;
|
|
43
63
|
};
|
|
44
64
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
45
65
|
"update:modelValue": (value: number) => any;
|
|
@@ -48,9 +68,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
48
68
|
"onUpdate:modelValue"?: (value: number) => any;
|
|
49
69
|
onCommit?: (value: number) => any;
|
|
50
70
|
}>, {
|
|
51
|
-
disabled: boolean;
|
|
52
|
-
max: number;
|
|
71
|
+
disabled: boolean | undefined;
|
|
53
72
|
min: number;
|
|
73
|
+
max: number;
|
|
54
74
|
step: number;
|
|
55
75
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
56
76
|
declare const _default: typeof __VLS_export;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Slider.vue.d.ts","sourceRoot":"","sources":["../../../src/primitives/Slider/Slider.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Slider.vue.d.ts","sourceRoot":"","sources":["../../../src/primitives/Slider/Slider.vue"],"names":[],"mappings":"AAsSA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,KAAK,WAAW,GAAG;IACf,kFAAkF;IAClF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oDAAoD;IACpD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mHAAmH;IACnH,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAChC,CAAC;AA6VJ,QAAA,MAAM,YAAY;;;;;;;cA9VH,OAAO,GAAG,SAAS;SANxB,MAAM;SAEN,MAAM;UAEL,MAAM;6EAoWf,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { cn } from "../../lib/cn.js";
|
|
2
2
|
import { useSplitAttrs } from "../../lib/attrs.js";
|
|
3
|
-
import {
|
|
3
|
+
import { useFieldControl } from "../../lib/field-context.js";
|
|
4
|
+
import { useAncestorDisabled } from "../../lib/ancestor-disabled.js";
|
|
5
|
+
import { computed, createBlock, createCommentVNode, createElementBlock, createVNode, defineComponent, mergeProps, normalizeClass, onBeforeUnmount, openBlock, ref, unref, useTemplateRef, watch, withCtx } from "vue";
|
|
4
6
|
import { SliderRange, SliderRoot, SliderThumb, SliderTrack } from "reka-ui";
|
|
5
7
|
//#region src/primitives/Slider/Slider.vue?vue&type=script&setup=true&lang.ts
|
|
8
|
+
var _hoisted_1 = [
|
|
9
|
+
"name",
|
|
10
|
+
"value",
|
|
11
|
+
"disabled"
|
|
12
|
+
];
|
|
6
13
|
/**
|
|
7
14
|
* Slider — one continuous value inside a bounded range. Reach for it when the
|
|
8
15
|
* range itself is the information: a volume, a ratio, a share of something
|
|
@@ -33,6 +40,26 @@ import { SliderRange, SliderRoot, SliderThumb, SliderTrack } from "reka-ui";
|
|
|
33
40
|
* bail-out mirrors NumberField's: reset `lastValue` to the committed value, so
|
|
34
41
|
* Reka's own comparison sees no change and never commits, and swallow the
|
|
35
42
|
* still-captured pointer's remaining ticks until it releases.
|
|
43
|
+
*
|
|
44
|
+
* Inside a [Field](../Field/Field.vue) it wires itself through
|
|
45
|
+
* `useFieldControl()`: the row's id, the id of its hint or error line,
|
|
46
|
+
* `required` and `invalid` all reach the thumb — which is the `role="slider"`
|
|
47
|
+
* element, and therefore the thing the row is talking about — and the row's
|
|
48
|
+
* `name` reaches a hidden input, so
|
|
49
|
+
* `<Field label="Volume" error="…"><Slider /></Field>` needs no attributes at
|
|
50
|
+
* the call site. `disabled` still wins wherever it is set, in both directions,
|
|
51
|
+
* which is why it defaults to `undefined` rather than `false`.
|
|
52
|
+
*
|
|
53
|
+
* **A row's label does not name it.** `<label for>` names a labelable element
|
|
54
|
+
* and the thumb is a `span[role="slider"]`, so the row's label resolves to it
|
|
55
|
+
* and announces nobody. `aria-label`/`aria-labelledby` are still what name this
|
|
56
|
+
* control, exactly as they were before — and they were always routed to the
|
|
57
|
+
* thumb for the same reason the rest of this bag is.
|
|
58
|
+
*
|
|
59
|
+
* There is no `readonly`, and a row's is ignored rather than approximated. The
|
|
60
|
+
* whole control is the drag: a track that shows a value and refuses to move is
|
|
61
|
+
* a [Progress](../Progress/Progress.vue) bar wearing a thumb, and painting one
|
|
62
|
+
* as live while swallowing every gesture is the state worse than either.
|
|
36
63
|
*/
|
|
37
64
|
var Slider_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
38
65
|
inheritAttrs: false,
|
|
@@ -44,7 +71,7 @@ var Slider_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
44
71
|
step: { default: .01 },
|
|
45
72
|
disabled: {
|
|
46
73
|
type: Boolean,
|
|
47
|
-
default:
|
|
74
|
+
default: void 0
|
|
48
75
|
}
|
|
49
76
|
},
|
|
50
77
|
emits: ["update:modelValue", "commit"],
|
|
@@ -52,6 +79,34 @@ var Slider_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
52
79
|
const props = __props;
|
|
53
80
|
const emit = __emit;
|
|
54
81
|
const { attrs, rest: thumbAttrs } = useSplitAttrs();
|
|
82
|
+
/**
|
|
83
|
+
* The one control in the library the platform cannot disable for us.
|
|
84
|
+
*
|
|
85
|
+
* `<fieldset disabled>` reaches `<input>`, `<button>`, `<select>` and
|
|
86
|
+
* `<textarea>` and stops there, and Reka renders this thumb as a
|
|
87
|
+
* `<span role="slider" tabindex="0">`. Measured in jsdom, a Slider inside a
|
|
88
|
+
* disabled group kept its tab stop and still moved its value on Home and End —
|
|
89
|
+
* identical behaviour to an available one. Painting it unavailable without
|
|
90
|
+
* this would produce the worse defect rather than fix the visible one: a
|
|
91
|
+
* control that looks unreachable and answers the keyboard anyway.
|
|
92
|
+
*
|
|
93
|
+
* It is read off the DOM rather than taken from the Field context because
|
|
94
|
+
* `Fieldset.vue` deliberately publishes no `disabled` there — see
|
|
95
|
+
* `../../lib/ancestor-disabled.ts` for why a read cannot drift from the
|
|
96
|
+
* attribute the way a second declaration would.
|
|
97
|
+
*/
|
|
98
|
+
const root = useTemplateRef("root");
|
|
99
|
+
const groupDisabled = useAncestorDisabled(() => root.value?.$el);
|
|
100
|
+
const field = useFieldControl(() => ({
|
|
101
|
+
id: attrs.id,
|
|
102
|
+
describedBy: attrs["aria-describedby"],
|
|
103
|
+
disabled: groupDisabled.value ? true : props.disabled
|
|
104
|
+
}));
|
|
105
|
+
const thumbFieldAttrs = computed(() => {
|
|
106
|
+
const aria = { ...field.attrs };
|
|
107
|
+
delete aria.name;
|
|
108
|
+
return aria;
|
|
109
|
+
});
|
|
55
110
|
const lastValue = ref(props.modelValue);
|
|
56
111
|
watch(() => props.modelValue, (value) => {
|
|
57
112
|
lastValue.value = value;
|
|
@@ -74,7 +129,7 @@ var Slider_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
74
129
|
if (props.modelValue !== void 0) emit("update:modelValue", props.modelValue);
|
|
75
130
|
}
|
|
76
131
|
function onRootPointerDown() {
|
|
77
|
-
if (
|
|
132
|
+
if (field.disabled) return;
|
|
78
133
|
aborted = false;
|
|
79
134
|
const onDragKeydown = (keyEvent) => {
|
|
80
135
|
if (keyEvent.key !== "Escape" || aborted) return;
|
|
@@ -105,20 +160,35 @@ var Slider_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
105
160
|
onBeforeUnmount(() => teardownDrag?.());
|
|
106
161
|
return (_ctx, _cache) => {
|
|
107
162
|
return openBlock(), createBlock(unref(SliderRoot), {
|
|
163
|
+
ref_key: "root",
|
|
164
|
+
ref: root,
|
|
108
165
|
"model-value": values.value,
|
|
109
166
|
min: __props.min,
|
|
110
167
|
max: __props.max,
|
|
111
168
|
step: __props.step,
|
|
112
|
-
disabled:
|
|
113
|
-
class: normalizeClass(unref(cn)("relative flex w-full touch-none items-center py-2 data-[disabled]:cursor-not-allowed
|
|
169
|
+
disabled: unref(field).disabled,
|
|
170
|
+
class: normalizeClass(unref(cn)("relative flex w-full touch-none items-center py-2 data-[disabled]:cursor-not-allowed", unref(attrs).class)),
|
|
114
171
|
onPointerdown: onRootPointerDown,
|
|
115
172
|
"onUpdate:modelValue": onUpdate,
|
|
116
173
|
onValueCommit: onCommit
|
|
117
174
|
}, {
|
|
118
|
-
default: withCtx(() => [
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
175
|
+
default: withCtx(() => [
|
|
176
|
+
unref(field).name !== void 0 ? (openBlock(), createElementBlock("input", {
|
|
177
|
+
key: 0,
|
|
178
|
+
type: "hidden",
|
|
179
|
+
name: unref(field).name,
|
|
180
|
+
value: lastValue.value,
|
|
181
|
+
disabled: unref(field).disabled
|
|
182
|
+
}, null, 8, _hoisted_1)) : createCommentVNode("", true),
|
|
183
|
+
createVNode(unref(SliderTrack), { class: "relative h-1.5 w-full grow rounded-full bg-muted" }, {
|
|
184
|
+
default: withCtx(() => [createVNode(unref(SliderRange), { class: "absolute h-full rounded-full bg-primary data-[disabled]:bg-muted-foreground" })]),
|
|
185
|
+
_: 1
|
|
186
|
+
}),
|
|
187
|
+
createVNode(unref(SliderThumb), mergeProps({
|
|
188
|
+
...unref(thumbAttrs),
|
|
189
|
+
...thumbFieldAttrs.value
|
|
190
|
+
}, { class: "block h-4 w-4 rounded-full border-2 border-primary bg-background shadow-sm transition-transform duration-fast ease-spring hover:scale-110 active:scale-95 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring focus-visible:shadow-halo data-[disabled]:pointer-events-none data-[disabled]:border-muted-foreground" }), null, 16)
|
|
191
|
+
]),
|
|
122
192
|
_: 1
|
|
123
193
|
}, 8, [
|
|
124
194
|
"model-value",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Slider.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/primitives/Slider/Slider.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, watch } from \"vue\";\nimport { SliderRoot, SliderTrack, SliderRange, SliderThumb } from \"reka-ui\";\nimport { cn } from \"../../lib/cn\";\nimport { useSplitAttrs } from \"../../lib/attrs\";\n\n/**\n * Slider — one continuous value inside a bounded range. Reach for it when the\n * range itself is the information: a volume, a ratio, a share of something\n * whole. A number that happens to be numeric but has no meaningful ceiling —\n * a coordinate, an angle — belongs in a NumberField instead.\n *\n * Built on Reka UI's Slider for the `role=\"slider\"` semantics, the pointer\n * drag and the arrow / Home / End stepping. Single-thumb only: Reka models the\n * value as an array, and this exposes a scalar.\n *\n * Two things are added here.\n *\n * The first is the drag buffer, and without it the component silently drops\n * changes. Given a defined model value Reka runs fully controlled, and its\n * release-time \"did this change?\" check compares against whatever it was last\n * fed — not against what it emitted. A host that correctly withholds transient\n * values until commit therefore leaves that check reading the pre-drag value\n * for the whole gesture, so it always answers no and the commit never fires.\n * `lastValue` below feeds Reka's own transient ticks back into its model, which\n * is exactly the fix NumberField applies for the same reason. Keyboard steps\n * need no buffer: Reka updates and commits inside one synchronous call, so it\n * compares against a value that is still old either way.\n *\n * The second is the abort path. Reka has no drag cancellation of its own — it\n * handles pointerdown, move and up, and commits whenever the release value\n * differs from the one it snapshotted — so Escape or a browser-issued\n * `pointercancel` mid-drag would still write one checkpoint on release. The\n * bail-out mirrors NumberField's: reset `lastValue` to the committed value, so\n * Reka's own comparison sees no change and never commits, and swallow the\n * still-captured pointer's remaining ticks until it releases.\n */\nconst props = withDefaults(\n defineProps<{\n /** The current value. Transient drag positions are reported before it changes. */\n modelValue?: number;\n /** The floor of the range, and where Home lands. */\n min?: number;\n /** The ceiling of the range, and where End lands. */\n max?: number;\n /** The granularity of one arrow-key step and of the drag's own snapping. */\n step?: number;\n /** Unavailable: dims the track and refuses both the pointer and the keyboard. */\n disabled?: boolean;\n }>(),\n { min: 0, max: 1, step: 0.01, disabled: false },\n);\n\nconst emit = defineEmits<{\n /** Transient: every position the thumb passes through during a drag. Not a checkpoint. */\n \"update:modelValue\": [value: number];\n /** Committed: once at the end of a gesture — drag release, or a keyboard step. */\n commit: [value: number];\n}>();\n\n// The root renders a real element, and it is the one a caller's `class` has to\n// land on — sizing and layout (`flex-1` to grow in a toolbar) are dead weight\n// on the thumb, which is a 16px absolutely-positioned circle no flex rule\n// reaches. Every other fallthrough attribute goes the other way, onto the\n// thumb: `aria-labelledby` describes the `role=\"slider\"` element, not the box\n// around it.\ndefineOptions({ inheritAttrs: false });\nconst { attrs, rest: thumbAttrs } = useSplitAttrs();\n\n// What the Reka root is fed as its own model value: seeded from the prop, then\n// advanced on every tick Reka emits, so its release-time check sees the drag's\n// real end position rather than the frozen prop.\nconst lastValue = ref(props.modelValue);\nwatch(\n () => props.modelValue,\n (value) => {\n lastValue.value = value;\n },\n);\n\nconst values = computed(() => (lastValue.value === undefined ? [] : [lastValue.value]));\n\nfunction onUpdate(next: number[] | undefined) {\n const value = next?.[0];\n if (value === undefined || aborted) return;\n lastValue.value = value;\n emit(\"update:modelValue\", value);\n}\n\nfunction onCommit(next: number[]) {\n if (next[0] !== undefined && !aborted) emit(\"commit\", next[0]);\n}\n\n// The abort path. Its window listeners live for the duration of one pointer\n// gesture and no longer.\nlet aborted = false;\nlet teardownDrag: (() => void) | undefined;\n\nfunction resetToCommitted() {\n if (lastValue.value === props.modelValue) return;\n lastValue.value = props.modelValue;\n // One transient tick carrying the committed value, so the host can restore\n // its pre-drag preview. Still never a checkpoint.\n if (props.modelValue !== undefined) emit(\"update:modelValue\", props.modelValue);\n}\n\nfunction onRootPointerDown() {\n if (props.disabled) return;\n aborted = false;\n const onDragKeydown = (keyEvent: KeyboardEvent) => {\n if (keyEvent.key !== \"Escape\" || aborted) return;\n keyEvent.preventDefault();\n keyEvent.stopPropagation();\n // Reka keeps the pointer captured until release, so `aborted` is what\n // stops the remaining move ticks from resurrecting the gesture.\n aborted = true;\n resetToCommitted();\n };\n const onPointerUp = () => {\n // This runs after Reka's own element-level release handling, so a\n // swallowed gesture has already settled by the time the abort re-arms.\n teardownDrag?.();\n aborted = false;\n };\n const onPointerCancel = () => {\n teardownDrag?.();\n aborted = false; // a cancelled pointer emits no further ticks\n resetToCommitted();\n };\n window.addEventListener(\"pointerup\", onPointerUp);\n window.addEventListener(\"pointercancel\", onPointerCancel);\n window.addEventListener(\"keydown\", onDragKeydown, true);\n teardownDrag = () => {\n window.removeEventListener(\"pointerup\", onPointerUp);\n window.removeEventListener(\"pointercancel\", onPointerCancel);\n window.removeEventListener(\"keydown\", onDragKeydown, true);\n teardownDrag = undefined;\n };\n}\n\nonBeforeUnmount(() => teardownDrag?.());\n</script>\n\n<template>\n <SliderRoot\n :model-value=\"values\"\n :min=\"min\"\n :max=\"max\"\n :step=\"step\"\n :disabled=\"disabled\"\n :class=\"\n cn(\n 'relative flex w-full touch-none items-center py-2 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50',\n attrs.class as string,\n )\n \"\n @pointerdown=\"onRootPointerDown\"\n @update:model-value=\"onUpdate\"\n @value-commit=\"onCommit\"\n >\n <SliderTrack class=\"relative h-1.5 w-full grow rounded-full bg-muted\">\n <!-- The filled range is a value a person set, so it is painted flat in\n the human force's colour rather than in a gradient. -->\n <SliderRange class=\"absolute h-full rounded-full bg-primary\" />\n </SliderTrack>\n <SliderThumb\n v-bind=\"thumbAttrs\"\n class=\"block h-4 w-4 rounded-full border-2 border-primary bg-background shadow-sm transition-transform duration-fast ease-spring hover:scale-110 active:scale-95 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring focus-visible:shadow-halo data-[disabled]:pointer-events-none\"\n />\n </SliderRoot>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCA,MAAM,QAAQ;EAgBd,MAAM,OAAO;EAcb,MAAM,EAAE,OAAO,MAAM,eAAe,cAAc;EAKlD,MAAM,YAAY,IAAI,MAAM,UAAU;EACtC,YACQ,MAAM,aACX,UAAU;GACT,UAAU,QAAQ;EACpB,CACF;EAEA,MAAM,SAAS,eAAgB,UAAU,UAAU,KAAA,IAAY,CAAC,IAAI,CAAC,UAAU,KAAK,CAAE;EAEtF,SAAS,SAAS,MAA4B;GAC5C,MAAM,QAAQ,OAAO;GACrB,IAAI,UAAU,KAAA,KAAa,SAAS;GACpC,UAAU,QAAQ;GAClB,KAAK,qBAAqB,KAAK;EACjC;EAEA,SAAS,SAAS,MAAgB;GAChC,IAAI,KAAK,OAAO,KAAA,KAAa,CAAC,SAAS,KAAK,UAAU,KAAK,EAAE;EAC/D;EAIA,IAAI,UAAU;EACd,IAAI;EAEJ,SAAS,mBAAmB;GAC1B,IAAI,UAAU,UAAU,MAAM,YAAY;GAC1C,UAAU,QAAQ,MAAM;GAGxB,IAAI,MAAM,eAAe,KAAA,GAAW,KAAK,qBAAqB,MAAM,UAAU;EAChF;EAEA,SAAS,oBAAoB;GAC3B,IAAI,MAAM,UAAU;GACpB,UAAU;GACV,MAAM,iBAAiB,aAA4B;IACjD,IAAI,SAAS,QAAQ,YAAY,SAAS;IAC1C,SAAS,eAAe;IACxB,SAAS,gBAAgB;IAGzB,UAAU;IACV,iBAAiB;GACnB;GACA,MAAM,oBAAoB;IAGxB,eAAe;IACf,UAAU;GACZ;GACA,MAAM,wBAAwB;IAC5B,eAAe;IACf,UAAU;IACV,iBAAiB;GACnB;GACA,OAAO,iBAAiB,aAAa,WAAW;GAChD,OAAO,iBAAiB,iBAAiB,eAAe;GACxD,OAAO,iBAAiB,WAAW,eAAe,IAAI;GACtD,qBAAqB;IACnB,OAAO,oBAAoB,aAAa,WAAW;IACnD,OAAO,oBAAoB,iBAAiB,eAAe;IAC3D,OAAO,oBAAoB,WAAW,eAAe,IAAI;IACzD,eAAe,KAAA;GACjB;EACF;EAEA,sBAAsB,eAAe,CAAC;;GAIpC,OAAA,UAAA,GAAA,YAyBa,MAAA,UAAA,GAAA;IAxBV,eAAa,OAAA;IACb,KAAK,QAAA;IACL,KAAK,QAAA;IACL,MAAM,QAAA;IACN,UAAU,QAAA;IACV,OAAK,eAAS,MAAA,EAAA,CAAE,CAAA,mHAAqI,MAAA,KAAA,CAAK,CAAC,KAAA,CAAA;IAM3J,eAAa;IACb,uBAAoB;IACpB,eAAc;;IAEf,SAAA,cAIc,CAJd,YAIc,MAAA,WAAA,GAAA,EAJD,OAAM,mDAAkD,GAAA;KAGnE,SAAA,cAA+D,CAA/D,YAA+D,MAAA,WAAA,GAAA,EAAlD,OAAM,0CAAyC,CAAA,CAAA,CAAA;;IAE9D,CAAA,GAAA,YAGE,MAAA,WAAA,GAHF,WACU,MAER,UAAA,GAFkB,EAClB,OAAM,4SAA2S,CAAA,GAAA,MAAA,EAAA,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"Slider.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/primitives/Slider/Slider.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, useTemplateRef, watch } from \"vue\";\nimport { SliderRoot, SliderTrack, SliderRange, SliderThumb } from \"reka-ui\";\nimport { cn } from \"../../lib/cn\";\nimport { useSplitAttrs } from \"../../lib/attrs\";\nimport { useAncestorDisabled } from \"../../lib/ancestor-disabled\";\nimport { useFieldControl } from \"../../lib/field-context\";\n\n/**\n * Slider — one continuous value inside a bounded range. Reach for it when the\n * range itself is the information: a volume, a ratio, a share of something\n * whole. A number that happens to be numeric but has no meaningful ceiling —\n * a coordinate, an angle — belongs in a NumberField instead.\n *\n * Built on Reka UI's Slider for the `role=\"slider\"` semantics, the pointer\n * drag and the arrow / Home / End stepping. Single-thumb only: Reka models the\n * value as an array, and this exposes a scalar.\n *\n * Two things are added here.\n *\n * The first is the drag buffer, and without it the component silently drops\n * changes. Given a defined model value Reka runs fully controlled, and its\n * release-time \"did this change?\" check compares against whatever it was last\n * fed — not against what it emitted. A host that correctly withholds transient\n * values until commit therefore leaves that check reading the pre-drag value\n * for the whole gesture, so it always answers no and the commit never fires.\n * `lastValue` below feeds Reka's own transient ticks back into its model, which\n * is exactly the fix NumberField applies for the same reason. Keyboard steps\n * need no buffer: Reka updates and commits inside one synchronous call, so it\n * compares against a value that is still old either way.\n *\n * The second is the abort path. Reka has no drag cancellation of its own — it\n * handles pointerdown, move and up, and commits whenever the release value\n * differs from the one it snapshotted — so Escape or a browser-issued\n * `pointercancel` mid-drag would still write one checkpoint on release. The\n * bail-out mirrors NumberField's: reset `lastValue` to the committed value, so\n * Reka's own comparison sees no change and never commits, and swallow the\n * still-captured pointer's remaining ticks until it releases.\n *\n * Inside a [Field](../Field/Field.vue) it wires itself through\n * `useFieldControl()`: the row's id, the id of its hint or error line,\n * `required` and `invalid` all reach the thumb — which is the `role=\"slider\"`\n * element, and therefore the thing the row is talking about — and the row's\n * `name` reaches a hidden input, so\n * `<Field label=\"Volume\" error=\"…\"><Slider /></Field>` needs no attributes at\n * the call site. `disabled` still wins wherever it is set, in both directions,\n * which is why it defaults to `undefined` rather than `false`.\n *\n * **A row's label does not name it.** `<label for>` names a labelable element\n * and the thumb is a `span[role=\"slider\"]`, so the row's label resolves to it\n * and announces nobody. `aria-label`/`aria-labelledby` are still what name this\n * control, exactly as they were before — and they were always routed to the\n * thumb for the same reason the rest of this bag is.\n *\n * There is no `readonly`, and a row's is ignored rather than approximated. The\n * whole control is the drag: a track that shows a value and refuses to move is\n * a [Progress](../Progress/Progress.vue) bar wearing a thumb, and painting one\n * as live while swallowing every gesture is the state worse than either.\n */\nconst props = withDefaults(\n defineProps<{\n /** The current value. Transient drag positions are reported before it changes. */\n modelValue?: number;\n /** The floor of the range, and where Home lands. */\n min?: number;\n /** The ceiling of the range, and where End lands. */\n max?: number;\n /** The granularity of one arrow-key step and of the drag's own snapping. */\n step?: number;\n /** Unavailable: dims the track and refuses both the pointer and the keyboard. Unset defers to a wrapping Field. */\n disabled?: boolean | undefined;\n }>(),\n {\n min: 0,\n max: 1,\n step: 0.01,\n // Not `false`: absent has to stay tellable from `false` for a Field above\n // to disable the row and for `:disabled=\"false\"` to overrule one that does.\n // Vue casts an absent Boolean prop with no declared default to `false`,\n // which would leave the context wired and inert.\n disabled: undefined,\n },\n);\n\nconst emit = defineEmits<{\n /** Transient: every position the thumb passes through during a drag. Not a checkpoint. */\n \"update:modelValue\": [value: number];\n /** Committed: once at the end of a gesture — drag release, or a keyboard step. */\n commit: [value: number];\n}>();\n\n// The root renders a real element, and it is the one a caller's `class` has to\n// land on — sizing and layout (`flex-1` to grow in a toolbar) are dead weight\n// on the thumb, which is a 16px absolutely-positioned circle no flex rule\n// reaches. Every other fallthrough attribute goes the other way, onto the\n// thumb: `aria-labelledby` describes the `role=\"slider\"` element, not the box\n// around it.\ndefineOptions({ inheritAttrs: false });\nconst { attrs, rest: thumbAttrs } = useSplitAttrs();\n\n/**\n * The one control in the library the platform cannot disable for us.\n *\n * `<fieldset disabled>` reaches `<input>`, `<button>`, `<select>` and\n * `<textarea>` and stops there, and Reka renders this thumb as a\n * `<span role=\"slider\" tabindex=\"0\">`. Measured in jsdom, a Slider inside a\n * disabled group kept its tab stop and still moved its value on Home and End —\n * identical behaviour to an available one. Painting it unavailable without\n * this would produce the worse defect rather than fix the visible one: a\n * control that looks unreachable and answers the keyboard anyway.\n *\n * It is read off the DOM rather than taken from the Field context because\n * `Fieldset.vue` deliberately publishes no `disabled` there — see\n * `../../lib/ancestor-disabled.ts` for why a read cannot drift from the\n * attribute the way a second declaration would.\n */\nconst root = useTemplateRef<{ $el?: Element }>(\"root\");\nconst groupDisabled = useAncestorDisabled(() => root.value?.$el);\n\n// `id` and `aria-describedby` reach this control as fallthrough attrs rather\n// than props, so they are read off `attrs` and handed in as this caller's own\n// values — a caller who sets either still beats the row, and the row's\n// description is merged into theirs rather than replacing it. `name`,\n// `required` and `invalid` are absent from the object because there is no prop\n// to oppose the row with; the row's answer stands unopposed, which is what\n// wrapping the slider in a Field asked for.\nconst field = useFieldControl(() => ({\n id: attrs.id as string | undefined,\n describedBy: attrs[\"aria-describedby\"] as string | undefined,\n // The fieldset beats the prop in both directions, exactly as it does for a\n // native control: an `<input :disabled=\"false\">` inside a disabled group is\n // disabled too, so a Slider that said the same must not be the one exception.\n disabled: groupDisabled.value ? true : props.disabled,\n}));\n\n// The resolved bag lands on the thumb for the same reason every other\n// fallthrough attribute does — it is the `role=\"slider\"` element, and an id, a\n// description or an `aria-invalid` describes that, not the box around it.\n//\n// `name` is the one key that goes the other way: a name on a thumb submits\n// nothing, so it drives the hidden input inside the root instead. Removed from\n// a copy rather than listed positively, so a key added to the resolved bag\n// later reaches the thumb without anyone remembering to come back here.\nconst thumbFieldAttrs = computed(() => {\n const aria: Record<string, unknown> = { ...field.attrs };\n delete aria.name;\n return aria;\n});\n\n// What the Reka root is fed as its own model value: seeded from the prop, then\n// advanced on every tick Reka emits, so its release-time check sees the drag's\n// real end position rather than the frozen prop.\nconst lastValue = ref(props.modelValue);\nwatch(\n () => props.modelValue,\n (value) => {\n lastValue.value = value;\n },\n);\n\nconst values = computed(() => (lastValue.value === undefined ? [] : [lastValue.value]));\n\nfunction onUpdate(next: number[] | undefined) {\n const value = next?.[0];\n if (value === undefined || aborted) return;\n lastValue.value = value;\n emit(\"update:modelValue\", value);\n}\n\nfunction onCommit(next: number[]) {\n if (next[0] !== undefined && !aborted) emit(\"commit\", next[0]);\n}\n\n// The abort path. Its window listeners live for the duration of one pointer\n// gesture and no longer.\nlet aborted = false;\nlet teardownDrag: (() => void) | undefined;\n\nfunction resetToCommitted() {\n if (lastValue.value === props.modelValue) return;\n lastValue.value = props.modelValue;\n // One transient tick carrying the committed value, so the host can restore\n // its pre-drag preview. Still never a checkpoint.\n if (props.modelValue !== undefined) emit(\"update:modelValue\", props.modelValue);\n}\n\nfunction onRootPointerDown() {\n if (field.disabled) return;\n aborted = false;\n const onDragKeydown = (keyEvent: KeyboardEvent) => {\n if (keyEvent.key !== \"Escape\" || aborted) return;\n keyEvent.preventDefault();\n keyEvent.stopPropagation();\n // Reka keeps the pointer captured until release, so `aborted` is what\n // stops the remaining move ticks from resurrecting the gesture.\n aborted = true;\n resetToCommitted();\n };\n const onPointerUp = () => {\n // This runs after Reka's own element-level release handling, so a\n // swallowed gesture has already settled by the time the abort re-arms.\n teardownDrag?.();\n aborted = false;\n };\n const onPointerCancel = () => {\n teardownDrag?.();\n aborted = false; // a cancelled pointer emits no further ticks\n resetToCommitted();\n };\n window.addEventListener(\"pointerup\", onPointerUp);\n window.addEventListener(\"pointercancel\", onPointerCancel);\n window.addEventListener(\"keydown\", onDragKeydown, true);\n teardownDrag = () => {\n window.removeEventListener(\"pointerup\", onPointerUp);\n window.removeEventListener(\"pointercancel\", onPointerCancel);\n window.removeEventListener(\"keydown\", onDragKeydown, true);\n teardownDrag = undefined;\n };\n}\n\nonBeforeUnmount(() => teardownDrag?.());\n</script>\n\n<template>\n <SliderRoot\n ref=\"root\"\n :model-value=\"values\"\n :min=\"min\"\n :max=\"max\"\n :step=\"step\"\n :disabled=\"field.disabled\"\n :class=\"\n cn(\n // Unavailability is painted in measured greys, never as an alpha over\n // the available state: the filled range and the thumb's rim *are* the\n // value, and `opacity-50` here took the range from 7.53:1 to 2.36:1\n // on the page ground — below WCAG 1.4.11's 3:1 floor for a graphical\n // object required to understand the control. The two parts drain to\n // their own tokens below; `aria-valuenow` announces the number, but\n // nothing re-paints it for a sighted reader, so the pixels stay.\n 'relative flex w-full touch-none items-center py-2 data-[disabled]:cursor-not-allowed',\n attrs.class as string,\n )\n \"\n @pointerdown=\"onRootPointerDown\"\n @update:model-value=\"onUpdate\"\n @value-commit=\"onCommit\"\n >\n <!-- Reka would mint this itself from a `name` on the root, but it models\n the value as an array and posts it as `volume[0]`. This control\n exposes a scalar and a row's `name` has to post one: a field that\n spells itself differently depending on which control its row holds is\n exactly the surprise the Field context exists to remove.\n\n `lastValue` and not `modelValue`, so what is submitted is what the\n thumb is showing: a host that withholds transient values until commit\n leaves the prop behind for the length of a gesture. -->\n <input\n v-if=\"field.name !== undefined\"\n type=\"hidden\"\n :name=\"field.name\"\n :value=\"lastValue\"\n :disabled=\"field.disabled\"\n />\n <SliderTrack class=\"relative h-1.5 w-full grow rounded-full bg-muted\">\n <!-- The filled range is a value a person set, so it is painted flat in\n the primary colour rather than in a gradient. Unavailable, it\n falls to the neutral well like every other control's value, keyed\n off Reka's own `data-disabled` on this node: `muted-foreground` is\n 5.25:1 on the page ground and 4.67:1 against the `bg-muted` track\n it sits on, both measured. -->\n <SliderRange\n class=\"absolute h-full rounded-full bg-primary data-[disabled]:bg-muted-foreground\"\n />\n </SliderTrack>\n <!-- The thumb's position is the value, so its rim drains with the range —\n `muted-foreground` at 5.25:1 on the page ground — while its fill,\n which is the page's own ground, needs no dim. -->\n <SliderThumb\n v-bind=\"{ ...thumbAttrs, ...thumbFieldAttrs }\"\n class=\"block h-4 w-4 rounded-full border-2 border-primary bg-background shadow-sm transition-transform duration-fast ease-spring hover:scale-110 active:scale-95 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring focus-visible:shadow-halo data-[disabled]:pointer-events-none data-[disabled]:border-muted-foreground\"\n />\n </SliderRoot>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2DA,MAAM,QAAQ;EAyBd,MAAM,OAAO;EAcb,MAAM,EAAE,OAAO,MAAM,eAAe,cAAc;;;;;;;;;;;;;;;;;EAkBlD,MAAM,OAAO,eAAkC,MAAM;EACrD,MAAM,gBAAgB,0BAA0B,KAAK,OAAO,GAAG;EAS/D,MAAM,QAAQ,uBAAuB;GACnC,IAAI,MAAM;GACV,aAAa,MAAM;GAInB,UAAU,cAAc,QAAQ,OAAO,MAAM;EAC/C,EAAE;EAUF,MAAM,kBAAkB,eAAe;GACrC,MAAM,OAAgC,EAAE,GAAG,MAAM,MAAM;GACvD,OAAO,KAAK;GACZ,OAAO;EACT,CAAC;EAKD,MAAM,YAAY,IAAI,MAAM,UAAU;EACtC,YACQ,MAAM,aACX,UAAU;GACT,UAAU,QAAQ;EACpB,CACF;EAEA,MAAM,SAAS,eAAgB,UAAU,UAAU,KAAA,IAAY,CAAC,IAAI,CAAC,UAAU,KAAK,CAAE;EAEtF,SAAS,SAAS,MAA4B;GAC5C,MAAM,QAAQ,OAAO;GACrB,IAAI,UAAU,KAAA,KAAa,SAAS;GACpC,UAAU,QAAQ;GAClB,KAAK,qBAAqB,KAAK;EACjC;EAEA,SAAS,SAAS,MAAgB;GAChC,IAAI,KAAK,OAAO,KAAA,KAAa,CAAC,SAAS,KAAK,UAAU,KAAK,EAAE;EAC/D;EAIA,IAAI,UAAU;EACd,IAAI;EAEJ,SAAS,mBAAmB;GAC1B,IAAI,UAAU,UAAU,MAAM,YAAY;GAC1C,UAAU,QAAQ,MAAM;GAGxB,IAAI,MAAM,eAAe,KAAA,GAAW,KAAK,qBAAqB,MAAM,UAAU;EAChF;EAEA,SAAS,oBAAoB;GAC3B,IAAI,MAAM,UAAU;GACpB,UAAU;GACV,MAAM,iBAAiB,aAA4B;IACjD,IAAI,SAAS,QAAQ,YAAY,SAAS;IAC1C,SAAS,eAAe;IACxB,SAAS,gBAAgB;IAGzB,UAAU;IACV,iBAAiB;GACnB;GACA,MAAM,oBAAoB;IAGxB,eAAe;IACf,UAAU;GACZ;GACA,MAAM,wBAAwB;IAC5B,eAAe;IACf,UAAU;IACV,iBAAiB;GACnB;GACA,OAAO,iBAAiB,aAAa,WAAW;GAChD,OAAO,iBAAiB,iBAAiB,eAAe;GACxD,OAAO,iBAAiB,WAAW,eAAe,IAAI;GACtD,qBAAqB;IACnB,OAAO,oBAAoB,aAAa,WAAW;IACnD,OAAO,oBAAoB,iBAAiB,eAAe;IAC3D,OAAO,oBAAoB,WAAW,eAAe,IAAI;IACzD,eAAe,KAAA;GACjB;EACF;EAEA,sBAAsB,eAAe,CAAC;;GAIpC,OAAA,UAAA,GAAA,YA0Da,MAAA,UAAA,GAAA;IAzDP,SAAA;IAAJ,KAAI;IACH,eAAa,OAAA;IACb,KAAK,QAAA;IACL,KAAK,QAAA;IACL,MAAM,QAAA;IACN,UAAU,MAAA,KAAA,CAAK,CAAC;IAChB,OAAK,eAAS,MAAA,EAAA,CAAE,CAAA,wFAAuoB,MAAA,KAAA,CAAK,CAAC,KAAA,CAAA;IAa7pB,eAAa;IACb,uBAAoB;IACpB,eAAc;;IAWf,SAAA,cAME;KALM,MAAA,KAAA,CAAK,CAAC,SAAS,KAAA,KADvB,UAAA,GAAA,mBAME,SAAA;;MAJA,MAAK;MACJ,MAAM,MAAA,KAAA,CAAK,CAAC;MACZ,OAAO,UAAA;MACP,UAAU,MAAA,KAAA,CAAK,CAAC;;KAEnB,YAUc,MAAA,WAAA,GAAA,EAVD,OAAM,mDAAkD,GAAA;MAOnE,SAAA,cAEE,CAFF,YAEE,MAAA,WAAA,GAAA,EADA,OAAM,8EAA6E,CAAA,CAAA,CAAA;;;KAMvF,YAGE,MAAA,WAAA,GAHF,WAGE;MAAA,GAFa,MAAA,UAAA;MAAU,GAAK,gBAAA;KAAe,GAAA,EAC3C,OAAM,oVAAmV,CAAA,GAAA,MAAA,EAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import SpeedDial_vue_vue_type_script_setup_true_lang_default from "./SpeedDial.vue_vue_type_script_setup_true_lang.js";
|
|
2
|
+
//#region src/primitives/SpeedDial/SpeedDial.vue
|
|
3
|
+
var SpeedDial_default = SpeedDial_vue_vue_type_script_setup_true_lang_default;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { SpeedDial_default as default };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=SpeedDial.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SpeedDial.js","names":[],"sources":["../../../src/primitives/SpeedDial/SpeedDial.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Component } from \"vue\";\n\n/**\n * One action in the fan.\n *\n * `label` is required and it is not a tooltip: it is rendered as real text\n * beside the glyph. A column of unlabelled circles is the failure mode of this\n * pattern — it reads only to whoever already knows the icons — and a `title`\n * attribute does not fix it, because it is not an accessible name and never\n * appears for a touch or keyboard user at all.\n */\nexport interface SpeedDialAction {\n /** The visible text on the action, and its accessible name. Required. */\n label: string;\n /** A glyph shown before the label. Decorative — the label carries the meaning. */\n icon?: Component;\n /** Visible but inert: announced as disabled, and choosing it emits nothing. */\n disabled?: boolean;\n}\n\n/** Which side of the trigger the fan opens onto. */\nexport type SpeedDialDirection = \"up\" | \"down\" | \"left\" | \"right\";\n\n/**\n * The three things a direction decides — which side the popper puts the fan\n * on, which axis it stacks along, and which axis the arrow keys walk — are one\n * decision, so they are one table rather than a `cva` map plus two lookups.\n * Split across three structures they drift, and a fan laid out on one axis and\n * navigated on another is exactly the defect that is invisible until someone\n * reaches for the keyboard.\n *\n * `flex-col` for `up` and not `flex-col-reverse`: reversing the visual order\n * would put `actions[0]` nearest the trigger, which is the convention, at the\n * price of making Arrow Down move the highlight *up* the screen and making a\n * screen reader read the fan bottom-to-top. So the rule is one line instead —\n * the actions always render in array order along the fan's own reading\n * direction — and the arrow keys, the reading order and the eye all agree.\n */\nconst FANS = {\n up: { side: \"top\", stack: \"flex-col\", axis: \"vertical\" },\n down: { side: \"bottom\", stack: \"flex-col\", axis: \"vertical\" },\n left: { side: \"left\", stack: \"flex-row\", axis: \"horizontal\" },\n right: { side: \"right\", stack: \"flex-row\", axis: \"horizontal\" },\n} satisfies Record<\n SpeedDialDirection,\n { side: \"top\" | \"bottom\" | \"left\" | \"right\"; stack: string; axis: \"vertical\" | \"horizontal\" }\n>;\n\n/**\n * Button's press language, mirrored rather than imported. A FAB is circular,\n * elevated and sized off its own scale, so `Button`'s height variants would\n * fight it — but the *feel* of a press is not per-component, so the transform\n * spring, the 0.97 press and the focus treatment are the same strings Button\n * carries.\n */\nconst PRESS = [\n \"[transition:transform_var(--duration-fast)_var(--ease-spring),background-color_var(--duration-fast)_var(--ease-out),box-shadow_var(--duration-fast)_var(--ease-out)]\",\n \"active:scale-press\",\n \"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring focus-visible:shadow-halo\",\n].join(\" \");\n\n/**\n * Reka's menu is a *vertical* roving-focus group: `MenuContentImpl` hard-codes\n * `arrowKeyOptions: \"vertical\"`, so Arrow Left and Arrow Right do nothing in\n * it. In a `left` or `right` fan that leaves the keys that move the highlight\n * running across the axis the reader can see.\n *\n * Re-issuing the press as the key Reka already listens for keeps one\n * implementation of the navigation — the typeahead, the highlight bookkeeping\n * and the skipping of disabled items all still come from Reka — instead of a\n * second, hand-rolled one running beside it and disagreeing with it.\n */\nconst MIRRORED_ARROWS: Record<string, string | undefined> = {\n ArrowRight: \"ArrowDown\",\n ArrowLeft: \"ArrowUp\",\n};\n</script>\n\n<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport {\n DropdownMenuRoot,\n DropdownMenuTrigger,\n DropdownMenuPortal,\n DropdownMenuContent,\n DropdownMenuItem,\n} from \"reka-ui\";\nimport { Plus, X } from \"@lucide/vue\";\nimport { cn } from \"../../lib/cn\";\nimport { listStaggerDelay } from \"../../lib/motion\";\nimport { optional } from \"../../lib/props\";\nimport { useSplitAttrs } from \"../../lib/attrs\";\n\n/**\n * SpeedDial — one prominent circular button that expands into a short fan of\n * related actions. The floating-action-button pattern: the single most likely\n * thing to do on a screen, with its three or four near neighbours a press\n * away.\n *\n * Built on Reka UI's DropdownMenu parts, and that is the load-bearing decision\n * here. Strip the circle and the fan away and what is left is a menu button:\n * `aria-haspopup=\"menu\"`, `aria-expanded` tracking the state, one Tab stop with\n * roving focus across the actions, typeahead, Esc closing and returning focus\n * to the trigger. Reka supplies every one of those, tested, and `DropdownMenu`\n * in this same directory already proves the wiring. Hand-rolling it would mean\n * re-solving focus management — the part of this pattern that is actually hard\n * and the part that silently rots — in order to change nothing a reader could\n * name. What is different about a SpeedDial is its *shape*: a circular trigger,\n * a fan of labelled pills instead of a panel of rows, and a direction. That is\n * layout, and layout is all this component adds.\n *\n * It is deliberately not modal, unlike `DropdownMenu`. Reka's modal path locks\n * the body and compensates for the vanished scrollbar with padding — which\n * widens the viewport and slides a viewport-pinned trigger sideways the moment\n * it opens. A control whose whole job is to sit in a corner cannot jump out of\n * it on press.\n *\n * **Positioning is the caller's.** This renders as an ordinary inline-level\n * element and pins itself to nothing; a `class` of `fixed bottom-6 right-6`\n * lands on the trigger. A library that nailed itself to a viewport corner could\n * never be placed in a panel.\n *\n * Reach for `DropdownMenu` when the trigger belongs in a toolbar or a row and\n * the commands are a list rather than a fan, and for `Button` when there is one\n * action and no menu at all.\n */\nconst props = withDefaults(\n defineProps<{\n /** The actions, in the order they read along the fan. Three or four; this is a shortcut, not a menu. */\n actions: SpeedDialAction[];\n /** The trigger's accessible name, e.g. \"Create\". Required — a lone glyph names nothing. */\n label: string;\n /** Drive the fan from the host with `v-model:open`; omit it and the component owns its own state. */\n open?: boolean | undefined;\n /** Which side of the trigger the fan opens onto. */\n direction?: SpeedDialDirection;\n }>(),\n // `open: undefined` is load-bearing rather than a redundant default — it is\n // what keeps the uncontrolled third state reachable past Vue's absent-Boolean\n // casting. `optional()` in the template is the other half; its docblock\n // carries the reasoning for both.\n { open: undefined, direction: \"up\" },\n);\n\nconst emit = defineEmits<{\n /** The chosen action, and its index in `actions` — the index is the stable identity, since a label is display text and gets translated. */\n select: [action: SpeedDialAction, index: number];\n /** The fan opened or closed, for `v-model:open`. */\n \"update:open\": [value: boolean];\n}>();\n\nconst fan = computed(() => FANS[props.direction]);\n\n// `DropdownMenuRoot` renders no DOM node at all, so fallthrough attributes\n// would be dropped on the floor rather than landing anywhere. They go to the\n// trigger, which is both the interactive element they describe and the element\n// a caller positions.\n//\n// `class` is pulled out of that spread and merged through `cn()` instead:\n// spreading it alongside the trigger's own `:class` only concatenates the two\n// lists — Vue's merge is generic, not Tailwind-aware — so a caller's `h-12`\n// would lose to the trigger's own `h-14` depending on which utility Tailwind\n// happened to emit last.\ndefineOptions({ inheritAttrs: false });\nconst { attrs, rest: triggerAttrs } = useSplitAttrs();\n\n/**\n * A disabled action selects nothing. Reka already blocks the pointer path on\n * the disabled row; this is the second half, for a keyboard press that reaches\n * it anyway.\n */\nfunction choose(action: SpeedDialAction, index: number): void {\n if (action.disabled) return;\n emit(\"select\", action, index);\n}\n\n/** See `MIRRORED_ARROWS`. Vertical fans are left alone — Reka already owns them. */\nfunction mirrorArrows(event: KeyboardEvent): void {\n if (fan.value.axis !== \"horizontal\") return;\n const mapped = MIRRORED_ARROWS[event.key];\n if (mapped === undefined) return;\n event.preventDefault();\n (event.currentTarget as HTMLElement | null)?.dispatchEvent(\n new KeyboardEvent(\"keydown\", { key: mapped, bubbles: true, cancelable: true }),\n );\n}\n</script>\n\n<template>\n <DropdownMenuRoot\n v-bind=\"optional({ open })\"\n :modal=\"false\"\n @update:open=\"$emit('update:open', $event)\"\n >\n <DropdownMenuTrigger\n v-bind=\"triggerAttrs\"\n type=\"button\"\n :aria-label=\"label\"\n :class=\"\n cn(\n // `shadow-lg`, which `theme.css` reserves for true overlays and which\n // would be wrong on an ordinary control: this one genuinely floats\n // over the page rather than sitting in it, so the largest elevation is\n // depth reported honestly rather than a glow on something flush.\n 'group inline-flex h-14 w-14 shrink-0 select-none items-center justify-center rounded-full bg-primary text-primary-foreground shadow-lg',\n 'hover:bg-primary/90',\n PRESS,\n attrs.class as string,\n )\n \"\n >\n <!-- Both glyphs are hidden from assistive technology: the button's name\n is `label`, and a second reading of \"plus\" would only compete with\n it. The open glyph cross-fades rather than the trigger simply\n rotating 45° into a cross, because the slot lets a caller supply a\n domain glyph — a pencil rotated 45° is a tilted pencil, not a\n dismissal. -->\n <span aria-hidden=\"true\" class=\"inline-grid place-items-center\">\n <span\n class=\"[grid-area:1/1] transition-[opacity,transform] duration-fast ease-out group-data-[state=open]:rotate-45 group-data-[state=open]:opacity-0\"\n >\n <!-- @slot The trigger's resting glyph. Defaults to a plus. -->\n <slot><Plus class=\"h-6 w-6\" /></slot>\n </span>\n <span\n class=\"[grid-area:1/1] -rotate-45 opacity-0 transition-[opacity,transform] duration-fast ease-out group-data-[state=open]:rotate-0 group-data-[state=open]:opacity-100\"\n >\n <X class=\"h-6 w-6\" />\n </span>\n </span>\n </DropdownMenuTrigger>\n\n <DropdownMenuPortal>\n <!-- `as-child` for one reason: `aria-orientation`. Reka hard-codes it to\n \"vertical\" as a *prop*, which a fallthrough attribute cannot beat —\n and announcing a `left` or `right` fan as a vertical menu tells a\n screen-reader user the opposite of what the arrow keys now do. The\n slot's own props win the merge, so the element below is where the\n correction can land. -->\n <DropdownMenuContent\n as-child\n :side=\"fan.side\"\n :side-offset=\"12\"\n align=\"center\"\n @keydown=\"mirrorArrows\"\n >\n <div\n :aria-orientation=\"fan.axis\"\n :class=\"\n cn(\n // No popover surface of its own. The fan is a set of floating\n // pills over the page, not a panel holding them, so the elevation\n // belongs to each action and there is no box drawn around them.\n 'z-50 flex items-center gap-3 outline-none',\n fan.stack,\n )\n \"\n >\n <DropdownMenuItem\n v-for=\"(action, index) in actions\"\n :key=\"index\"\n :disabled=\"action.disabled ?? false\"\n :class=\"\n cn(\n 'inline-flex h-9 shrink-0 cursor-pointer select-none items-center gap-2 whitespace-nowrap rounded-full border border-border bg-popover px-3 text-sm text-popover-foreground shadow-md outline-none',\n PRESS,\n 'data-[highlighted]:bg-subtle',\n // The pill drains rather than fades. Each action is a floating\n // label — it has no panel behind it and no tooltip beside it,\n // so the words *are* the control, and `data-[disabled]:opacity-50`\n // composited them to 3.21:1 against the page showing through.\n // Drained, the fill goes to the neutral well and the label to\n // the measured muted colour: 4.67:1 over it, and a pill that\n // has plainly given up its card-white surface. The elevation\n // goes with it, because a shadow is depth and an unavailable\n // action is not lifted off the page.\n //\n // The rim is the one place this pill diverges from the library's\n // disabled row, which slackens `input` to the lighter `border`\n // — and it has to. Every other control drains against a surface\n // that stays behind it; this one floats, so once the shadow\n // goes the rim is the only thing delimiting it, and `muted` on\n // the page ground is 1.12:1. Tightening to the strong weight is\n // what keeps an unavailable action locatable at all, which is\n // the prior question to it reading as unavailable.\n 'data-[disabled]:pointer-events-none data-[disabled]:border-border-strong data-[disabled]:bg-muted data-[disabled]:text-muted-foreground data-[disabled]:shadow-none',\n // The actions fan out one after another, which is what makes\n // this read as a fan opening rather than a block appearing. The\n // delay is the shared stagger vocabulary, capped there so a\n // fifth action does not trail in noticeably later than the\n // second.\n //\n // Entry only, and it stays that way for free: the content\n // declares no animation of its own, so on close Reka's Presence\n // sees `animation-name: none`, unmounts the whole fan in one\n // frame, and there is no interval left for the stagger to play\n // backwards in. Collapsing is instant by construction, not by a\n // second set of reversed delays.\n 'animate-scale-in',\n )\n \"\n :style=\"{ animationDelay: listStaggerDelay(index) }\"\n @select=\"choose(action, index)\"\n >\n <component :is=\"action.icon\" v-if=\"action.icon\" class=\"h-4 w-4\" aria-hidden=\"true\" />\n <span>{{ action.label }}</span>\n </DropdownMenuItem>\n </div>\n </DropdownMenuContent>\n </DropdownMenuPortal>\n </DropdownMenuRoot>\n</template>\n"],"mappings":""}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { Component } from "vue";
|
|
2
|
+
/**
|
|
3
|
+
* One action in the fan.
|
|
4
|
+
*
|
|
5
|
+
* `label` is required and it is not a tooltip: it is rendered as real text
|
|
6
|
+
* beside the glyph. A column of unlabelled circles is the failure mode of this
|
|
7
|
+
* pattern — it reads only to whoever already knows the icons — and a `title`
|
|
8
|
+
* attribute does not fix it, because it is not an accessible name and never
|
|
9
|
+
* appears for a touch or keyboard user at all.
|
|
10
|
+
*/
|
|
11
|
+
export interface SpeedDialAction {
|
|
12
|
+
/** The visible text on the action, and its accessible name. Required. */
|
|
13
|
+
label: string;
|
|
14
|
+
/** A glyph shown before the label. Decorative — the label carries the meaning. */
|
|
15
|
+
icon?: Component;
|
|
16
|
+
/** Visible but inert: announced as disabled, and choosing it emits nothing. */
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/** Which side of the trigger the fan opens onto. */
|
|
20
|
+
export type SpeedDialDirection = "up" | "down" | "left" | "right";
|
|
21
|
+
declare const _default: typeof __VLS_export;
|
|
22
|
+
export default _default;
|
|
23
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
24
|
+
/** The actions, in the order they read along the fan. Three or four; this is a shortcut, not a menu. */
|
|
25
|
+
actions: SpeedDialAction[];
|
|
26
|
+
/** The trigger's accessible name, e.g. "Create". Required — a lone glyph names nothing. */
|
|
27
|
+
label: string;
|
|
28
|
+
/** Drive the fan from the host with `v-model:open`; omit it and the component owns its own state. */
|
|
29
|
+
open?: boolean | undefined;
|
|
30
|
+
/** Which side of the trigger the fan opens onto. */
|
|
31
|
+
direction?: SpeedDialDirection;
|
|
32
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
33
|
+
select: (action: SpeedDialAction, index: number) => any;
|
|
34
|
+
"update:open": (value: boolean) => any;
|
|
35
|
+
}, string, import("vue").PublicProps, Readonly<{
|
|
36
|
+
/** The actions, in the order they read along the fan. Three or four; this is a shortcut, not a menu. */
|
|
37
|
+
actions: SpeedDialAction[];
|
|
38
|
+
/** The trigger's accessible name, e.g. "Create". Required — a lone glyph names nothing. */
|
|
39
|
+
label: string;
|
|
40
|
+
/** Drive the fan from the host with `v-model:open`; omit it and the component owns its own state. */
|
|
41
|
+
open?: boolean | undefined;
|
|
42
|
+
/** Which side of the trigger the fan opens onto. */
|
|
43
|
+
direction?: SpeedDialDirection;
|
|
44
|
+
}> & Readonly<{
|
|
45
|
+
onSelect?: (action: SpeedDialAction, index: number) => any;
|
|
46
|
+
"onUpdate:open"?: (value: boolean) => any;
|
|
47
|
+
}>, {
|
|
48
|
+
open: boolean | undefined;
|
|
49
|
+
direction: SpeedDialDirection;
|
|
50
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
51
|
+
default?: (props: {}) => any;
|
|
52
|
+
}>;
|
|
53
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
54
|
+
new (): {
|
|
55
|
+
$slots: S;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=SpeedDial.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SpeedDial.vue.d.ts","sourceRoot":"","sources":["../../../src/primitives/SpeedDial/SpeedDial.vue"],"names":[],"mappings":"AA2UA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAErC;;;;;;;;GAQG;AACH,MAAM,WAAW,eAAe;IAC9B,yEAAyE;IACzE,KAAK,EAAE,MAAM,CAAC;IACd,kFAAkF;IAClF,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,oDAAoD;AACpD,MAAM,MAAM,kBAAkB,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;wBAuD7C,OAAO,YAAY;AAAxC,wBAAyC;AACzC,QAAA,MAAM,YAAY;IAmCd,wGAAwG;aAC/F,eAAe,EAAE;IAC1B,2FAA2F;WACpF,MAAM;IACb,qGAAqG;WAC9F,OAAO,GAAG,SAAS;IAC1B,oDAAoD;gBACxC,kBAAkB;;;;;IAP9B,wGAAwG;aAC/F,eAAe,EAAE;IAC1B,2FAA2F;WACpF,MAAM;IACb,qGAAqG;WAC9F,OAAO,GAAG,SAAS;IAC1B,oDAAoD;gBACxC,kBAAkB;;;;;UAFvB,OAAO,GAAG,SAAS;eAEd,kBAAkB;;cA6YpB,CAAC,KAAK,IAAiB,KAAK,GAAG;EAWzC,CAAC;AAWL,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|