@keboola/design 10.1.0 → 11.0.1
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/AGENTS.md +2 -0
- package/dist/AIKit-Dre37SJr.js +1320 -0
- package/dist/AIKit-Dre37SJr.js.map +1 -0
- package/dist/Alert-DfZq9kGe.js +133 -0
- package/dist/Alert-DfZq9kGe.js.map +1 -0
- package/dist/AlertModal-BUC4Es8o.js +222 -0
- package/dist/AlertModal-BUC4Es8o.js.map +1 -0
- package/dist/AppShell-B5GQN6Zs.js +143 -0
- package/dist/AppShell-B5GQN6Zs.js.map +1 -0
- package/dist/AutoSaveTextarea-BeuWuszr.js +58 -0
- package/dist/AutoSaveTextarea-BeuWuszr.js.map +1 -0
- package/dist/Badge-Ch26CXoP.js +195 -0
- package/dist/Badge-Ch26CXoP.js.map +1 -0
- package/dist/BrandEditor-B8o9zdZO.js +903 -0
- package/dist/BrandEditor-B8o9zdZO.js.map +1 -0
- package/dist/BrandLogo-CJkRd0F8.js +46 -0
- package/dist/BrandLogo-CJkRd0F8.js.map +1 -0
- package/dist/Breadcrumb-DJp7WwSv.js +330 -0
- package/dist/Breadcrumb-DJp7WwSv.js.map +1 -0
- package/dist/Button-nzmDNS2q.js +391 -0
- package/dist/Button-nzmDNS2q.js.map +1 -0
- package/dist/Calendar-cG5NIJ4O.js +6768 -0
- package/dist/Calendar-cG5NIJ4O.js.map +1 -0
- package/dist/Card-BAoZ35CV.js +105 -0
- package/dist/Card-BAoZ35CV.js.map +1 -0
- package/dist/Checkbox-GJ8-srt4.js +97 -0
- package/dist/Checkbox-GJ8-srt4.js.map +1 -0
- package/dist/Clipboard-CBJZiviP.js +58 -0
- package/dist/Clipboard-CBJZiviP.js.map +1 -0
- package/dist/ClipboardButton-ez5V3fkk.js +43 -0
- package/dist/ClipboardButton-ez5V3fkk.js.map +1 -0
- package/dist/CodeEditor-BfQJfbhL.js +952 -0
- package/dist/CodeEditor-BfQJfbhL.js.map +1 -0
- package/dist/Collapsible-BQXWEOBC.js +34 -0
- package/dist/Collapsible-BQXWEOBC.js.map +1 -0
- package/dist/ColorInput-Dx8Dsv7Y.js +180 -0
- package/dist/ColorInput-Dx8Dsv7Y.js.map +1 -0
- package/dist/ColorModeSwitch-CCqj7tjE.js +77 -0
- package/dist/ColorModeSwitch-CCqj7tjE.js.map +1 -0
- package/dist/Combobox-c_xBjf0P.js +439 -0
- package/dist/Combobox-c_xBjf0P.js.map +1 -0
- package/dist/Command-CQ_bQsJp.js +102 -0
- package/dist/Command-CQ_bQsJp.js.map +1 -0
- package/dist/CopyField-BJ96zvXs.js +322 -0
- package/dist/CopyField-BJ96zvXs.js.map +1 -0
- package/dist/DateInput-CMD3dY-T.js +141 -0
- package/dist/DateInput-CMD3dY-T.js.map +1 -0
- package/dist/DatePicker-BbFbmsGl.js +24 -0
- package/dist/DatePicker-BbFbmsGl.js.map +1 -0
- package/dist/DateRangeInput-D3BhiKyk.js +139 -0
- package/dist/DateRangeInput-D3BhiKyk.js.map +1 -0
- package/dist/DateRangePicker-BiUgtt_M.js +159 -0
- package/dist/DateRangePicker-BiUgtt_M.js.map +1 -0
- package/dist/DiagramSkeleton-lwBS2YBa.js +11 -0
- package/dist/DiagramSkeleton-lwBS2YBa.js.map +1 -0
- package/dist/DiffView-ppTIzh2h.js +429 -0
- package/dist/DiffView-ppTIzh2h.js.map +1 -0
- package/dist/DropdownMenu-B6ZbYvaM.js +327 -0
- package/dist/DropdownMenu-B6ZbYvaM.js.map +1 -0
- package/dist/FieldBox-D7DYtX_m.js +70 -0
- package/dist/FieldBox-D7DYtX_m.js.map +1 -0
- package/dist/FileUpload-sXRv7JiY.js +2527 -0
- package/dist/FileUpload-sXRv7JiY.js.map +1 -0
- package/dist/Form-BDCef6O9.js +371 -0
- package/dist/Form-BDCef6O9.js.map +1 -0
- package/dist/FormGroup-S9mPNHKH.js +124 -0
- package/dist/FormGroup-S9mPNHKH.js.map +1 -0
- package/dist/FullScreenModal-CJa2VkJ2.js +96 -0
- package/dist/FullScreenModal-CJa2VkJ2.js.map +1 -0
- package/dist/HoverCard-WfDkLK1s.js +31 -0
- package/dist/HoverCard-WfDkLK1s.js.map +1 -0
- package/dist/InputGroup-BJWsI35s.js +292 -0
- package/dist/InputGroup-BJWsI35s.js.map +1 -0
- package/dist/Kbd-CxHAo1oo.js +111 -0
- package/dist/Kbd-CxHAo1oo.js.map +1 -0
- package/dist/MarkedText-Ckbft5mw.js +44 -0
- package/dist/MarkedText-Ckbft5mw.js.map +1 -0
- package/dist/MermaidDiagram-BB06gymm.js +399 -0
- package/dist/MermaidDiagram-BB06gymm.js.map +1 -0
- package/dist/Modal-BA5Wc3sx.js +185 -0
- package/dist/Modal-BA5Wc3sx.js.map +1 -0
- package/dist/ModalTitle-C76ke2eo.js +28 -0
- package/dist/ModalTitle-C76ke2eo.js.map +1 -0
- package/dist/MultiActionButtonGroup-CiBHxsSk.js +33 -0
- package/dist/MultiActionButtonGroup-CiBHxsSk.js.map +1 -0
- package/dist/Navbar-t16usFZQ.js +322 -0
- package/dist/Navbar-t16usFZQ.js.map +1 -0
- package/dist/OtpInput-CbbymqYs.js +93 -0
- package/dist/OtpInput-CbbymqYs.js.map +1 -0
- package/dist/PageHeader-Q3IpCnQd.js +177 -0
- package/dist/PageHeader-Q3IpCnQd.js.map +1 -0
- package/dist/PageLayout-DSVM-ASz.js +176 -0
- package/dist/PageLayout-DSVM-ASz.js.map +1 -0
- package/dist/PageToolbar-0_1OBzaZ.js +153 -0
- package/dist/PageToolbar-0_1OBzaZ.js.map +1 -0
- package/dist/Pagination-CM_Rszz-.js +70 -0
- package/dist/Pagination-CM_Rszz-.js.map +1 -0
- package/dist/Popconfirm-BGe1jLov.js +170 -0
- package/dist/Popconfirm-BGe1jLov.js.map +1 -0
- package/dist/Popover-Ca0V6AD1.js +92 -0
- package/dist/Popover-Ca0V6AD1.js.map +1 -0
- package/dist/RadioGroup-sIveSsNa.js +233 -0
- package/dist/RadioGroup-sIveSsNa.js.map +1 -0
- package/dist/Resizable-D3vYToZH.js +52 -0
- package/dist/Resizable-D3vYToZH.js.map +1 -0
- package/dist/Search-3UiqNZRj.js +184 -0
- package/dist/Search-3UiqNZRj.js.map +1 -0
- package/dist/SearchInput-D2fcOv7E.js +102 -0
- package/dist/SearchInput-D2fcOv7E.js.map +1 -0
- package/dist/SectionNav--7bw2b6u.js +276 -0
- package/dist/SectionNav--7bw2b6u.js.map +1 -0
- package/dist/Select-4YX38G5h.js +181 -0
- package/dist/Select-4YX38G5h.js.map +1 -0
- package/dist/Sheet-BQrX8-h5.js +169 -0
- package/dist/Sheet-BQrX8-h5.js.map +1 -0
- package/dist/Sidebar-ROaR_AqC.js +799 -0
- package/dist/Sidebar-ROaR_AqC.js.map +1 -0
- package/dist/Slider-Da_3mS5v.js +127 -0
- package/dist/Slider-Da_3mS5v.js.map +1 -0
- package/dist/Stepper-C8sm9ZFM.js +325 -0
- package/dist/Stepper-C8sm9ZFM.js.map +1 -0
- package/dist/Switch-CX2A0v50.js +201 -0
- package/dist/Switch-CX2A0v50.js.map +1 -0
- package/dist/Table-CvYuTuNU.js +104 -0
- package/dist/Table-CvYuTuNU.js.map +1 -0
- package/dist/Tabs-EAihyqCt.js +74 -0
- package/dist/Tabs-EAihyqCt.js.map +1 -0
- package/dist/TextInput-BGed-V13.js +110 -0
- package/dist/TextInput-BGed-V13.js.map +1 -0
- package/dist/ThemeProvider-QncUrfJn.js +203 -0
- package/dist/ThemeProvider-QncUrfJn.js.map +1 -0
- package/dist/TimePicker-B_NegL-7.js +98 -0
- package/dist/TimePicker-B_NegL-7.js.map +1 -0
- package/dist/Timeline-6btyJl4D.js +154 -0
- package/dist/Timeline-6btyJl4D.js.map +1 -0
- package/dist/Toast-DQSbs3oA.js +49 -0
- package/dist/Toast-DQSbs3oA.js.map +1 -0
- package/dist/ToggleGroup-Cy_10Mvu.js +47 -0
- package/dist/ToggleGroup-Cy_10Mvu.js.map +1 -0
- package/dist/Workbench-BzE-Vvd9.js +293 -0
- package/dist/Workbench-BzE-Vvd9.js.map +1 -0
- package/dist/ZoomableSvg-DG9PnAm8.js +248 -0
- package/dist/ZoomableSvg-DG9PnAm8.js.map +1 -0
- package/dist/charts.d.ts +124 -111
- package/dist/charts.js +303 -249
- package/dist/charts.js.map +1 -1
- package/dist/classNames-BzrkDnOD.js +9 -0
- package/dist/classNames-BzrkDnOD.js.map +1 -0
- package/dist/constants-D6JcsD4_.d.ts +41 -0
- package/dist/context-KxxeMHbR.js +62 -0
- package/dist/context-KxxeMHbR.js.map +1 -0
- package/dist/editors.d.ts +180 -173
- package/dist/editors.js +747 -420
- package/dist/editors.js.map +1 -1
- package/dist/escapeStringRegexp-8MxP2knR.js +6 -0
- package/dist/escapeStringRegexp-8MxP2knR.js.map +1 -0
- package/dist/icons-Cek151jC.js +640 -0
- package/dist/icons-Cek151jC.js.map +1 -0
- package/dist/icons.d.ts +2 -41
- package/dist/icons.js +2 -4
- package/dist/index-m-kQEWiY.d.ts +54 -0
- package/dist/index.d.ts +6192 -9904
- package/dist/index.js +112 -15803
- package/dist/internal/blocks/AIKit.js +2 -0
- package/dist/internal/blocks/AppShell.js +2 -0
- package/dist/internal/blocks/AutoSaveTextarea.js +2 -0
- package/dist/internal/blocks/BrandEditor.js +2 -0
- package/dist/internal/blocks/ChartPanel.js +46 -0
- package/dist/internal/blocks/ChartPanel.js.map +1 -0
- package/dist/internal/blocks/ClipboardButton.js +2 -0
- package/dist/internal/blocks/ColorInput.js +2 -0
- package/dist/internal/blocks/ColorModeSwitch.js +2 -0
- package/dist/internal/blocks/Command.js +2 -0
- package/dist/internal/blocks/CopyField.js +2 -0
- package/dist/internal/blocks/DashboardHero.js +59 -0
- package/dist/internal/blocks/DashboardHero.js.map +1 -0
- package/dist/internal/blocks/DateInput.js +2 -0
- package/dist/internal/blocks/DateRangeInput.js +2 -0
- package/dist/internal/blocks/EmptyConfigurationActionCard.js +16 -0
- package/dist/internal/blocks/EmptyConfigurationActionCard.js.map +1 -0
- package/dist/internal/blocks/EmptyState.js +142 -0
- package/dist/internal/blocks/EmptyState.js.map +1 -0
- package/dist/internal/blocks/ErrorState.js +179 -0
- package/dist/internal/blocks/ErrorState.js.map +1 -0
- package/dist/internal/blocks/ExportMenu.js +41 -0
- package/dist/internal/blocks/ExportMenu.js.map +1 -0
- package/dist/internal/blocks/Form.js +2 -0
- package/dist/internal/blocks/FormGroup.js +2 -0
- package/dist/internal/blocks/GoogleButton.js +95 -0
- package/dist/internal/blocks/GoogleButton.js.map +1 -0
- package/dist/internal/blocks/MicrosoftButton.js +64 -0
- package/dist/internal/blocks/MicrosoftButton.js.map +1 -0
- package/dist/internal/blocks/MultiActionButtonGroup.js +2 -0
- package/dist/internal/blocks/MultiCombobox.js +188 -0
- package/dist/internal/blocks/MultiCombobox.js.map +1 -0
- package/dist/internal/blocks/NumberInput.js +44 -0
- package/dist/internal/blocks/NumberInput.js.map +1 -0
- package/dist/internal/blocks/OtpInput.js +2 -0
- package/dist/internal/blocks/PageHeader.js +2 -0
- package/dist/internal/blocks/PageLayout.js +2 -0
- package/dist/internal/blocks/PageToolbar.js +2 -0
- package/dist/internal/blocks/PasswordInput.js +97 -0
- package/dist/internal/blocks/PasswordInput.js.map +1 -0
- package/dist/internal/blocks/SearchInput.js +2 -0
- package/dist/internal/blocks/SearchInputWithNavigation.js +65 -0
- package/dist/internal/blocks/SearchInputWithNavigation.js.map +1 -0
- package/dist/internal/blocks/SectionNav.js +2 -0
- package/dist/internal/blocks/SplitButton.js +46 -0
- package/dist/internal/blocks/SplitButton.js.map +1 -0
- package/dist/internal/blocks/StatCard.js +97 -0
- package/dist/internal/blocks/StatCard.js.map +1 -0
- package/dist/internal/blocks/TextInput.js +2 -0
- package/dist/internal/blocks/Textarea.js +32 -0
- package/dist/internal/blocks/Textarea.js.map +1 -0
- package/dist/internal/blocks/TimeInput.js +77 -0
- package/dist/internal/blocks/TimeInput.js.map +1 -0
- package/dist/internal/components/Alert.js +2 -0
- package/dist/internal/components/AlertModal.js +2 -0
- package/dist/internal/components/Avatar.js +53 -0
- package/dist/internal/components/Avatar.js.map +1 -0
- package/dist/internal/components/Badge.js +2 -0
- package/dist/internal/components/BrandLogo.js +2 -0
- package/dist/internal/components/Breadcrumb.js +2 -0
- package/dist/internal/components/Button.js +2 -0
- package/dist/internal/components/ButtonGroup.js +66 -0
- package/dist/internal/components/ButtonGroup.js.map +1 -0
- package/dist/internal/components/Calendar.js +2 -0
- package/dist/internal/components/Card.js +2 -0
- package/dist/internal/components/Checkbox.js +2 -0
- package/dist/internal/components/Clipboard.js +2 -0
- package/dist/internal/components/Collapsible.js +2 -0
- package/dist/internal/components/CollapsiblePanel.js +87 -0
- package/dist/internal/components/CollapsiblePanel.js.map +1 -0
- package/dist/internal/components/Combobox.js +2 -0
- package/dist/internal/components/DatePicker.js +2 -0
- package/dist/internal/components/DateRangePicker.js +2 -0
- package/dist/internal/components/DiffView.js +2 -0
- package/dist/internal/components/DotsLoader.js +18 -0
- package/dist/internal/components/DotsLoader.js.map +1 -0
- package/dist/internal/components/DropdownMenu.js +2 -0
- package/dist/internal/components/EmptySearchContent.js +12 -0
- package/dist/internal/components/EmptySearchContent.js.map +1 -0
- package/dist/internal/components/FileUpload.js +2 -0
- package/dist/internal/components/FullScreenModal.js +2 -0
- package/dist/internal/components/HelpBlock.js +25 -0
- package/dist/internal/components/HelpBlock.js.map +1 -0
- package/dist/internal/components/HoverCard.js +2 -0
- package/dist/internal/components/InputGroup.js +2 -0
- package/dist/internal/components/Kbd.js +2 -0
- package/dist/internal/components/Label.js +39 -0
- package/dist/internal/components/Label.js.map +1 -0
- package/dist/internal/components/Link.js +22 -0
- package/dist/internal/components/Link.js.map +1 -0
- package/dist/internal/components/MarkedText.js +2 -0
- package/dist/internal/components/MergeEditor/ConflictStatus/ConflictStatusIndicator.js +20 -0
- package/dist/internal/components/MergeEditor/ConflictStatus/ConflictStatusIndicator.js.map +1 -0
- package/dist/internal/components/MergeEditor/PaneHeader.js +13 -0
- package/dist/internal/components/MergeEditor/PaneHeader.js.map +1 -0
- package/dist/internal/components/MergeEditor/constants.js +18 -0
- package/dist/internal/components/MergeEditor/constants.js.map +1 -0
- package/dist/internal/components/MergeEditor/useMergeDiff.js +2 -0
- package/dist/internal/components/Modal.js +2 -0
- package/dist/internal/components/Navbar.js +2 -0
- package/dist/internal/components/Pagination.js +2 -0
- package/dist/internal/components/PanelWithDetails.js +31 -0
- package/dist/internal/components/PanelWithDetails.js.map +1 -0
- package/dist/internal/components/Popconfirm.js +2 -0
- package/dist/internal/components/Popover.js +2 -0
- package/dist/internal/components/Progress.js +47 -0
- package/dist/internal/components/Progress.js.map +1 -0
- package/dist/internal/components/RadioGroup.js +2 -0
- package/dist/internal/components/Resizable.js +2 -0
- package/dist/internal/components/ScrollArea.js +42 -0
- package/dist/internal/components/ScrollArea.js.map +1 -0
- package/dist/internal/components/Search.js +2 -0
- package/dist/internal/components/Select.js +2 -0
- package/dist/internal/components/Separator.js +84 -0
- package/dist/internal/components/Separator.js.map +1 -0
- package/dist/internal/components/Sheet.js +2 -0
- package/dist/internal/components/Sidebar.js +2 -0
- package/dist/internal/components/Skeleton/Skeleton.js +39 -0
- package/dist/internal/components/Skeleton/Skeleton.js.map +1 -0
- package/dist/internal/components/Skeleton/SkeletonList.js +41 -0
- package/dist/internal/components/Skeleton/SkeletonList.js.map +1 -0
- package/dist/internal/components/Slider.js +2 -0
- package/dist/internal/components/SpotlightBackdrop.js +132 -0
- package/dist/internal/components/SpotlightBackdrop.js.map +1 -0
- package/dist/internal/components/Stepper.js +2 -0
- package/dist/internal/components/Switch.js +2 -0
- package/dist/internal/components/Table.js +2 -0
- package/dist/internal/components/Tabs.js +2 -0
- package/dist/internal/components/ThemeProvider.js +3 -0
- package/dist/internal/components/TimePicker.js +2 -0
- package/dist/internal/components/Timeline.js +2 -0
- package/dist/internal/components/Toast.js +3 -0
- package/dist/internal/components/Toggle.js +169 -0
- package/dist/internal/components/Toggle.js.map +1 -0
- package/dist/internal/components/ToggleGroup.js +2 -0
- package/dist/internal/components/Tooltip.js +2 -0
- package/dist/internal/components/Truncated.js +45 -0
- package/dist/internal/components/Truncated.js.map +1 -0
- package/dist/internal/components/Workbench.js +2 -0
- package/dist/internal/components/ZoomableSvg.js +2 -0
- package/dist/internal/hooks/useAutosizeInput.js +77 -0
- package/dist/internal/hooks/useAutosizeInput.js.map +1 -0
- package/dist/internal/hooks/useScrollbarPosition.js +45 -0
- package/dist/internal/hooks/useScrollbarPosition.js.map +1 -0
- package/dist/internal/hooks/useStableCallback.js +29 -0
- package/dist/internal/hooks/useStableCallback.js.map +1 -0
- package/dist/internal/utils/mergeRefs.js +20 -0
- package/dist/internal/utils/mergeRefs.js.map +1 -0
- package/dist/internal/utils.js +5 -0
- package/dist/markdown-editor.d.ts +72 -72
- package/dist/markdown-editor.js +1122 -1193
- package/dist/markdown-editor.js.map +1 -1
- package/dist/mermaid.d.ts +12 -12
- package/dist/mermaid.js +2 -10
- package/dist/rjsf.d.ts +33 -34
- package/dist/rjsf.js +1543 -1600
- package/dist/rjsf.js.map +1 -1
- package/dist/rolldown-runtime-Bdc48AWt.js +33 -0
- package/dist/styles-DSUP_-9Z.js +158 -0
- package/dist/styles-DSUP_-9Z.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/testing.d.ts +8 -7
- package/dist/testing.js +36 -16
- package/dist/testing.js.map +1 -1
- package/dist/themeTokens-BNg98Mu9.js +85 -0
- package/dist/themeTokens-BNg98Mu9.js.map +1 -0
- package/dist/toast-CjkURw0M.js +184 -0
- package/dist/toast-CjkURw0M.js.map +1 -0
- package/dist/useColorSchemeState-CYqcUfSH.js +61 -0
- package/dist/useColorSchemeState-CYqcUfSH.js.map +1 -0
- package/dist/useControllableState-M6494mCT.js +31 -0
- package/dist/useControllableState-M6494mCT.js.map +1 -0
- package/dist/useElement-DkF6esWL.js +15 -0
- package/dist/useElement-DkF6esWL.js.map +1 -0
- package/dist/useMergeDiff-CvowEXJ1.js +465 -0
- package/dist/useMergeDiff-CvowEXJ1.js.map +1 -0
- package/dist/utils-D0c5VAyF.js +308 -0
- package/dist/utils-D0c5VAyF.js.map +1 -0
- package/package.json +10 -9
- package/src/styles.css +35 -7
- package/src/theme.css +64 -0
- package/dist/MermaidDiagram-EOKJHQQV.js +0 -10
- package/dist/MermaidDiagram-EOKJHQQV.js.map +0 -1
- package/dist/chunk-63NSN2VL.js +0 -274
- package/dist/chunk-63NSN2VL.js.map +0 -1
- package/dist/chunk-6FPEI4EM.js +0 -6683
- package/dist/chunk-6FPEI4EM.js.map +0 -1
- package/dist/chunk-7PUUHEJQ.js +0 -1313
- package/dist/chunk-7PUUHEJQ.js.map +0 -1
- package/dist/chunk-BOHNXTMM.js +0 -606
- package/dist/chunk-BOHNXTMM.js.map +0 -1
- package/dist/chunk-C3L3TBBT.js +0 -242
- package/dist/chunk-C3L3TBBT.js.map +0 -1
- package/dist/chunk-CTCFYWJC.js +0 -407
- package/dist/chunk-CTCFYWJC.js.map +0 -1
- package/dist/chunk-ESBL3IPF.js +0 -23
- package/dist/chunk-ESBL3IPF.js.map +0 -1
- package/dist/chunk-IJTHFNNJ.js +0 -261
- package/dist/chunk-IJTHFNNJ.js.map +0 -1
- package/dist/chunk-JP7PNHLH.js +0 -40
- package/dist/chunk-JP7PNHLH.js.map +0 -1
- package/dist/chunk-KPNAW5MU.js +0 -229
- package/dist/chunk-KPNAW5MU.js.map +0 -1
- package/dist/chunk-L37JJ6MR.js +0 -152
- package/dist/chunk-L37JJ6MR.js.map +0 -1
- package/dist/chunk-Q7NWXLCT.js +0 -90
- package/dist/chunk-Q7NWXLCT.js.map +0 -1
- package/dist/chunk-SYIEF644.js +0 -1016
- package/dist/chunk-SYIEF644.js.map +0 -1
- package/dist/chunk-VMFSRV5H.js +0 -16
- package/dist/chunk-VMFSRV5H.js.map +0 -1
- package/dist/chunk-VPPM7UUQ.js +0 -47
- package/dist/chunk-VPPM7UUQ.js.map +0 -1
- package/dist/chunk-XV3UUOYF.js +0 -845
- package/dist/chunk-XV3UUOYF.js.map +0 -1
- package/dist/constants-D3gaMY-W.d.ts +0 -39
- package/dist/icons.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/mermaid.js.map +0 -1
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
import { cn } from "./classNames-BzrkDnOD.js";
|
|
2
|
+
import { Check, X } from "./icons-Cek151jC.js";
|
|
3
|
+
import { Children, createContext, isValidElement, use } from "react";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/Stepper/StepperContext.tsx
|
|
7
|
+
const StepperContext = createContext({ orientation: "horizontal" });
|
|
8
|
+
const useStepperContext = () => use(StepperContext);
|
|
9
|
+
const StepItemContext = createContext(null);
|
|
10
|
+
const useStepItemContext = () => {
|
|
11
|
+
const ctx = use(StepItemContext);
|
|
12
|
+
if (!ctx) throw new Error("Stepper.Step subcomponents must be used inside <Stepper.Step>.");
|
|
13
|
+
return ctx;
|
|
14
|
+
};
|
|
15
|
+
const StepPositionContext = createContext({
|
|
16
|
+
index: 0,
|
|
17
|
+
isLast: true
|
|
18
|
+
});
|
|
19
|
+
const useStepPositionContext = () => use(StepPositionContext);
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/components/Stepper/styles.ts
|
|
22
|
+
const stepperVariants = cva([], {
|
|
23
|
+
defaultVariants: { orientation: "horizontal" },
|
|
24
|
+
variants: { orientation: {
|
|
25
|
+
horizontal: [
|
|
26
|
+
"tw:flex",
|
|
27
|
+
"tw:flex-row",
|
|
28
|
+
"tw:items-start",
|
|
29
|
+
"tw:w-full"
|
|
30
|
+
],
|
|
31
|
+
vertical: [
|
|
32
|
+
"tw:flex",
|
|
33
|
+
"tw:flex-col",
|
|
34
|
+
"tw:w-full"
|
|
35
|
+
]
|
|
36
|
+
} }
|
|
37
|
+
});
|
|
38
|
+
const stepVariants = cva(["tw:group/step"], {
|
|
39
|
+
defaultVariants: { orientation: "horizontal" },
|
|
40
|
+
variants: {
|
|
41
|
+
orientation: {
|
|
42
|
+
horizontal: [
|
|
43
|
+
"tw:flex",
|
|
44
|
+
"tw:flex-col",
|
|
45
|
+
"tw:items-center",
|
|
46
|
+
"tw:text-center",
|
|
47
|
+
"tw:gap-2"
|
|
48
|
+
],
|
|
49
|
+
vertical: [
|
|
50
|
+
"tw:flex",
|
|
51
|
+
"tw:flex-row",
|
|
52
|
+
"tw:items-stretch",
|
|
53
|
+
"tw:gap-3"
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
interactive: {
|
|
57
|
+
true: [
|
|
58
|
+
"tw:cursor-pointer",
|
|
59
|
+
"tw:bg-transparent",
|
|
60
|
+
"tw:border-0",
|
|
61
|
+
"tw:p-0",
|
|
62
|
+
"tw:font-[inherit]",
|
|
63
|
+
"tw:focus-visible:outline-hidden",
|
|
64
|
+
"tw:focus-visible:ring-2",
|
|
65
|
+
"tw:focus-visible:ring-ring/50",
|
|
66
|
+
"tw:focus-visible:rounded-md"
|
|
67
|
+
],
|
|
68
|
+
false: []
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
const indicatorVariants = cva([
|
|
73
|
+
"tw:flex",
|
|
74
|
+
"tw:items-center",
|
|
75
|
+
"tw:justify-center",
|
|
76
|
+
"tw:shrink-0",
|
|
77
|
+
"tw:size-8",
|
|
78
|
+
"tw:rounded-full",
|
|
79
|
+
"tw:border",
|
|
80
|
+
"tw:text-sm",
|
|
81
|
+
"tw:font-medium",
|
|
82
|
+
"tw:transition-colors",
|
|
83
|
+
"tw:[&_svg]:size-4"
|
|
84
|
+
], {
|
|
85
|
+
defaultVariants: { status: "upcoming" },
|
|
86
|
+
variants: { status: {
|
|
87
|
+
complete: [
|
|
88
|
+
"tw:bg-success",
|
|
89
|
+
"tw:text-white",
|
|
90
|
+
"tw:border-success"
|
|
91
|
+
],
|
|
92
|
+
active: [
|
|
93
|
+
"tw:bg-primary",
|
|
94
|
+
"tw:text-primary-foreground",
|
|
95
|
+
"tw:border-primary"
|
|
96
|
+
],
|
|
97
|
+
upcoming: [
|
|
98
|
+
"tw:bg-muted",
|
|
99
|
+
"tw:text-muted-foreground",
|
|
100
|
+
"tw:border-border"
|
|
101
|
+
],
|
|
102
|
+
error: [
|
|
103
|
+
"tw:bg-destructive",
|
|
104
|
+
"tw:text-destructive-foreground",
|
|
105
|
+
"tw:border-destructive"
|
|
106
|
+
]
|
|
107
|
+
} }
|
|
108
|
+
});
|
|
109
|
+
const labelVariants = cva([
|
|
110
|
+
"tw:text-sm",
|
|
111
|
+
"tw:font-medium",
|
|
112
|
+
"tw:leading-5"
|
|
113
|
+
], {
|
|
114
|
+
defaultVariants: { status: "upcoming" },
|
|
115
|
+
variants: { status: {
|
|
116
|
+
complete: ["tw:text-foreground"],
|
|
117
|
+
active: ["tw:text-foreground"],
|
|
118
|
+
upcoming: ["tw:text-muted-foreground"],
|
|
119
|
+
error: ["tw:text-destructive"]
|
|
120
|
+
} }
|
|
121
|
+
});
|
|
122
|
+
const descriptionClassnames = "tw:text-xs tw:text-muted-foreground tw:mt-0.5";
|
|
123
|
+
const connectorVariants = cva(["tw:shrink-0", "tw:transition-colors"], {
|
|
124
|
+
defaultVariants: {
|
|
125
|
+
orientation: "horizontal",
|
|
126
|
+
status: "upcoming"
|
|
127
|
+
},
|
|
128
|
+
variants: {
|
|
129
|
+
orientation: {
|
|
130
|
+
horizontal: [
|
|
131
|
+
"tw:h-0.5",
|
|
132
|
+
"tw:flex-1",
|
|
133
|
+
"tw:mt-4",
|
|
134
|
+
"tw:min-w-8"
|
|
135
|
+
],
|
|
136
|
+
vertical: [
|
|
137
|
+
"tw:w-0.5",
|
|
138
|
+
"tw:flex-1",
|
|
139
|
+
"tw:min-h-6"
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
status: {
|
|
143
|
+
complete: ["tw:bg-success"],
|
|
144
|
+
active: ["tw:bg-border"],
|
|
145
|
+
upcoming: ["tw:bg-border"],
|
|
146
|
+
error: ["tw:bg-destructive"]
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
//#endregion
|
|
151
|
+
//#region src/components/Stepper/StepperStepConnector.tsx
|
|
152
|
+
/**
|
|
153
|
+
* Visual line between two steps. Internal — `Stepper` renders connectors automatically between
|
|
154
|
+
* adjacent `Stepper.Step`s. Connector colour follows the preceding step's status.
|
|
155
|
+
*/
|
|
156
|
+
const StepperStepConnector = ({ className, ...props }) => {
|
|
157
|
+
const { orientation } = useStepperContext();
|
|
158
|
+
const { status } = useStepItemContext();
|
|
159
|
+
return /* @__PURE__ */ jsx("span", {
|
|
160
|
+
"aria-hidden": true,
|
|
161
|
+
className: cn(connectorVariants({
|
|
162
|
+
orientation,
|
|
163
|
+
status
|
|
164
|
+
}), className),
|
|
165
|
+
...props
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
//#endregion
|
|
169
|
+
//#region src/components/Stepper/StepperStepIndicator.tsx
|
|
170
|
+
/**
|
|
171
|
+
* Circular indicator slot. Renders the status icon (Check / X) or the step number automatically based on
|
|
172
|
+
* the parent `Stepper.Step` status. Pass `children` to override.
|
|
173
|
+
*/
|
|
174
|
+
const StepperStepIndicator = ({ children, className, ...props }) => {
|
|
175
|
+
const { index, status } = useStepItemContext();
|
|
176
|
+
const content = (() => {
|
|
177
|
+
if (children !== void 0) return children;
|
|
178
|
+
if (status === "complete") return /* @__PURE__ */ jsx(Check, { "aria-hidden": true });
|
|
179
|
+
if (status === "error") return /* @__PURE__ */ jsx(X, { "aria-hidden": true });
|
|
180
|
+
return index + 1;
|
|
181
|
+
})();
|
|
182
|
+
return /* @__PURE__ */ jsx("span", {
|
|
183
|
+
"aria-hidden": children === void 0,
|
|
184
|
+
className: cn(indicatorVariants({ status }), className),
|
|
185
|
+
...props,
|
|
186
|
+
children: content
|
|
187
|
+
});
|
|
188
|
+
};
|
|
189
|
+
//#endregion
|
|
190
|
+
//#region src/components/Stepper/StepperStep.tsx
|
|
191
|
+
/**
|
|
192
|
+
* One step in a `Stepper`. Render `Stepper.StepIndicator`, `Stepper.StepLabel`, and optional
|
|
193
|
+
* `Stepper.StepDescription` as children — order within the step is irrelevant; the indicator is
|
|
194
|
+
* extracted and rendered in the indicator slot.
|
|
195
|
+
*
|
|
196
|
+
* Set `Stepper`'s `onStepClick` prop to make every step a button; otherwise the Step renders as `<div>`.
|
|
197
|
+
*/
|
|
198
|
+
const StepperStep = ({ status = "upcoming", children, className, ...props }) => {
|
|
199
|
+
const { orientation, onStepClick } = useStepperContext();
|
|
200
|
+
const { index, isLast } = useStepPositionContext();
|
|
201
|
+
const interactive = Boolean(onStepClick);
|
|
202
|
+
const allChildren = Children.toArray(children);
|
|
203
|
+
const indicatorChild = allChildren.find((child) => isValidElement(child) && child.type === StepperStepIndicator);
|
|
204
|
+
const contentChildren = allChildren.filter((child) => child !== indicatorChild);
|
|
205
|
+
const indicator = indicatorChild ?? /* @__PURE__ */ jsx(StepperStepIndicator, {});
|
|
206
|
+
const handleClick = () => onStepClick?.(index);
|
|
207
|
+
const stepContext = {
|
|
208
|
+
index,
|
|
209
|
+
isLast,
|
|
210
|
+
status
|
|
211
|
+
};
|
|
212
|
+
const stepClassName = cn(stepVariants({
|
|
213
|
+
orientation,
|
|
214
|
+
interactive
|
|
215
|
+
}), className);
|
|
216
|
+
const ariaCurrent = status === "active" ? "step" : void 0;
|
|
217
|
+
const inner = orientation === "vertical" ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("span", {
|
|
218
|
+
className: "tw:flex tw:flex-col tw:items-center tw:self-stretch",
|
|
219
|
+
children: [indicator, !isLast && /* @__PURE__ */ jsx(StepperStepConnector, {})]
|
|
220
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
221
|
+
className: "tw:flex tw:min-w-0 tw:flex-col tw:items-start tw:pb-6 tw:text-left",
|
|
222
|
+
children: contentChildren
|
|
223
|
+
})] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [indicator, /* @__PURE__ */ jsx("span", {
|
|
224
|
+
className: "tw:flex tw:flex-col tw:items-center tw:text-center",
|
|
225
|
+
children: contentChildren
|
|
226
|
+
})] });
|
|
227
|
+
return /* @__PURE__ */ jsx(StepItemContext, {
|
|
228
|
+
value: stepContext,
|
|
229
|
+
children: interactive ? /* @__PURE__ */ jsx("button", {
|
|
230
|
+
...props,
|
|
231
|
+
type: "button",
|
|
232
|
+
onClick: handleClick,
|
|
233
|
+
"aria-current": ariaCurrent,
|
|
234
|
+
"data-status": status,
|
|
235
|
+
className: stepClassName,
|
|
236
|
+
children: inner
|
|
237
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
238
|
+
...props,
|
|
239
|
+
"aria-current": ariaCurrent,
|
|
240
|
+
"data-status": status,
|
|
241
|
+
className: stepClassName,
|
|
242
|
+
children: inner
|
|
243
|
+
})
|
|
244
|
+
});
|
|
245
|
+
};
|
|
246
|
+
//#endregion
|
|
247
|
+
//#region src/components/Stepper/StepperStepDescription.tsx
|
|
248
|
+
/** Optional secondary text below the step label. */
|
|
249
|
+
const StepperStepDescription = ({ className, ...props }) => /* @__PURE__ */ jsx("span", {
|
|
250
|
+
className: cn(descriptionClassnames, className),
|
|
251
|
+
...props
|
|
252
|
+
});
|
|
253
|
+
//#endregion
|
|
254
|
+
//#region src/components/Stepper/StepperStepLabel.tsx
|
|
255
|
+
/** Step title — short label describing the step (e.g. "Account", "Payment"). */
|
|
256
|
+
const StepperStepLabel = ({ className, ...props }) => {
|
|
257
|
+
const { status } = useStepItemContext();
|
|
258
|
+
return /* @__PURE__ */ jsx("span", {
|
|
259
|
+
className: cn(labelVariants({ status }), className),
|
|
260
|
+
...props
|
|
261
|
+
});
|
|
262
|
+
};
|
|
263
|
+
//#endregion
|
|
264
|
+
//#region src/components/Stepper/Stepper.tsx
|
|
265
|
+
const isStepElement = (child) => isValidElement(child) && child.type === StepperStep;
|
|
266
|
+
const getStepStatus = (step) => step.props.status ?? "upcoming";
|
|
267
|
+
/**
|
|
268
|
+
* Linear progress indicator for a multi-step flow.
|
|
269
|
+
*
|
|
270
|
+
* **When to use:** show progress through a finite, ordered sequence (onboarding wizard, multi-step form,
|
|
271
|
+
* deploy pipeline). Compose with `Stepper.Step` + `Stepper.StepIndicator` + `Stepper.StepLabel` (+ optional
|
|
272
|
+
* `Stepper.StepDescription`); connectors render automatically between steps.
|
|
273
|
+
* **When NOT to use:** for branching navigation use `Tabs` or `PageLayout.Tabs`; for an unordered status list
|
|
274
|
+
* use `Timeline`; for a single percentage value use `Progress`.
|
|
275
|
+
* **Composition:** set `onStepClick` to make steps focusable buttons (callback fires with the step index),
|
|
276
|
+
* otherwise the stepper is visual only. Each step's `status` prop drives the indicator + connector colour.
|
|
277
|
+
*/
|
|
278
|
+
const Stepper = ({ orientation = "horizontal", onStepClick, children, className, ...props }) => {
|
|
279
|
+
const steps = Children.toArray(children).filter(isStepElement);
|
|
280
|
+
const lastIndex = steps.length - 1;
|
|
281
|
+
return /* @__PURE__ */ jsx(StepperContext, {
|
|
282
|
+
value: {
|
|
283
|
+
orientation,
|
|
284
|
+
onStepClick
|
|
285
|
+
},
|
|
286
|
+
children: /* @__PURE__ */ jsx("ol", {
|
|
287
|
+
className: cn("tailwindcss-preflight", "tw:list-none", "tw:p-0", "tw:m-0", stepperVariants({ orientation }), className),
|
|
288
|
+
...props,
|
|
289
|
+
children: steps.map((step, index) => {
|
|
290
|
+
const isLast = index === lastIndex;
|
|
291
|
+
const wrappedStep = /* @__PURE__ */ jsx(StepPositionContext, {
|
|
292
|
+
value: {
|
|
293
|
+
index,
|
|
294
|
+
isLast
|
|
295
|
+
},
|
|
296
|
+
children: step
|
|
297
|
+
});
|
|
298
|
+
if (orientation === "vertical") return /* @__PURE__ */ jsx("li", {
|
|
299
|
+
className: "tw:contents",
|
|
300
|
+
children: wrappedStep
|
|
301
|
+
}, step.key ?? index);
|
|
302
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
303
|
+
className: "tw:contents",
|
|
304
|
+
children: [wrappedStep, !isLast && /* @__PURE__ */ jsx(StepItemContext, {
|
|
305
|
+
value: {
|
|
306
|
+
index: -1,
|
|
307
|
+
isLast: false,
|
|
308
|
+
status: getStepStatus(step)
|
|
309
|
+
},
|
|
310
|
+
children: /* @__PURE__ */ jsx(StepperStepConnector, {})
|
|
311
|
+
})]
|
|
312
|
+
}, step.key ?? index);
|
|
313
|
+
})
|
|
314
|
+
})
|
|
315
|
+
});
|
|
316
|
+
};
|
|
317
|
+
Stepper.Step = StepperStep;
|
|
318
|
+
Stepper.StepIndicator = StepperStepIndicator;
|
|
319
|
+
Stepper.StepLabel = StepperStepLabel;
|
|
320
|
+
Stepper.StepDescription = StepperStepDescription;
|
|
321
|
+
Stepper.StepConnector = StepperStepConnector;
|
|
322
|
+
//#endregion
|
|
323
|
+
export { Stepper };
|
|
324
|
+
|
|
325
|
+
//# sourceMappingURL=Stepper-C8sm9ZFM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stepper-C8sm9ZFM.js","names":[],"sources":["../src/components/Stepper/StepperContext.tsx","../src/components/Stepper/styles.ts","../src/components/Stepper/StepperStepConnector.tsx","../src/components/Stepper/StepperStepIndicator.tsx","../src/components/Stepper/StepperStep.tsx","../src/components/Stepper/StepperStepDescription.tsx","../src/components/Stepper/StepperStepLabel.tsx","../src/components/Stepper/Stepper.tsx"],"sourcesContent":["import { createContext, use } from 'react';\n\nexport type StepperOrientation = 'horizontal' | 'vertical';\n\ntype StepperContextType = {\n orientation: StepperOrientation;\n onStepClick?: (index: number) => void;\n};\n\nexport const StepperContext = createContext<StepperContextType>({\n orientation: 'horizontal',\n});\n\nexport const useStepperContext = () => use(StepperContext);\n\ntype StepItemContextType = {\n index: number;\n isLast: boolean;\n status: StepStatus;\n};\n\nexport const StepItemContext = createContext<StepItemContextType | null>(null);\n\nexport const useStepItemContext = () => {\n const ctx = use(StepItemContext);\n if (!ctx) {\n throw new Error('Stepper.Step subcomponents must be used inside <Stepper.Step>.');\n }\n return ctx;\n};\n\n// Position context provided by `Stepper` to each child `Stepper.Step` —\n// carries the step's index in the rendered list and whether it's the last.\n// Separated from `StepItemContext` so the connector + step share a status\n// channel but only the step needs positional info.\ntype StepPositionContextType = {\n index: number;\n isLast: boolean;\n};\n\nexport const StepPositionContext = createContext<StepPositionContextType>({\n index: 0,\n isLast: true,\n});\n\nexport const useStepPositionContext = () => use(StepPositionContext);\n\nconst STEP_STATUS = {\n complete: 'complete',\n active: 'active',\n upcoming: 'upcoming',\n error: 'error',\n} as const;\n\nexport type StepStatus = (typeof STEP_STATUS)[keyof typeof STEP_STATUS];\n","import { cva } from 'class-variance-authority';\n\nexport const stepperVariants = cva([], {\n defaultVariants: {\n orientation: 'horizontal',\n },\n variants: {\n orientation: {\n // Single row of steps + inter-step connectors. Steps shrink to content; connectors flex-fill the gaps.\n horizontal: ['tw:flex', 'tw:flex-row', 'tw:items-start', 'tw:w-full'],\n // Stack steps vertically; each step renders its own indicator column with an internal connector.\n vertical: ['tw:flex', 'tw:flex-col', 'tw:w-full'],\n },\n },\n});\n\nexport const stepVariants = cva(['tw:group/step'], {\n defaultVariants: {\n orientation: 'horizontal',\n },\n variants: {\n orientation: {\n // Indicator on top, label/description below.\n horizontal: ['tw:flex', 'tw:flex-col', 'tw:items-center', 'tw:text-center', 'tw:gap-2'],\n // Indicator column on the left (with the vertical connector stretching beneath it),\n // content column on the right with the label/description.\n vertical: ['tw:flex', 'tw:flex-row', 'tw:items-stretch', 'tw:gap-3'],\n },\n interactive: {\n true: [\n // Reset native `<button>` chrome so the Step looks identical to its non-interactive sibling.\n 'tw:cursor-pointer',\n 'tw:bg-transparent',\n 'tw:border-0',\n 'tw:p-0',\n 'tw:font-[inherit]',\n 'tw:focus-visible:outline-hidden',\n 'tw:focus-visible:ring-2',\n 'tw:focus-visible:ring-ring/50',\n 'tw:focus-visible:rounded-md',\n ],\n false: [],\n },\n },\n});\n\nexport const indicatorVariants = cva(\n [\n 'tw:flex',\n 'tw:items-center',\n 'tw:justify-center',\n 'tw:shrink-0',\n 'tw:size-8',\n 'tw:rounded-full',\n 'tw:border',\n 'tw:text-sm',\n 'tw:font-medium',\n 'tw:transition-colors',\n 'tw:[&_svg]:size-4',\n ],\n {\n defaultVariants: {\n status: 'upcoming',\n },\n variants: {\n status: {\n complete: ['tw:bg-success', 'tw:text-white', 'tw:border-success'],\n active: ['tw:bg-primary', 'tw:text-primary-foreground', 'tw:border-primary'],\n upcoming: ['tw:bg-muted', 'tw:text-muted-foreground', 'tw:border-border'],\n error: ['tw:bg-destructive', 'tw:text-destructive-foreground', 'tw:border-destructive'],\n },\n },\n },\n);\n\nexport const labelVariants = cva(['tw:text-sm', 'tw:font-medium', 'tw:leading-5'], {\n defaultVariants: {\n status: 'upcoming',\n },\n variants: {\n status: {\n complete: ['tw:text-foreground'],\n active: ['tw:text-foreground'],\n upcoming: ['tw:text-muted-foreground'],\n error: ['tw:text-destructive'],\n },\n },\n});\n\nexport const descriptionClassnames = 'tw:text-xs tw:text-muted-foreground tw:mt-0.5';\n\n// Connector colour follows the preceding step's status (complete → success line forward,\n// error → destructive, otherwise muted border).\nexport const connectorVariants = cva(['tw:shrink-0', 'tw:transition-colors'], {\n defaultVariants: {\n orientation: 'horizontal',\n status: 'upcoming',\n },\n variants: {\n orientation: {\n // Inline sibling between horizontal steps. Push down by half the indicator height (16px).\n horizontal: ['tw:h-0.5', 'tw:flex-1', 'tw:mt-4', 'tw:min-w-8'],\n // Inside the indicator column under the indicator. `flex-1` + `min-h-6` ensures it\n // stretches to fill the space alongside the content block.\n vertical: ['tw:w-0.5', 'tw:flex-1', 'tw:min-h-6'],\n },\n status: {\n complete: ['tw:bg-success'],\n active: ['tw:bg-border'],\n upcoming: ['tw:bg-border'],\n error: ['tw:bg-destructive'],\n },\n },\n});\n","import type { ComponentProps } from 'react';\n\nimport { cn } from '../../utils';\n\nimport { useStepItemContext, useStepperContext } from './StepperContext';\nimport { connectorVariants } from './styles';\n\ntype Props = ComponentProps<'span'>;\n\n/**\n * Visual line between two steps. Internal — `Stepper` renders connectors automatically between\n * adjacent `Stepper.Step`s. Connector colour follows the preceding step's status.\n */\nexport const StepperStepConnector = ({ className, ...props }: Props) => {\n const { orientation } = useStepperContext();\n const { status } = useStepItemContext();\n return (\n <span\n aria-hidden\n className={cn(connectorVariants({ orientation, status }), className)}\n {...props}\n />\n );\n};\n","import type { ComponentProps, ReactNode } from 'react';\n\nimport { Check, X } from '../../icons';\nimport { cn } from '../../utils';\n\nimport { useStepItemContext } from './StepperContext';\nimport { indicatorVariants } from './styles';\n\ntype Props = {\n /** Override the default content. By default renders Check for complete, X for error, step number otherwise. */\n children?: ReactNode;\n} & ComponentProps<'span'>;\n\n/**\n * Circular indicator slot. Renders the status icon (Check / X) or the step number automatically based on\n * the parent `Stepper.Step` status. Pass `children` to override.\n */\nexport const StepperStepIndicator = ({ children, className, ...props }: Props) => {\n const { index, status } = useStepItemContext();\n\n const content = (() => {\n if (children !== undefined) return children;\n if (status === 'complete') return <Check aria-hidden />;\n if (status === 'error') return <X aria-hidden />;\n return index + 1;\n })();\n\n return (\n <span\n aria-hidden={children === undefined}\n className={cn(indicatorVariants({ status }), className)}\n {...props}\n >\n {content}\n </span>\n );\n};\n","import { Children, type HTMLAttributes, isValidElement, type ReactNode } from 'react';\n\nimport { cn } from '../../utils';\n\nimport {\n StepItemContext,\n type StepStatus,\n useStepperContext,\n useStepPositionContext,\n} from './StepperContext';\nimport { StepperStepConnector } from './StepperStepConnector';\nimport { StepperStepIndicator } from './StepperStepIndicator';\nimport { stepVariants } from './styles';\n\ntype Props = {\n /** Visual state of the step. Drives indicator + connector colour. Defaults to `'upcoming'`. */\n status?: StepStatus;\n children: ReactNode;\n // Use generic HTML attributes so passthrough works for either `<div>` or `<button>`.\n} & Omit<HTMLAttributes<HTMLElement>, 'children'>;\n\n/**\n * One step in a `Stepper`. Render `Stepper.StepIndicator`, `Stepper.StepLabel`, and optional\n * `Stepper.StepDescription` as children — order within the step is irrelevant; the indicator is\n * extracted and rendered in the indicator slot.\n *\n * Set `Stepper`'s `onStepClick` prop to make every step a button; otherwise the Step renders as `<div>`.\n */\nexport const StepperStep = ({ status = 'upcoming', children, className, ...props }: Props) => {\n const { orientation, onStepClick } = useStepperContext();\n const { index, isLast } = useStepPositionContext();\n const interactive = Boolean(onStepClick);\n\n // Pull the indicator child out of `children` so we can position it\n // independently from the label/description block. Falls back to a default\n // indicator if the consumer didn't render one.\n // oxlint-disable-next-line react-x/no-children-to-array -- need to split indicator from label/description\n const allChildren = Children.toArray(children);\n const indicatorChild = allChildren.find(\n (child) => isValidElement(child) && child.type === StepperStepIndicator,\n );\n const contentChildren = allChildren.filter((child) => child !== indicatorChild);\n const indicator: ReactNode = indicatorChild ?? <StepperStepIndicator />;\n\n const handleClick = () => onStepClick?.(index);\n\n const stepContext = { index, isLast, status };\n\n const stepClassName = cn(stepVariants({ orientation, interactive }), className);\n\n const ariaCurrent = status === 'active' ? ('step' as const) : undefined;\n\n const inner =\n orientation === 'vertical' ? (\n <>\n <span className=\"tw:flex tw:flex-col tw:items-center tw:self-stretch\">\n {indicator}\n {!isLast && <StepperStepConnector />}\n </span>\n <span className=\"tw:flex tw:min-w-0 tw:flex-col tw:items-start tw:pb-6 tw:text-left\">\n {contentChildren}\n </span>\n </>\n ) : (\n <>\n {indicator}\n <span className=\"tw:flex tw:flex-col tw:items-center tw:text-center\">\n {contentChildren}\n </span>\n </>\n );\n\n return (\n <StepItemContext value={stepContext}>\n {interactive ? (\n <button\n {...props}\n type=\"button\"\n onClick={handleClick}\n aria-current={ariaCurrent}\n data-status={status}\n className={stepClassName}\n >\n {inner}\n </button>\n ) : (\n <div {...props} aria-current={ariaCurrent} data-status={status} className={stepClassName}>\n {inner}\n </div>\n )}\n </StepItemContext>\n );\n};\n","import type { ComponentProps } from 'react';\n\nimport { cn } from '../../utils';\n\nimport { descriptionClassnames } from './styles';\n\ntype Props = ComponentProps<'span'>;\n\n/** Optional secondary text below the step label. */\nexport const StepperStepDescription = ({ className, ...props }: Props) => (\n <span className={cn(descriptionClassnames, className)} {...props} />\n);\n","import type { ComponentProps } from 'react';\n\nimport { cn } from '../../utils';\n\nimport { useStepItemContext } from './StepperContext';\nimport { labelVariants } from './styles';\n\ntype Props = ComponentProps<'span'>;\n\n/** Step title — short label describing the step (e.g. \"Account\", \"Payment\"). */\nexport const StepperStepLabel = ({ className, ...props }: Props) => {\n const { status } = useStepItemContext();\n return <span className={cn(labelVariants({ status }), className)} {...props} />;\n};\n","import {\n Children,\n type ComponentProps,\n isValidElement,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport type { VariantProps } from 'class-variance-authority';\n\nimport { cn } from '../../utils';\n\nimport {\n StepItemContext,\n StepperContext,\n type StepperOrientation,\n StepPositionContext,\n type StepStatus,\n} from './StepperContext';\nimport { StepperStep } from './StepperStep';\nimport { StepperStepConnector } from './StepperStepConnector';\nimport { StepperStepDescription } from './StepperStepDescription';\nimport { StepperStepIndicator } from './StepperStepIndicator';\nimport { StepperStepLabel } from './StepperStepLabel';\nimport { stepperVariants } from './styles';\n\ntype Props = {\n /** Layout direction. Defaults to `horizontal`. */\n orientation?: StepperOrientation;\n /**\n * When provided, every step renders as a `<button>` and clicking fires this with the step index.\n * When undefined, steps render as `<div>` (visual only).\n */\n onStepClick?: (index: number) => void;\n children: ReactNode;\n} & Omit<ComponentProps<'ol'>, 'children'> &\n VariantProps<typeof stepperVariants>;\n\ntype StepElement = ReactElement<{ status?: StepStatus }>;\n\nconst isStepElement = (child: ReactNode): child is StepElement =>\n isValidElement(child) && child.type === StepperStep;\n\nconst getStepStatus = (step: StepElement): StepStatus => step.props.status ?? 'upcoming';\n\n/**\n * Linear progress indicator for a multi-step flow.\n *\n * **When to use:** show progress through a finite, ordered sequence (onboarding wizard, multi-step form,\n * deploy pipeline). Compose with `Stepper.Step` + `Stepper.StepIndicator` + `Stepper.StepLabel` (+ optional\n * `Stepper.StepDescription`); connectors render automatically between steps.\n * **When NOT to use:** for branching navigation use `Tabs` or `PageLayout.Tabs`; for an unordered status list\n * use `Timeline`; for a single percentage value use `Progress`.\n * **Composition:** set `onStepClick` to make steps focusable buttons (callback fires with the step index),\n * otherwise the stepper is visual only. Each step's `status` prop drives the indicator + connector colour.\n */\nexport const Stepper = ({\n orientation = 'horizontal',\n onStepClick,\n children,\n className,\n ...props\n}: Props) => {\n // oxlint-disable-next-line react-x/no-children-to-array -- need step count for connectors + positional context\n const steps = Children.toArray(children).filter(isStepElement);\n const lastIndex = steps.length - 1;\n\n return (\n <StepperContext value={{ orientation, onStepClick }}>\n <ol\n className={cn(\n 'tailwindcss-preflight',\n 'tw:list-none',\n 'tw:p-0',\n 'tw:m-0',\n stepperVariants({ orientation }),\n className,\n )}\n {...props}\n >\n {steps.map((step, index) => {\n const isLast = index === lastIndex;\n const wrappedStep = (\n <StepPositionContext value={{ index, isLast }}>{step}</StepPositionContext>\n );\n\n // Each <li> wraps one step (and, in horizontal mode, the trailing\n // connector) so the <ol> only ever has <li> children — valid list\n // markup that preserves the inner <button>/<div>'s native role.\n if (orientation === 'vertical') {\n return (\n // oxlint-disable-next-line react-x/no-array-index-key\n <li key={step.key ?? index} className=\"tw:contents\">\n {wrappedStep}\n </li>\n );\n }\n\n return (\n // oxlint-disable-next-line react-x/no-array-index-key\n <li key={step.key ?? index} className=\"tw:contents\">\n {wrappedStep}\n {!isLast && (\n // Connector colour follows the *current* (preceding) step's\n // status — a complete step paints a success line forward.\n <StepItemContext value={{ index: -1, isLast: false, status: getStepStatus(step) }}>\n <StepperStepConnector />\n </StepItemContext>\n )}\n </li>\n );\n })}\n </ol>\n </StepperContext>\n );\n};\n\nStepper.Step = StepperStep;\nStepper.StepIndicator = StepperStepIndicator;\nStepper.StepLabel = StepperStepLabel;\nStepper.StepDescription = StepperStepDescription;\nStepper.StepConnector = StepperStepConnector;\n"],"mappings":";;;;;;AASA,MAAa,iBAAiB,cAAkC,E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AC;EACC,CAAA;CACU,CAAA;AAEpB;AAEA,QAAQ,OAAO;AACf,QAAQ,gBAAgB;AACxB,QAAQ,YAAY;AACpB,QAAQ,kBAAkB;AAC1B,QAAQ,gBAAgB"}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { useArgoDesign } from "./context-KxxeMHbR.js";
|
|
2
|
+
import { FieldBox } from "./FieldBox-D7DYtX_m.js";
|
|
3
|
+
import { useId } from "react";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Root, Thumb } from "@radix-ui/react-switch";
|
|
7
|
+
//#region src/components/Switch/styles.ts
|
|
8
|
+
const switchVariants = cva([
|
|
9
|
+
"tailwindcss-preflight",
|
|
10
|
+
"tw:shrink-0",
|
|
11
|
+
"tw:cursor-pointer",
|
|
12
|
+
"tw:disabled:cursor-not-allowed",
|
|
13
|
+
"tw:disabled:opacity-50"
|
|
14
|
+
], {
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
size: "medium",
|
|
17
|
+
variant: "default"
|
|
18
|
+
},
|
|
19
|
+
variants: {
|
|
20
|
+
variant: {
|
|
21
|
+
default: [
|
|
22
|
+
"tw:peer/switch",
|
|
23
|
+
"tw:group/switch",
|
|
24
|
+
"tw:relative",
|
|
25
|
+
"tw:flex",
|
|
26
|
+
"tw:items-center",
|
|
27
|
+
"tw:gap-2",
|
|
28
|
+
"tw:min-h-5",
|
|
29
|
+
"tw:text-neutral-800",
|
|
30
|
+
"tw:font-normal",
|
|
31
|
+
"tw:before:content-[\" \"]",
|
|
32
|
+
"tw:before:block",
|
|
33
|
+
"tw:before:relative",
|
|
34
|
+
"tw:aria-checked:before:bg-primary-500",
|
|
35
|
+
"tw:before:bg-neutral-200",
|
|
36
|
+
"tw:aria-checked:before:hover:bg-primary-600",
|
|
37
|
+
"tw:before:hover:bg-neutral-300",
|
|
38
|
+
"tw:before:disabled:hover:bg-neutral-200",
|
|
39
|
+
"tw:transition-colors",
|
|
40
|
+
"tw:focus-visible:outline-hidden",
|
|
41
|
+
"tw:before:focus-visible:outline",
|
|
42
|
+
"tw:before:focus-visible:outline-1",
|
|
43
|
+
"tw:before:focus-visible:outline-ring",
|
|
44
|
+
"tw:before:focus-visible:ring-4",
|
|
45
|
+
"tw:before:focus-visible:ring-ring/30"
|
|
46
|
+
],
|
|
47
|
+
argo: [
|
|
48
|
+
"tw:peer",
|
|
49
|
+
"tw:inline-flex",
|
|
50
|
+
"tw:items-center",
|
|
51
|
+
"tw:w-9",
|
|
52
|
+
"tw:h-5",
|
|
53
|
+
"tw:rounded-full",
|
|
54
|
+
"tw:border",
|
|
55
|
+
"tw:border-transparent",
|
|
56
|
+
"tw:bg-input",
|
|
57
|
+
"tw:transition-colors",
|
|
58
|
+
"tw:data-[state=checked]:bg-primary",
|
|
59
|
+
"tw:focus-visible:outline-hidden",
|
|
60
|
+
"tw:focus-visible:border-primary",
|
|
61
|
+
"tw:focus-visible:ring-3",
|
|
62
|
+
"tw:focus-visible:ring-ring/50"
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
size: {
|
|
66
|
+
small: [],
|
|
67
|
+
medium: [],
|
|
68
|
+
large: []
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
compoundVariants: [
|
|
72
|
+
{
|
|
73
|
+
variant: "default",
|
|
74
|
+
size: "small",
|
|
75
|
+
class: [
|
|
76
|
+
"tw:before:w-6",
|
|
77
|
+
"tw:before:h-4",
|
|
78
|
+
"tw:before:rounded-lg"
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
variant: "default",
|
|
83
|
+
size: "medium",
|
|
84
|
+
class: [
|
|
85
|
+
"tw:before:w-8",
|
|
86
|
+
"tw:before:h-4",
|
|
87
|
+
"tw:before:rounded-lg"
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
variant: "default",
|
|
92
|
+
size: "large",
|
|
93
|
+
class: [
|
|
94
|
+
"tw:before:w-10",
|
|
95
|
+
"tw:before:h-5",
|
|
96
|
+
"tw:before:rounded-xl"
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
});
|
|
101
|
+
const thumbVariants = cva([
|
|
102
|
+
"tw:block",
|
|
103
|
+
"tw:shrink-0",
|
|
104
|
+
"tw:pointer-events-none",
|
|
105
|
+
"tw:bg-white",
|
|
106
|
+
"tw:rounded-full"
|
|
107
|
+
], {
|
|
108
|
+
defaultVariants: {
|
|
109
|
+
size: "medium",
|
|
110
|
+
variant: "default"
|
|
111
|
+
},
|
|
112
|
+
variants: {
|
|
113
|
+
variant: {
|
|
114
|
+
default: [
|
|
115
|
+
"tw:absolute",
|
|
116
|
+
"tw:left-0",
|
|
117
|
+
"tw:transition-transform",
|
|
118
|
+
"tw:ease-in-out",
|
|
119
|
+
"tw:shadow-[0_2px_5px_rgba(0,0,0,.26)]"
|
|
120
|
+
],
|
|
121
|
+
argo: [
|
|
122
|
+
"tw:size-4",
|
|
123
|
+
"tw:shadow-sm",
|
|
124
|
+
"tw:transition-transform",
|
|
125
|
+
"tw:data-[state=checked]:translate-x-[16px]",
|
|
126
|
+
"tw:data-[state=unchecked]:translate-x-0.5"
|
|
127
|
+
]
|
|
128
|
+
},
|
|
129
|
+
size: {
|
|
130
|
+
small: [],
|
|
131
|
+
medium: [],
|
|
132
|
+
large: []
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
compoundVariants: [
|
|
136
|
+
{
|
|
137
|
+
variant: "default",
|
|
138
|
+
size: "small",
|
|
139
|
+
class: [
|
|
140
|
+
"tw:w-3",
|
|
141
|
+
"tw:h-3",
|
|
142
|
+
"tw:data-[state=checked]:translate-x-2.5",
|
|
143
|
+
"tw:data-[state=unchecked]:translate-x-0.5"
|
|
144
|
+
]
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
variant: "default",
|
|
148
|
+
size: "medium",
|
|
149
|
+
class: [
|
|
150
|
+
"tw:w-3",
|
|
151
|
+
"tw:h-3",
|
|
152
|
+
"tw:data-[state=checked]:translate-x-[18px]",
|
|
153
|
+
"tw:data-[state=unchecked]:translate-x-0.5"
|
|
154
|
+
]
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
variant: "default",
|
|
158
|
+
size: "large",
|
|
159
|
+
class: [
|
|
160
|
+
"tw:w-3.5",
|
|
161
|
+
"tw:h-3.5",
|
|
162
|
+
"tw:data-[state=checked]:translate-x-6",
|
|
163
|
+
"tw:data-[state=unchecked]:translate-x-0.5"
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
]
|
|
167
|
+
});
|
|
168
|
+
//#endregion
|
|
169
|
+
//#region src/components/Switch/Switch.tsx
|
|
170
|
+
const Switch = ({ ref, className, size, disabled = false, id: idProp, children, description, variant, position, ...props }) => {
|
|
171
|
+
const fallbackId = useId();
|
|
172
|
+
const id = idProp?.toString() ?? fallbackId;
|
|
173
|
+
const switchVariant = useArgoDesign() ? "argo" : "default";
|
|
174
|
+
const switchElement = /* @__PURE__ */ jsx(Root, {
|
|
175
|
+
...props,
|
|
176
|
+
ref,
|
|
177
|
+
id,
|
|
178
|
+
disabled,
|
|
179
|
+
className: switchVariants({
|
|
180
|
+
className,
|
|
181
|
+
size,
|
|
182
|
+
variant: switchVariant
|
|
183
|
+
}),
|
|
184
|
+
children: /* @__PURE__ */ jsx(Thumb, { className: thumbVariants({
|
|
185
|
+
size,
|
|
186
|
+
variant: switchVariant
|
|
187
|
+
}) })
|
|
188
|
+
});
|
|
189
|
+
if (!children) return switchElement;
|
|
190
|
+
return /* @__PURE__ */ jsxs(FieldBox, {
|
|
191
|
+
htmlFor: id,
|
|
192
|
+
variant,
|
|
193
|
+
position,
|
|
194
|
+
control: switchElement,
|
|
195
|
+
children: [/* @__PURE__ */ jsx(FieldBox.Title, { children }), description && /* @__PURE__ */ jsx(FieldBox.Description, { children: description })]
|
|
196
|
+
});
|
|
197
|
+
};
|
|
198
|
+
//#endregion
|
|
199
|
+
export { Switch };
|
|
200
|
+
|
|
201
|
+
//# sourceMappingURL=Switch-CX2A0v50.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Switch-CX2A0v50.js","names":[],"sources":["../src/components/Switch/styles.ts","../src/components/Switch/Switch.tsx"],"sourcesContent":["import { cva } from 'class-variance-authority';\n\nexport const switchVariants = cva(\n [\n 'tailwindcss-preflight',\n 'tw:shrink-0',\n 'tw:cursor-pointer',\n 'tw:disabled:cursor-not-allowed',\n 'tw:disabled:opacity-50',\n ],\n {\n defaultVariants: {\n size: 'medium',\n variant: 'default',\n },\n variants: {\n variant: {\n default: [\n 'tw:peer/switch',\n 'tw:group/switch',\n 'tw:relative',\n\n // positioning\n 'tw:flex',\n 'tw:items-center',\n 'tw:gap-2',\n\n 'tw:min-h-5',\n\n // label\n 'tw:text-neutral-800',\n 'tw:font-normal',\n\n // before pseudo element\n 'tw:before:content-[\" \"]',\n 'tw:before:block',\n 'tw:before:relative',\n\n // color\n 'tw:aria-checked:before:bg-primary-500',\n 'tw:before:bg-neutral-200',\n\n // hover\n 'tw:aria-checked:before:hover:bg-primary-600',\n 'tw:before:hover:bg-neutral-300',\n\n // disabled\n 'tw:before:disabled:hover:bg-neutral-200',\n\n // others\n 'tw:transition-colors',\n\n 'tw:focus-visible:outline-hidden',\n 'tw:before:focus-visible:outline',\n 'tw:before:focus-visible:outline-1',\n 'tw:before:focus-visible:outline-ring',\n 'tw:before:focus-visible:ring-4',\n 'tw:before:focus-visible:ring-ring/30',\n ],\n argo: [\n 'tw:peer',\n 'tw:inline-flex',\n 'tw:items-center',\n\n // track\n 'tw:w-9',\n 'tw:h-5',\n 'tw:rounded-full',\n 'tw:border',\n 'tw:border-transparent',\n 'tw:bg-input',\n 'tw:transition-colors',\n\n // checked\n 'tw:data-[state=checked]:bg-primary',\n\n // focus\n 'tw:focus-visible:outline-hidden',\n 'tw:focus-visible:border-primary',\n 'tw:focus-visible:ring-3',\n 'tw:focus-visible:ring-ring/50',\n ],\n },\n size: {\n small: [],\n medium: [],\n large: [],\n },\n },\n compoundVariants: [\n {\n variant: 'default',\n size: 'small',\n class: ['tw:before:w-6', 'tw:before:h-4', 'tw:before:rounded-lg'],\n },\n {\n variant: 'default',\n size: 'medium',\n class: ['tw:before:w-8', 'tw:before:h-4', 'tw:before:rounded-lg'],\n },\n {\n variant: 'default',\n size: 'large',\n class: ['tw:before:w-10', 'tw:before:h-5', 'tw:before:rounded-xl'],\n },\n ],\n },\n);\n\nexport const thumbVariants = cva(\n ['tw:block', 'tw:shrink-0', 'tw:pointer-events-none', 'tw:bg-white', 'tw:rounded-full'],\n {\n defaultVariants: {\n size: 'medium',\n variant: 'default',\n },\n variants: {\n variant: {\n default: [\n 'tw:absolute',\n 'tw:left-0',\n 'tw:transition-transform',\n 'tw:ease-in-out',\n 'tw:shadow-[0_2px_5px_rgba(0,0,0,.26)]',\n ],\n argo: [\n 'tw:size-4',\n 'tw:shadow-sm',\n 'tw:transition-transform',\n 'tw:data-[state=checked]:translate-x-[16px]',\n 'tw:data-[state=unchecked]:translate-x-0.5',\n ],\n },\n size: {\n small: [],\n medium: [],\n large: [],\n },\n },\n compoundVariants: [\n {\n variant: 'default',\n size: 'small',\n class: [\n 'tw:w-3',\n 'tw:h-3',\n 'tw:data-[state=checked]:translate-x-2.5',\n 'tw:data-[state=unchecked]:translate-x-0.5',\n ],\n },\n {\n variant: 'default',\n size: 'medium',\n class: [\n 'tw:w-3',\n 'tw:h-3',\n 'tw:data-[state=checked]:translate-x-[18px]',\n 'tw:data-[state=unchecked]:translate-x-0.5',\n ],\n },\n {\n variant: 'default',\n size: 'large',\n class: [\n 'tw:w-3.5',\n 'tw:h-3.5',\n 'tw:data-[state=checked]:translate-x-6',\n 'tw:data-[state=unchecked]:translate-x-0.5',\n ],\n },\n ],\n },\n);\n","import { useId } from 'react';\nimport type { ComponentProps, ReactNode } from 'react';\nimport { Root, Thumb } from '@radix-ui/react-switch';\nimport type { VariantProps } from 'class-variance-authority';\n\nimport { FieldBox } from '../FieldBox';\nimport type { fieldBoxVariants } from '../FieldBox/styles';\nimport { useArgoDesign } from '../ThemeProvider/context';\n\nimport { switchVariants, thumbVariants } from './styles';\n\ntype Props = {\n id?: string | number;\n children?: ReactNode;\n description?: ReactNode;\n variant?: VariantProps<typeof fieldBoxVariants>['variant'];\n position?: 'start' | 'end';\n} & Omit<ComponentProps<typeof Root>, 'asChild' | 'id'> &\n Omit<VariantProps<typeof switchVariants>, 'variant'>;\n\nexport const Switch = ({\n ref,\n className,\n size,\n disabled = false,\n id: idProp,\n children,\n description,\n variant,\n position,\n ...props\n}: Props) => {\n const fallbackId = useId();\n const id = idProp?.toString() ?? fallbackId;\n const switchVariant = useArgoDesign() ? 'argo' : 'default';\n\n const switchElement = (\n <Root\n {...props}\n ref={ref}\n id={id}\n disabled={disabled}\n className={switchVariants({ className, size, variant: switchVariant })}\n >\n <Thumb className={thumbVariants({ size, variant: switchVariant })} />\n </Root>\n );\n\n if (!children) return switchElement;\n\n return (\n <FieldBox htmlFor={id} variant={variant} position={position} control={switchElement}>\n <FieldBox.Title>{children}</FieldBox.Title>\n {description && <FieldBox.Description>{description}</FieldBox.Description>}\n </FieldBox>\n );\n};\n"],"mappings":";;;;;;;AAEA,MAAa,iBAAiB,IAC5B;CACE;CACA;CACA;CACA;CACA;AACF,GACA;CACE,iBAAiB;EACf,MAAM;EACN,SAAS;CACX;CACA,UAAU;EACR,SAAS;GACP,SAAS;IACP;IACA;IACA;IAGA;IACA;IACA;IAEA;IAGA;IACA;IAGA;IACA;IACA;IAGA;IACA;IAGA;IACA;IAGA;IAGA;IAEA;IACA;IACA;IACA;IACA;IACA;GACF;GACA,MAAM;IACJ;IACA;IACA;IAGA;IACA;IACA;IACA;IACA;IACA;IACA;IAGA;IAGA;IACA;IACA;IACA;GACF;EACF;EACA,MAAM;GACJ,OAAO,CAAC;GACR,QAAQ,CAAC;GACT,OAAO,CAAC;EACV;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