@webiny/admin-ui 6.2.0 → 6.3.0-beta.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/Accordion/Accordion.d.ts +1 -1
- package/Accordion/Accordion.mdx +437 -463
- package/Accordion/components/AccordionContent.js.map +1 -1
- package/Alert/Alert.d.ts +1 -1
- package/Alert/Alert.js.map +1 -1
- package/Alert/Alert.mdx +80 -83
- package/AutoComplete/AutoComplete.mdx +63 -55
- package/Avatar/Avatar.d.ts +1 -1
- package/Avatar/Avatar.js.map +1 -1
- package/Avatar/Avatar.mdx +52 -43
- package/Button/Button.d.ts +1 -1
- package/Button/Button.js.map +1 -1
- package/Button/Button.mdx +50 -42
- package/Button/IconButton.d.ts +1 -1
- package/Button/IconButton.js.map +1 -1
- package/Card/components/CardContent.d.ts +1 -1
- package/Card/components/CardTitle.d.ts +1 -1
- package/Checkbox/Checkbox.mdx +51 -49
- package/Checkbox/primitives/CheckboxPrimitive.d.ts +1 -1
- package/CheckboxGroup/CheckboxGroup.mdx +51 -53
- package/CodeEditor/CodeEditor.mdx +44 -43
- package/ColorPicker/ColorPicker.mdx +41 -40
- package/Command/components/Item.d.ts +1 -1
- package/Command/components/Item.js.map +1 -1
- package/DataTable/DataTable.mdx +537 -542
- package/DataTable/components/ColumnSorter.d.ts +1 -1
- package/DataTable/components/ColumnSorter.js.map +1 -1
- package/Dialog/Dialog.js.map +1 -1
- package/Dialog/components/DialogContent.d.ts +1 -1
- package/Dialog/components/DialogContent.js +1 -1
- package/Dialog/components/DialogContent.js.map +1 -1
- package/Dialog/components/DialogFooter.d.ts +1 -1
- package/Dialog/components/DialogFooter.js.map +1 -1
- package/Dialog/components/DialogTitle.d.ts +1 -1
- package/Drawer/Drawer.js.map +1 -1
- package/Drawer/Drawer.mdx +73 -64
- package/Drawer/components/DrawerContent.d.ts +1 -1
- package/Drawer/components/DrawerContent.js.map +1 -1
- package/DropdownMenu/DropdownMenu.js.map +1 -1
- package/DropdownMenu/DropdownMenu.mdx +155 -256
- package/DropdownMenu/components/DropdownMenuCheckboxItem.js.map +1 -1
- package/DropdownMenu/components/DropdownMenuLabel.js.map +1 -1
- package/FilePicker/FilePicker.mdx +69 -69
- package/FilePicker/primitives/FilePickerPrimitive.d.ts +19 -19
- package/FilePicker/primitives/FilePickerPrimitive.js.map +1 -1
- package/FilePicker/primitives/components/Trigger.d.ts +1 -1
- package/FilePicker/primitives/components/previews/TextOnlyPreview/TextOnlyPreview.d.ts +1 -1
- package/FilePicker/primitives/components/previews/variants.d.ts +1 -1
- package/FilePicker/primitives/components/types.js.map +1 -1
- package/FormComponent/Description.d.ts +1 -1
- package/FormComponent/ErrorMessage.d.ts +1 -1
- package/FormComponent/Note.d.ts +1 -1
- package/Grid/Grid.d.ts +2 -2
- package/Grid/Grid.js.map +1 -1
- package/Grid/Grid.mdx +111 -121
- package/HeaderBar/HeaderBar.mdx +98 -99
- package/Heading/Heading.d.ts +1 -1
- package/Heading/Heading.js.map +1 -1
- package/Heading/Heading.mdx +63 -58
- package/Icon/Icon.d.ts +1 -1
- package/Icon/Icon.js.map +1 -1
- package/Icon/Icon.mdx +79 -147
- package/IconPicker/IconPicker.mdx +66 -64
- package/IconPicker/primitives/IconPickerPrimitive.d.ts +1 -1
- package/IconPicker/primitives/components/IconPickerTrigger.d.ts +1 -1
- package/Image/Image.js.map +1 -1
- package/Input/Input.mdx +67 -56
- package/Input/InputPrimitive.d.ts +1 -1
- package/Label/Label.d.ts +1 -1
- package/Label/Label.js.map +1 -1
- package/Label/Label.mdx +42 -42
- package/Label/components/LabelDescription.d.ts +1 -1
- package/Label/components/LabelRequired.d.ts +1 -1
- package/Label/components/LabelValue.d.ts +1 -1
- package/Link/Link.d.ts +1 -1
- package/Link/Link.mdx +129 -116
- package/List/List.d.ts +1 -1
- package/List/List.js.map +1 -1
- package/List/List.mdx +317 -329
- package/List/components/ListItem.d.ts +1 -1
- package/List/components/ListItem.js.map +1 -1
- package/Loader/Loader.d.ts +2 -2
- package/Loader/Loader.js.map +1 -1
- package/Loader/Loader.mdx +96 -91
- package/MultiAutoComplete/MultiAutoComplete.mdx +52 -51
- package/MultiAutoComplete/primitives/components/MultiAutoCompleteInput.d.ts +1 -1
- package/MultiAutoComplete/primitives/presenters/MultiAutoCompleteListOptionsPresenter.js.map +1 -1
- package/MultiAutoComplete/primitives/presenters/MultiAutoCompleteListOptionsPresenterWithUniqueValues.js.map +1 -1
- package/MultiAutoComplete/primitives/presenters/MultiAutoCompleteSelectedOptionsPresenter.js.map +1 -1
- package/MultiAutoComplete/primitives/presenters/MultiAutoCompleteTemporaryOptionPresenter.js.map +1 -1
- package/MultiFilePicker/MultiFilePicker.mdx +84 -80
- package/MultiFilePicker/primitives/MultiFilePickerPrimitive.js.map +1 -1
- package/Popover/Popover.mdx +112 -118
- package/Popover/primitives/components/PopoverArrow.d.ts +1 -1
- package/Popover/primitives/components/PopoverContent.d.ts +1 -1
- package/RadioGroup/RadioGroup.mdx +62 -59
- package/RadioGroup/primitives/RadioGroupPrimitive.js.map +1 -1
- package/RangeSlider/RangeSlider.mdx +48 -47
- package/RangeSlider/primitives/RangeSliderPrimitive.js.map +1 -1
- package/RangeSlider/primitives/components/RangeSliderValue.d.ts +1 -1
- package/RangeSlider/primitives/components/RangeSliderValue.js.map +1 -1
- package/ScrollArea/ScrollArea.js.map +1 -1
- package/SegmentedControl/SegmentedControl.mdx +59 -59
- package/SegmentedControl/primitives/SegmentedControlPrimitive.d.ts +1 -1
- package/SegmentedControl/primitives/SegmentedControlPrimitive.js.map +1 -1
- package/Select/Select.mdx +52 -43
- package/Select/primitives/components/SelectTrigger.d.ts +1 -1
- package/Select/primitives/components/SelectTrigger.js.map +1 -1
- package/Select/primitives/presenters/SelectPresenter.d.ts +1 -1
- package/Separator/Separator.d.ts +1 -1
- package/Separator/Separator.mdx +139 -150
- package/Sidebar/Sidebar.js.map +1 -1
- package/Sidebar/Sidebar.mdx +66 -88
- package/Sidebar/components/items/SidebarMenuSubItemIndentation.d.ts +1 -1
- package/Sidebar/components/items/SidebarMenuSubItemIndentation.js.map +1 -1
- package/Skeleton/Skeleton.d.ts +1 -1
- package/Skeleton/Skeleton.js.map +1 -1
- package/Skeleton/Skeleton.mdx +37 -37
- package/Slider/Slider.mdx +48 -47
- package/Slider/primitives/SliderPrimitive.js.map +1 -1
- package/Slider/primitives/components/SliderSideValue.d.ts +1 -1
- package/Slider/primitives/components/SliderSideValue.js.map +1 -1
- package/Slider/primitives/components/SliderTooltip.d.ts +1 -1
- package/SteppedProgress/components/SteppedProgressIcon.d.ts +1 -1
- package/SteppedProgress/components/SteppedProgressIcon.js.map +1 -1
- package/SteppedProgress/components/SteppedProgressIndicator.d.ts +1 -1
- package/SteppedProgress/components/SteppedProgressIndicator.js.map +1 -1
- package/Switch/Switch.mdx +44 -42
- package/Switch/primitives/SwitchPrimitive.d.ts +1 -1
- package/Table/Table.d.ts +1 -1
- package/Table/Table.js.map +1 -1
- package/Table/components/Direction.d.ts +1 -1
- package/Table/components/Direction.js.map +1 -1
- package/Table/components/Header.d.ts +1 -1
- package/Table/components/Header.js.map +1 -1
- package/Table/components/Resizer.d.ts +1 -1
- package/Table/components/Resizer.js.map +1 -1
- package/Table/components/Row.d.ts +1 -1
- package/Table/components/Row.js.map +1 -1
- package/Tabs/Tabs.mdx +297 -292
- package/Tabs/components/Content.d.ts +1 -1
- package/Tabs/components/List.d.ts +1 -1
- package/Tabs/components/Trigger.d.ts +1 -1
- package/Tag/Tag.d.ts +1 -1
- package/Tag/Tag.js.map +1 -1
- package/Tag/Tag.mdx +68 -64
- package/Tags/primitives/TagsPrimitive.js.map +1 -1
- package/Text/Text.d.ts +1 -1
- package/Text/Text.mdx +54 -48
- package/Textarea/Textarea.mdx +49 -39
- package/Textarea/TextareaPrimitive.d.ts +1 -1
- package/Textarea/TextareaPrimitive.js.map +1 -1
- package/Toast/Toast.mdx +63 -53
- package/Toast/components/ToastRoot.d.ts +1 -1
- package/Tooltip/Tooltip.mdx +197 -198
- package/Tooltip/components/TooltipArrow.d.ts +1 -1
- package/Tooltip/components/TooltipContent.d.ts +1 -1
- package/Tree/components/Item.d.ts +1 -1
- package/Tree/useTree.d.ts +1 -1
- package/Widget/components/WidgetContent.d.ts +1 -1
- package/package.json +15 -15
package/MultiAutoComplete/primitives/presenters/MultiAutoCompleteSelectedOptionsPresenter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["makeAutoObservable","CommandOptionFormatter","ListCache","MultiAutoCompleteSelectedOptionPresenter","options","constructor","init","params","length","option","getItem","o","value","addItems","clear","vm","getItems","map","format","empty","hasItems","addOption","removeOption","removeItems","resetOptions"],"sources":["MultiAutoCompleteSelectedOptionsPresenter.ts"],"sourcesContent":["import { makeAutoObservable } from \"mobx\";\nimport type { CommandOptionFormatted } from \"~/Command/domain/CommandOptionFormatted.js\";\nimport { CommandOptionFormatter } from \"~/Command/domain/CommandOptionFormatter.js\";\nimport type { CommandOption } from \"~/Command/domain/CommandOption.js\";\nimport { ListCache } from \"../../domains/index.js\";\n\ninterface MultiAutoCompleteSelectedOptionsParams {\n options?: CommandOption[];\n}\n\ninterface IMultiAutoCompleteSelectedOptionsPresenter {\n vm: {\n options: CommandOptionFormatted[];\n empty: boolean;\n };\n init: (params: MultiAutoCompleteSelectedOptionsParams) => void;\n addOption: (option: CommandOption) => void;\n removeOption: (value: string) => void;\n resetOptions: () => void;\n}\n\nclass MultiAutoCompleteSelectedOptionPresenter
|
|
1
|
+
{"version":3,"names":["makeAutoObservable","CommandOptionFormatter","ListCache","MultiAutoCompleteSelectedOptionPresenter","options","constructor","init","params","length","option","getItem","o","value","addItems","clear","vm","getItems","map","format","empty","hasItems","addOption","removeOption","removeItems","resetOptions"],"sources":["MultiAutoCompleteSelectedOptionsPresenter.ts"],"sourcesContent":["import { makeAutoObservable } from \"mobx\";\nimport type { CommandOptionFormatted } from \"~/Command/domain/CommandOptionFormatted.js\";\nimport { CommandOptionFormatter } from \"~/Command/domain/CommandOptionFormatter.js\";\nimport type { CommandOption } from \"~/Command/domain/CommandOption.js\";\nimport { ListCache } from \"../../domains/index.js\";\n\ninterface MultiAutoCompleteSelectedOptionsParams {\n options?: CommandOption[];\n}\n\ninterface IMultiAutoCompleteSelectedOptionsPresenter {\n vm: {\n options: CommandOptionFormatted[];\n empty: boolean;\n };\n init: (params: MultiAutoCompleteSelectedOptionsParams) => void;\n addOption: (option: CommandOption) => void;\n removeOption: (value: string) => void;\n resetOptions: () => void;\n}\n\nclass MultiAutoCompleteSelectedOptionPresenter implements IMultiAutoCompleteSelectedOptionsPresenter {\n private options = new ListCache<CommandOption>();\n\n constructor() {\n makeAutoObservable(this);\n }\n\n init(params: MultiAutoCompleteSelectedOptionsParams) {\n if (params.options?.length) {\n for (const option of params.options) {\n if (!this.options.getItem(o => o.value === option.value)) {\n this.options.addItems([option]);\n }\n }\n } else {\n // If no options are provided, clear the existing options\n this.options.clear();\n }\n }\n\n get vm() {\n return {\n options: this.options.getItems().map(option => CommandOptionFormatter.format(option)),\n empty: !this.options.hasItems()\n };\n }\n\n public addOption = (option: CommandOption) => {\n this.options.addItems([option]);\n };\n\n public removeOption = (value: string) => {\n this.options.removeItems(option => option.value === value);\n };\n\n public resetOptions = () => {\n this.options.clear();\n };\n}\n\nexport {\n MultiAutoCompleteSelectedOptionPresenter,\n type IMultiAutoCompleteSelectedOptionsPresenter,\n type MultiAutoCompleteSelectedOptionsParams\n};\n"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,MAAM;AAEzC,SAASC,sBAAsB;AAE/B,SAASC,SAAS;AAiBlB,MAAMC,wCAAwC,CAAuD;EACzFC,OAAO,GAAG,IAAIF,SAAS,CAAgB,CAAC;EAEhDG,WAAWA,CAAA,EAAG;IACVL,kBAAkB,CAAC,IAAI,CAAC;EAC5B;EAEAM,IAAIA,CAACC,MAA8C,EAAE;IACjD,IAAIA,MAAM,CAACH,OAAO,EAAEI,MAAM,EAAE;MACxB,KAAK,MAAMC,MAAM,IAAIF,MAAM,CAACH,OAAO,EAAE;QACjC,IAAI,CAAC,IAAI,CAACA,OAAO,CAACM,OAAO,CAACC,CAAC,IAAIA,CAAC,CAACC,KAAK,KAAKH,MAAM,CAACG,KAAK,CAAC,EAAE;UACtD,IAAI,CAACR,OAAO,CAACS,QAAQ,CAAC,CAACJ,MAAM,CAAC,CAAC;QACnC;MACJ;IACJ,CAAC,MAAM;MACH;MACA,IAAI,CAACL,OAAO,CAACU,KAAK,CAAC,CAAC;IACxB;EACJ;EAEA,IAAIC,EAAEA,CAAA,EAAG;IACL,OAAO;MACHX,OAAO,EAAE,IAAI,CAACA,OAAO,CAACY,QAAQ,CAAC,CAAC,CAACC,GAAG,CAACR,MAAM,IAAIR,sBAAsB,CAACiB,MAAM,CAACT,MAAM,CAAC,CAAC;MACrFU,KAAK,EAAE,CAAC,IAAI,CAACf,OAAO,CAACgB,QAAQ,CAAC;IAClC,CAAC;EACL;EAEOC,SAAS,GAAIZ,MAAqB,IAAK;IAC1C,IAAI,CAACL,OAAO,CAACS,QAAQ,CAAC,CAACJ,MAAM,CAAC,CAAC;EACnC,CAAC;EAEMa,YAAY,GAAIV,KAAa,IAAK;IACrC,IAAI,CAACR,OAAO,CAACmB,WAAW,CAACd,MAAM,IAAIA,MAAM,CAACG,KAAK,KAAKA,KAAK,CAAC;EAC9D,CAAC;EAEMY,YAAY,GAAGA,CAAA,KAAM;IACxB,IAAI,CAACpB,OAAO,CAACU,KAAK,CAAC,CAAC;EACxB,CAAC;AACL;AAEA,SACIX,wCAAwC","ignoreList":[]}
|
package/MultiAutoComplete/primitives/presenters/MultiAutoCompleteTemporaryOptionPresenter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["makeAutoObservable","CommandOption","CommandOptionFormatter","MultiAutoCompleteTemporaryOptionPresenter","option","undefined","constructor","init","vm","format","setOption","value","createFromString","resetOption"],"sources":["MultiAutoCompleteTemporaryOptionPresenter.ts"],"sourcesContent":["import { makeAutoObservable } from \"mobx\";\nimport { CommandOption } from \"~/Command/domain/CommandOption.js\";\nimport type { CommandOptionFormatted } from \"~/Command/domain/CommandOptionFormatted.js\";\nimport { CommandOptionFormatter } from \"~/Command/domain/CommandOptionFormatter.js\";\n\nexport interface IMultiAutoCompleteTemporaryOptionPresenter {\n vm: {\n option?: CommandOptionFormatted;\n };\n init: () => void;\n setOption: (value: string) => void;\n resetOption: () => void;\n}\n\nexport class MultiAutoCompleteTemporaryOptionPresenter
|
|
1
|
+
{"version":3,"names":["makeAutoObservable","CommandOption","CommandOptionFormatter","MultiAutoCompleteTemporaryOptionPresenter","option","undefined","constructor","init","vm","format","setOption","value","createFromString","resetOption"],"sources":["MultiAutoCompleteTemporaryOptionPresenter.ts"],"sourcesContent":["import { makeAutoObservable } from \"mobx\";\nimport { CommandOption } from \"~/Command/domain/CommandOption.js\";\nimport type { CommandOptionFormatted } from \"~/Command/domain/CommandOptionFormatted.js\";\nimport { CommandOptionFormatter } from \"~/Command/domain/CommandOptionFormatter.js\";\n\nexport interface IMultiAutoCompleteTemporaryOptionPresenter {\n vm: {\n option?: CommandOptionFormatted;\n };\n init: () => void;\n setOption: (value: string) => void;\n resetOption: () => void;\n}\n\nexport class MultiAutoCompleteTemporaryOptionPresenter implements IMultiAutoCompleteTemporaryOptionPresenter {\n private option?: CommandOption = undefined;\n\n constructor() {\n makeAutoObservable(this);\n }\n\n init() {\n return;\n }\n\n get vm() {\n return {\n option: this.option ? CommandOptionFormatter.format(this.option) : undefined\n };\n }\n\n public setOption = (value: string) => {\n this.option = CommandOption.createFromString(value);\n };\n\n public resetOption = () => {\n this.option = undefined;\n };\n}\n"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,MAAM;AACzC,SAASC,aAAa;AAEtB,SAASC,sBAAsB;AAW/B,OAAO,MAAMC,yCAAyC,CAAuD;EACjGC,MAAM,GAAmBC,SAAS;EAE1CC,WAAWA,CAAA,EAAG;IACVN,kBAAkB,CAAC,IAAI,CAAC;EAC5B;EAEAO,IAAIA,CAAA,EAAG;IACH;EACJ;EAEA,IAAIC,EAAEA,CAAA,EAAG;IACL,OAAO;MACHJ,MAAM,EAAE,IAAI,CAACA,MAAM,GAAGF,sBAAsB,CAACO,MAAM,CAAC,IAAI,CAACL,MAAM,CAAC,GAAGC;IACvE,CAAC;EACL;EAEOK,SAAS,GAAIC,KAAa,IAAK;IAClC,IAAI,CAACP,MAAM,GAAGH,aAAa,CAACW,gBAAgB,CAACD,KAAK,CAAC;EACvD,CAAC;EAEME,WAAW,GAAGA,CAAA,KAAM;IACvB,IAAI,CAACT,MAAM,GAAGC,SAAS;EAC3B,CAAC;AACL","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Canvas, Meta, Controls } from
|
|
1
|
+
import { Canvas, Meta, Controls } from "@storybook/addon-docs/blocks";
|
|
2
2
|
|
|
3
|
-
import * as MultiFilePickerStories from
|
|
3
|
+
import * as MultiFilePickerStories from "./MultiFilePicker.stories";
|
|
4
4
|
|
|
5
5
|
<Meta of={MultiFilePickerStories} />
|
|
6
6
|
|
|
@@ -13,8 +13,8 @@ The Multi File Picker component allows users to select, preview, and manage mult
|
|
|
13
13
|
The MultiFilePicker component is typically used with [Webiny's File Manager](https://www.webiny.com/enterprise-serverless-cms/file-manager) to provide a complete file selection experience.
|
|
14
14
|
|
|
15
15
|
> ⚠️ **Note**: The MultiFilePicker component is designed to work seamlessly with [Webiny's File Manager](https://www.webiny.com/enterprise-serverless-cms/file-manager).
|
|
16
|
-
In the Storybook example below, we've used random images from Picsum for demonstration purposes.
|
|
17
|
-
However, if you use this example code in a real Webiny project, the MultiFilePicker will integrate with the actual File Manager as expected.
|
|
16
|
+
> In the Storybook example below, we've used random images from Picsum for demonstration purposes.
|
|
17
|
+
> However, if you use this example code in a real Webiny project, the MultiFilePicker will integrate with the actual File Manager as expected.
|
|
18
18
|
|
|
19
19
|
<Canvas of={MultiFilePickerStories.Documentation} source={ { code: `
|
|
20
20
|
import React, { useState } from "react";
|
|
@@ -23,8 +23,8 @@ import { FileManager } from "@webiny/app-admin/components";
|
|
|
23
23
|
import type { FileManagerFileItem } from "@webiny/app-admin/base/ui/FileManager";
|
|
24
24
|
|
|
25
25
|
const MultiFilePickerExample = () => {
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
const [selectedFiles, setSelectedFiles] = useState<FileItemDto[]>([]);
|
|
27
|
+
const [validation, setValidation] = useState({ isValid: true, message: "" });
|
|
28
28
|
|
|
29
29
|
const formatFile = (file: FileManagerFileItem): FileItemDto => {
|
|
30
30
|
const metaItems = file.meta || [];
|
|
@@ -90,22 +90,23 @@ const MultiFilePickerExample = () => {
|
|
|
90
90
|
/>
|
|
91
91
|
</div>
|
|
92
92
|
);
|
|
93
|
+
|
|
93
94
|
};
|
|
94
95
|
|
|
95
96
|
export default MultiFilePickerExample;
|
|
96
97
|
|
|
97
98
|
` } }
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
99
|
+
additionalActions={[
|
|
100
|
+
{
|
|
101
|
+
title: 'Open in GitHub',
|
|
102
|
+
onClick: () => {
|
|
103
|
+
window.open(
|
|
104
|
+
'https://github.com/webiny/webiny-js/blob/feat/new-admin-ui/packages/admin-ui/src/MultiFilePicker/MultiFilePicker.tsx',
|
|
105
|
+
'_blank'
|
|
106
|
+
);
|
|
107
|
+
},
|
|
108
|
+
}
|
|
109
|
+
]}
|
|
109
110
|
/>
|
|
110
111
|
|
|
111
112
|
<Controls of={MultiFilePickerStories.Documentation} />
|
|
@@ -117,73 +118,76 @@ import { FileManager } from "@webiny/app-admin/components";
|
|
|
117
118
|
import type { FileManagerFileItem } from "@webiny/app-admin/base/ui/FileManager";
|
|
118
119
|
|
|
119
120
|
const MultiFilePickerExample = () => {
|
|
120
|
-
|
|
121
|
-
|
|
121
|
+
const [selectedFiles, setSelectedFiles] = useState<FileItemDto[]>([]);
|
|
122
|
+
const [validation, setValidation] = useState({ isValid: true, message: "" });
|
|
122
123
|
|
|
123
|
-
|
|
124
|
-
|
|
124
|
+
const formatFile = (file: FileManagerFileItem): FileItemDto => {
|
|
125
|
+
const metaItems = file.meta || [];
|
|
125
126
|
|
|
126
|
-
|
|
127
|
-
|
|
127
|
+
const getValue = (key: string) =>
|
|
128
|
+
metaItems.find((item: { key: string }) => item.key === key)?.value;
|
|
128
129
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
};
|
|
130
|
+
return {
|
|
131
|
+
id: file.id,
|
|
132
|
+
name: getValue("name") || "",
|
|
133
|
+
size: getValue("size") || 0,
|
|
134
|
+
mimeType: getValue("type") || "",
|
|
135
|
+
url: file.src || ""
|
|
136
136
|
};
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
return (
|
|
140
|
+
<div>
|
|
141
|
+
<FileManager
|
|
142
|
+
accept={["image/*", "application/pdf"]}
|
|
143
|
+
multiple={true}
|
|
144
|
+
render={({ showFileManager }) => (
|
|
145
|
+
<MultiFilePicker
|
|
146
|
+
label="Upload Images"
|
|
147
|
+
description="Select files to upload (JPG, PNG, PDF)"
|
|
148
|
+
note="Note: Maximum file size is 5MB per file"
|
|
149
|
+
type="area"
|
|
150
|
+
required={true}
|
|
151
|
+
values={selectedFiles}
|
|
152
|
+
validation={validation}
|
|
153
|
+
onSelectItem={() => {
|
|
154
|
+
showFileManager(files => {
|
|
155
|
+
if (files && Array.isArray(files) && files.length > 0) {
|
|
156
|
+
const formatted = files.map(formatFile);
|
|
157
|
+
setSelectedFiles(prev => [...prev, ...formatted]);
|
|
158
|
+
setValidation({ isValid: true, message: "" });
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
}}
|
|
162
|
+
onReplaceItem={(_, index) => {
|
|
163
|
+
// For replacing, we'll use the first file from the selection
|
|
164
|
+
showFileManager(files => {
|
|
165
|
+
if (files && Array.isArray(files) && files.length > 0) {
|
|
166
|
+
const updated = [...selectedFiles];
|
|
167
|
+
updated[index] = formatFile(files[0]);
|
|
168
|
+
setSelectedFiles(updated);
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
}}
|
|
172
|
+
onRemoveItem={(_, index) => {
|
|
173
|
+
const updated = [...selectedFiles];
|
|
174
|
+
updated.splice(index, 1);
|
|
175
|
+
if (updated.length === 0) {
|
|
176
|
+
setValidation({
|
|
177
|
+
isValid: false,
|
|
178
|
+
message: "Please select at least one file"
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
setSelectedFiles(updated);
|
|
182
|
+
}}
|
|
183
|
+
onEditItem={(file, index) => {
|
|
184
|
+
alert(`Editing: ${file?.name} at index ${index}`);
|
|
185
|
+
}}
|
|
186
|
+
/>
|
|
187
|
+
)}
|
|
188
|
+
/>
|
|
189
|
+
</div>
|
|
190
|
+
);
|
|
187
191
|
};
|
|
188
192
|
|
|
189
193
|
export default MultiFilePickerExample;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","FilePickerDescription","FilePickerLabel","filePickerVariants","FilePreview","ImagePreview","RichItemPreview","TextOnlyPreview","Trigger","cn","makeDecoratable","withStaticProps","Button","inputVariants","useMultiFilePicker","BaseMultiFilePickerPrimitive","className","buttonPlaceholder","containerStyle","description","disabled","invalid","label","onEditItem","onRemoveItem","onReplaceItem","onSelectItem","placeholder","renderFilePreview","renderTrigger","type","values","variant","vm","createElement","style","text","onClick","size","hasFiles","files","map","file","i","key","undefined","value","DecoratableMultiFilePickerPrimitive","MultiFilePickerPrimitive","Preview","Image","RichItem","TextOnly"],"sources":["MultiFilePickerPrimitive.tsx"],"sourcesContent":["import React from \"react\";\nimport {\n type FileItemDto,\n type FileItemFormatted,\n FilePickerDescription,\n FilePickerLabel,\n type FilePickerPrimitiveProps,\n filePickerVariants,\n FilePreview,\n ImagePreview,\n RichItemPreview,\n TextOnlyPreview,\n Trigger\n} from \"~/FilePicker/index.js\";\nimport { cn, makeDecoratable, withStaticProps } from \"~/utils.js\";\nimport { Button } from \"~/Button/index.js\";\nimport { inputVariants } from \"~/Input/index.js\";\nimport { useMultiFilePicker } from \"~/MultiFilePicker/primitives/useMultiFilePicker.js\";\n\ninterface MultiFilePickerPrimitiveProps
|
|
1
|
+
{"version":3,"names":["React","FilePickerDescription","FilePickerLabel","filePickerVariants","FilePreview","ImagePreview","RichItemPreview","TextOnlyPreview","Trigger","cn","makeDecoratable","withStaticProps","Button","inputVariants","useMultiFilePicker","BaseMultiFilePickerPrimitive","className","buttonPlaceholder","containerStyle","description","disabled","invalid","label","onEditItem","onRemoveItem","onReplaceItem","onSelectItem","placeholder","renderFilePreview","renderTrigger","type","values","variant","vm","createElement","style","text","onClick","size","hasFiles","files","map","file","i","key","undefined","value","DecoratableMultiFilePickerPrimitive","MultiFilePickerPrimitive","Preview","Image","RichItem","TextOnly"],"sources":["MultiFilePickerPrimitive.tsx"],"sourcesContent":["import React from \"react\";\nimport {\n type FileItemDto,\n type FileItemFormatted,\n FilePickerDescription,\n FilePickerLabel,\n type FilePickerPrimitiveProps,\n filePickerVariants,\n FilePreview,\n ImagePreview,\n RichItemPreview,\n TextOnlyPreview,\n Trigger\n} from \"~/FilePicker/index.js\";\nimport { cn, makeDecoratable, withStaticProps } from \"~/utils.js\";\nimport { Button } from \"~/Button/index.js\";\nimport { inputVariants } from \"~/Input/index.js\";\nimport { useMultiFilePicker } from \"~/MultiFilePicker/primitives/useMultiFilePicker.js\";\n\ninterface MultiFilePickerPrimitiveProps extends Omit<\n FilePickerPrimitiveProps,\n \"value\" | \"onEditItem\" | \"onRemoveItem\"\n> {\n /**\n * The list of file items or file paths.\n */\n values?: FileItemDto[] | string[] | null;\n /**\n * Placeholder text for the button that allows users to select a file.\n */\n buttonPlaceholder?: string;\n /**\n * Callback function to replace an item.\n */\n onReplaceItem: (item: FileItemFormatted | null, index: number) => void;\n /**\n * Optional callback function to edit an item.\n */\n onEditItem?: (item: FileItemFormatted | null, index: number) => void;\n /**\n * Optional callback function to remove an item.\n */\n onRemoveItem?: (item: FileItemFormatted | null, index: number) => void;\n}\n\nconst BaseMultiFilePickerPrimitive = ({\n className,\n buttonPlaceholder,\n containerStyle,\n description,\n disabled,\n invalid,\n label,\n onEditItem,\n onRemoveItem,\n onReplaceItem,\n onSelectItem,\n placeholder,\n renderFilePreview,\n renderTrigger,\n type = \"area\",\n values = [],\n variant\n}: MultiFilePickerPrimitiveProps) => {\n const { vm } = useMultiFilePicker({ values });\n\n return (\n <div\n data-disabled={disabled}\n className={cn(\n inputVariants({ variant, invalid }),\n filePickerVariants({ type, variant }),\n \"max-h-[280px]\",\n className\n )}\n style={containerStyle}\n >\n {type === \"area\" && (label || description) && (\n <div className={\"w-full flex justify-between\"}>\n <div className={\"w-full\"}>\n {label && (\n <div className={\"mb-xs\"}>\n {typeof label === \"string\" ? (\n <FilePickerLabel\n label={label}\n className={\"m-0\"}\n disabled={disabled}\n />\n ) : (\n label\n )}\n </div>\n )}\n {description && (\n <FilePickerDescription\n description={description}\n disabled={disabled}\n className={\"m-0\"}\n />\n )}\n </div>\n <Button\n text={buttonPlaceholder ?? \"Select a file\"}\n variant={\"ghost\"}\n onClick={onSelectItem}\n size={\"sm\"}\n disabled={disabled}\n />\n </div>\n )}\n {vm.hasFiles ? (\n <div className=\"w-full overflow-y-scroll flex flex-col gap-xs\">\n {vm.files.map((file, i) => (\n <FilePreview\n key={`file-preview-${i}`}\n disabled={disabled}\n onEditItem={onEditItem ? () => onEditItem(file, i) : undefined}\n onRemoveItem={onRemoveItem ? () => onRemoveItem(file, i) : undefined}\n onReplaceItem={onReplaceItem ? () => onReplaceItem(file, i) : undefined}\n renderFilePreview={renderFilePreview}\n type={type}\n value={file}\n />\n ))}\n </div>\n ) : (\n <Trigger\n disabled={disabled}\n onSelectItem={onSelectItem}\n renderTrigger={renderTrigger}\n text={placeholder}\n type={type}\n variant={variant}\n />\n )}\n </div>\n );\n};\n\nconst DecoratableMultiFilePickerPrimitive = makeDecoratable(\n \"MultiFilePickerPrimitive\",\n BaseMultiFilePickerPrimitive\n);\n\nconst MultiFilePickerPrimitive = withStaticProps(DecoratableMultiFilePickerPrimitive, {\n Preview: {\n Image: ImagePreview,\n RichItem: RichItemPreview,\n TextOnly: TextOnlyPreview\n }\n});\n\nexport {\n MultiFilePickerPrimitive,\n type FileItemFormatted,\n type FileItemDto,\n type MultiFilePickerPrimitiveProps\n};\n"],"mappings":"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","ignoreList":[]}
|
package/Popover/Popover.mdx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Canvas, Meta, Controls } from
|
|
1
|
+
import { Canvas, Meta, Controls } from "@storybook/addon-docs/blocks";
|
|
2
2
|
|
|
3
|
-
import * as PopoverStories from
|
|
3
|
+
import * as PopoverStories from "./Popover.stories";
|
|
4
4
|
|
|
5
5
|
<Meta of={PopoverStories} />
|
|
6
6
|
|
|
@@ -15,41 +15,40 @@ import React from "react";
|
|
|
15
15
|
import { Popover } from "@webiny/admin-ui";
|
|
16
16
|
|
|
17
17
|
const PopoverExample = () => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
};
|
|
18
|
+
return (
|
|
19
|
+
|
|
20
|
+
<div className="bg-[#f4f4f4] flex items-center justify-center w-full h-[300px]">
|
|
21
|
+
<Popover
|
|
22
|
+
trigger={<p>Popover trigger</p>}
|
|
23
|
+
content={
|
|
24
|
+
<div className={"w-[260px]"}>
|
|
25
|
+
<strong>Lorem ipsum dolor sit amet</strong>, consectetur adipiscing elit. Morbi lectus leo,
|
|
26
|
+
dapibus vitae mollis dictum, vulputate eget lorem. Aliquam rutrum auctor tempus.
|
|
27
|
+
</div>
|
|
28
|
+
}
|
|
29
|
+
align="center"
|
|
30
|
+
side="bottom"
|
|
31
|
+
variant="subtle"
|
|
32
|
+
arrow={false}
|
|
33
|
+
close={false}
|
|
34
|
+
/>
|
|
35
|
+
</div>
|
|
36
|
+
); };
|
|
38
37
|
|
|
39
38
|
export default PopoverExample;
|
|
40
39
|
|
|
41
40
|
` } }
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
41
|
+
additionalActions={[
|
|
42
|
+
{
|
|
43
|
+
title: 'Open in GitHub',
|
|
44
|
+
onClick: () => {
|
|
45
|
+
window.open(
|
|
46
|
+
'https://github.com/webiny/webiny-js/blob/feat/new-admin-ui/packages/admin-ui/src/Popover/Popover.tsx',
|
|
47
|
+
'_blank'
|
|
48
|
+
);
|
|
49
|
+
},
|
|
50
|
+
}
|
|
51
|
+
]}
|
|
53
52
|
/>
|
|
54
53
|
|
|
55
54
|
<Controls of={PopoverStories.Documentation} />
|
|
@@ -59,25 +58,24 @@ import React from "react";
|
|
|
59
58
|
import { Popover } from "@webiny/admin-ui";
|
|
60
59
|
|
|
61
60
|
const PopoverExample = () => {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
);
|
|
61
|
+
return (
|
|
62
|
+
<div className="bg-[#f4f4f4] flex items-center justify-center w-full h-[300px]">
|
|
63
|
+
<Popover
|
|
64
|
+
trigger={<p>Popover trigger</p>}
|
|
65
|
+
content={
|
|
66
|
+
<div className={"w-[260px]"}>
|
|
67
|
+
<strong>Lorem ipsum dolor sit amet</strong>, consectetur adipiscing elit. Morbi lectus
|
|
68
|
+
leo, dapibus vitae mollis dictum, vulputate eget lorem. Aliquam rutrum auctor tempus.
|
|
69
|
+
</div>
|
|
70
|
+
}
|
|
71
|
+
align="center"
|
|
72
|
+
side="bottom"
|
|
73
|
+
variant="subtle"
|
|
74
|
+
arrow={false}
|
|
75
|
+
close={false}
|
|
76
|
+
/>
|
|
77
|
+
</div>
|
|
78
|
+
);
|
|
81
79
|
};
|
|
82
80
|
|
|
83
81
|
export default PopoverExample;
|
|
@@ -94,22 +92,21 @@ import React from "react";
|
|
|
94
92
|
import { Popover } from "@webiny/admin-ui";
|
|
95
93
|
|
|
96
94
|
const AccentVariantExample = () => {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
};
|
|
95
|
+
return (
|
|
96
|
+
|
|
97
|
+
<div className="bg-[#f4f4f4] flex items-center justify-center w-full h-[300px]">
|
|
98
|
+
<Popover
|
|
99
|
+
trigger={<p>Popover trigger</p>}
|
|
100
|
+
content={
|
|
101
|
+
<div className={"w-[260px]"}>
|
|
102
|
+
<strong>Lorem ipsum dolor sit amet</strong>, consectetur adipiscing elit. Morbi lectus leo,
|
|
103
|
+
dapibus vitae mollis dictum, vulputate eget lorem. Aliquam rutrum auctor tempus.
|
|
104
|
+
</div>
|
|
105
|
+
}
|
|
106
|
+
variant="accent"
|
|
107
|
+
/>
|
|
108
|
+
</div>
|
|
109
|
+
); };
|
|
113
110
|
|
|
114
111
|
export default AccentVariantExample;
|
|
115
112
|
` } } />
|
|
@@ -123,23 +120,22 @@ import React from "react";
|
|
|
123
120
|
import { Popover } from "@webiny/admin-ui";
|
|
124
121
|
|
|
125
122
|
const WithArrowAccentExample = () => {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
};
|
|
123
|
+
return (
|
|
124
|
+
|
|
125
|
+
<div className="bg-[#f4f4f4] flex items-center justify-center w-full h-[300px]">
|
|
126
|
+
<Popover
|
|
127
|
+
trigger={<p>Popover trigger</p>}
|
|
128
|
+
content={
|
|
129
|
+
<div className={"w-[260px]"}>
|
|
130
|
+
<strong>Lorem ipsum dolor sit amet</strong>, consectetur adipiscing elit. Morbi lectus leo,
|
|
131
|
+
dapibus vitae mollis dictum, vulputate eget lorem. Aliquam rutrum auctor tempus.
|
|
132
|
+
</div>
|
|
133
|
+
}
|
|
134
|
+
variant="accent"
|
|
135
|
+
arrow={true}
|
|
136
|
+
/>
|
|
137
|
+
</div>
|
|
138
|
+
); };
|
|
143
139
|
|
|
144
140
|
export default WithArrowAccentExample;
|
|
145
141
|
` } } />
|
|
@@ -153,22 +149,21 @@ import React from "react";
|
|
|
153
149
|
import { Popover } from "@webiny/admin-ui";
|
|
154
150
|
|
|
155
151
|
const SubtleVariantExample = () => {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
};
|
|
152
|
+
return (
|
|
153
|
+
|
|
154
|
+
<div className="flex items-center justify-center bg-neutral-dark text-neutral-light w-full h-[300px]">
|
|
155
|
+
<Popover
|
|
156
|
+
trigger={<p>Popover trigger</p>}
|
|
157
|
+
content={
|
|
158
|
+
<div className={"w-[260px]"}>
|
|
159
|
+
<strong>Lorem ipsum dolor sit amet</strong>, consectetur adipiscing elit. Morbi lectus leo,
|
|
160
|
+
dapibus vitae mollis dictum, vulputate eget lorem. Aliquam rutrum auctor tempus.
|
|
161
|
+
</div>
|
|
162
|
+
}
|
|
163
|
+
variant="subtle"
|
|
164
|
+
/>
|
|
165
|
+
</div>
|
|
166
|
+
); };
|
|
172
167
|
|
|
173
168
|
export default SubtleVariantExample;
|
|
174
169
|
` } } />
|
|
@@ -182,23 +177,22 @@ import React from "react";
|
|
|
182
177
|
import { Popover } from "@webiny/admin-ui";
|
|
183
178
|
|
|
184
179
|
const WithArrowSubtleExample = () => {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
};
|
|
180
|
+
return (
|
|
181
|
+
|
|
182
|
+
<div className="flex items-center justify-center bg-neutral-dark text-neutral-light w-full h-[300px]">
|
|
183
|
+
<Popover
|
|
184
|
+
trigger={<p>Popover trigger</p>}
|
|
185
|
+
content={
|
|
186
|
+
<div className={"w-[260px]"}>
|
|
187
|
+
<strong>Lorem ipsum dolor sit amet</strong>, consectetur adipiscing elit. Morbi lectus leo,
|
|
188
|
+
dapibus vitae mollis dictum, vulputate eget lorem. Aliquam rutrum auctor tempus.
|
|
189
|
+
</div>
|
|
190
|
+
}
|
|
191
|
+
variant="subtle"
|
|
192
|
+
arrow={true}
|
|
193
|
+
/>
|
|
194
|
+
</div>
|
|
195
|
+
); };
|
|
202
196
|
|
|
203
197
|
export default WithArrowSubtleExample;
|
|
204
198
|
` } } />
|
|
@@ -3,7 +3,7 @@ import { Popover as PopoverPrimitive } from "radix-ui";
|
|
|
3
3
|
import { type VariantProps } from "../../../utils.js";
|
|
4
4
|
declare const popoverArrowVariants: (props?: ({
|
|
5
5
|
variant?: "accent" | "subtle" | null | undefined;
|
|
6
|
-
} & import("class-variance-authority/
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
type PopoverArrowProps = PopoverPrimitive.PopoverArrowProps & VariantProps<typeof popoverArrowVariants>;
|
|
8
8
|
declare const PopoverArrow: ({ variant, className, ...props }: PopoverArrowProps) => React.JSX.Element;
|
|
9
9
|
export { PopoverArrow, type PopoverArrowProps };
|
|
@@ -4,7 +4,7 @@ import { type VariantProps } from "../../../utils.js";
|
|
|
4
4
|
declare const popoverContentVariants: (props?: ({
|
|
5
5
|
variant?: "accent" | "subtle" | null | undefined;
|
|
6
6
|
arrow?: boolean | null | undefined;
|
|
7
|
-
} & import("class-variance-authority/
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
8
|
type PopoverContentProps = PopoverPrimitive.PopoverContentProps & VariantProps<typeof popoverContentVariants>;
|
|
9
9
|
declare const PopoverContent: ({ className, variant, arrow, align, sideOffset, collisionPadding, ...props }: PopoverContentProps) => React.JSX.Element;
|
|
10
10
|
export { PopoverContent, type PopoverContentProps };
|