@webiny/admin-ui 6.2.0 → 6.3.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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
|
@@ -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 FilePickerStories from
|
|
3
|
+
import * as FilePickerStories from "./FilePicker.stories";
|
|
4
4
|
|
|
5
5
|
<Meta of={FilePickerStories} />
|
|
6
6
|
|
|
@@ -13,8 +13,8 @@ The File Picker component allows users to select, preview, and manage files. It
|
|
|
13
13
|
The FilePicker 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 FilePicker 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 FilePicker 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 FilePicker will integrate with the actual File Manager as expected.
|
|
18
18
|
|
|
19
19
|
<Canvas of={FilePickerStories.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 FilePickerExample = () => {
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
const [selectedFile, setSelectedFile] = useState<FileItemDto | null>(null);
|
|
27
|
+
const [validation, setValidation] = useState({ isValid: true, message: "" });
|
|
28
28
|
|
|
29
29
|
return (
|
|
30
30
|
<FileManager
|
|
@@ -75,22 +75,23 @@ const FilePickerExample = () => {
|
|
|
75
75
|
)}
|
|
76
76
|
/>
|
|
77
77
|
);
|
|
78
|
+
|
|
78
79
|
};
|
|
79
80
|
|
|
80
81
|
export default FilePickerExample;
|
|
81
82
|
|
|
82
83
|
` } }
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
84
|
+
additionalActions={[
|
|
85
|
+
{
|
|
86
|
+
title: 'Open in GitHub',
|
|
87
|
+
onClick: () => {
|
|
88
|
+
window.open(
|
|
89
|
+
'https://github.com/webiny/webiny-js/blob/feat/new-admin-ui/packages/admin-ui/src/FilePicker/FilePicker.tsx',
|
|
90
|
+
'_blank'
|
|
91
|
+
);
|
|
92
|
+
},
|
|
93
|
+
}
|
|
94
|
+
]}
|
|
94
95
|
/>
|
|
95
96
|
|
|
96
97
|
<Controls of={FilePickerStories.Documentation} />
|
|
@@ -102,60 +103,59 @@ import { FileManager } from "@webiny/app-admin/components";
|
|
|
102
103
|
import type { FileManagerFileItem } from "@webiny/app-admin/base/ui/FileManager";
|
|
103
104
|
|
|
104
105
|
const FilePickerExample = () => {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
/>
|
|
154
|
-
)}
|
|
106
|
+
const [selectedFile, setSelectedFile] = useState<FileItemDto | null>(null);
|
|
107
|
+
const [validation, setValidation] = useState({ isValid: true, message: "" });
|
|
108
|
+
|
|
109
|
+
return (
|
|
110
|
+
<FileManager
|
|
111
|
+
accept={["image/*", "application/pdf"]}
|
|
112
|
+
onChange={(file: FileManagerFileItem) => {
|
|
113
|
+
if (file) {
|
|
114
|
+
// Convert FileManager file to the format FilePicker expects
|
|
115
|
+
const metaItems = file.meta || [];
|
|
116
|
+
const getName = () => {
|
|
117
|
+
const nameItem = metaItems.find((item: { key: string }) => item.key === "name");
|
|
118
|
+
return nameItem ? nameItem.value : "";
|
|
119
|
+
};
|
|
120
|
+
const getSize = () => {
|
|
121
|
+
const sizeItem = metaItems.find((item: { key: string }) => item.key === "size");
|
|
122
|
+
return sizeItem ? sizeItem.value : 0;
|
|
123
|
+
};
|
|
124
|
+
const getType = () => {
|
|
125
|
+
const typeItem = metaItems.find((item: { key: string }) => item.key === "type");
|
|
126
|
+
return typeItem ? typeItem.value : "";
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
setSelectedFile({
|
|
130
|
+
id: file.id,
|
|
131
|
+
name: getName(),
|
|
132
|
+
size: getSize(),
|
|
133
|
+
mimeType: getType(),
|
|
134
|
+
url: file.src || ""
|
|
135
|
+
});
|
|
136
|
+
setValidation({ isValid: true, message: "" });
|
|
137
|
+
}
|
|
138
|
+
}}
|
|
139
|
+
render={({ showFileManager }) => (
|
|
140
|
+
<FilePicker
|
|
141
|
+
label="Upload Image"
|
|
142
|
+
description="Select a file to upload (JPG, PNG, PDF)"
|
|
143
|
+
note="Note: Maximum file size is 5MB"
|
|
144
|
+
type="area"
|
|
145
|
+
required={true}
|
|
146
|
+
value={selectedFile}
|
|
147
|
+
onSelectItem={() => showFileManager()}
|
|
148
|
+
onRemoveItem={() => {
|
|
149
|
+
setSelectedFile(null);
|
|
150
|
+
setValidation({ isValid: false, message: "Please select a file" });
|
|
151
|
+
}}
|
|
152
|
+
onEditItem={() => showFileManager()}
|
|
153
|
+
validation={validation}
|
|
155
154
|
/>
|
|
156
|
-
|
|
155
|
+
)}
|
|
156
|
+
/>
|
|
157
|
+
);
|
|
157
158
|
};
|
|
158
159
|
|
|
159
160
|
export default FilePickerExample;
|
|
160
161
|
```
|
|
161
|
-
|
|
@@ -7,7 +7,7 @@ import type { FilePreviewRendererProps, TriggerRendererProps } from "./component
|
|
|
7
7
|
declare const filePickerVariants: (props?: ({
|
|
8
8
|
type?: "area" | "compact" | null | undefined;
|
|
9
9
|
variant?: "primary" | "secondary" | "ghost" | null | undefined;
|
|
10
|
-
} & import("class-variance-authority/
|
|
10
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
11
11
|
interface FilePickerPrimitiveProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof filePickerVariants> {
|
|
12
12
|
/**
|
|
13
13
|
* Custom styles for the container.
|
|
@@ -83,59 +83,59 @@ declare const FilePickerPrimitive: (({ className, containerStyle, description, d
|
|
|
83
83
|
}>) => (props: unknown) => React.JSX.Element;
|
|
84
84
|
} & {
|
|
85
85
|
Preview: {
|
|
86
|
-
Image: (({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem }: import("./
|
|
87
|
-
original: ({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem }: import("./
|
|
86
|
+
Image: (({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem }: import("./index.js").ImagePreviewProps) => React.JSX.Element) & {
|
|
87
|
+
original: ({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem }: import("./index.js").ImagePreviewProps) => React.JSX.Element;
|
|
88
88
|
originalName: string;
|
|
89
89
|
displayName: string;
|
|
90
90
|
} & {
|
|
91
|
-
original: (({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem }: import("./
|
|
92
|
-
original: ({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem }: import("./
|
|
91
|
+
original: (({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem }: import("./index.js").ImagePreviewProps) => React.JSX.Element) & {
|
|
92
|
+
original: ({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem }: import("./index.js").ImagePreviewProps) => React.JSX.Element;
|
|
93
93
|
originalName: string;
|
|
94
94
|
displayName: string;
|
|
95
95
|
};
|
|
96
96
|
originalName: string;
|
|
97
97
|
displayName: string;
|
|
98
98
|
} & {
|
|
99
|
-
createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<(({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem }: import("./
|
|
100
|
-
original: ({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem }: import("./
|
|
99
|
+
createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<(({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem }: import("./index.js").ImagePreviewProps) => React.JSX.Element) & {
|
|
100
|
+
original: ({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem }: import("./index.js").ImagePreviewProps) => React.JSX.Element;
|
|
101
101
|
originalName: string;
|
|
102
102
|
displayName: string;
|
|
103
103
|
}>) => (props: unknown) => React.JSX.Element;
|
|
104
104
|
};
|
|
105
|
-
RichItem: (({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, ...props }: import("./
|
|
106
|
-
original: ({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, ...props }: import("./
|
|
105
|
+
RichItem: (({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, ...props }: import("./index.js").RichItemPreviewProps) => React.JSX.Element) & {
|
|
106
|
+
original: ({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, ...props }: import("./index.js").RichItemPreviewProps) => React.JSX.Element;
|
|
107
107
|
originalName: string;
|
|
108
108
|
displayName: string;
|
|
109
109
|
} & {
|
|
110
|
-
original: (({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, ...props }: import("./
|
|
111
|
-
original: ({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, ...props }: import("./
|
|
110
|
+
original: (({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, ...props }: import("./index.js").RichItemPreviewProps) => React.JSX.Element) & {
|
|
111
|
+
original: ({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, ...props }: import("./index.js").RichItemPreviewProps) => React.JSX.Element;
|
|
112
112
|
originalName: string;
|
|
113
113
|
displayName: string;
|
|
114
114
|
};
|
|
115
115
|
originalName: string;
|
|
116
116
|
displayName: string;
|
|
117
117
|
} & {
|
|
118
|
-
createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<(({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, ...props }: import("./
|
|
119
|
-
original: ({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, ...props }: import("./
|
|
118
|
+
createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<(({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, ...props }: import("./index.js").RichItemPreviewProps) => React.JSX.Element) & {
|
|
119
|
+
original: ({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, ...props }: import("./index.js").RichItemPreviewProps) => React.JSX.Element;
|
|
120
120
|
originalName: string;
|
|
121
121
|
displayName: string;
|
|
122
122
|
}>) => (props: unknown) => React.JSX.Element;
|
|
123
123
|
};
|
|
124
|
-
TextOnly: (({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, small, variant, value, ...props }: import("./
|
|
125
|
-
original: ({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, small, variant, value, ...props }: import("./
|
|
124
|
+
TextOnly: (({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, small, variant, value, ...props }: import("./index.js").TextOnlyPreviewProps) => React.JSX.Element) & {
|
|
125
|
+
original: ({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, small, variant, value, ...props }: import("./index.js").TextOnlyPreviewProps) => React.JSX.Element;
|
|
126
126
|
originalName: string;
|
|
127
127
|
displayName: string;
|
|
128
128
|
} & {
|
|
129
|
-
original: (({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, small, variant, value, ...props }: import("./
|
|
130
|
-
original: ({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, small, variant, value, ...props }: import("./
|
|
129
|
+
original: (({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, small, variant, value, ...props }: import("./index.js").TextOnlyPreviewProps) => React.JSX.Element) & {
|
|
130
|
+
original: ({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, small, variant, value, ...props }: import("./index.js").TextOnlyPreviewProps) => React.JSX.Element;
|
|
131
131
|
originalName: string;
|
|
132
132
|
displayName: string;
|
|
133
133
|
};
|
|
134
134
|
originalName: string;
|
|
135
135
|
displayName: string;
|
|
136
136
|
} & {
|
|
137
|
-
createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<(({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, small, variant, value, ...props }: import("./
|
|
138
|
-
original: ({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, small, variant, value, ...props }: import("./
|
|
137
|
+
createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<(({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, small, variant, value, ...props }: import("./index.js").TextOnlyPreviewProps) => React.JSX.Element) & {
|
|
138
|
+
original: ({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, small, variant, value, ...props }: import("./index.js").TextOnlyPreviewProps) => React.JSX.Element;
|
|
139
139
|
originalName: string;
|
|
140
140
|
displayName: string;
|
|
141
141
|
}>) => (props: unknown) => React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","cn","cva","makeDecoratable","withStaticProps","FilePickerLabel","FilePickerDescription","Trigger","inputVariants","ImagePreview","RichItemPreview","TextOnlyPreview","FilePreview","FileItem","useFilePicker","filePickerVariants","variants","type","area","compact","variant","primary","secondary","ghost","defaultVariants","BaseFilePickerPrimitive","className","containerStyle","description","disabled","invalid","label","onEditItem","onRemoveItem","onSelectItem","placeholder","renderFilePreview","renderTrigger","value","vm","createElement","style","file","undefined","onReplaceItem","text","DecoratableFilePickerPrimitive","FilePickerPrimitive","Preview","Image","RichItem","TextOnly"],"sources":["FilePickerPrimitive.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn, cva, type VariantProps, makeDecoratable, withStaticProps } from \"~/utils.js\";\nimport { FilePickerLabel, FilePickerDescription, Trigger } from \"./components/index.js\";\nimport type { Label } from \"~/Label/index.js\";\nimport type { InputPrimitiveProps } from \"~/Input/index.js\";\nimport { inputVariants } from \"~/Input/index.js\";\nimport { ImagePreview, RichItemPreview, TextOnlyPreview, FilePreview } from \"./components/index.js\";\nimport { FileItem, type FileItemDto, type FileItemFormatted } from \"../domains/index.js\";\nimport { useFilePicker } from \"./useFilePicker.js\";\nimport type { FilePreviewRendererProps, TriggerRendererProps } from \"./components/types.js\";\n\nconst filePickerVariants = cva(\n [\n \"w-full border-sm text-md peer rounded-md\",\n \"focus-visible:outline-none\",\n \"data-[disabled=true]:cursor-not-allowed\",\n \"flex flex-col items-start gap-y-sm-extra\"\n ],\n {\n variants: {\n type: {\n area: [\n \"px-[calc(var(--padding-sm-extra)-(var(--border-width-sm)))] py-[calc(var(--padding-sm-extra)-(var(--border-width-sm)))]\"\n ],\n compact: [\n \"py-[calc(var(--padding-xs-plus)-(var(--border-width-sm)))] px-[calc(var(--padding-sm)-(var(--border-width-sm)))]\"\n ]\n },\n variant: {\n primary: \"\",\n secondary: \"\",\n ghost: [\"hover:bg-transparent\"]\n }\n },\n defaultVariants: {\n type: \"area\",\n variant: \"primary\"\n }\n }\n);\n\ninterface FilePickerPrimitiveProps\n extends React.HTMLAttributes<HTMLDivElement
|
|
1
|
+
{"version":3,"names":["React","cn","cva","makeDecoratable","withStaticProps","FilePickerLabel","FilePickerDescription","Trigger","inputVariants","ImagePreview","RichItemPreview","TextOnlyPreview","FilePreview","FileItem","useFilePicker","filePickerVariants","variants","type","area","compact","variant","primary","secondary","ghost","defaultVariants","BaseFilePickerPrimitive","className","containerStyle","description","disabled","invalid","label","onEditItem","onRemoveItem","onSelectItem","placeholder","renderFilePreview","renderTrigger","value","vm","createElement","style","file","undefined","onReplaceItem","text","DecoratableFilePickerPrimitive","FilePickerPrimitive","Preview","Image","RichItem","TextOnly"],"sources":["FilePickerPrimitive.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn, cva, type VariantProps, makeDecoratable, withStaticProps } from \"~/utils.js\";\nimport { FilePickerLabel, FilePickerDescription, Trigger } from \"./components/index.js\";\nimport type { Label } from \"~/Label/index.js\";\nimport type { InputPrimitiveProps } from \"~/Input/index.js\";\nimport { inputVariants } from \"~/Input/index.js\";\nimport { ImagePreview, RichItemPreview, TextOnlyPreview, FilePreview } from \"./components/index.js\";\nimport { FileItem, type FileItemDto, type FileItemFormatted } from \"../domains/index.js\";\nimport { useFilePicker } from \"./useFilePicker.js\";\nimport type { FilePreviewRendererProps, TriggerRendererProps } from \"./components/types.js\";\n\nconst filePickerVariants = cva(\n [\n \"w-full border-sm text-md peer rounded-md\",\n \"focus-visible:outline-none\",\n \"data-[disabled=true]:cursor-not-allowed\",\n \"flex flex-col items-start gap-y-sm-extra\"\n ],\n {\n variants: {\n type: {\n area: [\n \"px-[calc(var(--padding-sm-extra)-(var(--border-width-sm)))] py-[calc(var(--padding-sm-extra)-(var(--border-width-sm)))]\"\n ],\n compact: [\n \"py-[calc(var(--padding-xs-plus)-(var(--border-width-sm)))] px-[calc(var(--padding-sm)-(var(--border-width-sm)))]\"\n ]\n },\n variant: {\n primary: \"\",\n secondary: \"\",\n ghost: [\"hover:bg-transparent\"]\n }\n },\n defaultVariants: {\n type: \"area\",\n variant: \"primary\"\n }\n }\n);\n\ninterface FilePickerPrimitiveProps\n extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof filePickerVariants> {\n /**\n * Custom styles for the container.\n */\n containerStyle?: React.CSSProperties;\n /**\n * Indicates if the file picker is disabled.\n */\n disabled?: boolean;\n /**\n * Indicates if the input field is invalid.\n * Refer to `InputPrimitiveProps[\"invalid\"]` for possible values.\n */\n invalid?: InputPrimitiveProps[\"invalid\"];\n /**\n * Label for the file picker.\n */\n label?: React.ReactElement<typeof Label> | React.ReactNode | string;\n /**\n * Description for the file picker.\n */\n description?: React.ReactNode | string;\n /**\n * Callback triggered when an item is edited.\n */\n onEditItem?: (item: FileItemFormatted | null) => void;\n /**\n * Callback triggered when an item is removed.\n */\n onRemoveItem?: (item: FileItemFormatted | null) => void;\n /**\n * Callback triggered when an item is selected.\n */\n onSelectItem: () => void;\n /**\n * Placeholder text for the file picker.\n */\n placeholder?: string;\n /**\n * Custom renderer for the file preview.\n */\n renderFilePreview?: (props: FilePreviewRendererProps) => React.ReactElement<any>;\n /**\n * Custom renderer for the trigger.\n */\n renderTrigger?: (props: TriggerRendererProps) => React.ReactElement<any>;\n /**\n * Custom styles for the file picker.\n */\n style?: React.CSSProperties;\n /**\n * Value of the selected file.\n */\n value?: FileItemDto | string | null;\n}\n\nconst BaseFilePickerPrimitive = ({\n className,\n containerStyle,\n description,\n disabled,\n invalid,\n label,\n onEditItem,\n onRemoveItem,\n onSelectItem,\n placeholder,\n renderFilePreview,\n renderTrigger,\n type = \"area\",\n value,\n variant\n}: FilePickerPrimitiveProps) => {\n const { vm } = useFilePicker({ value });\n\n return (\n <div\n data-disabled={disabled}\n className={cn(\n inputVariants({ variant, invalid }),\n filePickerVariants({ type, variant }),\n className\n )}\n style={containerStyle}\n >\n {type === \"area\" && (label || description) && (\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 )}\n {vm.file ? (\n <FilePreview\n disabled={disabled}\n onEditItem={onEditItem ? () => onEditItem(vm.file) : undefined}\n onRemoveItem={onRemoveItem ? () => onRemoveItem(vm.file) : undefined}\n onReplaceItem={onSelectItem}\n renderFilePreview={renderFilePreview}\n type={type}\n value={vm.file}\n />\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 DecoratableFilePickerPrimitive = makeDecoratable(\n \"FilePickerPrimitive\",\n BaseFilePickerPrimitive\n);\n\nconst FilePickerPrimitive = withStaticProps(DecoratableFilePickerPrimitive, {\n Preview: {\n Image: ImagePreview,\n RichItem: RichItemPreview,\n TextOnly: TextOnlyPreview\n }\n});\n\nexport { FilePickerPrimitive, FileItem, type FilePickerPrimitiveProps, filePickerVariants };\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ import type { TriggerDefaultProps } from "../../../FilePicker/primitives/compone
|
|
|
4
4
|
declare const triggerVariants: (props?: ({
|
|
5
5
|
type?: "area" | "compact" | null | undefined;
|
|
6
6
|
variant?: "primary" | "secondary" | "ghost" | null | undefined;
|
|
7
|
-
} & import("class-variance-authority/
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
8
|
interface TriggerProps extends TriggerDefaultProps, VariantProps<typeof triggerVariants> {
|
|
9
9
|
renderTrigger?: (props: any) => React.ReactElement<any>;
|
|
10
10
|
}
|
|
@@ -4,7 +4,7 @@ import type { FilePreviewDefaultProps } from "../../types.js";
|
|
|
4
4
|
import { previewVariants } from "../variants.js";
|
|
5
5
|
declare const textOnlyPreviewVariants: (props?: ({
|
|
6
6
|
small?: boolean | null | undefined;
|
|
7
|
-
} & import("class-variance-authority/
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
8
|
type TextOnlyPreviewProps = FilePreviewDefaultProps & React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof previewVariants> & VariantProps<typeof textOnlyPreviewVariants>;
|
|
9
9
|
declare const TextOnlyPreview: (({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, small, variant, value, ...props }: TextOnlyPreviewProps) => React.JSX.Element) & {
|
|
10
10
|
original: ({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, small, variant, value, ...props }: TextOnlyPreviewProps) => React.JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const previewVariants: (props?: ({
|
|
2
2
|
variant?: "base" | "transparent" | "light" | null | undefined;
|
|
3
3
|
disabled?: boolean | null | undefined;
|
|
4
|
-
} & import("class-variance-authority/
|
|
4
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { VariantProps } from \"~/utils.js\";\nimport type { previewVariants } from \"./previews/variants.js\";\nimport type { FileItemFormatted } from \"../../domains/index.js\";\n\n/**\n * Default properties of a file preview component.\n * They are shared between the default and custom renderers.\n */\nexport interface FilePreviewDefaultProps\n extends
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { VariantProps } from \"~/utils.js\";\nimport type { previewVariants } from \"./previews/variants.js\";\nimport type { FileItemFormatted } from \"../../domains/index.js\";\n\n/**\n * Default properties of a file preview component.\n * They are shared between the default and custom renderers.\n */\nexport interface FilePreviewDefaultProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, \"children\">,\n VariantProps<typeof previewVariants> {\n onReplaceItem?: () => void;\n onRemoveItem?: () => void;\n onEditItem?: () => void;\n value: FileItemFormatted;\n disabled?: boolean;\n}\n\n/**\n * Properties that can be used to render a custom file preview component.\n * @see `renderFilePreview` property of the FilePickerPrimitiveProps.\n */\nexport type FilePreviewRendererProps = Omit<FilePreviewDefaultProps, \"type\"> & Record<string, any>;\n\n/**\n * Default properties of a trigger component.\n * They are shared between the default and custom renderers.\n */\nexport interface TriggerDefaultProps extends React.HTMLAttributes<HTMLButtonElement> {\n disabled?: boolean;\n text?: string;\n onSelectItem: () => void;\n}\n\n/**\n * Properties that can be used to render a custom trigger component.\n * @see `renderTrigger` property of the FilePickerPrimitiveProps.\n */\nexport type TriggerRendererProps = TriggerDefaultProps & Record<string, any>;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@ import { type TextProps } from "../Text/index.js";
|
|
|
3
3
|
import { type VariantProps } from "../utils.js";
|
|
4
4
|
declare const formComponentDescriptionVariants: (props?: ({
|
|
5
5
|
disabled?: boolean | null | undefined;
|
|
6
|
-
} & import("class-variance-authority/
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
type FormComponentDescriptionProps = TextProps & VariantProps<typeof formComponentDescriptionVariants> & {
|
|
8
8
|
text?: React.ReactNode;
|
|
9
9
|
};
|
|
@@ -3,7 +3,7 @@ import { type TextProps } from "../Text/index.js";
|
|
|
3
3
|
import { type VariantProps } from "../utils.js";
|
|
4
4
|
declare const formComponentErrorMessageVariants: (props?: ({
|
|
5
5
|
disabled?: boolean | null | undefined;
|
|
6
|
-
} & import("class-variance-authority/
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
type FormComponentErrorMessageProps = TextProps & VariantProps<typeof formComponentErrorMessageVariants> & {
|
|
8
8
|
text?: React.ReactNode;
|
|
9
9
|
invalid?: boolean;
|
package/FormComponent/Note.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { type TextProps } from "../Text/index.js";
|
|
|
3
3
|
import { type VariantProps } from "../utils.js";
|
|
4
4
|
declare const formComponentNoteVariants: (props?: ({
|
|
5
5
|
disabled?: boolean | null | undefined;
|
|
6
|
-
} & import("class-variance-authority/
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
type FormComponentNoteProps = TextProps & VariantProps<typeof formComponentNoteVariants> & {
|
|
8
8
|
text?: React.ReactNode;
|
|
9
9
|
};
|
package/Grid/Grid.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ declare const columnVariants: (props?: ({
|
|
|
4
4
|
span?: 1 | 2 | 4 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | "auto" | null | undefined;
|
|
5
5
|
offset?: 1 | 2 | 4 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | null | undefined;
|
|
6
6
|
align?: "bottom" | "top" | "middle" | null | undefined;
|
|
7
|
-
} & import("class-variance-authority/
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
8
|
interface ColumnProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof columnVariants> {
|
|
9
9
|
children?: React.ReactNode;
|
|
10
10
|
}
|
|
@@ -29,7 +29,7 @@ declare const Column: (({ span, align, children, className, offset, ...props }:
|
|
|
29
29
|
};
|
|
30
30
|
declare const gridVariants: (props?: ({
|
|
31
31
|
gap?: "none" | "small" | "compact" | "micro" | "comfortable" | "spacious" | null | undefined;
|
|
32
|
-
} & import("class-variance-authority/
|
|
32
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
33
33
|
interface GridProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof gridVariants> {
|
|
34
34
|
children: null | React.ReactElement<ColumnProps, typeof Column> | Array<React.ReactElement<ColumnProps, typeof Column>>;
|
|
35
35
|
}
|
package/Grid/Grid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","cn","cva","withStaticProps","makeDecoratable","columnVariants","variants","span","auto","offset","align","top","middle","bottom","defaultVariants","ColumnBase","children","className","props","createElement","Object","assign","Column","gridVariants","gap","none","micro","small","compact","comfortable","spacious","GridBase","DecoratableGrid","Grid"],"sources":["Grid.tsx"],"sourcesContent":["import React from \"react\";\nimport { cn, cva, withStaticProps, makeDecoratable, type VariantProps } from \"~/utils.js\";\n\nconst columnVariants = cva(\"\", {\n variants: {\n span: {\n auto: \"col-auto\",\n 1: \"col-span-1\",\n 2: \"col-span-2\",\n 3: \"col-span-3\",\n 4: \"col-span-4\",\n 5: \"col-span-5\",\n 6: \"col-span-6\",\n 7: \"col-span-7\",\n 8: \"col-span-8\",\n 9: \"col-span-9\",\n 10: \"col-span-10\",\n 11: \"col-span-11\",\n 12: \"col-span-12\"\n },\n offset: {\n 1: \"col-start-2\",\n 2: \"col-start-3\",\n 3: \"col-start-4\",\n 4: \"col-start-5\",\n 5: \"col-start-6\",\n 6: \"col-start-7\",\n 7: \"col-start-8\",\n 8: \"col-start-9\",\n 9: \"col-start-10\",\n 10: \"col-start-11\",\n 11: \"col-start-12\"\n },\n align: {\n top: \"self-start\",\n middle: \"self-center\",\n bottom: \"self-end\"\n }\n },\n defaultVariants: {\n span: \"auto\"\n }\n});\n\ninterface ColumnProps\n extends React.HTMLAttributes<HTMLDivElement
|
|
1
|
+
{"version":3,"names":["React","cn","cva","withStaticProps","makeDecoratable","columnVariants","variants","span","auto","offset","align","top","middle","bottom","defaultVariants","ColumnBase","children","className","props","createElement","Object","assign","Column","gridVariants","gap","none","micro","small","compact","comfortable","spacious","GridBase","DecoratableGrid","Grid"],"sources":["Grid.tsx"],"sourcesContent":["import React from \"react\";\nimport { cn, cva, withStaticProps, makeDecoratable, type VariantProps } from \"~/utils.js\";\n\nconst columnVariants = cva(\"\", {\n variants: {\n span: {\n auto: \"col-auto\",\n 1: \"col-span-1\",\n 2: \"col-span-2\",\n 3: \"col-span-3\",\n 4: \"col-span-4\",\n 5: \"col-span-5\",\n 6: \"col-span-6\",\n 7: \"col-span-7\",\n 8: \"col-span-8\",\n 9: \"col-span-9\",\n 10: \"col-span-10\",\n 11: \"col-span-11\",\n 12: \"col-span-12\"\n },\n offset: {\n 1: \"col-start-2\",\n 2: \"col-start-3\",\n 3: \"col-start-4\",\n 4: \"col-start-5\",\n 5: \"col-start-6\",\n 6: \"col-start-7\",\n 7: \"col-start-8\",\n 8: \"col-start-9\",\n 9: \"col-start-10\",\n 10: \"col-start-11\",\n 11: \"col-start-12\"\n },\n align: {\n top: \"self-start\",\n middle: \"self-center\",\n bottom: \"self-end\"\n }\n },\n defaultVariants: {\n span: \"auto\"\n }\n});\n\ninterface ColumnProps\n extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof columnVariants> {\n children?: React.ReactNode;\n}\n\nconst ColumnBase = ({ span, align, children, className, offset, ...props }: ColumnProps) => {\n return (\n <div {...props} className={cn(columnVariants({ span, offset, align }), className)}>\n {children}\n </div>\n );\n};\n\nconst Column = makeDecoratable(\"Column\", ColumnBase);\n\nconst gridVariants = cva(\"grid\", {\n variants: {\n gap: {\n none: \"gap-0\",\n micro: \"gap-xs\",\n small: \"gap-sm\",\n compact: \"gap-md\",\n comfortable: \"gap-lg\",\n spacious: \"gap-xl\"\n }\n },\n defaultVariants: {\n gap: \"comfortable\"\n }\n});\n\ninterface GridProps\n extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof gridVariants> {\n children:\n | null\n | React.ReactElement<ColumnProps, typeof Column>\n | Array<React.ReactElement<ColumnProps, typeof Column>>;\n}\n\nconst GridBase = ({ gap, children, className, ...props }: GridProps) => {\n return (\n <div {...props} className={cn(\"grid-cols-12\", gridVariants({ gap }), className)}>\n {children}\n </div>\n );\n};\n\nconst DecoratableGrid = makeDecoratable(\"Grid\", GridBase);\n\nconst Grid = withStaticProps(DecoratableGrid, { Column });\n\nexport { Grid, type GridProps, type ColumnProps };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,EAAE,EAAEC,GAAG,EAAEC,eAAe,EAAEC,eAAe;AAElD,MAAMC,cAAc,GAAGH,GAAG,CAAC,EAAE,EAAE;EAC3BI,QAAQ,EAAE;IACNC,IAAI,EAAE;MACFC,IAAI,EAAE,UAAU;MAChB,CAAC,EAAE,YAAY;MACf,CAAC,EAAE,YAAY;MACf,CAAC,EAAE,YAAY;MACf,CAAC,EAAE,YAAY;MACf,CAAC,EAAE,YAAY;MACf,CAAC,EAAE,YAAY;MACf,CAAC,EAAE,YAAY;MACf,CAAC,EAAE,YAAY;MACf,CAAC,EAAE,YAAY;MACf,EAAE,EAAE,aAAa;MACjB,EAAE,EAAE,aAAa;MACjB,EAAE,EAAE;IACR,CAAC;IACDC,MAAM,EAAE;MACJ,CAAC,EAAE,aAAa;MAChB,CAAC,EAAE,aAAa;MAChB,CAAC,EAAE,aAAa;MAChB,CAAC,EAAE,aAAa;MAChB,CAAC,EAAE,aAAa;MAChB,CAAC,EAAE,aAAa;MAChB,CAAC,EAAE,aAAa;MAChB,CAAC,EAAE,aAAa;MAChB,CAAC,EAAE,cAAc;MACjB,EAAE,EAAE,cAAc;MAClB,EAAE,EAAE;IACR,CAAC;IACDC,KAAK,EAAE;MACHC,GAAG,EAAE,YAAY;MACjBC,MAAM,EAAE,aAAa;MACrBC,MAAM,EAAE;IACZ;EACJ,CAAC;EACDC,eAAe,EAAE;IACbP,IAAI,EAAE;EACV;AACJ,CAAC,CAAC;AAOF,MAAMQ,UAAU,GAAGA,CAAC;EAAER,IAAI;EAAEG,KAAK;EAAEM,QAAQ;EAAEC,SAAS;EAAER,MAAM;EAAE,GAAGS;AAAmB,CAAC,KAAK;EACxF,oBACIlB,KAAA,CAAAmB,aAAA,QAAAC,MAAA,CAAAC,MAAA,KAASH,KAAK;IAAED,SAAS,EAAEhB,EAAE,CAACI,cAAc,CAAC;MAAEE,IAAI;MAAEE,MAAM;MAAEC;IAAM,CAAC,CAAC,EAAEO,SAAS;EAAE,IAC7ED,QACA,CAAC;AAEd,CAAC;AAED,MAAMM,MAAM,GAAGlB,eAAe,CAAC,QAAQ,EAAEW,UAAU,CAAC;AAEpD,MAAMQ,YAAY,GAAGrB,GAAG,CAAC,MAAM,EAAE;EAC7BI,QAAQ,EAAE;IACNkB,GAAG,EAAE;MACDC,IAAI,EAAE,OAAO;MACbC,KAAK,EAAE,QAAQ;MACfC,KAAK,EAAE,QAAQ;MACfC,OAAO,EAAE,QAAQ;MACjBC,WAAW,EAAE,QAAQ;MACrBC,QAAQ,EAAE;IACd;EACJ,CAAC;EACDhB,eAAe,EAAE;IACbU,GAAG,EAAE;EACT;AACJ,CAAC,CAAC;AAUF,MAAMO,QAAQ,GAAGA,CAAC;EAAEP,GAAG;EAAER,QAAQ;EAAEC,SAAS;EAAE,GAAGC;AAAiB,CAAC,KAAK;EACpE,oBACIlB,KAAA,CAAAmB,aAAA,QAAAC,MAAA,CAAAC,MAAA,KAASH,KAAK;IAAED,SAAS,EAAEhB,EAAE,CAAC,cAAc,EAAEsB,YAAY,CAAC;MAAEC;IAAI,CAAC,CAAC,EAAEP,SAAS;EAAE,IAC3ED,QACA,CAAC;AAEd,CAAC;AAED,MAAMgB,eAAe,GAAG5B,eAAe,CAAC,MAAM,EAAE2B,QAAQ,CAAC;AAEzD,MAAME,IAAI,GAAG9B,eAAe,CAAC6B,eAAe,EAAE;EAAEV;AAAO,CAAC,CAAC;AAEzD,SAASW,IAAI","ignoreList":[]}
|