@keboola/design 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +83 -0
- package/package.json +151 -0
- package/src/blocks/AIKit/AnswerSummary.stories.tsx +38 -0
- package/src/blocks/AIKit/AnswerSummary.tsx +63 -0
- package/src/blocks/AIKit/CollapsibleStepHeader.stories.tsx +53 -0
- package/src/blocks/AIKit/CollapsibleStepHeader.tsx +65 -0
- package/src/blocks/AIKit/InlineStepDetail.stories.tsx +25 -0
- package/src/blocks/AIKit/InlineStepDetail.tsx +13 -0
- package/src/blocks/AIKit/InlineStepLabel.stories.tsx +37 -0
- package/src/blocks/AIKit/InlineStepLabel.tsx +36 -0
- package/src/blocks/AIKit/MessageBubble.stories.tsx +137 -0
- package/src/blocks/AIKit/MessageBubble.tsx +68 -0
- package/src/blocks/AIKit/PlanApproval.stories.tsx +121 -0
- package/src/blocks/AIKit/PlanApproval.test.tsx +241 -0
- package/src/blocks/AIKit/PlanApproval.tsx +345 -0
- package/src/blocks/AIKit/PlanRewritingIndicator.test.tsx +17 -0
- package/src/blocks/AIKit/PlanRewritingIndicator.tsx +20 -0
- package/src/blocks/AIKit/PromptInput.stories.tsx +98 -0
- package/src/blocks/AIKit/PromptInput.tsx +218 -0
- package/src/blocks/AIKit/PromptInputAction.tsx +18 -0
- package/src/blocks/AIKit/PromptInputSubmit.tsx +55 -0
- package/src/blocks/AIKit/Question.stories.tsx +235 -0
- package/src/blocks/AIKit/Question.tsx +323 -0
- package/src/blocks/AIKit/QuestionBlock.stories.tsx +99 -0
- package/src/blocks/AIKit/QuestionBlock.tsx +83 -0
- package/src/blocks/AIKit/SuggestedPrompt.stories.tsx +88 -0
- package/src/blocks/AIKit/SuggestedPrompt.tsx +35 -0
- package/src/blocks/AIKit/ThinkingIndicator.stories.tsx +21 -0
- package/src/blocks/AIKit/ThinkingIndicator.tsx +14 -0
- package/src/blocks/AIKit/index.ts +12 -0
- package/src/blocks/AutoSaveTextarea/AutoSaveTextarea.stories.tsx +78 -0
- package/src/blocks/AutoSaveTextarea/AutoSaveTextarea.tsx +103 -0
- package/src/blocks/AutoSaveTextarea/index.ts +1 -0
- package/src/blocks/ClipboardButton/ClipboardButton.stories.tsx +28 -0
- package/src/blocks/ClipboardButton/ClipboardButton.tsx +41 -0
- package/src/blocks/ClipboardButton/ClipboardInline.tsx +41 -0
- package/src/blocks/ClipboardButton/index.ts +2 -0
- package/src/blocks/ColorInput/ColorInput.stories.tsx +109 -0
- package/src/blocks/ColorInput/ColorInput.test.tsx +163 -0
- package/src/blocks/ColorInput/ColorInput.tsx +169 -0
- package/src/blocks/ColorInput/ColorPicker.tsx +39 -0
- package/src/blocks/ColorInput/index.ts +1 -0
- package/src/blocks/ColorInput/utils.test.ts +189 -0
- package/src/blocks/ColorInput/utils.ts +74 -0
- package/src/blocks/EmptyConfigurationActionCard/EmptyConfigurationActionCard.stories.tsx +30 -0
- package/src/blocks/EmptyConfigurationActionCard/EmptyConfigurationActionCard.tsx +20 -0
- package/src/blocks/EmptyConfigurationActionCard/index.ts +1 -0
- package/src/blocks/EmptyState/EmptyState.stories.tsx +93 -0
- package/src/blocks/EmptyState/EmptyState.tsx +130 -0
- package/src/blocks/EmptyState/index.ts +1 -0
- package/src/blocks/ErrorState/ErrorState.stories.tsx +125 -0
- package/src/blocks/ErrorState/ErrorState.tsx +132 -0
- package/src/blocks/ErrorState/index.ts +1 -0
- package/src/blocks/Form/components/FormBody.tsx +27 -0
- package/src/blocks/Form/components/SubmitButton.tsx +30 -0
- package/src/blocks/Form/connectors/CheckboxField.tsx +34 -0
- package/src/blocks/Form/connectors/FieldShell.tsx +46 -0
- package/src/blocks/Form/connectors/NumberField.tsx +36 -0
- package/src/blocks/Form/connectors/PasswordField.tsx +38 -0
- package/src/blocks/Form/connectors/SelectField.tsx +73 -0
- package/src/blocks/Form/connectors/SwitchField.tsx +34 -0
- package/src/blocks/Form/connectors/TextAreaField.tsx +36 -0
- package/src/blocks/Form/connectors/TextField.tsx +36 -0
- package/src/blocks/Form/contexts.ts +4 -0
- package/src/blocks/Form/formHook.ts +30 -0
- package/src/blocks/Form/index.ts +2 -0
- package/src/blocks/Form/setServerFieldErrors.test.ts +38 -0
- package/src/blocks/Form/setServerFieldErrors.ts +21 -0
- package/src/blocks/MermaidDiagram/MermaidDiagram.stories.tsx +87 -0
- package/src/blocks/MermaidDiagram/MermaidDiagram.tsx +266 -0
- package/src/blocks/MermaidDiagram/index.ts +1 -0
- package/src/blocks/MultiActionButtonGroup/MultiActionButton.stories.tsx +118 -0
- package/src/blocks/MultiActionButtonGroup/MultiActionButton.tsx +40 -0
- package/src/blocks/MultiActionButtonGroup/MultiActionButtonGroup.tsx +16 -0
- package/src/blocks/MultiActionButtonGroup/index.ts +1 -0
- package/src/blocks/MultiCombobox/MultiCombobox.stories.tsx +324 -0
- package/src/blocks/MultiCombobox/MultiCombobox.tsx +241 -0
- package/src/blocks/MultiCombobox/index.ts +1 -0
- package/src/blocks/NumberInput/NumberInput.stories.tsx +112 -0
- package/src/blocks/NumberInput/NumberInput.test.tsx +148 -0
- package/src/blocks/NumberInput/NumberInput.tsx +89 -0
- package/src/blocks/NumberInput/index.ts +1 -0
- package/src/blocks/PageHeader/AGENTS.md +77 -0
- package/src/blocks/PageHeader/PageHeader.stories.tsx +272 -0
- package/src/blocks/PageHeader/PageHeader.tsx +7 -0
- package/src/blocks/PageHeader/PageHeaderDetail.tsx +62 -0
- package/src/blocks/PageHeader/PageHeaderIndex.tsx +56 -0
- package/src/blocks/PageHeader/index.ts +1 -0
- package/src/blocks/PageHeader/styles.ts +6 -0
- package/src/blocks/PageLayout/AGENTS.md +94 -0
- package/src/blocks/PageLayout/PageLayout.stories.tsx +143 -0
- package/src/blocks/PageLayout/PageLayout.tsx +130 -0
- package/src/blocks/PageLayout/index.ts +1 -0
- package/src/blocks/PasswordInput/PasswordInput.stories.tsx +114 -0
- package/src/blocks/PasswordInput/PasswordInput.test.tsx +219 -0
- package/src/blocks/PasswordInput/PasswordInput.tsx +180 -0
- package/src/blocks/PasswordInput/index.ts +1 -0
- package/src/blocks/SearchInput/SearchInput.stories.tsx +127 -0
- package/src/blocks/SearchInput/SearchInput.test.tsx +162 -0
- package/src/blocks/SearchInput/SearchInput.tsx +146 -0
- package/src/blocks/SearchInput/index.ts +1 -0
- package/src/blocks/SearchInputWithNavigation/SearchInputWithNavigation.stories.tsx +73 -0
- package/src/blocks/SearchInputWithNavigation/SearchInputWithNavigation.tsx +89 -0
- package/src/blocks/SearchInputWithNavigation/index.ts +1 -0
- package/src/blocks/SplitButton/SplitButton.stories.tsx +88 -0
- package/src/blocks/SplitButton/SplitButton.tsx +68 -0
- package/src/blocks/SplitButton/index.ts +1 -0
- package/src/blocks/Tagger/TagItem.tsx +29 -0
- package/src/blocks/Tagger/TagSelectPopover/TagSelectCreateItem.tsx +42 -0
- package/src/blocks/Tagger/TagSelectPopover/TagSelectItem.tsx +31 -0
- package/src/blocks/Tagger/TagSelectPopover/TagSelectList.tsx +67 -0
- package/src/blocks/Tagger/TagSelectPopover/TagSelectPopover.tsx +34 -0
- package/src/blocks/Tagger/TagSelectPopover/TagSelectValue.tsx +47 -0
- package/src/blocks/Tagger/TagSelectPopover/index.ts +1 -0
- package/src/blocks/Tagger/Tagger.stories.tsx +80 -0
- package/src/blocks/Tagger/Tagger.tsx +101 -0
- package/src/blocks/Tagger/index.ts +1 -0
- package/src/blocks/Tagger/types.ts +11 -0
- package/src/blocks/Textarea/Textarea.stories.tsx +47 -0
- package/src/blocks/Textarea/Textarea.tsx +50 -0
- package/src/blocks/Textarea/index.ts +1 -0
- package/src/components/Alert/Alert.stories.tsx +93 -0
- package/src/components/Alert/Alert.tsx +103 -0
- package/src/components/Alert/AlertAction.tsx +31 -0
- package/src/components/Alert/AlertCollapsibleIcon.tsx +26 -0
- package/src/components/Alert/AlertDescription.tsx +31 -0
- package/src/components/Alert/AlertIcon.tsx +43 -0
- package/src/components/Alert/AlertRoot.tsx +64 -0
- package/src/components/Alert/AlertTitle.tsx +25 -0
- package/src/components/Alert/index.ts +1 -0
- package/src/components/Avatar.stories.tsx +22 -0
- package/src/components/Avatar.tsx +88 -0
- package/src/components/Badge/Badge.stories.tsx +106 -0
- package/src/components/Badge/Badge.tsx +55 -0
- package/src/components/Badge/BadgeAddon.tsx +63 -0
- package/src/components/Badge/BadgeButton.tsx +39 -0
- package/src/components/Badge/BadgeLabel.tsx +37 -0
- package/src/components/Badge/BadgeRoot.tsx +21 -0
- package/src/components/Badge/index.ts +1 -0
- package/src/components/Badge/styles.ts +74 -0
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +135 -0
- package/src/components/Breadcrumb/Breadcrumb.tsx +23 -0
- package/src/components/Breadcrumb/BreadcrumbEllipsis.tsx +43 -0
- package/src/components/Breadcrumb/BreadcrumbItem.tsx +9 -0
- package/src/components/Breadcrumb/BreadcrumbLink.tsx +48 -0
- package/src/components/Breadcrumb/BreadcrumbList.tsx +26 -0
- package/src/components/Breadcrumb/BreadcrumbPage.tsx +22 -0
- package/src/components/Breadcrumb/BreadcrumbSeparator.tsx +28 -0
- package/src/components/Breadcrumb/index.ts +1 -0
- package/src/components/Button/Button.stories.tsx +68 -0
- package/src/components/Button/Button.tsx +73 -0
- package/src/components/Button/ButtonInline.stories.tsx +54 -0
- package/src/components/Button/ButtonInline.tsx +73 -0
- package/src/components/Button/index.ts +3 -0
- package/src/components/Button/styles.ts +292 -0
- package/src/components/ButtonGroup/ButtonGroup.stories.tsx +118 -0
- package/src/components/ButtonGroup/ButtonGroup.tsx +79 -0
- package/src/components/ButtonGroup/index.ts +1 -0
- package/src/components/Calendar/Calendar.stories.tsx +101 -0
- package/src/components/Calendar/Calendar.tsx +44 -0
- package/src/components/Calendar/index.ts +2 -0
- package/src/components/Card/Card.stories.tsx +60 -0
- package/src/components/Card/Card.tsx +25 -0
- package/src/components/Card/CardContent.tsx +5 -0
- package/src/components/Card/CardHeader.tsx +5 -0
- package/src/components/Card/CardTitle.tsx +13 -0
- package/src/components/Card/index.ts +1 -0
- package/src/components/Card/styles.ts +32 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +210 -0
- package/src/components/Checkbox/Checkbox.test.tsx +140 -0
- package/src/components/Checkbox/Checkbox.tsx +86 -0
- package/src/components/Checkbox/index.ts +1 -0
- package/src/components/Checkbox/styles.ts +77 -0
- package/src/components/Clipboard/Clipboard.stories.tsx +44 -0
- package/src/components/Clipboard/Clipboard.tsx +89 -0
- package/src/components/Clipboard/index.ts +1 -0
- package/src/components/CodeEditor/ButtonToolbar.tsx +14 -0
- package/src/components/CodeEditor/CodeEditor.tsx +155 -0
- package/src/components/CodeEditor/SqlEditor.stories.tsx +76 -0
- package/src/components/CodeEditor/SqlEditor.tsx +206 -0
- package/src/components/CodeEditor/ToggleComponentHelp.tsx +7 -0
- package/src/components/CodeEditor/activeQueryHighlight.test.ts +178 -0
- package/src/components/CodeEditor/activeQueryHighlight.ts +245 -0
- package/src/components/CodeEditor/helpers.ts +100 -0
- package/src/components/CodeEditor/highlighting.ts +184 -0
- package/src/components/CodeEditor/index.ts +3 -0
- package/src/components/CodeEditor/search.ts +186 -0
- package/src/components/Collapse.stories.tsx +56 -0
- package/src/components/Collapse.tsx +61 -0
- package/src/components/Collapsible/Collapsible.stories.tsx +55 -0
- package/src/components/Collapsible/Collapsible.tsx +11 -0
- package/src/components/Collapsible/CollapsibleContent.tsx +25 -0
- package/src/components/Collapsible/index.ts +1 -0
- package/src/components/CollapsiblePanel.stories.tsx +25 -0
- package/src/components/CollapsiblePanel.tsx +130 -0
- package/src/components/Combobox/Combobox.stories.tsx +426 -0
- package/src/components/Combobox/Combobox.test.tsx +165 -0
- package/src/components/Combobox/Combobox.tsx +347 -0
- package/src/components/Combobox/ComboboxChips.tsx +63 -0
- package/src/components/Combobox/ComboboxContent.tsx +95 -0
- package/src/components/Combobox/ComboboxEmpty.tsx +30 -0
- package/src/components/Combobox/ComboboxInput.tsx +10 -0
- package/src/components/Combobox/ComboboxInputGroup.tsx +38 -0
- package/src/components/Combobox/ComboboxItem.tsx +71 -0
- package/src/components/Combobox/ComboboxItemIndicator.tsx +76 -0
- package/src/components/Combobox/ComboboxList.tsx +32 -0
- package/src/components/Combobox/ComboboxRoot.tsx +5 -0
- package/src/components/Combobox/ComboboxSeparator.tsx +20 -0
- package/src/components/Combobox/Group/ComboboxCollection.tsx +7 -0
- package/src/components/Combobox/Group/ComboboxGroup.tsx +23 -0
- package/src/components/Combobox/Group/ComboboxGroupLabel.tsx +38 -0
- package/src/components/Combobox/Group/index.ts +3 -0
- package/src/components/Combobox/index.ts +1 -0
- package/src/components/Combobox/types.ts +26 -0
- package/src/components/Combobox/utils.test.ts +95 -0
- package/src/components/Combobox/utils.ts +103 -0
- package/src/components/Command/Command.stories.tsx +376 -0
- package/src/components/Command/Command.tsx +37 -0
- package/src/components/Command/CommandContent.tsx +19 -0
- package/src/components/Command/CommandEmpty.tsx +6 -0
- package/src/components/Command/CommandGroup.tsx +26 -0
- package/src/components/Command/CommandInput.tsx +27 -0
- package/src/components/Command/CommandItem/CheckIndicator.tsx +74 -0
- package/src/components/Command/CommandItem/CommandItem.tsx +91 -0
- package/src/components/Command/CommandItem/index.ts +1 -0
- package/src/components/Command/CommandList.tsx +32 -0
- package/src/components/Command/CommandSeparator.tsx +13 -0
- package/src/components/Command/index.ts +6 -0
- package/src/components/DatePicker/DatePicker.tsx +37 -0
- package/src/components/DatePicker/index.ts +1 -0
- package/src/components/DiffView/DiffView.stories.tsx +80 -0
- package/src/components/DiffView/DiffView.tsx +131 -0
- package/src/components/DiffView/DiffViewMark.tsx +21 -0
- package/src/components/DiffView/DiffViewTd.tsx +84 -0
- package/src/components/DiffView/DiffViewTh.tsx +23 -0
- package/src/components/DiffView/index.ts +11 -0
- package/src/components/DiffView/util.test.ts +231 -0
- package/src/components/DiffView/util.ts +311 -0
- package/src/components/DotsLoader.tsx +22 -0
- package/src/components/DropdownMenu/DropdownMenu.stories.tsx +306 -0
- package/src/components/DropdownMenu/DropdownMenu.tsx +61 -0
- package/src/components/DropdownMenu/DropdownMenuCheckboxItem.tsx +52 -0
- package/src/components/DropdownMenu/DropdownMenuContent.tsx +52 -0
- package/src/components/DropdownMenu/DropdownMenuContext.tsx +13 -0
- package/src/components/DropdownMenu/DropdownMenuItem.tsx +74 -0
- package/src/components/DropdownMenu/DropdownMenuItemDescription.tsx +42 -0
- package/src/components/DropdownMenu/DropdownMenuItemIndicator.tsx +98 -0
- package/src/components/DropdownMenu/DropdownMenuLabel.tsx +21 -0
- package/src/components/DropdownMenu/DropdownMenuRadioGroup/DropdownMenuRadioGroup.tsx +31 -0
- package/src/components/DropdownMenu/DropdownMenuRadioGroup/DropdownMenuRadioItem.tsx +64 -0
- package/src/components/DropdownMenu/DropdownMenuRadioGroup/index.ts +2 -0
- package/src/components/DropdownMenu/DropdownMenuSeparator.tsx +35 -0
- package/src/components/DropdownMenu/DropdownMenuSub/DropdownMenuSub.tsx +3 -0
- package/src/components/DropdownMenu/DropdownMenuSub/DropdownMenuSubContent.tsx +21 -0
- package/src/components/DropdownMenu/DropdownMenuSub/DropdownMenuSubTrigger.tsx +17 -0
- package/src/components/DropdownMenu/DropdownMenuSub/index.ts +3 -0
- package/src/components/DropdownMenu/DropdownMenuTrigger.tsx +19 -0
- package/src/components/DropdownMenu/ItemIcon.tsx +22 -0
- package/src/components/DropdownMenu/index.ts +1 -0
- package/src/components/DropdownMenu/styles.ts +82 -0
- package/src/components/EmptySearchContent.stories.tsx +12 -0
- package/src/components/EmptySearchContent.tsx +13 -0
- package/src/components/FieldBox/FieldBox.stories.tsx +138 -0
- package/src/components/FieldBox/FieldBox.tsx +43 -0
- package/src/components/FieldBox/FieldBoxDescription.tsx +18 -0
- package/src/components/FieldBox/FieldBoxTitle.tsx +20 -0
- package/src/components/FieldBox/index.ts +1 -0
- package/src/components/FieldBox/styles.ts +37 -0
- package/src/components/FormGroup/FormGroup.stories.tsx +120 -0
- package/src/components/FormGroup/FormGroup.tsx +33 -0
- package/src/components/FormGroup/FormGroupColorInput.tsx +15 -0
- package/src/components/FormGroup/FormGroupHelp.tsx +17 -0
- package/src/components/FormGroup/FormGroupNumberInput.tsx +15 -0
- package/src/components/FormGroup/FormGroupTextInput.tsx +15 -0
- package/src/components/FormGroup/FormGroupTextarea.tsx +12 -0
- package/src/components/FormGroup/context.ts +11 -0
- package/src/components/FormGroup/index.ts +2 -0
- package/src/components/FormGroup/types.ts +5 -0
- package/src/components/FullScreenModal/FullScreenModal.tsx +8 -0
- package/src/components/FullScreenModal/FullScreenModalBody.tsx +16 -0
- package/src/components/FullScreenModal/FullScreenModalHeader.tsx +89 -0
- package/src/components/FullScreenModal/FullScreenModalRoot.tsx +79 -0
- package/src/components/FullScreenModal/index.ts +3 -0
- package/src/components/HelpBlock/HelpBlock.stories.tsx +28 -0
- package/src/components/HelpBlock/HelpBlock.tsx +31 -0
- package/src/components/HelpBlock/index.ts +1 -0
- package/src/components/HoverCard/HoverCard.stories.tsx +77 -0
- package/src/components/HoverCard/HoverCard.tsx +13 -0
- package/src/components/HoverCard/HoverCardContent.tsx +63 -0
- package/src/components/HoverCard/index.ts +1 -0
- package/src/components/Icon/Icon.stories.tsx +26 -0
- package/src/components/Icon/Icon.tsx +10 -0
- package/src/components/Icon/Icons.mdx +28 -0
- package/src/components/Icon/constants.ts +1 -0
- package/src/components/Icon/index.ts +27 -0
- package/src/components/Input/DateInput/DateInput.stories.tsx +58 -0
- package/src/components/Input/DateInput/DateInput.tsx +140 -0
- package/src/components/Input/DateInput/helpers.test.ts +102 -0
- package/src/components/Input/DateInput/helpers.ts +59 -0
- package/src/components/Input/DateInput/index.ts +1 -0
- package/src/components/Input/DateRangeInput/DateRangeInput.stories.tsx +66 -0
- package/src/components/Input/DateRangeInput/DateRangeInput.tsx +141 -0
- package/src/components/Input/DateRangeInput/helpers.test.ts +146 -0
- package/src/components/Input/DateRangeInput/helpers.ts +36 -0
- package/src/components/Input/DateRangeInput/index.ts +1 -0
- package/src/components/Input/Input.stories.tsx +93 -0
- package/src/components/Input/Input.test.tsx +112 -0
- package/src/components/Input/Input.tsx +147 -0
- package/src/components/Input/TextInput/TextInput.stories.tsx +68 -0
- package/src/components/Input/TextInput/TextInput.test.tsx +52 -0
- package/src/components/Input/TextInput/TextInput.tsx +57 -0
- package/src/components/Input/TextInput/index.ts +1 -0
- package/src/components/Input/TimeInput/TimeInput.stories.tsx +89 -0
- package/src/components/Input/TimeInput/TimeInput.tsx +103 -0
- package/src/components/Input/TimeInput/index.ts +1 -0
- package/src/components/Input/index.ts +4 -0
- package/src/components/Input/utils.ts +11 -0
- package/src/components/InputGroup/InputGroup.stories.tsx +208 -0
- package/src/components/InputGroup/InputGroup.tsx +228 -0
- package/src/components/InputGroup/InputGroupAddon.tsx +46 -0
- package/src/components/InputGroup/InputGroupButton.tsx +25 -0
- package/src/components/InputGroup/InputGroupInput.tsx +34 -0
- package/src/components/InputGroup/InputGroupText.tsx +21 -0
- package/src/components/InputGroup/InputGroupTextArea.tsx +78 -0
- package/src/components/InputGroup/index.ts +1 -0
- package/src/components/Kbd/Kbd.stories.tsx +82 -0
- package/src/components/Kbd/Kbd.tsx +17 -0
- package/src/components/Kbd/KbdGroup.tsx +35 -0
- package/src/components/Kbd/KbdSeparator.tsx +9 -0
- package/src/components/Kbd/index.ts +3 -0
- package/src/components/Kbd/keyboardKeys.ts +40 -0
- package/src/components/Kbd/styles.ts +39 -0
- package/src/components/Label/Label.stories.tsx +53 -0
- package/src/components/Label/Label.tsx +31 -0
- package/src/components/Label/index.ts +1 -0
- package/src/components/Link.stories.tsx +19 -0
- package/src/components/Link.tsx +37 -0
- package/src/components/MarkdownEditor/MarkdownEditor.stories.tsx +120 -0
- package/src/components/MarkdownEditor/MarkdownEditor.test.ts +171 -0
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +155 -0
- package/src/components/MarkdownEditor/context.ts +10 -0
- package/src/components/MarkdownEditor/index.ts +1 -0
- package/src/components/MarkdownEditor/nodes/ImageNode.tsx +115 -0
- package/src/components/MarkdownEditor/nodes/ImageNodeComponent.tsx +18 -0
- package/src/components/MarkdownEditor/nodes/MermaidNode.tsx +72 -0
- package/src/components/MarkdownEditor/nodes/MermaidNodeComponent.tsx +35 -0
- package/src/components/MarkdownEditor/plugins/ImagePastePlugin.tsx +149 -0
- package/src/components/MarkdownEditor/plugins/KeyboardPlugin.tsx +37 -0
- package/src/components/MarkdownEditor/plugins/MarkdownSyncPlugin.tsx +56 -0
- package/src/components/MarkdownEditor/plugins/ToolbarPlugin.tsx +274 -0
- package/src/components/MarkdownEditor/plugins/toolbar/AlignmentDropdown.tsx +93 -0
- package/src/components/MarkdownEditor/plugins/toolbar/BlockTypeDropdown.tsx +133 -0
- package/src/components/MarkdownEditor/plugins/toolbar/LinkPanel.tsx +160 -0
- package/src/components/MarkdownEditor/plugins/toolbar/ToolbarButton.tsx +36 -0
- package/src/components/MarkdownEditor/plugins/toolbar/ToolbarDivider.tsx +1 -0
- package/src/components/MarkdownEditor/theme.ts +39 -0
- package/src/components/MarkdownEditor/transformers.ts +179 -0
- package/src/components/MarkedText/MarkedText.stories.tsx +46 -0
- package/src/components/MarkedText/MarkedText.tsx +36 -0
- package/src/components/MarkedText/index.ts +1 -0
- package/src/components/MarkedText/utils.test.ts +193 -0
- package/src/components/MarkedText/utils.ts +37 -0
- package/src/components/MergeEditor/AcceptControls/AcceptButton.tsx +20 -0
- package/src/components/MergeEditor/AcceptControls/AcceptControls.tsx +66 -0
- package/src/components/MergeEditor/ConflictStatus/ConflictStatusIndicator.tsx +38 -0
- package/src/components/MergeEditor/MergeEditor.stories.tsx +211 -0
- package/src/components/MergeEditor/MergeEditor.tsx +116 -0
- package/src/components/MergeEditor/MergePane.tsx +95 -0
- package/src/components/MergeEditor/PaneHeader.tsx +11 -0
- package/src/components/MergeEditor/constants.ts +48 -0
- package/src/components/MergeEditor/decorations.ts +126 -0
- package/src/components/MergeEditor/helpers.test.ts +172 -0
- package/src/components/MergeEditor/helpers.ts +118 -0
- package/src/components/MergeEditor/index.ts +5 -0
- package/src/components/MergeEditor/useMergeDiff.ts +573 -0
- package/src/components/MergeEditor/useScrollSync.ts +79 -0
- package/src/components/Modal/Modal.stories.tsx +678 -0
- package/src/components/Modal/Modal.tsx +23 -0
- package/src/components/Modal/ModalBody.tsx +23 -0
- package/src/components/Modal/ModalCloseIcon.tsx +32 -0
- package/src/components/Modal/ModalContent.tsx +87 -0
- package/src/components/Modal/ModalDescription.tsx +20 -0
- package/src/components/Modal/ModalFooter.tsx +15 -0
- package/src/components/Modal/ModalHeader.tsx +50 -0
- package/src/components/Modal/ModalIcon.tsx +83 -0
- package/src/components/Modal/ModalOverlay.tsx +42 -0
- package/src/components/Modal/ModalTitle.tsx +12 -0
- package/src/components/Modal/index.ts +1 -0
- package/src/components/Navbar/Navbar.stories.tsx +179 -0
- package/src/components/Navbar/Navbar.tsx +80 -0
- package/src/components/Navbar/NavbarContent.tsx +20 -0
- package/src/components/Navbar/NavbarFooter.tsx +11 -0
- package/src/components/Navbar/NavbarHeader.tsx +11 -0
- package/src/components/Navbar/NavbarMenu.tsx +30 -0
- package/src/components/Navbar/NavbarMenuAvatar.tsx +67 -0
- package/src/components/Navbar/NavbarMenuButton.tsx +134 -0
- package/src/components/Navbar/NavbarMenuItem.tsx +9 -0
- package/src/components/Navbar/NavbarMenuItemAdornment.tsx +65 -0
- package/src/components/Navbar/index.ts +1 -0
- package/src/components/Pagination/Pagination.stories.tsx +132 -0
- package/src/components/Pagination/Pagination.tsx +34 -0
- package/src/components/Pagination/PaginationButton.tsx +36 -0
- package/src/components/Pagination/PaginationContent.tsx +12 -0
- package/src/components/Pagination/PaginationEllipsis.tsx +26 -0
- package/src/components/Pagination/PaginationItem.tsx +9 -0
- package/src/components/Pagination/PaginationNext.tsx +19 -0
- package/src/components/Pagination/PaginationPrevious.tsx +11 -0
- package/src/components/Pagination/index.ts +1 -0
- package/src/components/PanelWithDetails.stories.tsx +28 -0
- package/src/components/PanelWithDetails.tsx +66 -0
- package/src/components/Popconfirm/Popconfirm.stories.tsx +365 -0
- package/src/components/Popconfirm/Popconfirm.tsx +82 -0
- package/src/components/Popconfirm/PopconfirmBody.tsx +5 -0
- package/src/components/Popconfirm/PopconfirmCancel.tsx +45 -0
- package/src/components/Popconfirm/PopconfirmConfirm.tsx +57 -0
- package/src/components/Popconfirm/PopconfirmContent.tsx +33 -0
- package/src/components/Popconfirm/PopconfirmFooter.tsx +9 -0
- package/src/components/Popconfirm/PopconfirmTrigger.tsx +22 -0
- package/src/components/Popconfirm/context.ts +19 -0
- package/src/components/Popconfirm/index.ts +1 -0
- package/src/components/Popover/Popover.stories.tsx +85 -0
- package/src/components/Popover/Popover.tsx +15 -0
- package/src/components/Popover/PopoverContent.tsx +99 -0
- package/src/components/Popover/index.ts +1 -0
- package/src/components/Progress/Progress.stories.tsx +67 -0
- package/src/components/Progress/Progress.tsx +45 -0
- package/src/components/Progress/index.ts +1 -0
- package/src/components/RadioGroup/Radio.tsx +67 -0
- package/src/components/RadioGroup/RadioGroup.stories.tsx +300 -0
- package/src/components/RadioGroup/RadioGroup.tsx +64 -0
- package/src/components/RadioGroup/RadioGroupItem.tsx +60 -0
- package/src/components/RadioGroup/RadioGroupItemButton.tsx +79 -0
- package/src/components/RadioGroup/RadioGroupSeparator.tsx +12 -0
- package/src/components/RadioGroup/context.ts +13 -0
- package/src/components/RadioGroup/index.ts +1 -0
- package/src/components/Resizable/Resizable.stories.tsx +50 -0
- package/src/components/Resizable/ResizableHandle.tsx +50 -0
- package/src/components/Resizable/ResizablePanel.tsx +12 -0
- package/src/components/Resizable/ResizablePanelGroup.tsx +19 -0
- package/src/components/Resizable/index.ts +3 -0
- package/src/components/ScrollArea/ScrollArea.stories.tsx +43 -0
- package/src/components/ScrollArea/ScrollArea.tsx +50 -0
- package/src/components/ScrollArea/ScrollBar.tsx +32 -0
- package/src/components/ScrollArea/index.ts +2 -0
- package/src/components/Search/ClearButton.tsx +42 -0
- package/src/components/Search/Search.stories.tsx +77 -0
- package/src/components/Search/Search.test.tsx +224 -0
- package/src/components/Search/Search.tsx +139 -0
- package/src/components/Search/SearchForm.tsx +37 -0
- package/src/components/Search/index.ts +2 -0
- package/src/components/Search/styles.ts +88 -0
- package/src/components/Search/utils.ts +11 -0
- package/src/components/Select/Select.stories.tsx +109 -0
- package/src/components/Select/Select.tsx +130 -0
- package/src/components/Select/SelectContent.tsx +101 -0
- package/src/components/Select/SelectGroup.tsx +10 -0
- package/src/components/Select/SelectItem.tsx +71 -0
- package/src/components/Select/SelectLabel.tsx +32 -0
- package/src/components/Select/SelectRoot.tsx +6 -0
- package/src/components/Select/SelectSeparator.tsx +13 -0
- package/src/components/Select/SelectTrigger.tsx +161 -0
- package/src/components/Select/index.ts +1 -0
- package/src/components/Separator/Separator.stories.tsx +41 -0
- package/src/components/Separator/Separator.tsx +84 -0
- package/src/components/Separator/index.ts +1 -0
- package/src/components/Sheet/Sheet.stories.tsx +63 -0
- package/src/components/Sheet/Sheet.tsx +21 -0
- package/src/components/Sheet/SheetBody.tsx +12 -0
- package/src/components/Sheet/SheetContent.tsx +131 -0
- package/src/components/Sheet/SheetFooter.tsx +9 -0
- package/src/components/Sheet/SheetHeader.tsx +39 -0
- package/src/components/Sheet/SheetOverlay.tsx +11 -0
- package/src/components/Sheet/SheetTitle.tsx +12 -0
- package/src/components/Sheet/index.ts +1 -0
- package/src/components/Sidebar/Sidebar.stories.tsx +812 -0
- package/src/components/Sidebar/Sidebar.tsx +225 -0
- package/src/components/Sidebar/SidebarContent.tsx +61 -0
- package/src/components/Sidebar/SidebarFillTrigger.tsx +25 -0
- package/src/components/Sidebar/SidebarFooter.tsx +13 -0
- package/src/components/Sidebar/SidebarGroup/SidebarGroup.tsx +23 -0
- package/src/components/Sidebar/SidebarGroup/SidebarGroupAction.tsx +49 -0
- package/src/components/Sidebar/SidebarGroup/SidebarGroupContent.tsx +20 -0
- package/src/components/Sidebar/SidebarGroup/SidebarGroupLabel.tsx +76 -0
- package/src/components/Sidebar/SidebarGroup/index.ts +4 -0
- package/src/components/Sidebar/SidebarHeader.tsx +20 -0
- package/src/components/Sidebar/SidebarInstanceContext.ts +18 -0
- package/src/components/Sidebar/SidebarMenu/SidebarMenu.tsx +28 -0
- package/src/components/Sidebar/SidebarMenu/SidebarMenuAction.tsx +69 -0
- package/src/components/Sidebar/SidebarMenu/SidebarMenuBadge.tsx +56 -0
- package/src/components/Sidebar/SidebarMenu/SidebarMenuButton.tsx +108 -0
- package/src/components/Sidebar/SidebarMenu/SidebarMenuCard.tsx +107 -0
- package/src/components/Sidebar/SidebarMenu/SidebarMenuIcon.tsx +30 -0
- package/src/components/Sidebar/SidebarMenu/SidebarMenuItem.tsx +9 -0
- package/src/components/Sidebar/SidebarMenu/SidebarMenuSub.tsx +143 -0
- package/src/components/Sidebar/SidebarMenu/SidebarMenuSubItem.tsx +106 -0
- package/src/components/Sidebar/SidebarMenu/SidebarSearchInput.tsx +90 -0
- package/src/components/Sidebar/SidebarMenu/index.ts +10 -0
- package/src/components/Sidebar/SidebarProvider/SidebarProvider.tsx +171 -0
- package/src/components/Sidebar/SidebarProvider/context.ts +35 -0
- package/src/components/Sidebar/SidebarProvider/index.ts +2 -0
- package/src/components/Sidebar/SidebarProvider/useHoverTracking.test.ts +199 -0
- package/src/components/Sidebar/SidebarProvider/useHoverTracking.ts +72 -0
- package/src/components/Sidebar/SidebarProvider/useSidebarState.ts +50 -0
- package/src/components/Sidebar/SidebarProvider/useTransitionPresence.test.ts +179 -0
- package/src/components/Sidebar/SidebarProvider/useTransitionPresence.ts +53 -0
- package/src/components/Sidebar/SidebarResizeHandle.tsx +28 -0
- package/src/components/Sidebar/SidebarSeparator.tsx +15 -0
- package/src/components/Sidebar/SidebarTrigger.tsx +40 -0
- package/src/components/Sidebar/index.ts +3 -0
- package/src/components/Sidebar/types.ts +6 -0
- package/src/components/Sidebar/useResizeSidebar.ts +112 -0
- package/src/components/Sidebar/utils.test.ts +178 -0
- package/src/components/Sidebar/utils.ts +70 -0
- package/src/components/Skeleton/Skeleton.stories.tsx +54 -0
- package/src/components/Skeleton/Skeleton.tsx +54 -0
- package/src/components/Skeleton/SkeletonList.stories.tsx +11 -0
- package/src/components/Skeleton/SkeletonList.tsx +65 -0
- package/src/components/Slider/Slider.stories.tsx +99 -0
- package/src/components/Slider/Slider.tsx +85 -0
- package/src/components/Slider/SliderThumb.tsx +57 -0
- package/src/components/Slider/SliderTrack.tsx +49 -0
- package/src/components/Slider/index.ts +1 -0
- package/src/components/Slider/useInteracting.test.ts +159 -0
- package/src/components/Slider/useInteracting.ts +64 -0
- package/src/components/Switch/Switch.stories.tsx +177 -0
- package/src/components/Switch/Switch.tsx +58 -0
- package/src/components/Switch/index.ts +1 -0
- package/src/components/Switch/styles.ts +173 -0
- package/src/components/Table/Table.stories.tsx +106 -0
- package/src/components/Table/Table.tsx +51 -0
- package/src/components/Table/TableBody.tsx +22 -0
- package/src/components/Table/TableCell.tsx +7 -0
- package/src/components/Table/TableFooter.tsx +15 -0
- package/src/components/Table/TableHead.tsx +15 -0
- package/src/components/Table/TableHeader.tsx +20 -0
- package/src/components/Table/TableRow.tsx +11 -0
- package/src/components/Table/index.ts +1 -0
- package/src/components/Tabs.stories.tsx +123 -0
- package/src/components/Tabs.tsx +111 -0
- package/src/components/ThemeProvider/AIGradientSvg.tsx +18 -0
- package/src/components/ThemeProvider/ThemeProvider.tsx +25 -0
- package/src/components/ThemeProvider/index.ts +1 -0
- package/src/components/TimePicker/TimePicker.tsx +95 -0
- package/src/components/TimePicker/TimePickerButton.tsx +39 -0
- package/src/components/TimePicker/index.ts +1 -0
- package/src/components/TimePicker/utils.ts +31 -0
- package/src/components/Timeline/Timeline.stories.tsx +246 -0
- package/src/components/Timeline/Timeline.tsx +35 -0
- package/src/components/Timeline/TimelineConnector.tsx +154 -0
- package/src/components/Timeline/TimelineContent.tsx +18 -0
- package/src/components/Timeline/TimelineItem.tsx +14 -0
- package/src/components/Timeline/index.ts +1 -0
- package/src/components/Timeline/useLastLineHeight.ts +36 -0
- package/src/components/Toast/Toast.stories.tsx +178 -0
- package/src/components/Toast/ToastAction.tsx +40 -0
- package/src/components/Toast/ToastDescription.tsx +28 -0
- package/src/components/Toast/ToastDismiss.tsx +36 -0
- package/src/components/Toast/ToastDuration.tsx +43 -0
- package/src/components/Toast/ToastRoot.tsx +130 -0
- package/src/components/Toast/ToastTitle.tsx +33 -0
- package/src/components/Toast/Toaster.tsx +25 -0
- package/src/components/Toast/index.ts +3 -0
- package/src/components/Toast/toast.tsx +94 -0
- package/src/components/Toast/useNotification.tsx +33 -0
- package/src/components/Toggle/Toggle.stories.tsx +67 -0
- package/src/components/Toggle/Toggle.tsx +197 -0
- package/src/components/Toggle/index.ts +1 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +82 -0
- package/src/components/Tooltip/Tooltip.tsx +87 -0
- package/src/components/Tooltip/TooltipContent.tsx +90 -0
- package/src/components/Tooltip/TooltipRoot.tsx +12 -0
- package/src/components/Tooltip/TooltipTrigger.tsx +42 -0
- package/src/components/Tooltip/index.ts +1 -0
- package/src/components/Truncated.stories.tsx +72 -0
- package/src/components/Truncated.tsx +78 -0
- package/src/components/ZoomableSvg/ZoomableSvg.stories.tsx +53 -0
- package/src/components/ZoomableSvg/ZoomableSvg.tsx +198 -0
- package/src/components/ZoomableSvg/index.ts +1 -0
- package/src/constants/keyCodes.ts +5 -0
- package/src/docs/Colors.mdx +19 -0
- package/src/docs/Spacing.mdx +35 -0
- package/src/docs/Typography.mdx +63 -0
- package/src/docs/components/Typeset.tsx +35 -0
- package/src/hooks/useAutosizeInput.stories.tsx +142 -0
- package/src/hooks/useAutosizeInput.test.tsx +77 -0
- package/src/hooks/useAutosizeInput.tsx +107 -0
- package/src/hooks/useElement.ts +16 -0
- package/src/hooks/useScrollbarPosition.ts +68 -0
- package/src/icon-names.ts +20 -0
- package/src/index.ts +87 -0
- package/src/styles.css +212 -0
- package/src/utils/classNames.test.ts +16 -0
- package/src/utils/classNames.ts +27 -0
- package/src/utils/copyToClipboard.ts +3 -0
- package/src/utils/createChangeInputEvent.ts +28 -0
- package/src/utils/createPrefixedString.ts +2 -0
- package/src/utils/debounce.test.ts +63 -0
- package/src/utils/debounce.ts +17 -0
- package/src/utils/decorators.tsx +16 -0
- package/src/utils/escapeStringRegexp.ts +4 -0
- package/src/utils/index.ts +11 -0
- package/src/utils/isMac.ts +26 -0
- package/src/utils/mergeRefs.ts +23 -0
- package/src/utils/noop.ts +1 -0
- package/src/utils/useSHA256.ts +21 -0
- package/src/vite-env.d.ts +1 -0
|
@@ -0,0 +1,812 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import type { ComponentProps } from 'react';
|
|
3
|
+
import type { Decorator, Meta, StoryObj } from '@storybook/react-vite';
|
|
4
|
+
import type { InputType } from 'storybook/internal/types';
|
|
5
|
+
|
|
6
|
+
import { cn } from '../../utils';
|
|
7
|
+
import { Button } from '../Button';
|
|
8
|
+
import { ButtonGroup } from '../ButtonGroup';
|
|
9
|
+
import { DropdownMenu } from '../DropdownMenu';
|
|
10
|
+
import { Icon } from '../Icon';
|
|
11
|
+
import { Link } from '../Link';
|
|
12
|
+
import { Modal } from '../Modal';
|
|
13
|
+
|
|
14
|
+
import { Sidebar } from './Sidebar';
|
|
15
|
+
import { SidebarProvider, useSidebar } from './SidebarProvider';
|
|
16
|
+
import type { SidebarCollapsible, SidebarMode, SidebarSide, SidebarVariant } from './types';
|
|
17
|
+
|
|
18
|
+
type SidebarProviderDecorator = Decorator<ComponentProps<typeof SidebarProvider>>;
|
|
19
|
+
|
|
20
|
+
const AppContent = ({
|
|
21
|
+
className,
|
|
22
|
+
side,
|
|
23
|
+
...props
|
|
24
|
+
}: ComponentProps<'main'> & { side?: SidebarSide | 'both' }) => {
|
|
25
|
+
const isBoth = side === 'both';
|
|
26
|
+
const isLeft = side === 'left' || isBoth;
|
|
27
|
+
const isRight = side === 'right' || isBoth;
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<main
|
|
31
|
+
{...props}
|
|
32
|
+
className={cn(
|
|
33
|
+
'tw-w-full tw-gap-4 tw-flex tw-flex-col tw-items-center tw-mx-auto tw-p-8 tw-my-2 tw-bg-white tw-rounded-xl tw-shadow-lg',
|
|
34
|
+
className,
|
|
35
|
+
)}
|
|
36
|
+
>
|
|
37
|
+
<h1>Keboola App</h1>
|
|
38
|
+
<div className="tw-flex tw-w-full tw-flex-1 tw-justify-between tw-gap-2">
|
|
39
|
+
{isLeft && (
|
|
40
|
+
<div>
|
|
41
|
+
<h3>Left Controls</h3>
|
|
42
|
+
<ButtonGroup space="compact">
|
|
43
|
+
<Sidebar.Trigger side="left">
|
|
44
|
+
<Button argo icon="sidebar" variant="primary">
|
|
45
|
+
Toggle
|
|
46
|
+
</Button>
|
|
47
|
+
</Sidebar.Trigger>
|
|
48
|
+
|
|
49
|
+
<Sidebar.FillTrigger side="left">
|
|
50
|
+
<Button argo icon="sidebar" variant="secondary">
|
|
51
|
+
Fill
|
|
52
|
+
</Button>
|
|
53
|
+
</Sidebar.FillTrigger>
|
|
54
|
+
</ButtonGroup>
|
|
55
|
+
</div>
|
|
56
|
+
)}
|
|
57
|
+
|
|
58
|
+
{isRight && (
|
|
59
|
+
<div>
|
|
60
|
+
<h3>Right Controls</h3>
|
|
61
|
+
<ButtonGroup space="compact">
|
|
62
|
+
<Sidebar.FillTrigger side="right">
|
|
63
|
+
<Button argo icon="sidebar" variant="secondary">
|
|
64
|
+
Fill
|
|
65
|
+
</Button>
|
|
66
|
+
</Sidebar.FillTrigger>
|
|
67
|
+
|
|
68
|
+
<Sidebar.Trigger side="right">
|
|
69
|
+
<Button argo icon="sidebar" variant="primary">
|
|
70
|
+
Toggle
|
|
71
|
+
</Button>
|
|
72
|
+
</Sidebar.Trigger>
|
|
73
|
+
</ButtonGroup>
|
|
74
|
+
</div>
|
|
75
|
+
)}
|
|
76
|
+
</div>
|
|
77
|
+
</main>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const leftLayoutDecorator: SidebarProviderDecorator = (StoryFn) => (
|
|
82
|
+
<div className="tw-flex tw-flex-1">
|
|
83
|
+
<StoryFn />
|
|
84
|
+
<AppContent side="left" />
|
|
85
|
+
</div>
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
const rightLayoutDecorator: SidebarProviderDecorator = (StoryFn) => (
|
|
89
|
+
<div className="tw-flex tw-flex-1">
|
|
90
|
+
<AppContent side="right" />
|
|
91
|
+
<StoryFn />
|
|
92
|
+
</div>
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
const collapsibleControl: InputType = {
|
|
96
|
+
control: { type: 'radio' },
|
|
97
|
+
options: ['icon', 'off-canvas'] satisfies SidebarCollapsible[],
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const variantControl: InputType = {
|
|
101
|
+
control: { type: 'radio' },
|
|
102
|
+
options: ['sided-floating', 'inset', 'floating'] satisfies SidebarVariant[],
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export default {
|
|
106
|
+
component: SidebarProvider,
|
|
107
|
+
parameters: {
|
|
108
|
+
layout: 'fullscreen',
|
|
109
|
+
},
|
|
110
|
+
args: {
|
|
111
|
+
defaultLeftMode: 'expanded',
|
|
112
|
+
leftVariant: 'sided-floating',
|
|
113
|
+
leftCollapsible: 'icon',
|
|
114
|
+
rightVariant: 'floating',
|
|
115
|
+
rightCollapsible: 'off-canvas',
|
|
116
|
+
},
|
|
117
|
+
argTypes: {
|
|
118
|
+
leftCollapsible: collapsibleControl,
|
|
119
|
+
leftVariant: variantControl,
|
|
120
|
+
rightCollapsible: collapsibleControl,
|
|
121
|
+
rightVariant: variantControl,
|
|
122
|
+
},
|
|
123
|
+
decorators: [
|
|
124
|
+
(StoryFn, context) => (
|
|
125
|
+
<SidebarProvider {...context.args}>
|
|
126
|
+
<div className="tailwindcss-preflight tw-flex tw-h-svh tw-w-svw tw-flex-col tw-bg-neutral-50">
|
|
127
|
+
<StoryFn />
|
|
128
|
+
</div>
|
|
129
|
+
</SidebarProvider>
|
|
130
|
+
),
|
|
131
|
+
],
|
|
132
|
+
} satisfies Meta<typeof SidebarProvider>;
|
|
133
|
+
|
|
134
|
+
const SidebarFillControlMenuButton = ({ side }: { side?: SidebarSide }) => (
|
|
135
|
+
<Sidebar.FillTrigger side={side}>
|
|
136
|
+
<Sidebar.MenuButton
|
|
137
|
+
tooltip="Sidebar Fill Control"
|
|
138
|
+
icon="expand-alt"
|
|
139
|
+
className="!tw-flex-none [&_svg]:tw-text-sidebar-foreground"
|
|
140
|
+
>
|
|
141
|
+
<span className="tw-sr-only">Sidebar Fill Control</span>
|
|
142
|
+
</Sidebar.MenuButton>
|
|
143
|
+
</Sidebar.FillTrigger>
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
const SidebarModeControlMenuButton = ({ side }: { side?: SidebarSide }) => {
|
|
147
|
+
const { mode, setMode } = useSidebar(side);
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<DropdownMenu variant="argo">
|
|
151
|
+
<DropdownMenu.Trigger asChild>
|
|
152
|
+
<Sidebar.MenuButton
|
|
153
|
+
tooltip="Sidebar State Control"
|
|
154
|
+
icon={['far', 'sidebar']}
|
|
155
|
+
className="!tw-flex-none [&_svg]:tw-text-sidebar-foreground"
|
|
156
|
+
>
|
|
157
|
+
<span className="tw-sr-only">Sidebar State Control</span>
|
|
158
|
+
</Sidebar.MenuButton>
|
|
159
|
+
</DropdownMenu.Trigger>
|
|
160
|
+
<DropdownMenu.Content>
|
|
161
|
+
<DropdownMenu.RadioGroup value={mode} onValueChange={setMode}>
|
|
162
|
+
<DropdownMenu.RadioItem closeOnSelect value="collapsed">
|
|
163
|
+
Collapsed
|
|
164
|
+
</DropdownMenu.RadioItem>
|
|
165
|
+
<DropdownMenu.RadioItem closeOnSelect value="expanded">
|
|
166
|
+
Expanded
|
|
167
|
+
</DropdownMenu.RadioItem>
|
|
168
|
+
<DropdownMenu.RadioItem closeOnSelect value="expand-on-hover">
|
|
169
|
+
Expand on Hover
|
|
170
|
+
</DropdownMenu.RadioItem>
|
|
171
|
+
</DropdownMenu.RadioGroup>
|
|
172
|
+
</DropdownMenu.Content>
|
|
173
|
+
</DropdownMenu>
|
|
174
|
+
);
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
type Story = StoryObj<typeof SidebarProvider>;
|
|
178
|
+
|
|
179
|
+
export const Default: Story = {
|
|
180
|
+
render: () => (
|
|
181
|
+
<div className="tw-flex tw-flex-1">
|
|
182
|
+
<Sidebar side="left">
|
|
183
|
+
<Sidebar.Header>
|
|
184
|
+
<Sidebar.Menu>
|
|
185
|
+
<Sidebar.MenuItem>
|
|
186
|
+
<Sidebar.MenuIcon
|
|
187
|
+
icon={['fak', 'keboola']}
|
|
188
|
+
className="!tw-size-8 tw-text-secondary-500"
|
|
189
|
+
/>
|
|
190
|
+
Sticky Header
|
|
191
|
+
</Sidebar.MenuItem>
|
|
192
|
+
</Sidebar.Menu>
|
|
193
|
+
|
|
194
|
+
<Sidebar.SearchInput placeholder="Search" />
|
|
195
|
+
</Sidebar.Header>
|
|
196
|
+
|
|
197
|
+
<Sidebar.Content>
|
|
198
|
+
<Sidebar.Menu>
|
|
199
|
+
<Sidebar.MenuItem>
|
|
200
|
+
<Sidebar.MenuButton tooltip="Dashboard" asChild>
|
|
201
|
+
<Link href="#">
|
|
202
|
+
<Sidebar.MenuIcon icon={['far', 'gauge']} />
|
|
203
|
+
Dashboard
|
|
204
|
+
</Link>
|
|
205
|
+
</Sidebar.MenuButton>
|
|
206
|
+
</Sidebar.MenuItem>
|
|
207
|
+
|
|
208
|
+
<Sidebar.MenuItem>
|
|
209
|
+
<Sidebar.MenuButton tooltip="AI Assistant" asChild>
|
|
210
|
+
<Link href="#">
|
|
211
|
+
<Sidebar.MenuIcon icon={['far', 'sparkles']} />
|
|
212
|
+
AI Assistant
|
|
213
|
+
</Link>
|
|
214
|
+
</Sidebar.MenuButton>
|
|
215
|
+
</Sidebar.MenuItem>
|
|
216
|
+
|
|
217
|
+
<Sidebar.MenuItem>
|
|
218
|
+
<Sidebar.MenuButton tooltip="Flows" asChild>
|
|
219
|
+
<Link href="#">
|
|
220
|
+
<Sidebar.MenuIcon icon={['far', 'bars-staggered']} />
|
|
221
|
+
Flows
|
|
222
|
+
</Link>
|
|
223
|
+
</Sidebar.MenuButton>
|
|
224
|
+
</Sidebar.MenuItem>
|
|
225
|
+
|
|
226
|
+
<Sidebar.MenuItem>
|
|
227
|
+
<Sidebar.MenuButton tooltip="Components" icon={['far', 'layer-group']}>
|
|
228
|
+
Components
|
|
229
|
+
</Sidebar.MenuButton>
|
|
230
|
+
</Sidebar.MenuItem>
|
|
231
|
+
|
|
232
|
+
<Sidebar.MenuItem>
|
|
233
|
+
<Sidebar.MenuButton tooltip="Templates" icon={['far', 'book-open']}>
|
|
234
|
+
Templates
|
|
235
|
+
</Sidebar.MenuButton>
|
|
236
|
+
</Sidebar.MenuItem>
|
|
237
|
+
|
|
238
|
+
<Sidebar.MenuItem>
|
|
239
|
+
<Sidebar.MenuButton tooltip="Data Catalog" icon={['far', 'database']}>
|
|
240
|
+
Data Catalog
|
|
241
|
+
</Sidebar.MenuButton>
|
|
242
|
+
</Sidebar.MenuItem>
|
|
243
|
+
|
|
244
|
+
<Sidebar.MenuItem>
|
|
245
|
+
<Sidebar.MenuButton
|
|
246
|
+
tooltip="Storage"
|
|
247
|
+
icon={['far', 'warehouse']}
|
|
248
|
+
aria-selected={true}
|
|
249
|
+
>
|
|
250
|
+
Storage
|
|
251
|
+
</Sidebar.MenuButton>
|
|
252
|
+
</Sidebar.MenuItem>
|
|
253
|
+
|
|
254
|
+
<Sidebar.MenuItem>
|
|
255
|
+
<Sidebar.MenuButton tooltip="Transformations" icon={['far', 'window-restore']}>
|
|
256
|
+
Transformations
|
|
257
|
+
</Sidebar.MenuButton>
|
|
258
|
+
</Sidebar.MenuItem>
|
|
259
|
+
|
|
260
|
+
<Sidebar.MenuItem>
|
|
261
|
+
<Sidebar.MenuButton tooltip="Workspaces" icon={['far', 'box']}>
|
|
262
|
+
Workspaces
|
|
263
|
+
</Sidebar.MenuButton>
|
|
264
|
+
</Sidebar.MenuItem>
|
|
265
|
+
|
|
266
|
+
<Sidebar.MenuItem>
|
|
267
|
+
<Sidebar.MenuButton tooltip="Jobs" icon={['far', 'key']}>
|
|
268
|
+
Jobs
|
|
269
|
+
</Sidebar.MenuButton>
|
|
270
|
+
</Sidebar.MenuItem>
|
|
271
|
+
</Sidebar.Menu>
|
|
272
|
+
</Sidebar.Content>
|
|
273
|
+
|
|
274
|
+
<Sidebar.Footer>
|
|
275
|
+
<Sidebar.Menu>
|
|
276
|
+
<Sidebar.MenuItem>
|
|
277
|
+
<Sidebar.MenuCard
|
|
278
|
+
icon="clock"
|
|
279
|
+
title="Whats New"
|
|
280
|
+
className="tw-flex tw-flex-col tw-gap-2"
|
|
281
|
+
>
|
|
282
|
+
Our arbitrary content
|
|
283
|
+
<Button>Our Button</Button>
|
|
284
|
+
</Sidebar.MenuCard>
|
|
285
|
+
<Sidebar.MenuBadge>8</Sidebar.MenuBadge>
|
|
286
|
+
</Sidebar.MenuItem>
|
|
287
|
+
|
|
288
|
+
<Sidebar.MenuItem>
|
|
289
|
+
<Sidebar.MenuButton tooltip="Support & Feedback" icon={['far', 'key']}>
|
|
290
|
+
Support & Feedback
|
|
291
|
+
</Sidebar.MenuButton>
|
|
292
|
+
</Sidebar.MenuItem>
|
|
293
|
+
|
|
294
|
+
<Sidebar.Separator />
|
|
295
|
+
<Sidebar.MenuItem>
|
|
296
|
+
<SidebarFillControlMenuButton side="left" />
|
|
297
|
+
</Sidebar.MenuItem>
|
|
298
|
+
|
|
299
|
+
<Sidebar.MenuItem>
|
|
300
|
+
<SidebarModeControlMenuButton side="left" />
|
|
301
|
+
</Sidebar.MenuItem>
|
|
302
|
+
</Sidebar.Menu>
|
|
303
|
+
</Sidebar.Footer>
|
|
304
|
+
</Sidebar>
|
|
305
|
+
|
|
306
|
+
<AppContent side="both" />
|
|
307
|
+
|
|
308
|
+
<Sidebar container side="right">
|
|
309
|
+
<div className="tw-flex tw-flex-col tw-items-center tw-p-4">
|
|
310
|
+
<h1>KAI</h1>
|
|
311
|
+
<Sidebar.FillTrigger side="right">
|
|
312
|
+
<Button block argo icon="sidebar" variant="secondary">
|
|
313
|
+
Fill
|
|
314
|
+
</Button>
|
|
315
|
+
</Sidebar.FillTrigger>
|
|
316
|
+
</div>
|
|
317
|
+
</Sidebar>
|
|
318
|
+
</div>
|
|
319
|
+
),
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
export const Resizable: Story = {
|
|
323
|
+
render: () => {
|
|
324
|
+
const [rightWidth, setRightWidth] = useState(384);
|
|
325
|
+
|
|
326
|
+
return (
|
|
327
|
+
<SidebarProvider
|
|
328
|
+
rightVariant="floating"
|
|
329
|
+
rightCollapsible="off-canvas"
|
|
330
|
+
defaultRightMode="expanded"
|
|
331
|
+
rightWidth={rightWidth}
|
|
332
|
+
onRightWidthChange={setRightWidth}
|
|
333
|
+
>
|
|
334
|
+
<div className="tailwindcss-preflight tw-flex tw-h-svh tw-w-svw tw-bg-neutral-50">
|
|
335
|
+
<AppContent side="right" />
|
|
336
|
+
|
|
337
|
+
<Sidebar container side="right" resizable>
|
|
338
|
+
<div className="tw-flex tw-flex-col tw-items-center tw-gap-4 tw-p-4">
|
|
339
|
+
<h2>Resizable Sidebar</h2>
|
|
340
|
+
<p className="tw-text-sm tw-text-neutral-400">
|
|
341
|
+
Width: {rightWidth}px — Drag left edge to resize
|
|
342
|
+
</p>
|
|
343
|
+
<Sidebar.FillTrigger side="right">
|
|
344
|
+
<Button block argo icon="expand-alt" variant="secondary">
|
|
345
|
+
Fullscreen
|
|
346
|
+
</Button>
|
|
347
|
+
</Sidebar.FillTrigger>
|
|
348
|
+
<Sidebar.Trigger side="right">
|
|
349
|
+
<Button block argo icon="sidebar" variant="outline">
|
|
350
|
+
Collapse
|
|
351
|
+
</Button>
|
|
352
|
+
</Sidebar.Trigger>
|
|
353
|
+
</div>
|
|
354
|
+
</Sidebar>
|
|
355
|
+
</div>
|
|
356
|
+
</SidebarProvider>
|
|
357
|
+
);
|
|
358
|
+
},
|
|
359
|
+
decorators: [],
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
export const SidebarInSidebar: Story = {
|
|
363
|
+
args: {
|
|
364
|
+
rightWidth: 384,
|
|
365
|
+
leftVariant: 'none',
|
|
366
|
+
},
|
|
367
|
+
decorators: [rightLayoutDecorator],
|
|
368
|
+
render: () => {
|
|
369
|
+
const { isFill } = useSidebar('right');
|
|
370
|
+
const [innerMode, setInnerMode] = useState<SidebarMode>('collapsed');
|
|
371
|
+
|
|
372
|
+
const handleOnModeChange = (mode: SidebarMode) => {
|
|
373
|
+
setInnerMode(mode);
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
return (
|
|
377
|
+
<Sidebar container side="right">
|
|
378
|
+
<SidebarProvider
|
|
379
|
+
leftVariant="sided-floating"
|
|
380
|
+
leftMode={isFill ? innerMode : 'collapsed'}
|
|
381
|
+
leftCollapsible={isFill ? 'icon' : 'off-canvas'}
|
|
382
|
+
onLeftModeChange={handleOnModeChange}
|
|
383
|
+
>
|
|
384
|
+
<div className="tw-flex tw-flex-1">
|
|
385
|
+
<Sidebar className="tw-absolute">
|
|
386
|
+
<Sidebar.Content>
|
|
387
|
+
<Sidebar.SearchInput placeholder="Search" />
|
|
388
|
+
|
|
389
|
+
<Sidebar.Menu>
|
|
390
|
+
<Sidebar.MenuItem>
|
|
391
|
+
<Sidebar.MenuButton tooltip="Simple" icon={['far', 'rectangle-terminal']}>
|
|
392
|
+
Action
|
|
393
|
+
</Sidebar.MenuButton>
|
|
394
|
+
</Sidebar.MenuItem>
|
|
395
|
+
|
|
396
|
+
<Sidebar.MenuItem>
|
|
397
|
+
<Sidebar.MenuCard icon="clock" title="Card">
|
|
398
|
+
Content
|
|
399
|
+
</Sidebar.MenuCard>
|
|
400
|
+
</Sidebar.MenuItem>
|
|
401
|
+
|
|
402
|
+
<Sidebar.MenuItem>
|
|
403
|
+
<SidebarModeControlMenuButton side="left" />
|
|
404
|
+
</Sidebar.MenuItem>
|
|
405
|
+
</Sidebar.Menu>
|
|
406
|
+
</Sidebar.Content>
|
|
407
|
+
</Sidebar>
|
|
408
|
+
<main className="tw-m-2 tw-flex tw-flex-1 tw-justify-center tw-rounded-xl tw-bg-neutral-50">
|
|
409
|
+
<h1>KAI</h1>
|
|
410
|
+
</main>
|
|
411
|
+
</div>
|
|
412
|
+
</SidebarProvider>
|
|
413
|
+
</Sidebar>
|
|
414
|
+
);
|
|
415
|
+
},
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
export const MenuItems: Story = {
|
|
419
|
+
decorators: [leftLayoutDecorator],
|
|
420
|
+
render: () => (
|
|
421
|
+
<Sidebar>
|
|
422
|
+
<Sidebar.Content>
|
|
423
|
+
<Sidebar.Menu>
|
|
424
|
+
<Sidebar.MenuItem>
|
|
425
|
+
<Sidebar.MenuButton tooltip="Simple" icon={['far', 'rectangle-terminal']}>
|
|
426
|
+
Simple
|
|
427
|
+
</Sidebar.MenuButton>
|
|
428
|
+
</Sidebar.MenuItem>
|
|
429
|
+
|
|
430
|
+
<Sidebar.MenuItem>
|
|
431
|
+
<Sidebar.MenuButton
|
|
432
|
+
tooltip="Active"
|
|
433
|
+
icon={['far', 'rectangle-terminal']}
|
|
434
|
+
aria-selected={true}
|
|
435
|
+
>
|
|
436
|
+
Active
|
|
437
|
+
</Sidebar.MenuButton>
|
|
438
|
+
</Sidebar.MenuItem>
|
|
439
|
+
|
|
440
|
+
<Sidebar.MenuItem>
|
|
441
|
+
<Sidebar.MenuButton tooltip="Disabled" icon={['far', 'rectangle-terminal']} disabled>
|
|
442
|
+
Disabled
|
|
443
|
+
</Sidebar.MenuButton>
|
|
444
|
+
</Sidebar.MenuItem>
|
|
445
|
+
|
|
446
|
+
<Sidebar.MenuItem>
|
|
447
|
+
<Sidebar.MenuButton tooltip="Simple Anchor" asChild>
|
|
448
|
+
<a href="https://www.keboole.com">
|
|
449
|
+
<Sidebar.MenuIcon icon={['far', 'rectangle-terminal']} />
|
|
450
|
+
Simple Anchor
|
|
451
|
+
</a>
|
|
452
|
+
</Sidebar.MenuButton>
|
|
453
|
+
</Sidebar.MenuItem>
|
|
454
|
+
|
|
455
|
+
<Sidebar.MenuItem>
|
|
456
|
+
<Sidebar.MenuButton
|
|
457
|
+
tooltip="Simple Anchor - Active"
|
|
458
|
+
asChild
|
|
459
|
+
icon={['far', 'rectangle-terminal']}
|
|
460
|
+
>
|
|
461
|
+
{/*use react-router based on spec*/}
|
|
462
|
+
{/*https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-current*/}
|
|
463
|
+
<a aria-current="page" href="https://www.keboola.com">
|
|
464
|
+
Simple Anchor - Active
|
|
465
|
+
</a>
|
|
466
|
+
</Sidebar.MenuButton>
|
|
467
|
+
</Sidebar.MenuItem>
|
|
468
|
+
|
|
469
|
+
<Sidebar.MenuItem>
|
|
470
|
+
<Sidebar.MenuButton
|
|
471
|
+
tooltip="This will be very long text hidden with ellipsis"
|
|
472
|
+
icon={['far', 'rectangle-terminal']}
|
|
473
|
+
>
|
|
474
|
+
<span className="tw-truncate">This will be very long text hidden with ellipsis</span>
|
|
475
|
+
</Sidebar.MenuButton>
|
|
476
|
+
</Sidebar.MenuItem>
|
|
477
|
+
|
|
478
|
+
<Sidebar.MenuItem>
|
|
479
|
+
<Sidebar.MenuCard icon="clock" title="Card Item">
|
|
480
|
+
Content
|
|
481
|
+
</Sidebar.MenuCard>
|
|
482
|
+
</Sidebar.MenuItem>
|
|
483
|
+
|
|
484
|
+
<Sidebar.MenuItem>
|
|
485
|
+
<Sidebar.SubMenu icon={['far', 'layer-group']} label="Sub Menu" defaultOpen>
|
|
486
|
+
<Sidebar.SubItem>Plain Sub Item</Sidebar.SubItem>
|
|
487
|
+
<Sidebar.SubItem aria-selected>Active Sub Item</Sidebar.SubItem>
|
|
488
|
+
<Sidebar.SubItem asChild>
|
|
489
|
+
{/* oxlint-disable-next-line jsx-a11y/anchor-is-valid */}
|
|
490
|
+
<a href="#">Anchor Sub Item</a>
|
|
491
|
+
</Sidebar.SubItem>
|
|
492
|
+
<Sidebar.SubItem disabled>Disabled Sub Item</Sidebar.SubItem>
|
|
493
|
+
</Sidebar.SubMenu>
|
|
494
|
+
</Sidebar.MenuItem>
|
|
495
|
+
</Sidebar.Menu>
|
|
496
|
+
</Sidebar.Content>
|
|
497
|
+
</Sidebar>
|
|
498
|
+
),
|
|
499
|
+
};
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* The SidebarMenuAction component is used to render a menu action within a SidebarMenuItem.
|
|
503
|
+
*
|
|
504
|
+
* This button works independently of the SidebarMenuButton i.e you can have the `<SidebarMenuButton />` as a clickable link and the `<SidebarMenuAction />` as a button.
|
|
505
|
+
*/
|
|
506
|
+
export const MenuAction: Story = {
|
|
507
|
+
decorators: [leftLayoutDecorator],
|
|
508
|
+
render: () => (
|
|
509
|
+
<Sidebar>
|
|
510
|
+
<Sidebar.Content>
|
|
511
|
+
<Sidebar.Menu>
|
|
512
|
+
<Sidebar.MenuItem>
|
|
513
|
+
<Sidebar.MenuButton
|
|
514
|
+
tooltip="Dropdown Action With very very long text"
|
|
515
|
+
icon={['far', 'rectangle-terminal']}
|
|
516
|
+
>
|
|
517
|
+
<span className="tw-truncate">Dropdown Action With very very long text</span>
|
|
518
|
+
</Sidebar.MenuButton>
|
|
519
|
+
<DropdownMenu>
|
|
520
|
+
<DropdownMenu.Trigger asChild>
|
|
521
|
+
<Sidebar.MenuAction showOnHover>
|
|
522
|
+
<Icon icon={['far', 'ellipsis']} />
|
|
523
|
+
<span className="tw-sr-only">Actions</span>
|
|
524
|
+
</Sidebar.MenuAction>
|
|
525
|
+
</DropdownMenu.Trigger>
|
|
526
|
+
|
|
527
|
+
<DropdownMenu.Content side="right" align="start">
|
|
528
|
+
<DropdownMenu.Group>
|
|
529
|
+
<DropdownMenu.Item icon="pen">Edit </DropdownMenu.Item>
|
|
530
|
+
<DropdownMenu.Item icon="trash">Delete </DropdownMenu.Item>
|
|
531
|
+
</DropdownMenu.Group>
|
|
532
|
+
</DropdownMenu.Content>
|
|
533
|
+
</DropdownMenu>
|
|
534
|
+
</Sidebar.MenuItem>
|
|
535
|
+
|
|
536
|
+
<Sidebar.MenuItem>
|
|
537
|
+
<Sidebar.MenuButton tooltip="As Non-actionable" icon="code">
|
|
538
|
+
<span className="tw-truncate">As Non-actionable</span>
|
|
539
|
+
</Sidebar.MenuButton>
|
|
540
|
+
|
|
541
|
+
<Sidebar.MenuAction asChild>
|
|
542
|
+
<Icon icon="triangle-exclamation" className="tw-text-warning-600" />
|
|
543
|
+
</Sidebar.MenuAction>
|
|
544
|
+
</Sidebar.MenuItem>
|
|
545
|
+
<Sidebar.MenuItem>
|
|
546
|
+
<Sidebar.MenuButton tooltip="As Non-actionable with Very long text" icon="code">
|
|
547
|
+
<span className="tw-truncate">As Non-actionable with Very long text</span>
|
|
548
|
+
</Sidebar.MenuButton>
|
|
549
|
+
<Sidebar.MenuAction asChild>
|
|
550
|
+
<Icon icon="triangle-exclamation" className="tw-text-warning-600" />
|
|
551
|
+
</Sidebar.MenuAction>
|
|
552
|
+
</Sidebar.MenuItem>
|
|
553
|
+
<Sidebar.MenuItem>
|
|
554
|
+
<Sidebar.MenuButton tooltip="As Link" asChild icon={['far', 'code-branch']}>
|
|
555
|
+
{/* oxlint-disable-next-line jsx-a11y/anchor-is-valid */}
|
|
556
|
+
<a href="#">As Link</a>
|
|
557
|
+
</Sidebar.MenuButton>
|
|
558
|
+
<Sidebar.MenuAction asChild>
|
|
559
|
+
<Link href="#">
|
|
560
|
+
<Icon icon={['far', 'gauge']} className="tw-text-warning-600" />
|
|
561
|
+
<span className="tw-sr-only">Dashboard</span>
|
|
562
|
+
</Link>
|
|
563
|
+
</Sidebar.MenuAction>
|
|
564
|
+
</Sidebar.MenuItem>
|
|
565
|
+
</Sidebar.Menu>
|
|
566
|
+
</Sidebar.Content>
|
|
567
|
+
</Sidebar>
|
|
568
|
+
),
|
|
569
|
+
};
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* The `Sidebar.MenuBadge` component is used to display notification counts, status indicators,
|
|
573
|
+
* or other small pieces of information on menu buttons.
|
|
574
|
+
*
|
|
575
|
+
* The badge is positioned absolutely in the top-right corner of the menu button and automatically
|
|
576
|
+
* adapts its color based on button state (hover, active). It's hidden when the sidebar is collapsed
|
|
577
|
+
* to icon-only mode.
|
|
578
|
+
*/
|
|
579
|
+
export const MenuBadge: Story = {
|
|
580
|
+
decorators: [leftLayoutDecorator],
|
|
581
|
+
render: () => (
|
|
582
|
+
<Sidebar>
|
|
583
|
+
<Sidebar.Content>
|
|
584
|
+
<Sidebar.Menu>
|
|
585
|
+
<Sidebar.MenuItem>
|
|
586
|
+
<Sidebar.MenuButton tooltip="Messages" icon={['far', 'rectangle-terminal']}>
|
|
587
|
+
Messages
|
|
588
|
+
</Sidebar.MenuButton>
|
|
589
|
+
<Sidebar.MenuBadge>5</Sidebar.MenuBadge>
|
|
590
|
+
</Sidebar.MenuItem>
|
|
591
|
+
|
|
592
|
+
<Sidebar.MenuItem>
|
|
593
|
+
<Sidebar.MenuButton tooltip="Storage" icon={['far', 'warehouse']} aria-selected={true}>
|
|
594
|
+
Storage
|
|
595
|
+
</Sidebar.MenuButton>
|
|
596
|
+
<Sidebar.MenuBadge>3</Sidebar.MenuBadge>
|
|
597
|
+
</Sidebar.MenuItem>
|
|
598
|
+
|
|
599
|
+
<Sidebar.MenuItem>
|
|
600
|
+
<Sidebar.MenuButton
|
|
601
|
+
tooltip="Link"
|
|
602
|
+
icon={['far', 'warehouse']}
|
|
603
|
+
aria-selected={true}
|
|
604
|
+
asChild
|
|
605
|
+
>
|
|
606
|
+
<Link href="#">Link</Link>
|
|
607
|
+
</Sidebar.MenuButton>
|
|
608
|
+
<Sidebar.MenuBadge>3</Sidebar.MenuBadge>
|
|
609
|
+
</Sidebar.MenuItem>
|
|
610
|
+
|
|
611
|
+
<Sidebar.MenuItem>
|
|
612
|
+
<Sidebar.MenuCard icon="clock" title="Card With Badge">
|
|
613
|
+
Content
|
|
614
|
+
</Sidebar.MenuCard>
|
|
615
|
+
<Sidebar.MenuBadge>8</Sidebar.MenuBadge>
|
|
616
|
+
</Sidebar.MenuItem>
|
|
617
|
+
</Sidebar.Menu>
|
|
618
|
+
</Sidebar.Content>
|
|
619
|
+
</Sidebar>
|
|
620
|
+
),
|
|
621
|
+
};
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Use the `Sidebar.Group` component to create a section within the sidebar.
|
|
625
|
+
*
|
|
626
|
+
* A `Sidebar.Group` has a `Sidebar.GroupLabel`, a `Sidebar.GroupContent` and an optional `Sidebar.GroupAction`.
|
|
627
|
+
*/
|
|
628
|
+
export const Group: Story = {
|
|
629
|
+
decorators: [leftLayoutDecorator],
|
|
630
|
+
render: () => (
|
|
631
|
+
<Sidebar>
|
|
632
|
+
<Sidebar.Content>
|
|
633
|
+
<Sidebar.Group>
|
|
634
|
+
<Sidebar.GroupLabel>Group A</Sidebar.GroupLabel>
|
|
635
|
+
<Sidebar.GroupAction icon="plus" />
|
|
636
|
+
<Sidebar.GroupContent>
|
|
637
|
+
<Sidebar.Menu>
|
|
638
|
+
<Sidebar.MenuItem>
|
|
639
|
+
<Sidebar.MenuButton tooltip="Group A Item" icon="gauge">
|
|
640
|
+
Group A Item
|
|
641
|
+
</Sidebar.MenuButton>
|
|
642
|
+
</Sidebar.MenuItem>
|
|
643
|
+
</Sidebar.Menu>
|
|
644
|
+
</Sidebar.GroupContent>
|
|
645
|
+
</Sidebar.Group>
|
|
646
|
+
|
|
647
|
+
<Sidebar.Group>
|
|
648
|
+
<Sidebar.GroupLabel>Group B</Sidebar.GroupLabel>
|
|
649
|
+
<Sidebar.GroupAction icon="minus" />
|
|
650
|
+
<Sidebar.GroupContent>
|
|
651
|
+
<Sidebar.Menu>
|
|
652
|
+
<Sidebar.MenuItem>
|
|
653
|
+
<Sidebar.MenuButton tooltip="Group B Item" icon="gauge">
|
|
654
|
+
Group B Item
|
|
655
|
+
</Sidebar.MenuButton>
|
|
656
|
+
</Sidebar.MenuItem>
|
|
657
|
+
</Sidebar.Menu>
|
|
658
|
+
</Sidebar.GroupContent>
|
|
659
|
+
</Sidebar.Group>
|
|
660
|
+
</Sidebar.Content>
|
|
661
|
+
</Sidebar>
|
|
662
|
+
),
|
|
663
|
+
};
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* The `SidebarSeparator` component is used to render a separator within a `Sidebar`.
|
|
667
|
+
*/
|
|
668
|
+
export const Separator: Story = {
|
|
669
|
+
decorators: [leftLayoutDecorator],
|
|
670
|
+
render: () => (
|
|
671
|
+
<Sidebar>
|
|
672
|
+
<Sidebar.Content>
|
|
673
|
+
<Sidebar.Menu>
|
|
674
|
+
<Sidebar.MenuItem>
|
|
675
|
+
<Sidebar.MenuButton tooltip="Menu & Menu" icon="folder-open">
|
|
676
|
+
Menu & Menu
|
|
677
|
+
</Sidebar.MenuButton>
|
|
678
|
+
</Sidebar.MenuItem>
|
|
679
|
+
</Sidebar.Menu>
|
|
680
|
+
|
|
681
|
+
<Sidebar.Separator />
|
|
682
|
+
|
|
683
|
+
<Sidebar.Menu>
|
|
684
|
+
<Sidebar.MenuItem>
|
|
685
|
+
<Sidebar.MenuButton tooltip="Menu & Group" icon="folder-open">
|
|
686
|
+
Menu & Group
|
|
687
|
+
</Sidebar.MenuButton>
|
|
688
|
+
</Sidebar.MenuItem>
|
|
689
|
+
</Sidebar.Menu>
|
|
690
|
+
|
|
691
|
+
<Sidebar.Separator />
|
|
692
|
+
|
|
693
|
+
<Sidebar.Group>
|
|
694
|
+
<Sidebar.GroupLabel>Group A</Sidebar.GroupLabel>
|
|
695
|
+
<Sidebar.GroupContent>
|
|
696
|
+
<Sidebar.Menu>
|
|
697
|
+
<Sidebar.MenuItem>
|
|
698
|
+
<Sidebar.MenuButton tooltip="MenuItem * MenuItem" icon="folder-open">
|
|
699
|
+
MenuItem * MenuItem
|
|
700
|
+
</Sidebar.MenuButton>
|
|
701
|
+
</Sidebar.MenuItem>
|
|
702
|
+
|
|
703
|
+
<Sidebar.Separator />
|
|
704
|
+
|
|
705
|
+
<Sidebar.MenuItem>
|
|
706
|
+
<Sidebar.MenuButton tooltip="Item E" icon="folder-open">
|
|
707
|
+
Item E
|
|
708
|
+
</Sidebar.MenuButton>
|
|
709
|
+
</Sidebar.MenuItem>
|
|
710
|
+
</Sidebar.Menu>
|
|
711
|
+
</Sidebar.GroupContent>
|
|
712
|
+
</Sidebar.Group>
|
|
713
|
+
</Sidebar.Content>
|
|
714
|
+
</Sidebar>
|
|
715
|
+
),
|
|
716
|
+
};
|
|
717
|
+
|
|
718
|
+
/*
|
|
719
|
+
* Use the `Sidebar` component inside a `Modal` or `Popover` to create a modal sidebar.
|
|
720
|
+
*/
|
|
721
|
+
export const InsideModal: Story = {
|
|
722
|
+
render: () => (
|
|
723
|
+
<Modal>
|
|
724
|
+
<Modal.Trigger asChild>
|
|
725
|
+
<Button>Open Modal</Button>
|
|
726
|
+
</Modal.Trigger>
|
|
727
|
+
|
|
728
|
+
<Modal.Content className="tw-size-[800px] !tw-flex-row tw-gap-0 tw-overflow-hidden tw-bg-neutral-50 tw-p-0">
|
|
729
|
+
<Modal.Header title="Story for Sidebar inside Modal" className="tw-sr-only" />
|
|
730
|
+
<SidebarProvider leftVariant="floating" leftCollapsible="icon">
|
|
731
|
+
<div className="tw-flex tw-flex-1">
|
|
732
|
+
<Sidebar side="left">
|
|
733
|
+
<Sidebar.Header>
|
|
734
|
+
<Sidebar.Menu>
|
|
735
|
+
<Sidebar.MenuItem>
|
|
736
|
+
<Sidebar.Trigger>
|
|
737
|
+
<Sidebar.MenuButton tooltip="Collapse" icon={['far', 'sidebar']}>
|
|
738
|
+
Collapse
|
|
739
|
+
</Sidebar.MenuButton>
|
|
740
|
+
</Sidebar.Trigger>
|
|
741
|
+
</Sidebar.MenuItem>
|
|
742
|
+
</Sidebar.Menu>
|
|
743
|
+
</Sidebar.Header>
|
|
744
|
+
</Sidebar>
|
|
745
|
+
|
|
746
|
+
<AppContent>Keboola Content</AppContent>
|
|
747
|
+
</div>
|
|
748
|
+
</SidebarProvider>
|
|
749
|
+
</Modal.Content>
|
|
750
|
+
</Modal>
|
|
751
|
+
),
|
|
752
|
+
};
|
|
753
|
+
|
|
754
|
+
export const StaticSiteMenu: Story = {
|
|
755
|
+
render: () => {
|
|
756
|
+
const HEADER_HEIGHT = '40px'; // Adjust based on your header height
|
|
757
|
+
|
|
758
|
+
return (
|
|
759
|
+
<>
|
|
760
|
+
<header
|
|
761
|
+
className="tw-top tw-static tw-flex tw-items-center tw-justify-center tw-border-b tw-border-neutral-150 tw-bg-white"
|
|
762
|
+
style={{
|
|
763
|
+
height: HEADER_HEIGHT,
|
|
764
|
+
}}
|
|
765
|
+
>
|
|
766
|
+
Static Site header
|
|
767
|
+
</header>
|
|
768
|
+
|
|
769
|
+
<div className="tw-flex tw-flex-1">
|
|
770
|
+
<Sidebar
|
|
771
|
+
style={{
|
|
772
|
+
top: HEADER_HEIGHT,
|
|
773
|
+
}}
|
|
774
|
+
>
|
|
775
|
+
<Sidebar.Header>
|
|
776
|
+
<Sidebar.Menu>
|
|
777
|
+
<Sidebar.MenuItem>
|
|
778
|
+
<Sidebar.Trigger>
|
|
779
|
+
<Sidebar.MenuButton tooltip="Hello" icon="bolt">
|
|
780
|
+
Hello
|
|
781
|
+
</Sidebar.MenuButton>
|
|
782
|
+
</Sidebar.Trigger>
|
|
783
|
+
</Sidebar.MenuItem>
|
|
784
|
+
</Sidebar.Menu>
|
|
785
|
+
</Sidebar.Header>
|
|
786
|
+
</Sidebar>
|
|
787
|
+
|
|
788
|
+
<AppContent side="both" />
|
|
789
|
+
|
|
790
|
+
<Sidebar
|
|
791
|
+
side="right"
|
|
792
|
+
style={{
|
|
793
|
+
top: HEADER_HEIGHT,
|
|
794
|
+
}}
|
|
795
|
+
>
|
|
796
|
+
<Sidebar.Header>
|
|
797
|
+
<Sidebar.Menu>
|
|
798
|
+
<Sidebar.MenuItem>
|
|
799
|
+
<Sidebar.Trigger side="right">
|
|
800
|
+
<Sidebar.MenuButton tooltip="Hello" icon="bolt">
|
|
801
|
+
Hello
|
|
802
|
+
</Sidebar.MenuButton>
|
|
803
|
+
</Sidebar.Trigger>
|
|
804
|
+
</Sidebar.MenuItem>
|
|
805
|
+
</Sidebar.Menu>
|
|
806
|
+
</Sidebar.Header>
|
|
807
|
+
</Sidebar>
|
|
808
|
+
</div>
|
|
809
|
+
</>
|
|
810
|
+
);
|
|
811
|
+
},
|
|
812
|
+
};
|