@keboola/design 2.0.1 → 2.1.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 +57 -1
- package/dist/icon-names.d.cts +7 -0
- package/dist/icon-names.d.ts +7 -0
- package/dist/icons.cjs +4 -0
- package/dist/icons.d.cts +6 -0
- package/dist/icons.d.ts +6 -0
- package/dist/icons.js +1 -1
- package/dist/index.cjs +127 -97
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10184 -0
- package/dist/index.d.ts +10184 -0
- package/dist/index.js +163 -133
- package/dist/index.js.map +1 -1
- package/dist/markdown-editor.cjs +30 -33
- package/dist/markdown-editor.cjs.map +1 -1
- package/dist/markdown-editor.d.cts +74 -0
- package/dist/markdown-editor.d.ts +74 -0
- package/dist/markdown-editor.js +30 -33
- package/dist/markdown-editor.js.map +1 -1
- package/dist/mermaid.cjs +18 -14
- package/dist/mermaid.cjs.map +1 -1
- package/dist/mermaid.d.cts +11 -0
- package/dist/mermaid.d.ts +11 -0
- package/dist/mermaid.js +18 -14
- package/dist/mermaid.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +79 -9
- package/src/blocks/AIKit/AnswerSummary.stories.tsx +0 -38
- package/src/blocks/AIKit/AnswerSummary.tsx +0 -63
- package/src/blocks/AIKit/CollapsibleStepHeader.stories.tsx +0 -53
- package/src/blocks/AIKit/CollapsibleStepHeader.tsx +0 -64
- package/src/blocks/AIKit/InlineStepDetail.stories.tsx +0 -25
- package/src/blocks/AIKit/InlineStepDetail.tsx +0 -13
- package/src/blocks/AIKit/InlineStepLabel.stories.tsx +0 -37
- package/src/blocks/AIKit/InlineStepLabel.tsx +0 -36
- package/src/blocks/AIKit/MessageBubble.stories.tsx +0 -145
- package/src/blocks/AIKit/MessageBubble.tsx +0 -68
- package/src/blocks/AIKit/PlanApproval.stories.tsx +0 -121
- package/src/blocks/AIKit/PlanApproval.test.tsx +0 -241
- package/src/blocks/AIKit/PlanApproval.tsx +0 -363
- package/src/blocks/AIKit/PlanRewritingIndicator.test.tsx +0 -17
- package/src/blocks/AIKit/PlanRewritingIndicator.tsx +0 -20
- package/src/blocks/AIKit/PromptInput.stories.tsx +0 -106
- package/src/blocks/AIKit/PromptInput.test.tsx +0 -53
- package/src/blocks/AIKit/PromptInput.tsx +0 -218
- package/src/blocks/AIKit/PromptInputAction.tsx +0 -18
- package/src/blocks/AIKit/PromptInputSubmit.tsx +0 -59
- package/src/blocks/AIKit/Question.stories.tsx +0 -235
- package/src/blocks/AIKit/Question.tsx +0 -350
- package/src/blocks/AIKit/QuestionBlock.stories.tsx +0 -99
- package/src/blocks/AIKit/QuestionBlock.tsx +0 -83
- package/src/blocks/AIKit/SuggestedPrompt.stories.tsx +0 -82
- package/src/blocks/AIKit/SuggestedPrompt.tsx +0 -42
- package/src/blocks/AIKit/ThinkingIndicator.stories.tsx +0 -21
- package/src/blocks/AIKit/ThinkingIndicator.tsx +0 -14
- package/src/blocks/AIKit/index.ts +0 -12
- package/src/blocks/AutoSaveTextarea/AutoSaveTextarea.stories.tsx +0 -78
- package/src/blocks/AutoSaveTextarea/AutoSaveTextarea.tsx +0 -103
- package/src/blocks/AutoSaveTextarea/index.ts +0 -1
- package/src/blocks/ClipboardButton/ClipboardButton.stories.tsx +0 -28
- package/src/blocks/ClipboardButton/ClipboardButton.tsx +0 -43
- package/src/blocks/ClipboardButton/ClipboardInline.tsx +0 -40
- package/src/blocks/ClipboardButton/index.ts +0 -2
- package/src/blocks/ColorInput/ColorInput.stories.tsx +0 -109
- package/src/blocks/ColorInput/ColorInput.test.tsx +0 -163
- package/src/blocks/ColorInput/ColorInput.tsx +0 -171
- package/src/blocks/ColorInput/ColorPicker.tsx +0 -42
- package/src/blocks/ColorInput/index.ts +0 -1
- package/src/blocks/ColorInput/utils.test.ts +0 -189
- package/src/blocks/ColorInput/utils.ts +0 -74
- package/src/blocks/EmptyConfigurationActionCard/EmptyConfigurationActionCard.stories.tsx +0 -30
- package/src/blocks/EmptyConfigurationActionCard/EmptyConfigurationActionCard.tsx +0 -20
- package/src/blocks/EmptyConfigurationActionCard/index.ts +0 -1
- package/src/blocks/EmptyState/EmptyState.stories.tsx +0 -93
- package/src/blocks/EmptyState/EmptyState.tsx +0 -146
- package/src/blocks/EmptyState/index.ts +0 -1
- package/src/blocks/ErrorState/ErrorState.stories.tsx +0 -125
- package/src/blocks/ErrorState/ErrorState.tsx +0 -162
- package/src/blocks/ErrorState/index.ts +0 -1
- package/src/blocks/Form/components/FormBody.tsx +0 -27
- package/src/blocks/Form/components/SubmitButton.tsx +0 -30
- package/src/blocks/Form/connectors/CheckboxField.tsx +0 -34
- package/src/blocks/Form/connectors/FieldShell.tsx +0 -46
- package/src/blocks/Form/connectors/NumberField.tsx +0 -36
- package/src/blocks/Form/connectors/PasswordField.tsx +0 -38
- package/src/blocks/Form/connectors/SelectField.tsx +0 -73
- package/src/blocks/Form/connectors/SwitchField.tsx +0 -34
- package/src/blocks/Form/connectors/TextAreaField.tsx +0 -36
- package/src/blocks/Form/connectors/TextField.tsx +0 -36
- package/src/blocks/Form/contexts.ts +0 -4
- package/src/blocks/Form/formHook.ts +0 -45
- package/src/blocks/Form/index.ts +0 -2
- package/src/blocks/Form/setServerFieldErrors.test.ts +0 -38
- package/src/blocks/Form/setServerFieldErrors.ts +0 -21
- package/src/blocks/InputOtp/InputOtp.stories.tsx +0 -214
- package/src/blocks/InputOtp/InputOtp.test.tsx +0 -162
- package/src/blocks/InputOtp/InputOtp.tsx +0 -62
- package/src/blocks/InputOtp/InputOtpGroup.tsx +0 -13
- package/src/blocks/InputOtp/InputOtpSeparator.tsx +0 -23
- package/src/blocks/InputOtp/InputOtpSlot.styles.ts +0 -52
- package/src/blocks/InputOtp/InputOtpSlot.tsx +0 -44
- package/src/blocks/InputOtp/context.ts +0 -23
- package/src/blocks/InputOtp/index.ts +0 -23
- package/src/blocks/MermaidDiagram/MermaidDiagram.stories.tsx +0 -87
- package/src/blocks/MermaidDiagram/MermaidDiagram.tsx +0 -266
- package/src/blocks/MermaidDiagram/index.ts +0 -1
- package/src/blocks/MultiActionButtonGroup/MultiActionButton.stories.tsx +0 -119
- package/src/blocks/MultiActionButtonGroup/MultiActionButton.tsx +0 -41
- package/src/blocks/MultiActionButtonGroup/MultiActionButtonGroup.tsx +0 -16
- package/src/blocks/MultiActionButtonGroup/index.ts +0 -1
- package/src/blocks/MultiCombobox/MultiCombobox.stories.tsx +0 -324
- package/src/blocks/MultiCombobox/MultiCombobox.tsx +0 -257
- package/src/blocks/MultiCombobox/index.ts +0 -1
- package/src/blocks/NumberInput/NumberInput.stories.tsx +0 -112
- package/src/blocks/NumberInput/NumberInput.test.tsx +0 -148
- package/src/blocks/NumberInput/NumberInput.tsx +0 -89
- package/src/blocks/NumberInput/index.ts +0 -1
- package/src/blocks/PageHeader/AGENTS.md +0 -137
- package/src/blocks/PageHeader/PageHeader.stories.tsx +0 -371
- package/src/blocks/PageHeader/PageHeader.tsx +0 -22
- package/src/blocks/PageHeader/PageHeaderDetail.tsx +0 -84
- package/src/blocks/PageHeader/PageHeaderIndex.tsx +0 -75
- package/src/blocks/PageHeader/index.ts +0 -1
- package/src/blocks/PageHeader/styles.ts +0 -6
- package/src/blocks/PageLayout/AGENTS.md +0 -94
- package/src/blocks/PageLayout/PageLayout.stories.tsx +0 -146
- package/src/blocks/PageLayout/PageLayout.tsx +0 -139
- package/src/blocks/PageLayout/index.ts +0 -1
- package/src/blocks/PageToolbar/PageToolbar.stories.tsx +0 -353
- package/src/blocks/PageToolbar/PageToolbar.tsx +0 -160
- package/src/blocks/PageToolbar/PageToolbarToken.tsx +0 -61
- package/src/blocks/PageToolbar/index.ts +0 -1
- package/src/blocks/PasswordInput/PasswordInput.stories.tsx +0 -114
- package/src/blocks/PasswordInput/PasswordInput.test.tsx +0 -219
- package/src/blocks/PasswordInput/PasswordInput.tsx +0 -180
- package/src/blocks/PasswordInput/index.ts +0 -1
- package/src/blocks/SearchInput/SearchInput.stories.tsx +0 -127
- package/src/blocks/SearchInput/SearchInput.test.tsx +0 -162
- package/src/blocks/SearchInput/SearchInput.tsx +0 -172
- package/src/blocks/SearchInput/index.ts +0 -1
- package/src/blocks/SearchInputWithNavigation/SearchInputWithNavigation.stories.tsx +0 -73
- package/src/blocks/SearchInputWithNavigation/SearchInputWithNavigation.tsx +0 -92
- package/src/blocks/SearchInputWithNavigation/index.ts +0 -1
- package/src/blocks/SplitButton/SplitButton.stories.tsx +0 -91
- package/src/blocks/SplitButton/SplitButton.tsx +0 -81
- package/src/blocks/SplitButton/index.ts +0 -1
- package/src/blocks/Tagger/TagItem.tsx +0 -32
- package/src/blocks/Tagger/TagSelectPopover/TagSelectCreateItem.tsx +0 -44
- package/src/blocks/Tagger/TagSelectPopover/TagSelectItem.tsx +0 -31
- package/src/blocks/Tagger/TagSelectPopover/TagSelectList.tsx +0 -67
- package/src/blocks/Tagger/TagSelectPopover/TagSelectPopover.tsx +0 -34
- package/src/blocks/Tagger/TagSelectPopover/TagSelectValue.tsx +0 -47
- package/src/blocks/Tagger/TagSelectPopover/index.ts +0 -1
- package/src/blocks/Tagger/Tagger.stories.tsx +0 -80
- package/src/blocks/Tagger/Tagger.tsx +0 -101
- package/src/blocks/Tagger/index.ts +0 -1
- package/src/blocks/Tagger/types.ts +0 -11
- package/src/blocks/Textarea/Textarea.stories.tsx +0 -47
- package/src/blocks/Textarea/Textarea.tsx +0 -50
- package/src/blocks/Textarea/index.ts +0 -1
- package/src/components/Alert/Alert.stories.tsx +0 -101
- package/src/components/Alert/Alert.tsx +0 -121
- package/src/components/Alert/AlertAction.tsx +0 -31
- package/src/components/Alert/AlertCollapsibleIcon.tsx +0 -25
- package/src/components/Alert/AlertDescription.tsx +0 -36
- package/src/components/Alert/AlertIcon.tsx +0 -40
- package/src/components/Alert/AlertRoot.tsx +0 -64
- package/src/components/Alert/AlertTitle.tsx +0 -25
- package/src/components/Alert/index.ts +0 -1
- package/src/components/Avatar.stories.tsx +0 -22
- package/src/components/Avatar.tsx +0 -88
- package/src/components/Badge/Badge.stories.tsx +0 -122
- package/src/components/Badge/Badge.tsx +0 -71
- package/src/components/Badge/BadgeAddon.tsx +0 -63
- package/src/components/Badge/BadgeButton.tsx +0 -40
- package/src/components/Badge/BadgeLabel.tsx +0 -37
- package/src/components/Badge/BadgeRoot.tsx +0 -21
- package/src/components/Badge/index.ts +0 -1
- package/src/components/Badge/styles.ts +0 -74
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +0 -135
- package/src/components/Breadcrumb/Breadcrumb.tsx +0 -23
- package/src/components/Breadcrumb/BreadcrumbEllipsis.tsx +0 -43
- package/src/components/Breadcrumb/BreadcrumbItem.tsx +0 -9
- package/src/components/Breadcrumb/BreadcrumbLink.tsx +0 -48
- package/src/components/Breadcrumb/BreadcrumbList.tsx +0 -26
- package/src/components/Breadcrumb/BreadcrumbPage.tsx +0 -22
- package/src/components/Breadcrumb/BreadcrumbSeparator.tsx +0 -28
- package/src/components/Breadcrumb/index.ts +0 -1
- package/src/components/Button/Button.stories.tsx +0 -80
- package/src/components/Button/Button.tsx +0 -110
- package/src/components/Button/ButtonInline.stories.tsx +0 -54
- package/src/components/Button/ButtonInline.tsx +0 -77
- package/src/components/Button/index.ts +0 -3
- package/src/components/Button/styles.ts +0 -313
- package/src/components/ButtonGroup/ButtonGroup.stories.tsx +0 -140
- package/src/components/ButtonGroup/ButtonGroup.tsx +0 -79
- package/src/components/ButtonGroup/index.ts +0 -1
- package/src/components/Calendar/Calendar.stories.tsx +0 -101
- package/src/components/Calendar/Calendar.tsx +0 -44
- package/src/components/Calendar/index.ts +0 -2
- package/src/components/Card/Card.stories.tsx +0 -60
- package/src/components/Card/Card.tsx +0 -42
- package/src/components/Card/CardContent.tsx +0 -5
- package/src/components/Card/CardHeader.tsx +0 -5
- package/src/components/Card/CardTitle.tsx +0 -13
- package/src/components/Card/index.ts +0 -1
- package/src/components/Card/styles.ts +0 -32
- package/src/components/Checkbox/Checkbox.stories.tsx +0 -210
- package/src/components/Checkbox/Checkbox.test.tsx +0 -140
- package/src/components/Checkbox/Checkbox.tsx +0 -83
- package/src/components/Checkbox/index.ts +0 -1
- package/src/components/Checkbox/styles.ts +0 -77
- package/src/components/Clipboard/Clipboard.stories.tsx +0 -44
- package/src/components/Clipboard/Clipboard.tsx +0 -89
- package/src/components/Clipboard/index.ts +0 -1
- package/src/components/CodeEditor/ButtonToolbar.tsx +0 -14
- package/src/components/CodeEditor/CodeEditor.tsx +0 -155
- package/src/components/CodeEditor/SqlEditor.stories.tsx +0 -76
- package/src/components/CodeEditor/SqlEditor.tsx +0 -206
- package/src/components/CodeEditor/ToggleComponentHelp.tsx +0 -7
- package/src/components/CodeEditor/activeQueryHighlight.test.ts +0 -178
- package/src/components/CodeEditor/activeQueryHighlight.ts +0 -245
- package/src/components/CodeEditor/helpers.ts +0 -100
- package/src/components/CodeEditor/highlighting.ts +0 -184
- package/src/components/CodeEditor/index.ts +0 -3
- package/src/components/CodeEditor/search.ts +0 -186
- package/src/components/Collapse.stories.tsx +0 -56
- package/src/components/Collapse.tsx +0 -61
- package/src/components/Collapsible/Collapsible.stories.tsx +0 -55
- package/src/components/Collapsible/Collapsible.tsx +0 -11
- package/src/components/Collapsible/CollapsibleContent.tsx +0 -25
- package/src/components/Collapsible/index.ts +0 -1
- package/src/components/CollapsiblePanel.stories.tsx +0 -25
- package/src/components/CollapsiblePanel.tsx +0 -127
- package/src/components/Combobox/Combobox.stories.tsx +0 -426
- package/src/components/Combobox/Combobox.test.tsx +0 -165
- package/src/components/Combobox/Combobox.tsx +0 -345
- package/src/components/Combobox/ComboboxChips.tsx +0 -68
- package/src/components/Combobox/ComboboxContent.tsx +0 -95
- package/src/components/Combobox/ComboboxEmpty.tsx +0 -30
- package/src/components/Combobox/ComboboxInput.tsx +0 -10
- package/src/components/Combobox/ComboboxInputGroup.tsx +0 -38
- package/src/components/Combobox/ComboboxItem.tsx +0 -70
- package/src/components/Combobox/ComboboxItemIndicator.tsx +0 -78
- package/src/components/Combobox/ComboboxList.tsx +0 -32
- package/src/components/Combobox/ComboboxRoot.tsx +0 -5
- package/src/components/Combobox/ComboboxSeparator.tsx +0 -20
- package/src/components/Combobox/Group/ComboboxCollection.tsx +0 -7
- package/src/components/Combobox/Group/ComboboxGroup.tsx +0 -23
- package/src/components/Combobox/Group/ComboboxGroupLabel.tsx +0 -38
- package/src/components/Combobox/Group/index.ts +0 -3
- package/src/components/Combobox/index.ts +0 -1
- package/src/components/Combobox/types.ts +0 -22
- package/src/components/Combobox/utils.test.ts +0 -95
- package/src/components/Combobox/utils.ts +0 -103
- package/src/components/Command/Command.stories.tsx +0 -367
- package/src/components/Command/Command.tsx +0 -37
- package/src/components/Command/CommandContent.tsx +0 -19
- package/src/components/Command/CommandEmpty.tsx +0 -6
- package/src/components/Command/CommandGroup.tsx +0 -26
- package/src/components/Command/CommandInput.tsx +0 -27
- package/src/components/Command/CommandItem/CheckIndicator.tsx +0 -86
- package/src/components/Command/CommandItem/CommandItem.tsx +0 -94
- package/src/components/Command/CommandItem/index.ts +0 -1
- package/src/components/Command/CommandList.tsx +0 -32
- package/src/components/Command/CommandSeparator.tsx +0 -13
- package/src/components/Command/index.ts +0 -6
- package/src/components/DatePicker/DatePicker.tsx +0 -37
- package/src/components/DatePicker/index.ts +0 -1
- package/src/components/DiffView/DiffView.stories.tsx +0 -80
- package/src/components/DiffView/DiffView.tsx +0 -131
- package/src/components/DiffView/DiffViewMark.tsx +0 -21
- package/src/components/DiffView/DiffViewTd.tsx +0 -84
- package/src/components/DiffView/DiffViewTh.tsx +0 -23
- package/src/components/DiffView/index.ts +0 -11
- package/src/components/DiffView/util.test.ts +0 -231
- package/src/components/DiffView/util.ts +0 -311
- package/src/components/DotsLoader.tsx +0 -22
- package/src/components/DropdownMenu/DropdownMenu.stories.tsx +0 -310
- package/src/components/DropdownMenu/DropdownMenu.tsx +0 -61
- package/src/components/DropdownMenu/DropdownMenuCheckboxItem.tsx +0 -55
- package/src/components/DropdownMenu/DropdownMenuContent.tsx +0 -52
- package/src/components/DropdownMenu/DropdownMenuContext.tsx +0 -13
- package/src/components/DropdownMenu/DropdownMenuItem.tsx +0 -80
- package/src/components/DropdownMenu/DropdownMenuItemDescription.tsx +0 -42
- package/src/components/DropdownMenu/DropdownMenuItemIndicator.tsx +0 -104
- package/src/components/DropdownMenu/DropdownMenuLabel.tsx +0 -21
- package/src/components/DropdownMenu/DropdownMenuRadioGroup/DropdownMenuRadioGroup.tsx +0 -31
- package/src/components/DropdownMenu/DropdownMenuRadioGroup/DropdownMenuRadioItem.tsx +0 -67
- package/src/components/DropdownMenu/DropdownMenuRadioGroup/index.ts +0 -2
- package/src/components/DropdownMenu/DropdownMenuSeparator.tsx +0 -35
- package/src/components/DropdownMenu/DropdownMenuSub/DropdownMenuSub.tsx +0 -3
- package/src/components/DropdownMenu/DropdownMenuSub/DropdownMenuSubContent.tsx +0 -21
- package/src/components/DropdownMenu/DropdownMenuSub/DropdownMenuSubTrigger.tsx +0 -17
- package/src/components/DropdownMenu/DropdownMenuSub/index.ts +0 -3
- package/src/components/DropdownMenu/DropdownMenuTrigger.tsx +0 -19
- package/src/components/DropdownMenu/ItemIcon.tsx +0 -30
- package/src/components/DropdownMenu/index.ts +0 -1
- package/src/components/DropdownMenu/styles.ts +0 -82
- package/src/components/EmptySearchContent.stories.tsx +0 -12
- package/src/components/EmptySearchContent.tsx +0 -13
- package/src/components/FieldBox/FieldBox.stories.tsx +0 -138
- package/src/components/FieldBox/FieldBox.tsx +0 -43
- package/src/components/FieldBox/FieldBoxDescription.tsx +0 -18
- package/src/components/FieldBox/FieldBoxTitle.tsx +0 -20
- package/src/components/FieldBox/index.ts +0 -1
- package/src/components/FieldBox/styles.ts +0 -37
- package/src/components/FormGroup/FormGroup.stories.tsx +0 -120
- package/src/components/FormGroup/FormGroup.tsx +0 -48
- package/src/components/FormGroup/FormGroupColorInput.tsx +0 -15
- package/src/components/FormGroup/FormGroupHelp.tsx +0 -17
- package/src/components/FormGroup/FormGroupNumberInput.tsx +0 -15
- package/src/components/FormGroup/FormGroupTextInput.tsx +0 -15
- package/src/components/FormGroup/FormGroupTextarea.tsx +0 -12
- package/src/components/FormGroup/context.ts +0 -11
- package/src/components/FormGroup/index.ts +0 -2
- package/src/components/FormGroup/types.ts +0 -5
- package/src/components/FullScreenModal/FullScreenModal.tsx +0 -8
- package/src/components/FullScreenModal/FullScreenModalBody.tsx +0 -16
- package/src/components/FullScreenModal/FullScreenModalHeader.tsx +0 -92
- package/src/components/FullScreenModal/FullScreenModalRoot.tsx +0 -79
- package/src/components/FullScreenModal/index.ts +0 -3
- package/src/components/HelpBlock/HelpBlock.stories.tsx +0 -28
- package/src/components/HelpBlock/HelpBlock.tsx +0 -31
- package/src/components/HelpBlock/index.ts +0 -1
- package/src/components/HoverCard/HoverCard.stories.tsx +0 -77
- package/src/components/HoverCard/HoverCard.tsx +0 -13
- package/src/components/HoverCard/HoverCardContent.tsx +0 -68
- package/src/components/HoverCard/index.ts +0 -1
- package/src/components/Icon/Icon.stories.tsx +0 -26
- package/src/components/Icon/Icon.tsx +0 -10
- package/src/components/Icon/Icons.mdx +0 -28
- package/src/components/Icon/constants.ts +0 -1
- package/src/components/Icon/index.ts +0 -27
- package/src/components/Input/DateInput/DateInput.stories.tsx +0 -58
- package/src/components/Input/DateInput/DateInput.tsx +0 -143
- package/src/components/Input/DateInput/helpers.test.ts +0 -102
- package/src/components/Input/DateInput/helpers.ts +0 -59
- package/src/components/Input/DateInput/index.ts +0 -1
- package/src/components/Input/DateRangeInput/DateRangeInput.stories.tsx +0 -66
- package/src/components/Input/DateRangeInput/DateRangeInput.tsx +0 -139
- package/src/components/Input/DateRangeInput/helpers.test.ts +0 -146
- package/src/components/Input/DateRangeInput/helpers.ts +0 -36
- package/src/components/Input/DateRangeInput/index.ts +0 -1
- package/src/components/Input/Input.stories.tsx +0 -93
- package/src/components/Input/Input.test.tsx +0 -112
- package/src/components/Input/Input.tsx +0 -163
- package/src/components/Input/TextInput/TextInput.stories.tsx +0 -68
- package/src/components/Input/TextInput/TextInput.test.tsx +0 -52
- package/src/components/Input/TextInput/TextInput.tsx +0 -73
- package/src/components/Input/TextInput/index.ts +0 -1
- package/src/components/Input/TimeInput/TimeInput.stories.tsx +0 -89
- package/src/components/Input/TimeInput/TimeInput.tsx +0 -106
- package/src/components/Input/TimeInput/index.ts +0 -1
- package/src/components/Input/index.ts +0 -4
- package/src/components/Input/utils.ts +0 -11
- package/src/components/InputGroup/InputGroup.stories.tsx +0 -215
- package/src/components/InputGroup/InputGroup.tsx +0 -228
- package/src/components/InputGroup/InputGroupAddon.tsx +0 -57
- package/src/components/InputGroup/InputGroupButton.tsx +0 -25
- package/src/components/InputGroup/InputGroupInput.tsx +0 -34
- package/src/components/InputGroup/InputGroupText.tsx +0 -21
- package/src/components/InputGroup/InputGroupTextArea.tsx +0 -78
- package/src/components/InputGroup/index.ts +0 -1
- package/src/components/Kbd/Kbd.stories.tsx +0 -82
- package/src/components/Kbd/Kbd.tsx +0 -17
- package/src/components/Kbd/KbdGroup.tsx +0 -35
- package/src/components/Kbd/KbdSeparator.tsx +0 -9
- package/src/components/Kbd/index.ts +0 -3
- package/src/components/Kbd/keyboardKeys.ts +0 -40
- package/src/components/Kbd/styles.ts +0 -39
- package/src/components/Label/Label.stories.tsx +0 -53
- package/src/components/Label/Label.tsx +0 -31
- package/src/components/Label/index.ts +0 -1
- package/src/components/Link.stories.tsx +0 -19
- package/src/components/Link.tsx +0 -37
- package/src/components/MarkdownEditor/MarkdownEditor.stories.tsx +0 -182
- package/src/components/MarkdownEditor/MarkdownEditor.test.ts +0 -171
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +0 -245
- package/src/components/MarkdownEditor/context.ts +0 -10
- package/src/components/MarkdownEditor/index.ts +0 -1
- package/src/components/MarkdownEditor/nodes/ImageNode.tsx +0 -115
- package/src/components/MarkdownEditor/nodes/ImageNodeComponent.tsx +0 -18
- package/src/components/MarkdownEditor/nodes/MermaidNode.tsx +0 -72
- package/src/components/MarkdownEditor/nodes/MermaidNodeComponent.tsx +0 -35
- package/src/components/MarkdownEditor/plugins/ImagePastePlugin.tsx +0 -149
- package/src/components/MarkdownEditor/plugins/KeyboardPlugin.tsx +0 -81
- package/src/components/MarkdownEditor/plugins/MarkdownSyncPlugin.tsx +0 -65
- package/src/components/MarkdownEditor/plugins/ToolbarPlugin.tsx +0 -284
- package/src/components/MarkdownEditor/plugins/toolbar/AlignmentDropdown.tsx +0 -99
- package/src/components/MarkdownEditor/plugins/toolbar/BlockTypeDropdown.tsx +0 -142
- package/src/components/MarkdownEditor/plugins/toolbar/LinkPanel.tsx +0 -160
- package/src/components/MarkdownEditor/plugins/toolbar/ToolbarButton.tsx +0 -36
- package/src/components/MarkdownEditor/plugins/toolbar/ToolbarDivider.tsx +0 -1
- package/src/components/MarkdownEditor/theme.ts +0 -39
- package/src/components/MarkdownEditor/transformers.ts +0 -189
- package/src/components/MarkedText/MarkedText.stories.tsx +0 -46
- package/src/components/MarkedText/MarkedText.tsx +0 -36
- package/src/components/MarkedText/index.ts +0 -1
- package/src/components/MarkedText/utils.test.ts +0 -193
- package/src/components/MarkedText/utils.ts +0 -37
- package/src/components/MergeEditor/AcceptControls/AcceptButton.tsx +0 -25
- package/src/components/MergeEditor/AcceptControls/AcceptControls.tsx +0 -77
- package/src/components/MergeEditor/ConflictStatus/ConflictStatusIndicator.tsx +0 -38
- package/src/components/MergeEditor/MergeEditor.stories.tsx +0 -226
- package/src/components/MergeEditor/MergeEditor.tsx +0 -125
- package/src/components/MergeEditor/MergePane.tsx +0 -113
- package/src/components/MergeEditor/PaneHeader.tsx +0 -11
- package/src/components/MergeEditor/constants.ts +0 -48
- package/src/components/MergeEditor/decorations.ts +0 -126
- package/src/components/MergeEditor/helpers.test.ts +0 -172
- package/src/components/MergeEditor/helpers.ts +0 -118
- package/src/components/MergeEditor/index.ts +0 -5
- package/src/components/MergeEditor/useMergeDiff.ts +0 -573
- package/src/components/MergeEditor/useScrollSync.ts +0 -79
- package/src/components/Modal/Modal.stories.tsx +0 -680
- package/src/components/Modal/Modal.tsx +0 -49
- package/src/components/Modal/ModalBody.tsx +0 -33
- package/src/components/Modal/ModalCloseIcon.tsx +0 -31
- package/src/components/Modal/ModalContent.tsx +0 -95
- package/src/components/Modal/ModalDescription.tsx +0 -20
- package/src/components/Modal/ModalFooter.tsx +0 -20
- package/src/components/Modal/ModalHeader.tsx +0 -61
- package/src/components/Modal/ModalIcon.tsx +0 -109
- package/src/components/Modal/ModalOverlay.tsx +0 -42
- package/src/components/Modal/ModalTitle.tsx +0 -12
- package/src/components/Modal/index.ts +0 -1
- package/src/components/Navbar/Navbar.stories.tsx +0 -191
- package/src/components/Navbar/Navbar.tsx +0 -80
- package/src/components/Navbar/NavbarContent.tsx +0 -20
- package/src/components/Navbar/NavbarFooter.tsx +0 -11
- package/src/components/Navbar/NavbarHeader.tsx +0 -11
- package/src/components/Navbar/NavbarMenu.tsx +0 -30
- package/src/components/Navbar/NavbarMenuAvatar.tsx +0 -67
- package/src/components/Navbar/NavbarMenuButton.tsx +0 -135
- package/src/components/Navbar/NavbarMenuItem.tsx +0 -9
- package/src/components/Navbar/NavbarMenuItemAdornment.tsx +0 -65
- package/src/components/Navbar/index.ts +0 -1
- package/src/components/Pagination/Pagination.stories.tsx +0 -131
- package/src/components/Pagination/Pagination.tsx +0 -34
- package/src/components/Pagination/PaginationButton.tsx +0 -36
- package/src/components/Pagination/PaginationContent.tsx +0 -12
- package/src/components/Pagination/PaginationEllipsis.tsx +0 -26
- package/src/components/Pagination/PaginationItem.tsx +0 -9
- package/src/components/Pagination/PaginationNext.tsx +0 -20
- package/src/components/Pagination/PaginationPrevious.tsx +0 -14
- package/src/components/Pagination/index.ts +0 -1
- package/src/components/PanelWithDetails.stories.tsx +0 -28
- package/src/components/PanelWithDetails.tsx +0 -65
- package/src/components/Popconfirm/Popconfirm.stories.tsx +0 -373
- package/src/components/Popconfirm/Popconfirm.tsx +0 -82
- package/src/components/Popconfirm/PopconfirmBody.tsx +0 -5
- package/src/components/Popconfirm/PopconfirmCancel.tsx +0 -45
- package/src/components/Popconfirm/PopconfirmConfirm.tsx +0 -57
- package/src/components/Popconfirm/PopconfirmContent.tsx +0 -33
- package/src/components/Popconfirm/PopconfirmFooter.tsx +0 -9
- package/src/components/Popconfirm/PopconfirmTrigger.tsx +0 -22
- package/src/components/Popconfirm/context.ts +0 -19
- package/src/components/Popconfirm/index.ts +0 -1
- package/src/components/Popover/Popover.stories.tsx +0 -85
- package/src/components/Popover/Popover.tsx +0 -15
- package/src/components/Popover/PopoverContent.tsx +0 -103
- package/src/components/Popover/index.ts +0 -1
- package/src/components/Progress/Progress.stories.tsx +0 -67
- package/src/components/Progress/Progress.tsx +0 -45
- package/src/components/Progress/index.ts +0 -1
- package/src/components/RadioGroup/Radio.tsx +0 -61
- package/src/components/RadioGroup/RadioGroup.stories.tsx +0 -300
- package/src/components/RadioGroup/RadioGroup.tsx +0 -64
- package/src/components/RadioGroup/RadioGroupItem.tsx +0 -60
- package/src/components/RadioGroup/RadioGroupItemButton.tsx +0 -79
- package/src/components/RadioGroup/RadioGroupSeparator.tsx +0 -12
- package/src/components/RadioGroup/context.ts +0 -13
- package/src/components/RadioGroup/index.ts +0 -1
- package/src/components/Resizable/Resizable.stories.tsx +0 -50
- package/src/components/Resizable/ResizableHandle.tsx +0 -50
- package/src/components/Resizable/ResizablePanel.tsx +0 -12
- package/src/components/Resizable/ResizablePanelGroup.tsx +0 -19
- package/src/components/Resizable/index.ts +0 -3
- package/src/components/ScrollArea/ScrollArea.stories.tsx +0 -43
- package/src/components/ScrollArea/ScrollArea.tsx +0 -50
- package/src/components/ScrollArea/ScrollBar.tsx +0 -32
- package/src/components/ScrollArea/index.ts +0 -2
- package/src/components/Search/ClearButton.tsx +0 -42
- package/src/components/Search/Search.stories.tsx +0 -77
- package/src/components/Search/Search.test.tsx +0 -224
- package/src/components/Search/Search.tsx +0 -139
- package/src/components/Search/SearchForm.tsx +0 -37
- package/src/components/Search/index.ts +0 -2
- package/src/components/Search/styles.ts +0 -88
- package/src/components/Search/utils.ts +0 -11
- package/src/components/Select/Select.stories.tsx +0 -109
- package/src/components/Select/Select.tsx +0 -141
- package/src/components/Select/SelectContent.tsx +0 -110
- package/src/components/Select/SelectGroup.tsx +0 -10
- package/src/components/Select/SelectItem.tsx +0 -72
- package/src/components/Select/SelectLabel.tsx +0 -32
- package/src/components/Select/SelectRoot.tsx +0 -6
- package/src/components/Select/SelectSeparator.tsx +0 -13
- package/src/components/Select/SelectTrigger.tsx +0 -161
- package/src/components/Select/index.ts +0 -1
- package/src/components/Separator/Separator.stories.tsx +0 -60
- package/src/components/Separator/Separator.test.tsx +0 -39
- package/src/components/Separator/Separator.tsx +0 -115
- package/src/components/Separator/index.ts +0 -1
- package/src/components/Sheet/Sheet.stories.tsx +0 -63
- package/src/components/Sheet/Sheet.tsx +0 -21
- package/src/components/Sheet/SheetBody.tsx +0 -12
- package/src/components/Sheet/SheetContent.tsx +0 -131
- package/src/components/Sheet/SheetFooter.tsx +0 -9
- package/src/components/Sheet/SheetHeader.tsx +0 -39
- package/src/components/Sheet/SheetOverlay.tsx +0 -11
- package/src/components/Sheet/SheetTitle.tsx +0 -12
- package/src/components/Sheet/index.ts +0 -1
- package/src/components/Sidebar/Sidebar.stories.tsx +0 -849
- package/src/components/Sidebar/Sidebar.tsx +0 -225
- package/src/components/Sidebar/SidebarContent.tsx +0 -61
- package/src/components/Sidebar/SidebarFillTrigger.tsx +0 -25
- package/src/components/Sidebar/SidebarFooter.tsx +0 -13
- package/src/components/Sidebar/SidebarGroup/SidebarGroup.tsx +0 -23
- package/src/components/Sidebar/SidebarGroup/SidebarGroupAction.tsx +0 -53
- package/src/components/Sidebar/SidebarGroup/SidebarGroupContent.tsx +0 -20
- package/src/components/Sidebar/SidebarGroup/SidebarGroupLabel.tsx +0 -76
- package/src/components/Sidebar/SidebarGroup/index.ts +0 -4
- package/src/components/Sidebar/SidebarHeader.tsx +0 -20
- package/src/components/Sidebar/SidebarInstanceContext.ts +0 -18
- package/src/components/Sidebar/SidebarMenu/SidebarMenu.tsx +0 -28
- package/src/components/Sidebar/SidebarMenu/SidebarMenuAction.tsx +0 -69
- package/src/components/Sidebar/SidebarMenu/SidebarMenuBadge.tsx +0 -56
- package/src/components/Sidebar/SidebarMenu/SidebarMenuButton.tsx +0 -110
- package/src/components/Sidebar/SidebarMenu/SidebarMenuCard.tsx +0 -108
- package/src/components/Sidebar/SidebarMenu/SidebarMenuIcon.tsx +0 -30
- package/src/components/Sidebar/SidebarMenu/SidebarMenuItem.tsx +0 -9
- package/src/components/Sidebar/SidebarMenu/SidebarMenuSub.tsx +0 -139
- package/src/components/Sidebar/SidebarMenu/SidebarMenuSubItem.tsx +0 -106
- package/src/components/Sidebar/SidebarMenu/SidebarSearchInput.tsx +0 -88
- package/src/components/Sidebar/SidebarMenu/index.ts +0 -10
- package/src/components/Sidebar/SidebarProvider/SidebarProvider.tsx +0 -171
- package/src/components/Sidebar/SidebarProvider/context.ts +0 -35
- package/src/components/Sidebar/SidebarProvider/index.ts +0 -2
- package/src/components/Sidebar/SidebarProvider/useHoverTracking.test.ts +0 -199
- package/src/components/Sidebar/SidebarProvider/useHoverTracking.ts +0 -72
- package/src/components/Sidebar/SidebarProvider/useSidebarState.ts +0 -50
- package/src/components/Sidebar/SidebarProvider/useTransitionPresence.test.ts +0 -179
- package/src/components/Sidebar/SidebarProvider/useTransitionPresence.ts +0 -53
- package/src/components/Sidebar/SidebarResizeHandle.tsx +0 -28
- package/src/components/Sidebar/SidebarSeparator.tsx +0 -15
- package/src/components/Sidebar/SidebarTrigger.tsx +0 -40
- package/src/components/Sidebar/index.ts +0 -3
- package/src/components/Sidebar/types.ts +0 -6
- package/src/components/Sidebar/useResizeSidebar.ts +0 -112
- package/src/components/Sidebar/utils.test.ts +0 -178
- package/src/components/Sidebar/utils.ts +0 -70
- package/src/components/Skeleton/Skeleton.stories.tsx +0 -106
- package/src/components/Skeleton/Skeleton.tsx +0 -77
- package/src/components/Skeleton/SkeletonList.stories.tsx +0 -11
- package/src/components/Skeleton/SkeletonList.tsx +0 -65
- package/src/components/Slider/Slider.stories.tsx +0 -99
- package/src/components/Slider/Slider.tsx +0 -85
- package/src/components/Slider/SliderThumb.tsx +0 -57
- package/src/components/Slider/SliderTrack.tsx +0 -49
- package/src/components/Slider/index.ts +0 -1
- package/src/components/Slider/useInteracting.test.ts +0 -159
- package/src/components/Slider/useInteracting.ts +0 -64
- package/src/components/Switch/Switch.stories.tsx +0 -177
- package/src/components/Switch/Switch.tsx +0 -58
- package/src/components/Switch/index.ts +0 -1
- package/src/components/Switch/styles.ts +0 -173
- package/src/components/Table/Table.stories.tsx +0 -328
- package/src/components/Table/Table.tsx +0 -68
- package/src/components/Table/TableBody.tsx +0 -22
- package/src/components/Table/TableCell.tsx +0 -7
- package/src/components/Table/TableFooter.tsx +0 -15
- package/src/components/Table/TableHead.tsx +0 -15
- package/src/components/Table/TableHeader.tsx +0 -20
- package/src/components/Table/TableRow.tsx +0 -11
- package/src/components/Table/index.ts +0 -1
- package/src/components/Tabs.stories.tsx +0 -123
- package/src/components/Tabs.tsx +0 -134
- package/src/components/ThemeProvider/AIGradientSvg.tsx +0 -18
- package/src/components/ThemeProvider/ThemeProvider.tsx +0 -25
- package/src/components/ThemeProvider/index.ts +0 -1
- package/src/components/TimePicker/TimePicker.tsx +0 -95
- package/src/components/TimePicker/TimePickerButton.tsx +0 -39
- package/src/components/TimePicker/index.ts +0 -1
- package/src/components/TimePicker/utils.ts +0 -31
- package/src/components/Timeline/Timeline.stories.tsx +0 -246
- package/src/components/Timeline/Timeline.tsx +0 -35
- package/src/components/Timeline/TimelineConnector.tsx +0 -158
- package/src/components/Timeline/TimelineContent.tsx +0 -18
- package/src/components/Timeline/TimelineItem.tsx +0 -14
- package/src/components/Timeline/index.ts +0 -1
- package/src/components/Timeline/useLastLineHeight.ts +0 -36
- package/src/components/Toast/Toast.stories.tsx +0 -178
- package/src/components/Toast/ToastAction.tsx +0 -40
- package/src/components/Toast/ToastDescription.tsx +0 -28
- package/src/components/Toast/ToastDismiss.tsx +0 -36
- package/src/components/Toast/ToastDuration.tsx +0 -43
- package/src/components/Toast/ToastRoot.tsx +0 -135
- package/src/components/Toast/ToastTitle.tsx +0 -33
- package/src/components/Toast/Toaster.tsx +0 -25
- package/src/components/Toast/index.ts +0 -3
- package/src/components/Toast/toast.tsx +0 -94
- package/src/components/Toast/useNotification.tsx +0 -33
- package/src/components/Toggle/Toggle.stories.tsx +0 -67
- package/src/components/Toggle/Toggle.tsx +0 -202
- package/src/components/Toggle/index.ts +0 -1
- package/src/components/ToggleGroup/ToggleGroup.stories.tsx +0 -60
- package/src/components/ToggleGroup/ToggleGroup.tsx +0 -99
- package/src/components/ToggleGroup/index.ts +0 -1
- package/src/components/Tooltip/Tooltip.stories.tsx +0 -82
- package/src/components/Tooltip/Tooltip.tsx +0 -110
- package/src/components/Tooltip/TooltipContent.tsx +0 -90
- package/src/components/Tooltip/TooltipRoot.tsx +0 -12
- package/src/components/Tooltip/TooltipTrigger.tsx +0 -42
- package/src/components/Tooltip/index.ts +0 -1
- package/src/components/Truncated.stories.tsx +0 -72
- package/src/components/Truncated.tsx +0 -78
- package/src/components/ZoomableSvg/ZoomableSvg.stories.tsx +0 -53
- package/src/components/ZoomableSvg/ZoomableSvg.tsx +0 -200
- package/src/components/ZoomableSvg/index.ts +0 -1
- package/src/constants/keyCodes.ts +0 -5
- package/src/docs/Colors.mdx +0 -19
- package/src/docs/Spacing.mdx +0 -35
- package/src/docs/Typography.mdx +0 -63
- package/src/docs/components/Typeset.tsx +0 -35
- package/src/hooks/useAutosizeInput.stories.tsx +0 -142
- package/src/hooks/useAutosizeInput.test.tsx +0 -77
- package/src/hooks/useAutosizeInput.tsx +0 -107
- package/src/hooks/useElement.ts +0 -16
- package/src/hooks/useScrollbarPosition.ts +0 -68
- package/src/icon-names.ts +0 -20
- package/src/icons/Keboola.tsx +0 -28
- package/src/icons/icons.stories.tsx +0 -174
- package/src/icons/index.ts +0 -188
- package/src/index.ts +0 -90
- package/src/patterns/AlertWithAction.stories.tsx +0 -30
- package/src/patterns/CardWithEmptyState.stories.tsx +0 -66
- package/src/patterns/ConfirmDialog.stories.tsx +0 -72
- package/src/patterns/CreatableMultiCombobox.stories.tsx +0 -33
- package/src/patterns/DataCardWithSkeleton.stories.tsx +0 -48
- package/src/patterns/DisabledButtonTooltip.stories.tsx +0 -30
- package/src/patterns/FilterToolbar.stories.tsx +0 -275
- package/src/patterns/InfoTooltip.stories.tsx +0 -56
- package/src/patterns/ListDetail.stories.tsx +0 -65
- package/src/patterns/ModalForm.stories.tsx +0 -59
- package/src/patterns/PageHeaderTabs.stories.tsx +0 -48
- package/src/utils/classNames.test.ts +0 -16
- package/src/utils/classNames.ts +0 -27
- package/src/utils/copyToClipboard.ts +0 -3
- package/src/utils/createChangeInputEvent.ts +0 -28
- package/src/utils/createPrefixedString.ts +0 -2
- package/src/utils/debounce.test.ts +0 -63
- package/src/utils/debounce.ts +0 -17
- package/src/utils/decorators.tsx +0 -16
- package/src/utils/escapeStringRegexp.ts +0 -4
- package/src/utils/index.ts +0 -11
- package/src/utils/isMac.ts +0 -26
- package/src/utils/legacyIcon.tsx +0 -28
- package/src/utils/mergeRefs.ts +0 -23
- package/src/utils/noop.ts +0 -1
- package/src/utils/useSHA256.ts +0 -21
- package/src/vite-env.d.ts +0 -1
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { ComponentProps } from 'react';
|
|
2
|
-
|
|
3
|
-
import { ChevronRight } from '../../icons';
|
|
4
|
-
import { cn } from '../../utils';
|
|
5
|
-
|
|
6
|
-
import { PaginationButton } from './PaginationButton';
|
|
7
|
-
|
|
8
|
-
type Props = ComponentProps<typeof PaginationButton>;
|
|
9
|
-
|
|
10
|
-
export const PaginationNext = ({ children, className, ...props }: Props) => (
|
|
11
|
-
<PaginationButton
|
|
12
|
-
{...props}
|
|
13
|
-
aria-label="Go to next page"
|
|
14
|
-
size="medium"
|
|
15
|
-
className={cn('tw-flex-row-reverse', className)}
|
|
16
|
-
>
|
|
17
|
-
<ChevronRight className="tw-size-5" />
|
|
18
|
-
{children ?? 'Next'}
|
|
19
|
-
</PaginationButton>
|
|
20
|
-
);
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { ComponentProps } from 'react';
|
|
2
|
-
|
|
3
|
-
import { ChevronLeft } from '../../icons';
|
|
4
|
-
|
|
5
|
-
import { PaginationButton } from './PaginationButton';
|
|
6
|
-
|
|
7
|
-
type Props = ComponentProps<typeof PaginationButton>;
|
|
8
|
-
|
|
9
|
-
export const PaginationPrevious = ({ children, ...props }: Props) => (
|
|
10
|
-
<PaginationButton {...props} size="medium" aria-label="Go to previous page">
|
|
11
|
-
<ChevronLeft className="tw-size-5" />
|
|
12
|
-
{children ?? 'Previous'}
|
|
13
|
-
</PaginationButton>
|
|
14
|
-
);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Pagination';
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
-
|
|
3
|
-
import { PanelWithDetails } from './PanelWithDetails';
|
|
4
|
-
|
|
5
|
-
const meta: Meta<typeof PanelWithDetails> = {
|
|
6
|
-
component: PanelWithDetails,
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export default meta;
|
|
10
|
-
|
|
11
|
-
type Story = StoryObj<typeof PanelWithDetails>;
|
|
12
|
-
|
|
13
|
-
const commonArgs = {
|
|
14
|
-
children: (
|
|
15
|
-
<div className="tw-px-4 tw-py-3">
|
|
16
|
-
The extended attribute table file is full. The requested resource is in use. The file type
|
|
17
|
-
being saved or retrieved has been blocked.
|
|
18
|
-
</div>
|
|
19
|
-
),
|
|
20
|
-
} as const;
|
|
21
|
-
|
|
22
|
-
export const Top: Story = {
|
|
23
|
-
args: { ...commonArgs, placement: 'top' },
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const Bottom: Story = {
|
|
27
|
-
args: { ...commonArgs, placement: 'bottom' },
|
|
28
|
-
};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import type { KeyboardEvent, PropsWithChildren } from 'react';
|
|
3
|
-
|
|
4
|
-
import { keyCodes } from '../constants/keyCodes';
|
|
5
|
-
import { ChevronDown } from '../icons';
|
|
6
|
-
import { cn } from '../utils';
|
|
7
|
-
|
|
8
|
-
import { Collapse } from './Collapse';
|
|
9
|
-
|
|
10
|
-
type Props = PropsWithChildren<{
|
|
11
|
-
defaultExpanded?: boolean;
|
|
12
|
-
labelCollapse?: string;
|
|
13
|
-
labelOpen?: string;
|
|
14
|
-
placement?: 'top' | 'bottom';
|
|
15
|
-
className?: string;
|
|
16
|
-
}>;
|
|
17
|
-
|
|
18
|
-
export const PanelWithDetails = ({
|
|
19
|
-
defaultExpanded = false,
|
|
20
|
-
labelCollapse = 'Hide details',
|
|
21
|
-
labelOpen = 'Show details',
|
|
22
|
-
placement = 'top',
|
|
23
|
-
children,
|
|
24
|
-
}: Props) => {
|
|
25
|
-
const [isOpen, setIsOpen] = useState(defaultExpanded);
|
|
26
|
-
|
|
27
|
-
const handleKeyUp = (e: KeyboardEvent<HTMLDivElement>) => {
|
|
28
|
-
if ([keyCodes.ENTER, keyCodes.SPACE].includes(e.key)) {
|
|
29
|
-
e.stopPropagation();
|
|
30
|
-
setIsOpen(!isOpen);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<Collapse
|
|
36
|
-
open={isOpen}
|
|
37
|
-
className={cn(placement === 'bottom' ? 'tw-flex-col-reverse' : 'tw-flex-col')}
|
|
38
|
-
header={
|
|
39
|
-
<div
|
|
40
|
-
role="button"
|
|
41
|
-
tabIndex={0}
|
|
42
|
-
className={cn(
|
|
43
|
-
'tw-flex tw-cursor-pointer tw-items-center tw-rounded-sm tw-bg-neutral-100 tw-px-4 tw-py-3 tw-text-sm tw-text-neutral-400',
|
|
44
|
-
'hover:tw-text-secondary-500',
|
|
45
|
-
)}
|
|
46
|
-
onClick={() => setIsOpen(!isOpen)}
|
|
47
|
-
onKeyUp={handleKeyUp}
|
|
48
|
-
>
|
|
49
|
-
<div className="tw-mr-2 tw-flex tw-shrink-0 tw-items-center">
|
|
50
|
-
<ChevronDown
|
|
51
|
-
className={cn(
|
|
52
|
-
'tw-size-5',
|
|
53
|
-
!isOpen ? '-tw-rotate-90' : placement === 'bottom' ? 'tw-rotate-180' : '',
|
|
54
|
-
)}
|
|
55
|
-
/>
|
|
56
|
-
</div>
|
|
57
|
-
|
|
58
|
-
<div className="tw-py-0.5">{isOpen ? labelCollapse : labelOpen}</div>
|
|
59
|
-
</div>
|
|
60
|
-
}
|
|
61
|
-
>
|
|
62
|
-
<div className="tw-px-5 tw-py-3">{children}</div>
|
|
63
|
-
</Collapse>
|
|
64
|
-
);
|
|
65
|
-
};
|
|
@@ -1,373 +0,0 @@
|
|
|
1
|
-
import { type ComponentProps, useState } from 'react';
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
3
|
-
import { action } from 'storybook/actions';
|
|
4
|
-
|
|
5
|
-
import { Check, Rocket, Trash2, X } from '@keboola/design/icons';
|
|
6
|
-
|
|
7
|
-
import { Button } from '../Button/Button';
|
|
8
|
-
import { DropdownMenu } from '../DropdownMenu';
|
|
9
|
-
import { Label } from '../Label';
|
|
10
|
-
import { Modal } from '../Modal';
|
|
11
|
-
import { Switch } from '../Switch';
|
|
12
|
-
|
|
13
|
-
import { Popconfirm } from './Popconfirm';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Pop up a bubble confirmation box for an action.
|
|
17
|
-
* ### When to use
|
|
18
|
-
* A simple and compact popover used for asking for user confirmation.
|
|
19
|
-
*/
|
|
20
|
-
const meta: Meta<typeof Popconfirm> = {
|
|
21
|
-
component: Popconfirm,
|
|
22
|
-
decorators: [
|
|
23
|
-
(Story) => (
|
|
24
|
-
<div className="tw-flex tw-justify-center">
|
|
25
|
-
<Story />
|
|
26
|
-
</div>
|
|
27
|
-
),
|
|
28
|
-
],
|
|
29
|
-
args: {
|
|
30
|
-
onConfirm: (event) => {
|
|
31
|
-
action('onConfirm')(event);
|
|
32
|
-
},
|
|
33
|
-
onCancel: (event) => {
|
|
34
|
-
action('onCancel')(event);
|
|
35
|
-
},
|
|
36
|
-
variant: 'confirm',
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export default meta;
|
|
41
|
-
|
|
42
|
-
type Story = StoryObj<typeof meta>;
|
|
43
|
-
|
|
44
|
-
const DeafultDemo = ({
|
|
45
|
-
children,
|
|
46
|
-
align,
|
|
47
|
-
side,
|
|
48
|
-
...props
|
|
49
|
-
}: ComponentProps<typeof Popconfirm> &
|
|
50
|
-
Pick<ComponentProps<typeof Popconfirm.Content>, 'align' | 'side'>) => {
|
|
51
|
-
return (
|
|
52
|
-
<Popconfirm {...props}>
|
|
53
|
-
<Popconfirm.Trigger asChild>{children}</Popconfirm.Trigger>
|
|
54
|
-
<Popconfirm.Content align={align} side={side}>
|
|
55
|
-
<Popconfirm.Body>
|
|
56
|
-
{side}-{align}
|
|
57
|
-
</Popconfirm.Body>
|
|
58
|
-
|
|
59
|
-
<Popconfirm.Footer>
|
|
60
|
-
<Popconfirm.Cancel />
|
|
61
|
-
<Popconfirm.Confirm />
|
|
62
|
-
</Popconfirm.Footer>
|
|
63
|
-
</Popconfirm.Content>
|
|
64
|
-
</Popconfirm>
|
|
65
|
-
);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export const Default: Story = {
|
|
69
|
-
render: (props) => (
|
|
70
|
-
<div className="tw-flex tw-w-full tw-flex-col tw-gap-8 tw-px-52">
|
|
71
|
-
<div className="tw-flex tw-justify-center tw-gap-2">
|
|
72
|
-
<DeafultDemo {...props} side="top" align="start">
|
|
73
|
-
<Button variant="primary">Top-Start</Button>
|
|
74
|
-
</DeafultDemo>
|
|
75
|
-
|
|
76
|
-
<DeafultDemo {...props} side="top" align="center">
|
|
77
|
-
<Button variant="primary">Top-Center</Button>
|
|
78
|
-
</DeafultDemo>
|
|
79
|
-
<DeafultDemo {...props} side="top" align="end">
|
|
80
|
-
<Button variant="primary">Top-End</Button>
|
|
81
|
-
</DeafultDemo>
|
|
82
|
-
</div>
|
|
83
|
-
|
|
84
|
-
<div className="tw-flex tw-justify-between">
|
|
85
|
-
<div className="tw-flex tw-flex-col tw-gap-2">
|
|
86
|
-
<DeafultDemo {...props} side="left" align="start">
|
|
87
|
-
<Button variant="primary">Left-start</Button>
|
|
88
|
-
</DeafultDemo>
|
|
89
|
-
<DeafultDemo {...props} side="left" align="center">
|
|
90
|
-
<Button variant="primary">left-center</Button>
|
|
91
|
-
</DeafultDemo>
|
|
92
|
-
<DeafultDemo {...props} side="left" align="end">
|
|
93
|
-
<Button variant="primary">left-end</Button>
|
|
94
|
-
</DeafultDemo>
|
|
95
|
-
</div>
|
|
96
|
-
|
|
97
|
-
<div className="tw-flex tw-flex-col tw-gap-2">
|
|
98
|
-
<DeafultDemo {...props} side="right" align="start">
|
|
99
|
-
<Button variant="primary">right-start</Button>
|
|
100
|
-
</DeafultDemo>
|
|
101
|
-
<DeafultDemo {...props} side="right" align="center">
|
|
102
|
-
<Button variant="primary">right-center</Button>
|
|
103
|
-
</DeafultDemo>
|
|
104
|
-
<DeafultDemo {...props} side="right" align="end">
|
|
105
|
-
<Button variant="primary">right-end</Button>
|
|
106
|
-
</DeafultDemo>
|
|
107
|
-
</div>
|
|
108
|
-
</div>
|
|
109
|
-
|
|
110
|
-
<div className="tw-flex tw-justify-center tw-gap-2">
|
|
111
|
-
<DeafultDemo {...props} side="bottom" align="start">
|
|
112
|
-
<Button variant="primary">Bottom-Start</Button>
|
|
113
|
-
</DeafultDemo>
|
|
114
|
-
|
|
115
|
-
<DeafultDemo {...props} side="bottom" align="center">
|
|
116
|
-
<Button variant="primary">Bottom-Center</Button>
|
|
117
|
-
</DeafultDemo>
|
|
118
|
-
<DeafultDemo {...props} side="bottom" align="end">
|
|
119
|
-
<Button variant="primary">Bottom-End</Button>
|
|
120
|
-
</DeafultDemo>
|
|
121
|
-
</div>
|
|
122
|
-
</div>
|
|
123
|
-
),
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
export const Confirm: Story = {
|
|
127
|
-
render: (props) => (
|
|
128
|
-
<Popconfirm {...props}>
|
|
129
|
-
<Popconfirm.Trigger asChild>
|
|
130
|
-
<Button variant="primary">Trigger</Button>
|
|
131
|
-
</Popconfirm.Trigger>
|
|
132
|
-
<Popconfirm.Content>
|
|
133
|
-
<Popconfirm.Body>Are you sure you want to proceed with this action</Popconfirm.Body>
|
|
134
|
-
|
|
135
|
-
<Popconfirm.Footer>
|
|
136
|
-
<Popconfirm.Cancel />
|
|
137
|
-
<Popconfirm.Confirm />
|
|
138
|
-
</Popconfirm.Footer>
|
|
139
|
-
</Popconfirm.Content>
|
|
140
|
-
</Popconfirm>
|
|
141
|
-
),
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
export const Danger: Story = {
|
|
145
|
-
args: {
|
|
146
|
-
variant: 'danger',
|
|
147
|
-
},
|
|
148
|
-
render: (props) => (
|
|
149
|
-
<Popconfirm {...props}>
|
|
150
|
-
<Popconfirm.Trigger asChild>
|
|
151
|
-
<Button variant="danger">Trigger</Button>
|
|
152
|
-
</Popconfirm.Trigger>
|
|
153
|
-
<Popconfirm.Content>
|
|
154
|
-
<Popconfirm.Body>Are you sure you want to delete this branch?</Popconfirm.Body>
|
|
155
|
-
|
|
156
|
-
<Popconfirm.Footer>
|
|
157
|
-
<Popconfirm.Cancel />
|
|
158
|
-
<Popconfirm.Confirm />
|
|
159
|
-
</Popconfirm.Footer>
|
|
160
|
-
</Popconfirm.Content>
|
|
161
|
-
</Popconfirm>
|
|
162
|
-
),
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
const SkipPopoverDemo = (props: ComponentProps<typeof Popconfirm>) => {
|
|
166
|
-
const [enabled, setEnabled] = useState(false);
|
|
167
|
-
|
|
168
|
-
return (
|
|
169
|
-
<div className="tw-flex tw-flex-col tw-gap-2">
|
|
170
|
-
<div className="tw-flex tw-items-center tw-gap-2">
|
|
171
|
-
<Switch id="allow-popover" checked={enabled} onCheckedChange={setEnabled} />
|
|
172
|
-
<Label htmlFor="allow-popover">Skip Confirm</Label>
|
|
173
|
-
</div>
|
|
174
|
-
|
|
175
|
-
<Popconfirm {...props} enabled={!enabled}>
|
|
176
|
-
<Popconfirm.Trigger asChild>
|
|
177
|
-
<Button variant="primary">Trigger</Button>
|
|
178
|
-
</Popconfirm.Trigger>
|
|
179
|
-
<Popconfirm.Content>
|
|
180
|
-
<Popconfirm.Body>Are you sure you want to proceed with this action</Popconfirm.Body>
|
|
181
|
-
|
|
182
|
-
<Popconfirm.Footer>
|
|
183
|
-
<Popconfirm.Cancel />
|
|
184
|
-
<Popconfirm.Confirm />
|
|
185
|
-
</Popconfirm.Footer>
|
|
186
|
-
</Popconfirm.Content>
|
|
187
|
-
</Popconfirm>
|
|
188
|
-
</div>
|
|
189
|
-
);
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
export const SkipPopconfirm: Story = {
|
|
193
|
-
args: {
|
|
194
|
-
onConfirm: () => {
|
|
195
|
-
alert('Confirmed!');
|
|
196
|
-
},
|
|
197
|
-
},
|
|
198
|
-
render: SkipPopoverDemo,
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
export const AsyncConfirm: Story = {
|
|
202
|
-
args: {
|
|
203
|
-
onConfirm: () => new Promise((resolve) => setTimeout(resolve, 3000)),
|
|
204
|
-
},
|
|
205
|
-
render: (props) => (
|
|
206
|
-
<Popconfirm {...props}>
|
|
207
|
-
<Popconfirm.Trigger asChild>
|
|
208
|
-
<Button variant="primary">Trigger</Button>
|
|
209
|
-
</Popconfirm.Trigger>
|
|
210
|
-
<Popconfirm.Content>
|
|
211
|
-
<Popconfirm.Body>Are you sure you want to proceed with this action</Popconfirm.Body>
|
|
212
|
-
|
|
213
|
-
<Popconfirm.Footer>
|
|
214
|
-
<Popconfirm.Cancel />
|
|
215
|
-
<Popconfirm.Confirm />
|
|
216
|
-
</Popconfirm.Footer>
|
|
217
|
-
</Popconfirm.Content>
|
|
218
|
-
</Popconfirm>
|
|
219
|
-
),
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
const ControlledDemo = (props: ComponentProps<typeof Popconfirm>) => {
|
|
223
|
-
const [open, setIsOpen] = useState(false);
|
|
224
|
-
|
|
225
|
-
return (
|
|
226
|
-
<Popconfirm {...props} open={open} onOpenChange={setIsOpen}>
|
|
227
|
-
<Popconfirm.Trigger asChild>
|
|
228
|
-
<Button variant="primary">Trigger</Button>
|
|
229
|
-
</Popconfirm.Trigger>
|
|
230
|
-
<Popconfirm.Content>
|
|
231
|
-
<Popconfirm.Body>Are you sure you want to proceed with this action</Popconfirm.Body>
|
|
232
|
-
|
|
233
|
-
<Popconfirm.Footer>
|
|
234
|
-
<Popconfirm.Cancel />
|
|
235
|
-
<Popconfirm.Confirm />
|
|
236
|
-
</Popconfirm.Footer>
|
|
237
|
-
</Popconfirm.Content>
|
|
238
|
-
</Popconfirm>
|
|
239
|
-
);
|
|
240
|
-
};
|
|
241
|
-
|
|
242
|
-
export const Controlled: Story = {
|
|
243
|
-
render: ControlledDemo,
|
|
244
|
-
};
|
|
245
|
-
|
|
246
|
-
export const CustomButtons: Story = {
|
|
247
|
-
render: (props) => (
|
|
248
|
-
<Popconfirm {...props}>
|
|
249
|
-
<Popconfirm.Trigger asChild>
|
|
250
|
-
<Button variant="primary">Trigger</Button>
|
|
251
|
-
</Popconfirm.Trigger>
|
|
252
|
-
<Popconfirm.Content>
|
|
253
|
-
<Popconfirm.Body>Are you sure you want to proceed with this action</Popconfirm.Body>
|
|
254
|
-
|
|
255
|
-
<Popconfirm.Footer className="tw-flex tw-justify-end">
|
|
256
|
-
<Popconfirm.Cancel asChild>
|
|
257
|
-
<Button variant="outline" size="icon">
|
|
258
|
-
<X className="tw-size-4" />
|
|
259
|
-
</Button>
|
|
260
|
-
</Popconfirm.Cancel>
|
|
261
|
-
|
|
262
|
-
<Popconfirm.Confirm asChild>
|
|
263
|
-
<Button size="icon">
|
|
264
|
-
<Rocket className="tw-size-4" />
|
|
265
|
-
</Button>
|
|
266
|
-
</Popconfirm.Confirm>
|
|
267
|
-
</Popconfirm.Footer>
|
|
268
|
-
</Popconfirm.Content>
|
|
269
|
-
</Popconfirm>
|
|
270
|
-
),
|
|
271
|
-
};
|
|
272
|
-
|
|
273
|
-
export const WithoutCancel: Story = {
|
|
274
|
-
args: {
|
|
275
|
-
variant: 'danger',
|
|
276
|
-
},
|
|
277
|
-
render: (props) => (
|
|
278
|
-
<Popconfirm {...props}>
|
|
279
|
-
<Popconfirm.Trigger asChild>
|
|
280
|
-
<Button variant="danger">Trigger</Button>
|
|
281
|
-
</Popconfirm.Trigger>
|
|
282
|
-
<Popconfirm.Content>
|
|
283
|
-
<Popconfirm.Body>Are you sure you want to delete this branch?</Popconfirm.Body>
|
|
284
|
-
|
|
285
|
-
<Popconfirm.Footer>
|
|
286
|
-
<Popconfirm.Confirm />
|
|
287
|
-
</Popconfirm.Footer>
|
|
288
|
-
</Popconfirm.Content>
|
|
289
|
-
</Popconfirm>
|
|
290
|
-
),
|
|
291
|
-
};
|
|
292
|
-
|
|
293
|
-
export const InModal: Story = {
|
|
294
|
-
args: {
|
|
295
|
-
variant: 'danger',
|
|
296
|
-
},
|
|
297
|
-
render: (props) => (
|
|
298
|
-
<Modal>
|
|
299
|
-
<Modal.Trigger asChild>
|
|
300
|
-
<Button type="button">Open Modal</Button>
|
|
301
|
-
</Modal.Trigger>
|
|
302
|
-
<Modal.Content>
|
|
303
|
-
<Modal.Body className="tw-flex tw-justify-center">
|
|
304
|
-
<Popconfirm {...props}>
|
|
305
|
-
<Popconfirm.Trigger asChild>
|
|
306
|
-
<Button variant="danger" size="icon">
|
|
307
|
-
<Trash2 className="tw-size-4" />
|
|
308
|
-
</Button>
|
|
309
|
-
</Popconfirm.Trigger>
|
|
310
|
-
<Popconfirm.Content>
|
|
311
|
-
<Popconfirm.Body>Are you sure you want to delete this branch?</Popconfirm.Body>
|
|
312
|
-
|
|
313
|
-
<Popconfirm.Footer>
|
|
314
|
-
<Popconfirm.Cancel />
|
|
315
|
-
<Popconfirm.Confirm />
|
|
316
|
-
</Popconfirm.Footer>
|
|
317
|
-
</Popconfirm.Content>
|
|
318
|
-
</Popconfirm>
|
|
319
|
-
</Modal.Body>
|
|
320
|
-
<Modal.Footer>
|
|
321
|
-
<Modal.Close asChild>
|
|
322
|
-
<Button type="button" variant="primary" className="tw-w-full">
|
|
323
|
-
Close
|
|
324
|
-
</Button>
|
|
325
|
-
</Modal.Close>
|
|
326
|
-
</Modal.Footer>
|
|
327
|
-
</Modal.Content>
|
|
328
|
-
</Modal>
|
|
329
|
-
),
|
|
330
|
-
};
|
|
331
|
-
|
|
332
|
-
export const InDropdownMenu: Story = {
|
|
333
|
-
render: (props) => (
|
|
334
|
-
<DropdownMenu>
|
|
335
|
-
<DropdownMenu.Trigger asChild>
|
|
336
|
-
<Button type="button">Open Dropdown menu</Button>
|
|
337
|
-
</DropdownMenu.Trigger>
|
|
338
|
-
<DropdownMenu.Content>
|
|
339
|
-
<DropdownMenu.Group>
|
|
340
|
-
<Popconfirm {...props} variant="danger">
|
|
341
|
-
<Popconfirm.Trigger asChild>
|
|
342
|
-
<DropdownMenu.Item asModalTrigger icon={<Trash2 className="tw-size-4" />}>
|
|
343
|
-
Delete Task
|
|
344
|
-
</DropdownMenu.Item>
|
|
345
|
-
</Popconfirm.Trigger>
|
|
346
|
-
<Popconfirm.Content side="left">
|
|
347
|
-
<Popconfirm.Body>Are you sure you want to delte this task?</Popconfirm.Body>
|
|
348
|
-
<Popconfirm.Footer>
|
|
349
|
-
<Popconfirm.Cancel />
|
|
350
|
-
<Popconfirm.Confirm />
|
|
351
|
-
</Popconfirm.Footer>
|
|
352
|
-
</Popconfirm.Content>
|
|
353
|
-
</Popconfirm>
|
|
354
|
-
|
|
355
|
-
<Popconfirm {...props}>
|
|
356
|
-
<Popconfirm.Trigger asChild>
|
|
357
|
-
<DropdownMenu.Item asModalTrigger icon={<Check className="tw-size-4" />}>
|
|
358
|
-
Confirm
|
|
359
|
-
</DropdownMenu.Item>
|
|
360
|
-
</Popconfirm.Trigger>
|
|
361
|
-
<Popconfirm.Content side="left">
|
|
362
|
-
<Popconfirm.Body>Are you sure you want to continue?</Popconfirm.Body>
|
|
363
|
-
<Popconfirm.Footer>
|
|
364
|
-
<Popconfirm.Cancel />
|
|
365
|
-
<Popconfirm.Confirm />
|
|
366
|
-
</Popconfirm.Footer>
|
|
367
|
-
</Popconfirm.Content>
|
|
368
|
-
</Popconfirm>
|
|
369
|
-
</DropdownMenu.Group>
|
|
370
|
-
</DropdownMenu.Content>
|
|
371
|
-
</DropdownMenu>
|
|
372
|
-
),
|
|
373
|
-
};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { useMemo, useRef, useState } from 'react';
|
|
2
|
-
import type { ComponentProps, ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
import { Popover } from '../Popover';
|
|
5
|
-
|
|
6
|
-
import { PopconfirmContextProvider, type PopconfirmContextType } from './context';
|
|
7
|
-
import { PopconfirmBody } from './PopconfirmBody';
|
|
8
|
-
import { PopconfirmCancel } from './PopconfirmCancel';
|
|
9
|
-
import { PopconfirmConfirm } from './PopconfirmConfirm';
|
|
10
|
-
import { PopconfirmContent } from './PopconfirmContent';
|
|
11
|
-
import { PopconfirmFooter } from './PopconfirmFooter';
|
|
12
|
-
import { PopconfirmTrigger } from './PopconfirmTrigger';
|
|
13
|
-
|
|
14
|
-
const noop = () => void 0;
|
|
15
|
-
|
|
16
|
-
type Props = {
|
|
17
|
-
children: ReactNode;
|
|
18
|
-
skipAsyncWait?: boolean;
|
|
19
|
-
} & ComponentProps<typeof Popover> &
|
|
20
|
-
Omit<Partial<PopconfirmContextType>, 'isLoading'>;
|
|
21
|
-
|
|
22
|
-
export const Popconfirm = ({
|
|
23
|
-
children,
|
|
24
|
-
onConfirm = noop,
|
|
25
|
-
onCancel = noop,
|
|
26
|
-
variant = 'confirm',
|
|
27
|
-
enabled = true,
|
|
28
|
-
onOpenChange = noop,
|
|
29
|
-
open,
|
|
30
|
-
skipAsyncWait = false,
|
|
31
|
-
...rest
|
|
32
|
-
}: Props) => {
|
|
33
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
34
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
35
|
-
|
|
36
|
-
const confirmRef = useRef(onConfirm);
|
|
37
|
-
const cancelRef = useRef(onCancel);
|
|
38
|
-
confirmRef.current = onConfirm;
|
|
39
|
-
cancelRef.current = onCancel;
|
|
40
|
-
|
|
41
|
-
const handleOnOpenChange = (open: boolean) => {
|
|
42
|
-
setIsOpen(open);
|
|
43
|
-
onOpenChange(open);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const context = useMemo<PopconfirmContextType>(
|
|
47
|
-
() => ({
|
|
48
|
-
variant,
|
|
49
|
-
isLoading,
|
|
50
|
-
enabled,
|
|
51
|
-
onConfirm: (event) => {
|
|
52
|
-
const result = confirmRef.current(event);
|
|
53
|
-
|
|
54
|
-
if (!(result instanceof Promise) || skipAsyncWait) return;
|
|
55
|
-
|
|
56
|
-
event.preventDefault();
|
|
57
|
-
setIsLoading(true);
|
|
58
|
-
result.finally(() => {
|
|
59
|
-
setIsLoading(false);
|
|
60
|
-
setIsOpen(false);
|
|
61
|
-
});
|
|
62
|
-
},
|
|
63
|
-
onCancel: (event) => {
|
|
64
|
-
cancelRef.current(event);
|
|
65
|
-
},
|
|
66
|
-
}),
|
|
67
|
-
[variant, isLoading, enabled, skipAsyncWait],
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
return (
|
|
71
|
-
<Popover {...rest} open={open || isOpen} onOpenChange={handleOnOpenChange}>
|
|
72
|
-
<PopconfirmContextProvider value={context}>{children}</PopconfirmContextProvider>
|
|
73
|
-
</Popover>
|
|
74
|
-
);
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
Popconfirm.Confirm = PopconfirmConfirm;
|
|
78
|
-
Popconfirm.Cancel = PopconfirmCancel;
|
|
79
|
-
Popconfirm.Footer = PopconfirmFooter;
|
|
80
|
-
Popconfirm.Content = PopconfirmContent;
|
|
81
|
-
Popconfirm.Body = PopconfirmBody;
|
|
82
|
-
Popconfirm.Trigger = PopconfirmTrigger;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { ComponentProps, ElementRef, ReactNode, Ref } from 'react';
|
|
2
|
-
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
-
|
|
4
|
-
import { cn } from '../../utils';
|
|
5
|
-
import { Button } from '../Button';
|
|
6
|
-
import { Popover } from '../Popover';
|
|
7
|
-
|
|
8
|
-
import { usePopconfirmContext } from './context';
|
|
9
|
-
|
|
10
|
-
type SlotProps = { asChild: true } & ComponentProps<'button'>;
|
|
11
|
-
type ButtonProps = { asChild?: false; children?: ReactNode } & Omit<
|
|
12
|
-
ComponentProps<typeof Button>,
|
|
13
|
-
'children'
|
|
14
|
-
>;
|
|
15
|
-
type Props = SlotProps | ButtonProps;
|
|
16
|
-
|
|
17
|
-
export const PopconfirmCancel = ({
|
|
18
|
-
ref,
|
|
19
|
-
onClick,
|
|
20
|
-
children,
|
|
21
|
-
asChild,
|
|
22
|
-
className,
|
|
23
|
-
...props
|
|
24
|
-
}: Props & { ref?: Ref<ElementRef<'button'>> }) => {
|
|
25
|
-
const { onCancel, isLoading } = usePopconfirmContext();
|
|
26
|
-
|
|
27
|
-
const handleClick: ComponentProps<'button'>['onClick'] = (event) => {
|
|
28
|
-
onClick?.(event);
|
|
29
|
-
onCancel(event);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<Popover.Close asChild onClick={handleClick} disabled={isLoading}>
|
|
34
|
-
{asChild ? (
|
|
35
|
-
<Slot {...props} ref={ref} className={className}>
|
|
36
|
-
{children}
|
|
37
|
-
</Slot>
|
|
38
|
-
) : (
|
|
39
|
-
<Button variant="outline" size="small" {...props} ref={ref} className={cn(className)}>
|
|
40
|
-
{children ?? 'Cancel'}
|
|
41
|
-
</Button>
|
|
42
|
-
)}
|
|
43
|
-
</Popover.Close>
|
|
44
|
-
);
|
|
45
|
-
};
|