@morscherlab/mint-sdk 1.0.0-alpha.2
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 +326 -0
- package/dist/__stories__/experiment-helpers.d.ts +25 -0
- package/dist/__tests__/components/AppLayout.test.d.ts +1 -0
- package/dist/__tests__/components/AppSidebar.test.d.ts +1 -0
- package/dist/__tests__/components/AppTopBar.test.d.ts +1 -0
- package/dist/__tests__/components/BaseInput.test.d.ts +1 -0
- package/dist/__tests__/components/BasePill.test.d.ts +1 -0
- package/dist/__tests__/components/Calendar.test.d.ts +1 -0
- package/dist/__tests__/components/CollapsibleCard.test.d.ts +1 -0
- package/dist/__tests__/components/DataFrame.test.d.ts +1 -0
- package/dist/__tests__/components/DropdownButton.test.d.ts +1 -0
- package/dist/__tests__/composables/formBuilderRegistry.test.d.ts +1 -0
- package/dist/__tests__/composables/useAppExperiment.test.d.ts +1 -0
- package/dist/__tests__/composables/useAuth.test.d.ts +1 -0
- package/dist/__tests__/composables/useAutoGroup.test.d.ts +1 -0
- package/dist/__tests__/composables/useExperimentData.test.d.ts +13 -0
- package/dist/__tests__/composables/useExperimentSave.test.d.ts +1 -0
- package/dist/__tests__/composables/useForm.test.d.ts +1 -0
- package/dist/__tests__/composables/useFormBuilder.test.d.ts +1 -0
- package/dist/__tests__/composables/usePlatformContext.test.d.ts +1 -0
- package/dist/__tests__/composables/usePluginApi.test.d.ts +13 -0
- package/dist/__tests__/composables/usePluginConfig.test.d.ts +14 -0
- package/dist/__tests__/utils/color.test.d.ts +1 -0
- package/dist/auth-BYmxZdJl.js +297 -0
- package/dist/auth-BYmxZdJl.js.map +1 -0
- package/dist/components/AlertBox.vue.d.ts +34 -0
- package/dist/components/AppAvatarMenu.vue.d.ts +58 -0
- package/dist/components/AppContainer.vue.d.ts +28 -0
- package/dist/components/AppLayout.vue.d.ts +31 -0
- package/dist/components/AppPageSelector.vue.d.ts +43 -0
- package/dist/components/AppPillNav.vue.d.ts +11 -0
- package/dist/components/AppPluginSwitcher.vue.d.ts +38 -0
- package/dist/components/AppSidebar.vue.d.ts +47 -0
- package/dist/components/AppTopBar.vue.d.ts +111 -0
- package/dist/components/AuditTrail.vue.d.ts +38 -0
- package/dist/components/AutoGroupModal.vue.d.ts +124 -0
- package/dist/components/Avatar.vue.d.ts +14 -0
- package/dist/components/BaseButton.vue.d.ts +37 -0
- package/dist/components/BaseCheckbox.vue.d.ts +17 -0
- package/dist/components/BaseInput.vue.d.ts +34 -0
- package/dist/components/BaseModal.vue.d.ts +46 -0
- package/dist/components/BasePill.vue.d.ts +57 -0
- package/dist/components/BaseRadioGroup.vue.d.ts +21 -0
- package/dist/components/BaseSelect.vue.d.ts +20 -0
- package/dist/components/BaseSlider.vue.d.ts +22 -0
- package/dist/components/BaseTabs.vue.d.ts +14 -0
- package/dist/components/BaseTextarea.vue.d.ts +30 -0
- package/dist/components/BaseToggle.vue.d.ts +19 -0
- package/dist/components/BatchProgressList.vue.d.ts +43 -0
- package/dist/components/Breadcrumb.vue.d.ts +33 -0
- package/dist/components/Calendar.vue.d.ts +107 -0
- package/dist/components/ChartContainer.vue.d.ts +31 -0
- package/dist/components/ChemicalFormula.vue.d.ts +8 -0
- package/dist/components/CollapsibleCard.vue.d.ts +41 -0
- package/dist/components/ColorSlider.vue.d.ts +34 -0
- package/dist/components/ConcentrationInput.vue.d.ts +25 -0
- package/dist/components/ConfirmDialog.vue.d.ts +42 -0
- package/dist/components/DataFrame.vue.d.ts +107 -0
- package/dist/components/DatePicker.vue.d.ts +25 -0
- package/dist/components/DateTimePicker.vue.d.ts +30 -0
- package/dist/components/Divider.vue.d.ts +14 -0
- package/dist/components/DoseCalculator.vue.d.ts +19 -0
- package/dist/components/DropdownButton.vue.d.ts +47 -0
- package/dist/components/EmptyState.vue.d.ts +36 -0
- package/dist/components/ExperimentCodeBadge.vue.d.ts +14 -0
- package/dist/components/ExperimentDataViewer.vue.d.ts +29 -0
- package/dist/components/ExperimentPopover.vue.d.ts +32 -0
- package/dist/components/ExperimentSelectorModal.vue.d.ts +28 -0
- package/dist/components/ExperimentTimeline.vue.d.ts +44 -0
- package/dist/components/FileUploader.vue.d.ts +40 -0
- package/dist/components/FitPanel.vue.d.ts +46 -0
- package/dist/components/FormActions.vue.d.ts +33 -0
- package/dist/components/FormBuilder.vue.d.ts +287 -0
- package/dist/components/FormField.vue.d.ts +28 -0
- package/dist/components/FormFieldRenderer.vue.d.ts +31 -0
- package/dist/components/FormSection.vue.d.ts +43 -0
- package/dist/components/FormulaInput.vue.d.ts +25 -0
- package/dist/components/GroupAssigner.vue.d.ts +25 -0
- package/dist/components/GroupingModal.vue.d.ts +12 -0
- package/dist/components/IconButton.vue.d.ts +34 -0
- package/dist/components/LoadingSpinner.vue.d.ts +12 -0
- package/dist/components/MoleculeInput.vue.d.ts +27 -0
- package/dist/components/MultiSelect.vue.d.ts +19 -0
- package/dist/components/NumberInput.vue.d.ts +22 -0
- package/dist/components/PlateMapEditor.vue.d.ts +50 -0
- package/dist/components/ProgressBar.vue.d.ts +23 -0
- package/dist/components/ProtocolStepEditor.vue.d.ts +24 -0
- package/dist/components/RackEditor.vue.d.ts +40 -0
- package/dist/components/ReagentEditor.vue.d.ts +30 -0
- package/dist/components/ReagentList.vue.d.ts +32 -0
- package/dist/components/ResourceCard.vue.d.ts +50 -0
- package/dist/components/SampleHierarchyTree.vue.d.ts +26 -0
- package/dist/components/SampleLegend.vue.d.ts +32 -0
- package/dist/components/SampleSelector.vue.d.ts +29 -0
- package/dist/components/ScheduleCalendar.vue.d.ts +110 -0
- package/dist/components/ScientificNumber.vue.d.ts +14 -0
- package/dist/components/SegmentedControl.vue.d.ts +20 -0
- package/dist/components/SequenceInput.vue.d.ts +54 -0
- package/dist/components/SettingsButton.vue.d.ts +30 -0
- package/dist/components/SettingsModal.vue.d.ts +36 -0
- package/dist/components/Skeleton.vue.d.ts +11 -0
- package/dist/components/StatusIndicator.vue.d.ts +13 -0
- package/dist/components/StepWizard.vue.d.ts +65 -0
- package/dist/components/TagsInput.vue.d.ts +39 -0
- package/dist/components/ThemeToggle.vue.d.ts +7 -0
- package/dist/components/TimePicker.vue.d.ts +29 -0
- package/dist/components/TimeRangeInput.vue.d.ts +27 -0
- package/dist/components/ToastNotification.vue.d.ts +2 -0
- package/dist/components/Tooltip.vue.d.ts +35 -0
- package/dist/components/UnitInput.vue.d.ts +39 -0
- package/dist/components/WellEditPopup.vue.d.ts +25 -0
- package/dist/components/WellPlate.vue.d.ts +73 -0
- package/dist/components/index.d.ts +87 -0
- package/dist/components/index.js +3 -0
- package/dist/components-CKf-UpGi.js +15089 -0
- package/dist/components-CKf-UpGi.js.map +1 -0
- package/dist/composables/experiment-utils.d.ts +8 -0
- package/dist/composables/formBuilderRegistry.d.ts +13 -0
- package/dist/composables/index.d.ts +28 -0
- package/dist/composables/index.js +3 -0
- package/dist/composables/useApi.d.ts +20 -0
- package/dist/composables/useAppExperiment.d.ts +37 -0
- package/dist/composables/useAsync.d.ts +128 -0
- package/dist/composables/useAuth.d.ts +47 -0
- package/dist/composables/useAutoGroup.d.ts +106 -0
- package/dist/composables/useChemicalFormula.d.ts +21 -0
- package/dist/composables/useConcentrationUnits.d.ts +29 -0
- package/dist/composables/useDoseCalculator.d.ts +58 -0
- package/dist/composables/useExperimentData.d.ts +18 -0
- package/dist/composables/useExperimentSave.d.ts +36 -0
- package/dist/composables/useExperimentSelector.d.ts +30 -0
- package/dist/composables/useForm.d.ts +92 -0
- package/dist/composables/useFormBuilder.d.ts +24 -0
- package/dist/composables/usePasskey.d.ts +10 -0
- package/dist/composables/usePlatformContext.d.ts +131 -0
- package/dist/composables/usePluginApi.d.ts +29 -0
- package/dist/composables/usePluginConfig.d.ts +13 -0
- package/dist/composables/useProtocolTemplates.d.ts +44 -0
- package/dist/composables/useRackEditor.d.ts +31 -0
- package/dist/composables/useReagentSeries.d.ts +23 -0
- package/dist/composables/useScheduleDrag.d.ts +78 -0
- package/dist/composables/useSequenceUtils.d.ts +14 -0
- package/dist/composables/useTheme.d.ts +8 -0
- package/dist/composables/useTimeUtils.d.ts +29 -0
- package/dist/composables/useToast.d.ts +22 -0
- package/dist/composables/useWellPlateEditor.d.ts +33 -0
- package/dist/composables-D0QfFzq1.js +805 -0
- package/dist/composables-D0QfFzq1.js.map +1 -0
- package/dist/histoire.setup.d.ts +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +7 -0
- package/dist/install.d.ts +16 -0
- package/dist/install.js +23 -0
- package/dist/install.js.map +1 -0
- package/dist/stores/auth.d.ts +146 -0
- package/dist/stores/index.d.ts +2 -0
- package/dist/stores/index.js +2 -0
- package/dist/stores/settings.d.ts +75 -0
- package/dist/styles.css +29728 -0
- package/dist/tailwind.preset.d.ts +58 -0
- package/dist/tailwind.preset.js +66 -0
- package/dist/tailwind.preset.js.map +1 -0
- package/dist/types/auth.d.ts +42 -0
- package/dist/types/auto-group.d.ts +34 -0
- package/dist/types/components.d.ts +528 -0
- package/dist/types/form-builder.d.ts +167 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.js +0 -0
- package/dist/types/platform.d.ts +75 -0
- package/dist/useScheduleDrag-DAJueTbK.js +7181 -0
- package/dist/useScheduleDrag-DAJueTbK.js.map +1 -0
- package/dist/utils/color.d.ts +24 -0
- package/package.json +114 -0
- package/src/__stories__/experiment-helpers.ts +83 -0
- package/src/__tests__/components/AppLayout.test.ts +163 -0
- package/src/__tests__/components/AppSidebar.test.ts +292 -0
- package/src/__tests__/components/AppTopBar.test.ts +683 -0
- package/src/__tests__/components/BaseInput.test.ts +99 -0
- package/src/__tests__/components/BasePill.test.ts +291 -0
- package/src/__tests__/components/Calendar.test.ts +566 -0
- package/src/__tests__/components/CollapsibleCard.test.ts +524 -0
- package/src/__tests__/components/DataFrame.test.ts +767 -0
- package/src/__tests__/components/DropdownButton.test.ts +471 -0
- package/src/__tests__/composables/formBuilderRegistry.test.ts +187 -0
- package/src/__tests__/composables/useAppExperiment.test.ts +560 -0
- package/src/__tests__/composables/useAuth.test.ts +188 -0
- package/src/__tests__/composables/useAutoGroup.test.ts +860 -0
- package/src/__tests__/composables/useExperimentData.test.ts +127 -0
- package/src/__tests__/composables/useExperimentSave.test.ts +347 -0
- package/src/__tests__/composables/useForm.test.ts +205 -0
- package/src/__tests__/composables/useFormBuilder.test.ts +917 -0
- package/src/__tests__/composables/usePlatformContext.test.ts +116 -0
- package/src/__tests__/composables/usePluginApi.test.ts +81 -0
- package/src/__tests__/composables/usePluginConfig.test.ts +176 -0
- package/src/__tests__/utils/color.test.ts +96 -0
- package/src/components/AlertBox.story.vue +204 -0
- package/src/components/AlertBox.vue +88 -0
- package/src/components/AppAvatarMenu.story.vue +155 -0
- package/src/components/AppAvatarMenu.vue +184 -0
- package/src/components/AppContainer.story.vue +104 -0
- package/src/components/AppContainer.vue +34 -0
- package/src/components/AppLayout.story.vue +292 -0
- package/src/components/AppLayout.vue +75 -0
- package/src/components/AppPageSelector.vue +159 -0
- package/src/components/AppPillNav.vue +66 -0
- package/src/components/AppPluginSwitcher.vue +241 -0
- package/src/components/AppSidebar.story.vue +309 -0
- package/src/components/AppSidebar.vue +119 -0
- package/src/components/AppTopBar.story.vue +304 -0
- package/src/components/AppTopBar.vue +661 -0
- package/src/components/AuditTrail.story.vue +163 -0
- package/src/components/AuditTrail.vue +151 -0
- package/src/components/AutoGroupModal.story.vue +273 -0
- package/src/components/AutoGroupModal.vue +566 -0
- package/src/components/Avatar.story.vue +115 -0
- package/src/components/Avatar.vue +79 -0
- package/src/components/BaseButton.story.vue +96 -0
- package/src/components/BaseButton.vue +73 -0
- package/src/components/BaseCheckbox.story.vue +73 -0
- package/src/components/BaseCheckbox.vue +69 -0
- package/src/components/BaseInput.story.vue +98 -0
- package/src/components/BaseInput.vue +74 -0
- package/src/components/BaseModal.story.vue +237 -0
- package/src/components/BaseModal.vue +182 -0
- package/src/components/BasePill.story.vue +142 -0
- package/src/components/BasePill.vue +89 -0
- package/src/components/BaseRadioGroup.story.vue +145 -0
- package/src/components/BaseRadioGroup.vue +124 -0
- package/src/components/BaseSelect.story.vue +120 -0
- package/src/components/BaseSelect.vue +71 -0
- package/src/components/BaseSlider.story.vue +122 -0
- package/src/components/BaseSlider.vue +126 -0
- package/src/components/BaseTabs.story.vue +127 -0
- package/src/components/BaseTabs.vue +59 -0
- package/src/components/BaseTextarea.story.vue +91 -0
- package/src/components/BaseTextarea.vue +62 -0
- package/src/components/BaseToggle.story.vue +81 -0
- package/src/components/BaseToggle.vue +76 -0
- package/src/components/BatchProgressList.story.vue +92 -0
- package/src/components/BatchProgressList.vue +184 -0
- package/src/components/Breadcrumb.story.vue +106 -0
- package/src/components/Breadcrumb.vue +75 -0
- package/src/components/Calendar.story.vue +106 -0
- package/src/components/Calendar.vue +363 -0
- package/src/components/ChartContainer.story.vue +113 -0
- package/src/components/ChartContainer.vue +64 -0
- package/src/components/ChemicalFormula.story.vue +102 -0
- package/src/components/ChemicalFormula.vue +39 -0
- package/src/components/CollapsibleCard.story.vue +135 -0
- package/src/components/CollapsibleCard.vue +167 -0
- package/src/components/ColorSlider.story.vue +120 -0
- package/src/components/ColorSlider.vue +164 -0
- package/src/components/ConcentrationInput.story.vue +77 -0
- package/src/components/ConcentrationInput.vue +185 -0
- package/src/components/ConfirmDialog.story.vue +248 -0
- package/src/components/ConfirmDialog.vue +93 -0
- package/src/components/DataFrame.story.vue +148 -0
- package/src/components/DataFrame.vue +419 -0
- package/src/components/DatePicker.story.vue +119 -0
- package/src/components/DatePicker.vue +330 -0
- package/src/components/DateTimePicker.story.vue +112 -0
- package/src/components/DateTimePicker.vue +392 -0
- package/src/components/Divider.story.vue +80 -0
- package/src/components/Divider.vue +49 -0
- package/src/components/DoseCalculator.story.vue +68 -0
- package/src/components/DoseCalculator.vue +476 -0
- package/src/components/DropdownButton.story.vue +102 -0
- package/src/components/DropdownButton.vue +181 -0
- package/src/components/EmptyState.story.vue +135 -0
- package/src/components/EmptyState.vue +69 -0
- package/src/components/ExperimentCodeBadge.story.vue +77 -0
- package/src/components/ExperimentCodeBadge.vue +64 -0
- package/src/components/ExperimentDataViewer.story.vue +174 -0
- package/src/components/ExperimentDataViewer.vue +288 -0
- package/src/components/ExperimentPopover.story.vue +384 -0
- package/src/components/ExperimentPopover.vue +241 -0
- package/src/components/ExperimentSelectorModal.story.vue +391 -0
- package/src/components/ExperimentSelectorModal.vue +387 -0
- package/src/components/ExperimentTimeline.story.vue +161 -0
- package/src/components/ExperimentTimeline.vue +382 -0
- package/src/components/FileUploader.story.vue +107 -0
- package/src/components/FileUploader.vue +386 -0
- package/src/components/FitPanel.story.vue +125 -0
- package/src/components/FitPanel.vue +120 -0
- package/src/components/FormActions.vue +92 -0
- package/src/components/FormBuilder.vue +214 -0
- package/src/components/FormField.story.vue +132 -0
- package/src/components/FormField.vue +59 -0
- package/src/components/FormFieldRenderer.vue +58 -0
- package/src/components/FormSection.vue +90 -0
- package/src/components/FormulaInput.story.vue +96 -0
- package/src/components/FormulaInput.vue +125 -0
- package/src/components/GroupAssigner.story.vue +83 -0
- package/src/components/GroupAssigner.vue +284 -0
- package/src/components/GroupingModal.story.vue +52 -0
- package/src/components/GroupingModal.vue +422 -0
- package/src/components/IconButton.story.vue +135 -0
- package/src/components/IconButton.vue +73 -0
- package/src/components/LoadingSpinner.story.vue +70 -0
- package/src/components/LoadingSpinner.vue +50 -0
- package/src/components/MoleculeInput.story.vue +66 -0
- package/src/components/MoleculeInput.vue +426 -0
- package/src/components/MultiSelect.story.vue +132 -0
- package/src/components/MultiSelect.vue +118 -0
- package/src/components/NumberInput.story.vue +122 -0
- package/src/components/NumberInput.vue +160 -0
- package/src/components/PlateMapEditor.story.vue +92 -0
- package/src/components/PlateMapEditor.vue +513 -0
- package/src/components/ProgressBar.story.vue +148 -0
- package/src/components/ProgressBar.vue +114 -0
- package/src/components/ProtocolStepEditor.story.vue +69 -0
- package/src/components/ProtocolStepEditor.vue +522 -0
- package/src/components/RackEditor.story.vue +100 -0
- package/src/components/RackEditor.vue +371 -0
- package/src/components/ReagentEditor.story.vue +153 -0
- package/src/components/ReagentEditor.vue +418 -0
- package/src/components/ReagentList.story.vue +137 -0
- package/src/components/ReagentList.vue +463 -0
- package/src/components/ResourceCard.story.vue +150 -0
- package/src/components/ResourceCard.vue +161 -0
- package/src/components/SampleHierarchyTree.story.vue +161 -0
- package/src/components/SampleHierarchyTree.vue +256 -0
- package/src/components/SampleLegend.story.vue +91 -0
- package/src/components/SampleLegend.vue +119 -0
- package/src/components/SampleSelector.story.vue +111 -0
- package/src/components/SampleSelector.vue +1033 -0
- package/src/components/ScheduleCalendar.story.vue +195 -0
- package/src/components/ScheduleCalendar.vue +569 -0
- package/src/components/ScientificNumber.story.vue +127 -0
- package/src/components/ScientificNumber.vue +197 -0
- package/src/components/SegmentedControl.story.vue +132 -0
- package/src/components/SegmentedControl.vue +79 -0
- package/src/components/SequenceInput.story.vue +119 -0
- package/src/components/SequenceInput.vue +209 -0
- package/src/components/SettingsButton.story.vue +58 -0
- package/src/components/SettingsButton.vue +76 -0
- package/src/components/SettingsModal.story.vue +145 -0
- package/src/components/SettingsModal.vue +146 -0
- package/src/components/Skeleton.story.vue +141 -0
- package/src/components/Skeleton.vue +74 -0
- package/src/components/StatusIndicator.story.vue +99 -0
- package/src/components/StatusIndicator.vue +40 -0
- package/src/components/StepWizard.story.vue +155 -0
- package/src/components/StepWizard.vue +223 -0
- package/src/components/TagsInput.story.vue +155 -0
- package/src/components/TagsInput.vue +265 -0
- package/src/components/ThemeToggle.story.vue +36 -0
- package/src/components/ThemeToggle.vue +54 -0
- package/src/components/TimePicker.story.vue +96 -0
- package/src/components/TimePicker.vue +273 -0
- package/src/components/TimeRangeInput.story.vue +104 -0
- package/src/components/TimeRangeInput.vue +122 -0
- package/src/components/ToastNotification.story.vue +157 -0
- package/src/components/ToastNotification.vue +62 -0
- package/src/components/Tooltip.story.vue +138 -0
- package/src/components/Tooltip.vue +119 -0
- package/src/components/UnitInput.story.vue +194 -0
- package/src/components/UnitInput.vue +213 -0
- package/src/components/WellEditPopup.vue +234 -0
- package/src/components/WellPlate.story.vue +282 -0
- package/src/components/WellPlate.vue +830 -0
- package/src/components/index.ts +118 -0
- package/src/composables/experiment-utils.ts +57 -0
- package/src/composables/formBuilderRegistry.ts +79 -0
- package/src/composables/index.ts +140 -0
- package/src/composables/useApi.ts +167 -0
- package/src/composables/useAppExperiment.ts +159 -0
- package/src/composables/useAsync.ts +323 -0
- package/src/composables/useAuth.ts +445 -0
- package/src/composables/useAutoGroup.ts +641 -0
- package/src/composables/useChemicalFormula.ts +275 -0
- package/src/composables/useConcentrationUnits.ts +246 -0
- package/src/composables/useDoseCalculator.ts +370 -0
- package/src/composables/useExperimentData.ts +86 -0
- package/src/composables/useExperimentSave.ts +192 -0
- package/src/composables/useExperimentSelector.ts +292 -0
- package/src/composables/useForm.ts +416 -0
- package/src/composables/useFormBuilder.ts +383 -0
- package/src/composables/usePasskey.ts +216 -0
- package/src/composables/usePlatformContext.ts +299 -0
- package/src/composables/usePluginApi.ts +39 -0
- package/src/composables/usePluginConfig.ts +93 -0
- package/src/composables/useProtocolTemplates.ts +518 -0
- package/src/composables/useRackEditor.ts +222 -0
- package/src/composables/useReagentSeries.ts +91 -0
- package/src/composables/useScheduleDrag.ts +245 -0
- package/src/composables/useSequenceUtils.ts +105 -0
- package/src/composables/useTheme.ts +58 -0
- package/src/composables/useTimeUtils.ts +131 -0
- package/src/composables/useToast.ts +40 -0
- package/src/composables/useWellPlateEditor.ts +421 -0
- package/src/histoire.setup.ts +17 -0
- package/src/index.ts +367 -0
- package/src/install.ts +32 -0
- package/src/stores/auth.ts +152 -0
- package/src/stores/index.ts +2 -0
- package/src/stores/settings.ts +218 -0
- package/src/styles/components/alert-box.css +150 -0
- package/src/styles/components/app-avatar-menu.css +155 -0
- package/src/styles/components/app-container.css +33 -0
- package/src/styles/components/app-layout.css +98 -0
- package/src/styles/components/app-page-selector.css +191 -0
- package/src/styles/components/app-pill-nav.css +57 -0
- package/src/styles/components/app-plugin-switcher.css +209 -0
- package/src/styles/components/app-sidebar.css +145 -0
- package/src/styles/components/app-top-bar.css +492 -0
- package/src/styles/components/audit-trail.css +143 -0
- package/src/styles/components/auto-group-modal.css +644 -0
- package/src/styles/components/avatar.css +73 -0
- package/src/styles/components/batch-progress-list.css +196 -0
- package/src/styles/components/breadcrumb.css +64 -0
- package/src/styles/components/button.css +188 -0
- package/src/styles/components/calendar.css +192 -0
- package/src/styles/components/chart-container.css +69 -0
- package/src/styles/components/checkbox.css +123 -0
- package/src/styles/components/chemical-formula.css +46 -0
- package/src/styles/components/collapsible-card.css +253 -0
- package/src/styles/components/color-slider.css +110 -0
- package/src/styles/components/concentration-input.css +156 -0
- package/src/styles/components/confirm-dialog.css +183 -0
- package/src/styles/components/dataframe.css +382 -0
- package/src/styles/components/date-picker.css +243 -0
- package/src/styles/components/datetime-picker.css +229 -0
- package/src/styles/components/divider.css +63 -0
- package/src/styles/components/dose-calculator.css +301 -0
- package/src/styles/components/dropdown-button.css +280 -0
- package/src/styles/components/empty-state.css +151 -0
- package/src/styles/components/experiment-code-badge.css +33 -0
- package/src/styles/components/experiment-data-viewer.css +138 -0
- package/src/styles/components/experiment-popover.css +562 -0
- package/src/styles/components/experiment-selector-modal.css +285 -0
- package/src/styles/components/experiment-timeline.css +529 -0
- package/src/styles/components/file-uploader.css +310 -0
- package/src/styles/components/fit-panel.css +67 -0
- package/src/styles/components/form-builder.css +69 -0
- package/src/styles/components/form-field.css +48 -0
- package/src/styles/components/formula-input.css +103 -0
- package/src/styles/components/group-assigner.css +200 -0
- package/src/styles/components/grouping-modal.css +323 -0
- package/src/styles/components/icon-button.css +192 -0
- package/src/styles/components/input.css +66 -0
- package/src/styles/components/loading-spinner.css +67 -0
- package/src/styles/components/modal.css +350 -0
- package/src/styles/components/molecule-input.css +186 -0
- package/src/styles/components/multi-select.css +131 -0
- package/src/styles/components/number-input.css +199 -0
- package/src/styles/components/pill.css +188 -0
- package/src/styles/components/plate-map-editor.css +464 -0
- package/src/styles/components/progress-bar.css +133 -0
- package/src/styles/components/protocol-step-editor.css +449 -0
- package/src/styles/components/rack-editor.css +265 -0
- package/src/styles/components/radio-group.css +240 -0
- package/src/styles/components/reagent-editor.css +510 -0
- package/src/styles/components/reagent-list.css +407 -0
- package/src/styles/components/resource-card.css +360 -0
- package/src/styles/components/sample-hierarchy-tree.css +314 -0
- package/src/styles/components/sample-legend.css +201 -0
- package/src/styles/components/sample-selector.css +751 -0
- package/src/styles/components/schedule-calendar.css +478 -0
- package/src/styles/components/scientific-number.css +63 -0
- package/src/styles/components/segmented-control.css +197 -0
- package/src/styles/components/select.css +77 -0
- package/src/styles/components/sequence-input.css +184 -0
- package/src/styles/components/settings-button.css +94 -0
- package/src/styles/components/settings-modal.css +95 -0
- package/src/styles/components/skeleton.css +49 -0
- package/src/styles/components/slider.css +74 -0
- package/src/styles/components/status-indicator.css +66 -0
- package/src/styles/components/step-wizard.css +192 -0
- package/src/styles/components/tabs.css +95 -0
- package/src/styles/components/tags-input.css +195 -0
- package/src/styles/components/textarea.css +82 -0
- package/src/styles/components/theme-toggle.css +69 -0
- package/src/styles/components/time-picker.css +171 -0
- package/src/styles/components/time-range-input.css +42 -0
- package/src/styles/components/toast.css +91 -0
- package/src/styles/components/toggle.css +146 -0
- package/src/styles/components/tooltip.css +91 -0
- package/src/styles/components/unit-input.css +123 -0
- package/src/styles/components/well-edit-popup.css +252 -0
- package/src/styles/components/well-plate.css +307 -0
- package/src/styles/index.css +87 -0
- package/src/styles/variables.css +1117 -0
- package/src/tailwind.preset.ts +61 -0
- package/src/types/auth.ts +55 -0
- package/src/types/auto-group.ts +40 -0
- package/src/types/components.ts +710 -0
- package/src/types/form-builder.ts +197 -0
- package/src/types/index.ts +207 -0
- package/src/types/platform.ts +116 -0
- package/src/utils/color.ts +96 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/** Multi-step wizard with a progress stepper, per-step validity tracking, and Back/Next navigation. */
|
|
3
|
+
import { ref, computed } from 'vue'
|
|
4
|
+
import type { WizardStep, WizardStepState } from '../types'
|
|
5
|
+
|
|
6
|
+
export interface Props {
|
|
7
|
+
steps: WizardStep[]
|
|
8
|
+
modelValue?: number
|
|
9
|
+
linear?: boolean
|
|
10
|
+
showProgress?: boolean
|
|
11
|
+
showStepNumbers?: boolean
|
|
12
|
+
size?: 'sm' | 'md' | 'lg'
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
16
|
+
modelValue: 0,
|
|
17
|
+
linear: true,
|
|
18
|
+
showProgress: true,
|
|
19
|
+
showStepNumbers: true,
|
|
20
|
+
size: 'md',
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
const emit = defineEmits<{
|
|
24
|
+
'update:modelValue': [index: number]
|
|
25
|
+
'complete': []
|
|
26
|
+
'cancel': []
|
|
27
|
+
'step-change': [change: [from: number, to: number]]
|
|
28
|
+
}>()
|
|
29
|
+
|
|
30
|
+
const stepValidity = ref<boolean[]>([])
|
|
31
|
+
|
|
32
|
+
// Initialize validity for all steps to true
|
|
33
|
+
if (stepValidity.value.length === 0) {
|
|
34
|
+
stepValidity.value = props.steps.map(() => true)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const stepStates = computed<WizardStepState[]>(() => {
|
|
38
|
+
return props.steps.map((_, index) => {
|
|
39
|
+
if (index === props.modelValue) return 'active'
|
|
40
|
+
if (index < props.modelValue && stepValidity.value[index] !== false) return 'completed'
|
|
41
|
+
if (index > props.modelValue && props.linear) {
|
|
42
|
+
for (let i = props.modelValue; i < index; i++) {
|
|
43
|
+
if (stepValidity.value[i] === false) return 'disabled'
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return 'pending'
|
|
47
|
+
})
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
function setStepValid(index: number, valid: boolean) {
|
|
51
|
+
if (index >= 0 && index < props.steps.length) {
|
|
52
|
+
stepValidity.value[index] = valid
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function goToStep(index: number) {
|
|
57
|
+
if (index < 0 || index >= props.steps.length) return
|
|
58
|
+
if (stepStates.value[index] === 'disabled') return
|
|
59
|
+
|
|
60
|
+
if (props.linear && index > props.modelValue) {
|
|
61
|
+
for (let i = props.modelValue; i < index; i++) {
|
|
62
|
+
if (stepValidity.value[i] === false) return
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const from = props.modelValue
|
|
67
|
+
emit('step-change', [from, index])
|
|
68
|
+
emit('update:modelValue', index)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function goNext() {
|
|
72
|
+
if (stepValidity.value[props.modelValue] === false) return
|
|
73
|
+
if (props.modelValue < props.steps.length - 1) {
|
|
74
|
+
goToStep(props.modelValue + 1)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function goBack() {
|
|
79
|
+
if (props.modelValue > 0) {
|
|
80
|
+
goToStep(props.modelValue - 1)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function finish() {
|
|
85
|
+
if (stepValidity.value[props.modelValue] === false) return
|
|
86
|
+
if (props.modelValue === props.steps.length - 1) {
|
|
87
|
+
emit('complete')
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function cancel() {
|
|
92
|
+
emit('cancel')
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function handleKeydown(event: KeyboardEvent) {
|
|
96
|
+
switch (event.key) {
|
|
97
|
+
case 'ArrowLeft':
|
|
98
|
+
event.preventDefault()
|
|
99
|
+
goBack()
|
|
100
|
+
break
|
|
101
|
+
case 'ArrowRight':
|
|
102
|
+
event.preventDefault()
|
|
103
|
+
goNext()
|
|
104
|
+
break
|
|
105
|
+
case 'Escape':
|
|
106
|
+
cancel()
|
|
107
|
+
break
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
defineExpose({ setStepValid })
|
|
112
|
+
</script>
|
|
113
|
+
|
|
114
|
+
<template>
|
|
115
|
+
<div
|
|
116
|
+
:class="['mld-wizard', `mld-wizard--${props.size}`]"
|
|
117
|
+
tabindex="0"
|
|
118
|
+
@keydown="handleKeydown"
|
|
119
|
+
>
|
|
120
|
+
<!-- Progress indicator -->
|
|
121
|
+
<div v-if="props.showProgress" class="mld-wizard__progress">
|
|
122
|
+
<slot name="progress" :steps="props.steps" :current="props.modelValue" :states="stepStates">
|
|
123
|
+
<div class="mld-wizard__steps-indicator">
|
|
124
|
+
<template v-for="(step, index) in props.steps" :key="step.id">
|
|
125
|
+
<!-- Connector line (before each step except first) -->
|
|
126
|
+
<div
|
|
127
|
+
v-if="index > 0"
|
|
128
|
+
:class="[
|
|
129
|
+
'mld-wizard__step-connector',
|
|
130
|
+
stepStates[index - 1] === 'completed' ? 'mld-wizard__step-connector--completed' : '',
|
|
131
|
+
]"
|
|
132
|
+
/>
|
|
133
|
+
<!-- Step indicator -->
|
|
134
|
+
<div
|
|
135
|
+
:class="[
|
|
136
|
+
'mld-wizard__step-indicator',
|
|
137
|
+
`mld-wizard__step-indicator--${stepStates[index]}`,
|
|
138
|
+
]"
|
|
139
|
+
@click="goToStep(index)"
|
|
140
|
+
>
|
|
141
|
+
<div class="mld-wizard__step-dot">
|
|
142
|
+
<template v-if="stepStates[index] === 'completed'">
|
|
143
|
+
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
|
|
144
|
+
<path d="M20 6 9 17l-5-5" />
|
|
145
|
+
</svg>
|
|
146
|
+
</template>
|
|
147
|
+
<template v-else-if="props.showStepNumbers">
|
|
148
|
+
{{ index + 1 }}
|
|
149
|
+
</template>
|
|
150
|
+
</div>
|
|
151
|
+
<div class="mld-wizard__step-label">{{ step.label }}</div>
|
|
152
|
+
</div>
|
|
153
|
+
</template>
|
|
154
|
+
</div>
|
|
155
|
+
</slot>
|
|
156
|
+
</div>
|
|
157
|
+
|
|
158
|
+
<!-- Step content -->
|
|
159
|
+
<div class="mld-wizard__body">
|
|
160
|
+
<div
|
|
161
|
+
v-for="(step, index) in props.steps"
|
|
162
|
+
:key="step.id"
|
|
163
|
+
v-show="index === props.modelValue"
|
|
164
|
+
class="mld-wizard__step-content"
|
|
165
|
+
>
|
|
166
|
+
<slot :name="`step-${step.id}`" :step="step" :index="index" />
|
|
167
|
+
</div>
|
|
168
|
+
</div>
|
|
169
|
+
|
|
170
|
+
<!-- Navigation -->
|
|
171
|
+
<div class="mld-wizard__navigation">
|
|
172
|
+
<slot
|
|
173
|
+
name="navigation"
|
|
174
|
+
:go-back="goBack"
|
|
175
|
+
:go-next="goNext"
|
|
176
|
+
:finish="finish"
|
|
177
|
+
:cancel="cancel"
|
|
178
|
+
:is-first="props.modelValue === 0"
|
|
179
|
+
:is-last="props.modelValue === props.steps.length - 1"
|
|
180
|
+
:can-proceed="stepValidity[props.modelValue] !== false"
|
|
181
|
+
>
|
|
182
|
+
<button
|
|
183
|
+
type="button"
|
|
184
|
+
class="mld-wizard__nav-btn mld-wizard__nav-btn--cancel"
|
|
185
|
+
@click="cancel"
|
|
186
|
+
>
|
|
187
|
+
Cancel
|
|
188
|
+
</button>
|
|
189
|
+
<div style="flex: 1" />
|
|
190
|
+
<button
|
|
191
|
+
type="button"
|
|
192
|
+
class="mld-wizard__nav-btn mld-wizard__nav-btn--back"
|
|
193
|
+
:disabled="props.modelValue === 0"
|
|
194
|
+
@click="goBack"
|
|
195
|
+
>
|
|
196
|
+
Back
|
|
197
|
+
</button>
|
|
198
|
+
<button
|
|
199
|
+
v-if="props.modelValue < props.steps.length - 1"
|
|
200
|
+
type="button"
|
|
201
|
+
class="mld-wizard__nav-btn mld-wizard__nav-btn--next"
|
|
202
|
+
:disabled="stepValidity[props.modelValue] === false"
|
|
203
|
+
@click="goNext"
|
|
204
|
+
>
|
|
205
|
+
Next
|
|
206
|
+
</button>
|
|
207
|
+
<button
|
|
208
|
+
v-else
|
|
209
|
+
type="button"
|
|
210
|
+
class="mld-wizard__nav-btn mld-wizard__nav-btn--finish"
|
|
211
|
+
:disabled="stepValidity[props.modelValue] === false"
|
|
212
|
+
@click="finish"
|
|
213
|
+
>
|
|
214
|
+
Finish
|
|
215
|
+
</button>
|
|
216
|
+
</slot>
|
|
217
|
+
</div>
|
|
218
|
+
</div>
|
|
219
|
+
</template>
|
|
220
|
+
|
|
221
|
+
<style>
|
|
222
|
+
@import '../styles/components/step-wizard.css';
|
|
223
|
+
</style>
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import TagsInput from './TagsInput.vue'
|
|
4
|
+
|
|
5
|
+
const sizes = ['sm', 'md', 'lg'] as const
|
|
6
|
+
const sampleTags = ref(['HeLa', 'MCF-7', 'A549'])
|
|
7
|
+
const emptyTags = ref<string[]>([])
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<Story title="Base Inputs/TagsInput">
|
|
12
|
+
<Variant title="Playground">
|
|
13
|
+
<template #default="{ state }">
|
|
14
|
+
<div style="padding: 2rem; max-width: 500px; margin: 0 auto;">
|
|
15
|
+
<TagsInput
|
|
16
|
+
v-model="state.tags"
|
|
17
|
+
:placeholder="state.placeholder"
|
|
18
|
+
:disabled="state.disabled"
|
|
19
|
+
:error="state.error"
|
|
20
|
+
:size="state.size"
|
|
21
|
+
:max-tags="state.useMaxTags ? state.maxTags : undefined"
|
|
22
|
+
:allow-duplicates="state.allowDuplicates"
|
|
23
|
+
/>
|
|
24
|
+
<p style="margin-top: 1rem; font-size: 0.875rem; color: var(--text-muted, #94a3b8);">
|
|
25
|
+
Tags: <code>{{ JSON.stringify(state.tags) }}</code>
|
|
26
|
+
</p>
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<template #controls="{ state }">
|
|
31
|
+
<HstText v-model="state.placeholder" title="Placeholder" />
|
|
32
|
+
<HstSelect
|
|
33
|
+
v-model="state.size"
|
|
34
|
+
title="Size"
|
|
35
|
+
:options="sizes.map(s => ({ label: s, value: s }))"
|
|
36
|
+
/>
|
|
37
|
+
<HstCheckbox v-model="state.disabled" title="Disabled" />
|
|
38
|
+
<HstCheckbox v-model="state.error" title="Error" />
|
|
39
|
+
<HstCheckbox v-model="state.allowDuplicates" title="Allow Duplicates" />
|
|
40
|
+
<HstCheckbox v-model="state.useMaxTags" title="Limit Max Tags" />
|
|
41
|
+
<HstSlider v-model="state.maxTags" title="Max Tags" :min="1" :max="20" />
|
|
42
|
+
</template>
|
|
43
|
+
</Variant>
|
|
44
|
+
|
|
45
|
+
<Variant title="Sizes">
|
|
46
|
+
<div style="padding: 2rem; max-width: 500px; margin: 0 auto; display: flex; flex-direction: column; gap: 1rem;">
|
|
47
|
+
<div v-for="size in sizes" :key="size">
|
|
48
|
+
<p style="margin: 0 0 0.5rem; font-size: 0.75rem; color: var(--text-muted, #94a3b8); text-transform: uppercase; letter-spacing: 0.05em;">
|
|
49
|
+
{{ size }}
|
|
50
|
+
</p>
|
|
51
|
+
<TagsInput v-model="sampleTags" :size="size" />
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</Variant>
|
|
55
|
+
|
|
56
|
+
<Variant title="With Placeholder">
|
|
57
|
+
<div style="padding: 2rem; max-width: 500px; margin: 0 auto;">
|
|
58
|
+
<TagsInput
|
|
59
|
+
v-model="emptyTags"
|
|
60
|
+
placeholder="Type a cell line and press Enter..."
|
|
61
|
+
/>
|
|
62
|
+
</div>
|
|
63
|
+
</Variant>
|
|
64
|
+
|
|
65
|
+
<Variant title="Pre-filled Tags">
|
|
66
|
+
<div style="padding: 2rem; max-width: 500px; margin: 0 auto;">
|
|
67
|
+
<TagsInput
|
|
68
|
+
:model-value="['DMSO', 'Staurosporine', 'Doxorubicin', 'Paclitaxel', 'Cisplatin']"
|
|
69
|
+
placeholder="Add compound..."
|
|
70
|
+
/>
|
|
71
|
+
</div>
|
|
72
|
+
</Variant>
|
|
73
|
+
|
|
74
|
+
<Variant title="Max Tags Limit">
|
|
75
|
+
<div style="padding: 2rem; max-width: 500px; margin: 0 auto;">
|
|
76
|
+
<p style="margin: 0 0 0.5rem; font-size: 0.875rem; color: var(--text-primary, #e2e8f0);">Maximum 3 tags allowed</p>
|
|
77
|
+
<TagsInput
|
|
78
|
+
:model-value="['Tag 1', 'Tag 2']"
|
|
79
|
+
:max-tags="3"
|
|
80
|
+
placeholder="Add up to 3 tags..."
|
|
81
|
+
/>
|
|
82
|
+
</div>
|
|
83
|
+
</Variant>
|
|
84
|
+
|
|
85
|
+
<Variant title="Error State">
|
|
86
|
+
<div style="padding: 2rem; max-width: 500px; margin: 0 auto;">
|
|
87
|
+
<TagsInput
|
|
88
|
+
:model-value="['invalid-tag']"
|
|
89
|
+
error
|
|
90
|
+
placeholder="Fix the tags..."
|
|
91
|
+
/>
|
|
92
|
+
</div>
|
|
93
|
+
</Variant>
|
|
94
|
+
|
|
95
|
+
<Variant title="Disabled">
|
|
96
|
+
<div style="padding: 2rem; max-width: 500px; margin: 0 auto;">
|
|
97
|
+
<TagsInput
|
|
98
|
+
:model-value="['Read', 'Only', 'Tags']"
|
|
99
|
+
disabled
|
|
100
|
+
/>
|
|
101
|
+
</div>
|
|
102
|
+
</Variant>
|
|
103
|
+
|
|
104
|
+
<Variant title="Autocomplete — with suggestions">
|
|
105
|
+
<template #default="{ state }">
|
|
106
|
+
<div style="padding: 2rem; max-width: 420px; display: flex; flex-direction: column; gap: 0.5rem;">
|
|
107
|
+
<TagsInput
|
|
108
|
+
v-model="state.tags"
|
|
109
|
+
placeholder="Type to search tags..."
|
|
110
|
+
:suggestions="[
|
|
111
|
+
{ value: 'dose-response', count: 142 },
|
|
112
|
+
{ value: 'dose-ranging', count: 58 },
|
|
113
|
+
{ value: 'drug-screen', count: 97 },
|
|
114
|
+
{ value: 'deletion', count: 21 },
|
|
115
|
+
{ value: 'dna-seq', count: 34 },
|
|
116
|
+
{ value: 'oncology', count: 203 },
|
|
117
|
+
{ value: 'on-target', count: 11 },
|
|
118
|
+
]"
|
|
119
|
+
/>
|
|
120
|
+
<p style="margin: 0; font-size: 0.75rem; color: var(--text-muted);">
|
|
121
|
+
Try typing "d" — matches rank with usage counts on the right.
|
|
122
|
+
</p>
|
|
123
|
+
</div>
|
|
124
|
+
</template>
|
|
125
|
+
<template #initState>
|
|
126
|
+
{{ { tags: [] } }}
|
|
127
|
+
</template>
|
|
128
|
+
</Variant>
|
|
129
|
+
|
|
130
|
+
<Variant title="Categorized — namespaced tags">
|
|
131
|
+
<template #default="{ state }">
|
|
132
|
+
<div style="padding: 2rem; max-width: 520px; display: flex; flex-direction: column; gap: 0.5rem;">
|
|
133
|
+
<TagsInput
|
|
134
|
+
v-model="state.tags"
|
|
135
|
+
v-model:active-category="state.activeCategory"
|
|
136
|
+
placeholder="Pick a category and type..."
|
|
137
|
+
:categories="[
|
|
138
|
+
{ name: 'role', prefix: 'role', color: 'primary' },
|
|
139
|
+
{ name: 'status', prefix: 'status', color: 'success' },
|
|
140
|
+
{ name: 'type', prefix: 'type', color: 'info' },
|
|
141
|
+
{ name: 'qc', prefix: 'qc', color: 'warning' },
|
|
142
|
+
{ name: 'ref', prefix: 'ref', color: 'neutral' },
|
|
143
|
+
]"
|
|
144
|
+
/>
|
|
145
|
+
<p style="margin: 0; font-size: 0.75rem; color: var(--text-muted);">
|
|
146
|
+
Click a category to activate its prefix. Typed tags auto-namespace (e.g. <code>status:passed</code>).
|
|
147
|
+
</p>
|
|
148
|
+
</div>
|
|
149
|
+
</template>
|
|
150
|
+
<template #initState>
|
|
151
|
+
{{ { tags: ['role:control', 'status:passed', 'type:metabolomics', 'qc:outlier'], activeCategory: 'type' } }}
|
|
152
|
+
</template>
|
|
153
|
+
</Variant>
|
|
154
|
+
</Story>
|
|
155
|
+
</template>
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/** Lets users type and add tags with autocomplete suggestions, categories, and a max-tag cap. */
|
|
3
|
+
import { ref, computed } from 'vue'
|
|
4
|
+
|
|
5
|
+
interface TagSuggestion {
|
|
6
|
+
value: string
|
|
7
|
+
count?: number
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface TagCategory {
|
|
11
|
+
name: string
|
|
12
|
+
prefix: string
|
|
13
|
+
color?: 'primary' | 'success' | 'warning' | 'error' | 'info' | 'neutral'
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface Props {
|
|
17
|
+
modelValue?: string[]
|
|
18
|
+
placeholder?: string
|
|
19
|
+
disabled?: boolean
|
|
20
|
+
error?: boolean
|
|
21
|
+
size?: 'sm' | 'md' | 'lg'
|
|
22
|
+
maxTags?: number
|
|
23
|
+
allowDuplicates?: boolean
|
|
24
|
+
suggestions?: string[] | TagSuggestion[]
|
|
25
|
+
categories?: TagCategory[]
|
|
26
|
+
activeCategory?: string
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
30
|
+
modelValue: () => [],
|
|
31
|
+
disabled: false,
|
|
32
|
+
error: false,
|
|
33
|
+
size: 'md',
|
|
34
|
+
allowDuplicates: false,
|
|
35
|
+
suggestions: () => [],
|
|
36
|
+
categories: () => [],
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
const emit = defineEmits<{
|
|
40
|
+
'update:modelValue': [value: string[]]
|
|
41
|
+
'update:activeCategory': [prefix: string]
|
|
42
|
+
}>()
|
|
43
|
+
|
|
44
|
+
const inputValue = ref('')
|
|
45
|
+
const inputRef = ref<HTMLInputElement>()
|
|
46
|
+
const dropdownOpen = ref(false)
|
|
47
|
+
const highlightedIndex = ref(-1)
|
|
48
|
+
|
|
49
|
+
const canAddMore = computed(() => {
|
|
50
|
+
if (props.maxTags === undefined) return true
|
|
51
|
+
return props.modelValue.length < props.maxTags
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
const normalizedSuggestions = computed<TagSuggestion[]>(() => {
|
|
55
|
+
return props.suggestions.map(s => typeof s === 'string' ? { value: s } : s)
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
const filteredSuggestions = computed<TagSuggestion[]>(() => {
|
|
59
|
+
const q = inputValue.value.trim().toLowerCase()
|
|
60
|
+
if (!q) return []
|
|
61
|
+
return normalizedSuggestions.value
|
|
62
|
+
.filter(s => s.value.toLowerCase().startsWith(q) && !props.modelValue.includes(s.value))
|
|
63
|
+
.slice(0, 8)
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
function categoryFor(tag: string): TagCategory | undefined {
|
|
67
|
+
const colonIdx = tag.indexOf(':')
|
|
68
|
+
if (colonIdx === -1) return undefined
|
|
69
|
+
const prefix = tag.slice(0, colonIdx)
|
|
70
|
+
return props.categories.find(c => c.prefix === prefix)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function addTag(value: string) {
|
|
74
|
+
const trimmed = value.trim()
|
|
75
|
+
if (!trimmed) return
|
|
76
|
+
if (!canAddMore.value) return
|
|
77
|
+
|
|
78
|
+
// If a category is active and user didn't already type a prefix, prepend it
|
|
79
|
+
let final = trimmed
|
|
80
|
+
if (props.activeCategory && !trimmed.includes(':')) {
|
|
81
|
+
final = `${props.activeCategory}:${trimmed}`
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (!props.allowDuplicates && props.modelValue.includes(final)) return
|
|
85
|
+
|
|
86
|
+
emit('update:modelValue', [...props.modelValue, final])
|
|
87
|
+
inputValue.value = ''
|
|
88
|
+
dropdownOpen.value = false
|
|
89
|
+
highlightedIndex.value = -1
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function removeTag(index: number) {
|
|
93
|
+
if (props.disabled) return
|
|
94
|
+
const newTags = [...props.modelValue]
|
|
95
|
+
newTags.splice(index, 1)
|
|
96
|
+
emit('update:modelValue', newTags)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function handleKeydown(event: KeyboardEvent) {
|
|
100
|
+
if (event.key === 'ArrowDown' && filteredSuggestions.value.length) {
|
|
101
|
+
event.preventDefault()
|
|
102
|
+
highlightedIndex.value = Math.min(highlightedIndex.value + 1, filteredSuggestions.value.length - 1)
|
|
103
|
+
dropdownOpen.value = true
|
|
104
|
+
return
|
|
105
|
+
}
|
|
106
|
+
if (event.key === 'ArrowUp' && filteredSuggestions.value.length) {
|
|
107
|
+
event.preventDefault()
|
|
108
|
+
highlightedIndex.value = Math.max(highlightedIndex.value - 1, 0)
|
|
109
|
+
return
|
|
110
|
+
}
|
|
111
|
+
if (event.key === 'Enter' || event.key === ',') {
|
|
112
|
+
event.preventDefault()
|
|
113
|
+
if (highlightedIndex.value >= 0 && filteredSuggestions.value[highlightedIndex.value]) {
|
|
114
|
+
addTag(filteredSuggestions.value[highlightedIndex.value].value)
|
|
115
|
+
} else {
|
|
116
|
+
addTag(inputValue.value)
|
|
117
|
+
}
|
|
118
|
+
return
|
|
119
|
+
}
|
|
120
|
+
if (event.key === 'Escape') {
|
|
121
|
+
dropdownOpen.value = false
|
|
122
|
+
highlightedIndex.value = -1
|
|
123
|
+
return
|
|
124
|
+
}
|
|
125
|
+
if (event.key === 'Backspace' && !inputValue.value && props.modelValue.length > 0) {
|
|
126
|
+
removeTag(props.modelValue.length - 1)
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function handleFocus() {
|
|
131
|
+
if (filteredSuggestions.value.length) dropdownOpen.value = true
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function handleBlur() {
|
|
135
|
+
// Delay so a click on a suggestion fires first
|
|
136
|
+
setTimeout(() => {
|
|
137
|
+
dropdownOpen.value = false
|
|
138
|
+
}, 120)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function handlePaste(event: ClipboardEvent) {
|
|
142
|
+
event.preventDefault()
|
|
143
|
+
const text = event.clipboardData?.getData('text')
|
|
144
|
+
if (!text) return
|
|
145
|
+
|
|
146
|
+
const tags = text.split(/[,\n]/).map(t => t.trim()).filter(Boolean)
|
|
147
|
+
const newTags = [...props.modelValue]
|
|
148
|
+
|
|
149
|
+
for (const tag of tags) {
|
|
150
|
+
if (!canAddMore.value) break
|
|
151
|
+
if (!props.allowDuplicates && newTags.includes(tag)) continue
|
|
152
|
+
newTags.push(tag)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
emit('update:modelValue', newTags)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function focusInput() {
|
|
159
|
+
inputRef.value?.focus()
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function setCategory(prefix: string) {
|
|
163
|
+
emit('update:activeCategory', prefix === props.activeCategory ? '' : prefix)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function onInputEvent() {
|
|
167
|
+
dropdownOpen.value = filteredSuggestions.value.length > 0
|
|
168
|
+
highlightedIndex.value = -1
|
|
169
|
+
}
|
|
170
|
+
</script>
|
|
171
|
+
|
|
172
|
+
<template>
|
|
173
|
+
<div
|
|
174
|
+
:class="[
|
|
175
|
+
'mld-tags-input',
|
|
176
|
+
`mld-tags-input--${size}`,
|
|
177
|
+
error ? 'mld-tags-input--error' : '',
|
|
178
|
+
disabled ? 'mld-tags-input--disabled' : '',
|
|
179
|
+
categories.length ? 'mld-tags-input--categorized' : '',
|
|
180
|
+
]"
|
|
181
|
+
>
|
|
182
|
+
<!-- Category switcher (only if categories defined) -->
|
|
183
|
+
<div v-if="categories.length" class="mld-tags-input__categories">
|
|
184
|
+
<button
|
|
185
|
+
v-for="cat in categories"
|
|
186
|
+
:key="cat.prefix"
|
|
187
|
+
type="button"
|
|
188
|
+
:class="[
|
|
189
|
+
'mld-tags-input__category',
|
|
190
|
+
`mld-tags-input__category--${cat.color ?? 'neutral'}`,
|
|
191
|
+
activeCategory === cat.prefix ? 'mld-tags-input__category--active' : '',
|
|
192
|
+
]"
|
|
193
|
+
:disabled="disabled"
|
|
194
|
+
@click="setCategory(cat.prefix)"
|
|
195
|
+
>
|
|
196
|
+
{{ cat.name }}
|
|
197
|
+
</button>
|
|
198
|
+
</div>
|
|
199
|
+
|
|
200
|
+
<div class="mld-tags-input__field" @click="focusInput">
|
|
201
|
+
<span
|
|
202
|
+
v-for="(tag, index) in modelValue"
|
|
203
|
+
:key="`${tag}-${index}`"
|
|
204
|
+
:class="[
|
|
205
|
+
'mld-tags-input__tag',
|
|
206
|
+
`mld-tags-input__tag--${size}`,
|
|
207
|
+
categoryFor(tag) ? `mld-tags-input__tag--${categoryFor(tag)?.color ?? 'neutral'}` : '',
|
|
208
|
+
]"
|
|
209
|
+
>
|
|
210
|
+
{{ tag }}
|
|
211
|
+
<button
|
|
212
|
+
v-if="!disabled"
|
|
213
|
+
type="button"
|
|
214
|
+
:aria-label="`Remove ${tag}`"
|
|
215
|
+
class="mld-tags-input__tag-remove"
|
|
216
|
+
@click.stop="removeTag(index)"
|
|
217
|
+
>
|
|
218
|
+
<svg class="mld-tags-input__tag-remove-icon" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24">
|
|
219
|
+
<path d="M18 6 6 18" /><path d="m6 6 12 12" />
|
|
220
|
+
</svg>
|
|
221
|
+
</button>
|
|
222
|
+
</span>
|
|
223
|
+
|
|
224
|
+
<input
|
|
225
|
+
ref="inputRef"
|
|
226
|
+
v-model="inputValue"
|
|
227
|
+
type="text"
|
|
228
|
+
:placeholder="modelValue.length === 0 ? placeholder : ''"
|
|
229
|
+
:disabled="disabled || !canAddMore"
|
|
230
|
+
:class="['mld-tags-input__input', `mld-tags-input__input--${size}`]"
|
|
231
|
+
@keydown="handleKeydown"
|
|
232
|
+
@paste="handlePaste"
|
|
233
|
+
@focus="handleFocus"
|
|
234
|
+
@blur="handleBlur"
|
|
235
|
+
@input="onInputEvent"
|
|
236
|
+
/>
|
|
237
|
+
|
|
238
|
+
<!-- Autocomplete dropdown -->
|
|
239
|
+
<div
|
|
240
|
+
v-if="dropdownOpen && filteredSuggestions.length"
|
|
241
|
+
class="mld-tags-input__dropdown"
|
|
242
|
+
>
|
|
243
|
+
<button
|
|
244
|
+
v-for="(sug, i) in filteredSuggestions"
|
|
245
|
+
:key="sug.value"
|
|
246
|
+
type="button"
|
|
247
|
+
:class="[
|
|
248
|
+
'mld-tags-input__dropdown-item',
|
|
249
|
+
i === highlightedIndex ? 'mld-tags-input__dropdown-item--highlighted' : '',
|
|
250
|
+
]"
|
|
251
|
+
@mousedown.prevent="addTag(sug.value)"
|
|
252
|
+
>
|
|
253
|
+
<span>{{ sug.value }}</span>
|
|
254
|
+
<span v-if="sug.count !== undefined" class="mld-tags-input__dropdown-count">
|
|
255
|
+
{{ sug.count }}
|
|
256
|
+
</span>
|
|
257
|
+
</button>
|
|
258
|
+
</div>
|
|
259
|
+
</div>
|
|
260
|
+
</div>
|
|
261
|
+
</template>
|
|
262
|
+
|
|
263
|
+
<style>
|
|
264
|
+
@import '../styles/components/tags-input.css';
|
|
265
|
+
</style>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import ThemeToggle from './ThemeToggle.vue'
|
|
3
|
+
|
|
4
|
+
const sizes: ('sm' | 'md' | 'lg')[] = ['sm', 'md', 'lg']
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<Story title="Action/ThemeToggle">
|
|
9
|
+
<Variant title="Playground">
|
|
10
|
+
<template #default="{ state }">
|
|
11
|
+
<div style="padding: 2rem; display: flex; align-items: center; justify-content: center;">
|
|
12
|
+
<ThemeToggle :size="state.size" />
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<template #controls="{ state }">
|
|
17
|
+
<HstSelect
|
|
18
|
+
v-model="state.size"
|
|
19
|
+
title="Size"
|
|
20
|
+
:options="sizes.map(s => ({ label: s, value: s }))"
|
|
21
|
+
/>
|
|
22
|
+
</template>
|
|
23
|
+
</Variant>
|
|
24
|
+
|
|
25
|
+
<Variant title="All Sizes">
|
|
26
|
+
<div style="padding: 2rem; display: flex; gap: 1.5rem; align-items: center; justify-content: center;">
|
|
27
|
+
<div v-for="size in sizes" :key="size" style="display: flex; flex-direction: column; align-items: center; gap: 0.5rem;">
|
|
28
|
+
<ThemeToggle :size="size" />
|
|
29
|
+
<span style="font-size: 0.75rem; color: var(--text-muted, #94a3b8); text-transform: uppercase; letter-spacing: 0.05em;">
|
|
30
|
+
{{ size }}
|
|
31
|
+
</span>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</Variant>
|
|
35
|
+
</Story>
|
|
36
|
+
</template>
|