@webiny/admin-ui 6.2.0-beta.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
|
@@ -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 CheckboxGroupStories from
|
|
3
|
+
import * as CheckboxGroupStories from "./CheckboxGroup.stories";
|
|
4
4
|
|
|
5
5
|
<Meta of={CheckboxGroupStories} />
|
|
6
6
|
|
|
@@ -18,8 +18,8 @@ import React, { useState } from "react";
|
|
|
18
18
|
import { CheckboxGroup } from "@webiny/admin-ui";
|
|
19
19
|
|
|
20
20
|
const CheckboxGroupExample = () => {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
const [selectedValues, setSelectedValues] = useState<string[]>([]);
|
|
22
|
+
const [validation, setValidation] = useState({ isValid: true, message: "" });
|
|
23
23
|
|
|
24
24
|
const handleChange = (newValues: string[]) => {
|
|
25
25
|
setSelectedValues(newValues);
|
|
@@ -50,25 +50,26 @@ const CheckboxGroupExample = () => {
|
|
|
50
50
|
/>
|
|
51
51
|
</div>
|
|
52
52
|
);
|
|
53
|
+
|
|
53
54
|
};
|
|
54
55
|
|
|
55
56
|
export default CheckboxGroupExample;
|
|
56
57
|
|
|
57
58
|
` } }
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
59
|
+
additionalActions={[
|
|
60
|
+
{
|
|
61
|
+
title: 'Open in GitHub',
|
|
62
|
+
onClick: () => {
|
|
63
|
+
window.open(
|
|
64
|
+
'https://github.com/webiny/webiny-js/blob/feat/new-admin-ui/packages/admin-ui/src/CheckboxGroup/CheckboxGroup.tsx',
|
|
65
|
+
'_blank'
|
|
66
|
+
);
|
|
67
|
+
},
|
|
68
|
+
}
|
|
69
|
+
]}
|
|
69
70
|
/>
|
|
70
71
|
|
|
71
|
-
<Controls of={CheckboxGroupStories.Documentation} exclude={"onChange"}/>
|
|
72
|
+
<Controls of={CheckboxGroupStories.Documentation} exclude={"onChange"} />
|
|
72
73
|
|
|
73
74
|
```tsx
|
|
74
75
|
import React, { useState } from "react";
|
|
@@ -76,38 +77,38 @@ import React, { useState } from "react";
|
|
|
76
77
|
import { CheckboxGroup } from "@webiny/admin-ui";
|
|
77
78
|
|
|
78
79
|
const CheckboxGroupExample = () => {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
80
|
+
const [selectedValues, setSelectedValues] = useState<string[]>([]);
|
|
81
|
+
const [validation, setValidation] = useState({ isValid: true, message: "" });
|
|
82
|
+
|
|
83
|
+
const handleChange = (newValues: string[]) => {
|
|
84
|
+
setSelectedValues(newValues);
|
|
85
|
+
|
|
86
|
+
// Simple required validation
|
|
87
|
+
if (!newValues || newValues.length === 0) {
|
|
88
|
+
setValidation({ isValid: false, message: "Please select at least one option." });
|
|
89
|
+
} else {
|
|
90
|
+
setValidation({ isValid: true, message: "" });
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<div>
|
|
96
|
+
<CheckboxGroup
|
|
97
|
+
label="Select your preferences"
|
|
98
|
+
description="Choose one or more options."
|
|
99
|
+
note="Note: You can select multiple values."
|
|
100
|
+
required={true}
|
|
101
|
+
items={[
|
|
102
|
+
{ label: "Value 1", value: "value-1" },
|
|
103
|
+
{ label: "Value 2", value: "value-2" },
|
|
104
|
+
{ label: "Value 3", value: "value-3" }
|
|
105
|
+
]}
|
|
106
|
+
value={selectedValues}
|
|
107
|
+
onChange={handleChange}
|
|
108
|
+
validation={validation}
|
|
109
|
+
/>
|
|
110
|
+
</div>
|
|
111
|
+
);
|
|
111
112
|
};
|
|
112
113
|
|
|
113
114
|
export default CheckboxGroupExample;
|
|
@@ -116,10 +117,7 @@ export default CheckboxGroupExample;
|
|
|
116
117
|
## Anatomy
|
|
117
118
|
|
|
118
119
|
### General
|
|
119
|
-
Checkbox Group input enable users to select a single or multiple items from a list of offered choices. A checkbox input group organizes related checkbox input options together for better clarity and functionality.
|
|
120
|
-
|
|
121
|
-
<img src="/images/storybook/checkbox-group/general.png" alt="General"/>
|
|
122
|
-
|
|
123
|
-
|
|
124
120
|
|
|
121
|
+
Checkbox Group input enable users to select a single or multiple items from a list of offered choices. A checkbox input group organizes related checkbox input options together for better clarity and functionality.
|
|
125
122
|
|
|
123
|
+
<img src="/images/storybook/checkbox-group/general.png" alt="General" />
|
|
@@ -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 CodeEditorStories from
|
|
3
|
+
import * as CodeEditorStories from "./CodeEditor.stories";
|
|
4
4
|
|
|
5
5
|
<Meta of={CodeEditorStories} />
|
|
6
6
|
|
|
@@ -15,8 +15,8 @@ import React, { useState } from "react";
|
|
|
15
15
|
import { CodeEditor } from "@webiny/admin-ui";
|
|
16
16
|
|
|
17
17
|
const CodeEditorExample = () => {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
const [code, setCode] = useState('{\\n "name": "example",\\n "version": "1.0.0"\\n}');
|
|
19
|
+
const [validation, setValidation] = useState({ isValid: true, message: "" });
|
|
20
20
|
|
|
21
21
|
const handleChange = (newCode: string) => {
|
|
22
22
|
setCode(newCode);
|
|
@@ -42,58 +42,59 @@ const CodeEditorExample = () => {
|
|
|
42
42
|
validation={validation}
|
|
43
43
|
/>
|
|
44
44
|
);
|
|
45
|
+
|
|
45
46
|
};
|
|
46
47
|
|
|
47
48
|
export default CodeEditorExample;
|
|
48
49
|
|
|
49
50
|
` } }
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
51
|
+
additionalActions={[
|
|
52
|
+
{
|
|
53
|
+
title: 'Open in GitHub',
|
|
54
|
+
onClick: () => {
|
|
55
|
+
window.open(
|
|
56
|
+
'https://github.com/webiny/webiny-js/blob/feat/new-admin-ui/packages/admin-ui/src/CodeEditor/CodeEditor.tsx',
|
|
57
|
+
'_blank'
|
|
58
|
+
);
|
|
59
|
+
},
|
|
60
|
+
}
|
|
61
|
+
]}
|
|
61
62
|
/>
|
|
62
63
|
|
|
63
|
-
<Controls of={CodeEditorStories.Documentation} exclude={"onChange"}/>
|
|
64
|
+
<Controls of={CodeEditorStories.Documentation} exclude={"onChange"} />
|
|
64
65
|
|
|
65
66
|
```tsx
|
|
66
67
|
import React, { useState } from "react";
|
|
67
68
|
import { CodeEditor } from "@webiny/admin-ui";
|
|
68
69
|
|
|
69
70
|
const CodeEditorExample = () => {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
71
|
+
const [code, setCode] = useState('{\n "name": "example",\n "version": "1.0.0"\n}');
|
|
72
|
+
const [validation, setValidation] = useState({ isValid: true, message: "" });
|
|
73
|
+
|
|
74
|
+
const handleChange = (newCode: string) => {
|
|
75
|
+
setCode(newCode);
|
|
76
|
+
|
|
77
|
+
// Simple required validation
|
|
78
|
+
if (!newCode || newCode.trim() === "") {
|
|
79
|
+
setValidation({ isValid: false, message: "This field is required" });
|
|
80
|
+
} else {
|
|
81
|
+
setValidation({ isValid: true, message: "" });
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<CodeEditor
|
|
87
|
+
label="JSON Configuration"
|
|
88
|
+
description="Enter your configuration in JSON format"
|
|
89
|
+
note="Note: Make sure your JSON is valid"
|
|
90
|
+
required={true}
|
|
91
|
+
mode="json"
|
|
92
|
+
theme="github"
|
|
93
|
+
value={code}
|
|
94
|
+
onChange={handleChange}
|
|
95
|
+
validation={validation}
|
|
96
|
+
/>
|
|
97
|
+
);
|
|
97
98
|
};
|
|
98
99
|
|
|
99
100
|
export default CodeEditorExample;
|
|
@@ -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 ColorPickerStories from
|
|
3
|
+
import * as ColorPickerStories from "./ColorPicker.stories";
|
|
4
4
|
|
|
5
5
|
<Meta of={ColorPickerStories} />
|
|
6
6
|
|
|
@@ -15,8 +15,8 @@ import React, { useState } from "react";
|
|
|
15
15
|
import { ColorPicker } from "@webiny/admin-ui";
|
|
16
16
|
|
|
17
17
|
const ColorPickerExample = () => {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
const [color, setColor] = useState("#4285F4");
|
|
19
|
+
const [validation, setValidation] = useState({ isValid: true, message: "" });
|
|
20
20
|
|
|
21
21
|
const handleChange = (newColor: string) => {
|
|
22
22
|
setColor(newColor);
|
|
@@ -39,55 +39,56 @@ const ColorPickerExample = () => {
|
|
|
39
39
|
validation={validation}
|
|
40
40
|
/>
|
|
41
41
|
);
|
|
42
|
+
|
|
42
43
|
};
|
|
43
44
|
|
|
44
45
|
export default ColorPickerExample;
|
|
45
46
|
|
|
46
47
|
` } }
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
48
|
+
additionalActions={[
|
|
49
|
+
{
|
|
50
|
+
title: 'Open in GitHub',
|
|
51
|
+
onClick: () => {
|
|
52
|
+
window.open(
|
|
53
|
+
'https://github.com/webiny/webiny-js/blob/feat/new-admin-ui/packages/admin-ui/src/ColorPicker/ColorPicker.tsx',
|
|
54
|
+
'_blank'
|
|
55
|
+
);
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
]}
|
|
58
59
|
/>
|
|
59
60
|
|
|
60
|
-
<Controls of={ColorPickerStories.Documentation} exclude={"onChange"}/>
|
|
61
|
+
<Controls of={ColorPickerStories.Documentation} exclude={"onChange"} />
|
|
61
62
|
|
|
62
63
|
```tsx
|
|
63
64
|
import React, { useState } from "react";
|
|
64
65
|
import { ColorPicker } from "@webiny/admin-ui";
|
|
65
66
|
|
|
66
67
|
const ColorPickerExample = () => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
68
|
+
const [color, setColor] = useState("#4285F4");
|
|
69
|
+
const [validation, setValidation] = useState({ isValid: true, message: "" });
|
|
70
|
+
|
|
71
|
+
const handleChange = (newColor: string) => {
|
|
72
|
+
setColor(newColor);
|
|
73
|
+
|
|
74
|
+
if (!newColor) {
|
|
75
|
+
setValidation({ isValid: false, message: "Please select a color" });
|
|
76
|
+
} else {
|
|
77
|
+
setValidation({ isValid: true, message: "" });
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<ColorPicker
|
|
83
|
+
label="Brand Color"
|
|
84
|
+
description="Select your primary brand color"
|
|
85
|
+
note="Note: Choose a color that aligns with your brand identity"
|
|
86
|
+
required={true}
|
|
87
|
+
value={color}
|
|
88
|
+
onChange={handleChange}
|
|
89
|
+
validation={validation}
|
|
90
|
+
/>
|
|
91
|
+
);
|
|
91
92
|
};
|
|
92
93
|
|
|
93
94
|
export default ColorPickerExample;
|
|
@@ -3,7 +3,7 @@ import { Command as CommandPrimitive } from "cmdk";
|
|
|
3
3
|
import { type VariantProps } from "../../utils.js";
|
|
4
4
|
declare const commandItemVariants: (props?: ({
|
|
5
5
|
selected?: boolean | null | undefined;
|
|
6
|
-
} & import("class-variance-authority/
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
interface ItemProps extends React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>, VariantProps<typeof commandItemVariants> {
|
|
8
8
|
selected?: boolean;
|
|
9
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","ReactComponent","Check","Command","CommandPrimitive","cn","cva","commandItemVariants","variants","selected","true","Item","className","children","props","createElement","Object","assign"],"sources":["Item.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { ReactComponent as Check } from \"@webiny/icons/check.svg\";\nimport { Command as CommandPrimitive } from \"cmdk\";\nimport { cn, cva, type VariantProps } from \"~/utils.js\";\n\nconst commandItemVariants = cva(\n [\n \"flex items-center justify-between gap-sm-extra cursor-default select-none rounded-sm p-sm mx-sm text-md outline-none overflow-hidden\",\n \"bg-neutral-base text-neutral-primary fill-neutral-xstrong\",\n \"data-[disabled=true]:text-neutral-disabled data-[disabled=true]:cursor-not-allowed\",\n \"data-[selected=true]:bg-neutral-dimmed\"\n ],\n {\n variants: {\n selected: {\n true: \"font-semibold bg-neutral-dimmed\"\n }\n }\n }\n);\n\ninterface ItemProps\n extends
|
|
1
|
+
{"version":3,"names":["React","ReactComponent","Check","Command","CommandPrimitive","cn","cva","commandItemVariants","variants","selected","true","Item","className","children","props","createElement","Object","assign"],"sources":["Item.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { ReactComponent as Check } from \"@webiny/icons/check.svg\";\nimport { Command as CommandPrimitive } from \"cmdk\";\nimport { cn, cva, type VariantProps } from \"~/utils.js\";\n\nconst commandItemVariants = cva(\n [\n \"flex items-center justify-between gap-sm-extra cursor-default select-none rounded-sm p-sm mx-sm text-md outline-none overflow-hidden\",\n \"bg-neutral-base text-neutral-primary fill-neutral-xstrong\",\n \"data-[disabled=true]:text-neutral-disabled data-[disabled=true]:cursor-not-allowed\",\n \"data-[selected=true]:bg-neutral-dimmed\"\n ],\n {\n variants: {\n selected: {\n true: \"font-semibold bg-neutral-dimmed\"\n }\n }\n }\n);\n\ninterface ItemProps\n extends\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>,\n VariantProps<typeof commandItemVariants> {\n selected?: boolean;\n}\n\nconst Item = ({ className, children, selected, ...props }: ItemProps) => (\n <CommandPrimitive.Item className={cn(commandItemVariants({ selected }), className)} {...props}>\n <span className={\"w-full overflow-hidden truncate whitespace-nowrap\"}>{children}</span>\n {selected ? <Check className=\"w-md h-md\" /> : null}\n </CommandPrimitive.Item>\n);\n\nexport { Item, type ItemProps };\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,cAAc,IAAIC,KAAK,QAAQ,yBAAyB;AACjE,SAASC,OAAO,IAAIC,gBAAgB,QAAQ,MAAM;AAClD,SAASC,EAAE,EAAEC,GAAG;AAEhB,MAAMC,mBAAmB,GAAGD,GAAG,CAC3B,CACI,sIAAsI,EACtI,2DAA2D,EAC3D,oFAAoF,EACpF,wCAAwC,CAC3C,EACD;EACIE,QAAQ,EAAE;IACNC,QAAQ,EAAE;MACNC,IAAI,EAAE;IACV;EACJ;AACJ,CACJ,CAAC;AASD,MAAMC,IAAI,GAAGA,CAAC;EAAEC,SAAS;EAAEC,QAAQ;EAAEJ,QAAQ;EAAE,GAAGK;AAAiB,CAAC,kBAChEd,KAAA,CAAAe,aAAA,CAACX,gBAAgB,CAACO,IAAI,EAAAK,MAAA,CAAAC,MAAA;EAACL,SAAS,EAAEP,EAAE,CAACE,mBAAmB,CAAC;IAAEE;EAAS,CAAC,CAAC,EAAEG,SAAS;AAAE,GAAKE,KAAK,gBACzFd,KAAA,CAAAe,aAAA;EAAMH,SAAS,EAAE;AAAoD,GAAEC,QAAe,CAAC,EACtFJ,QAAQ,gBAAGT,KAAA,CAAAe,aAAA,CAACb,KAAK;EAACU,SAAS,EAAC;AAAW,CAAE,CAAC,GAAG,IAC3B,CAC1B;AAED,SAASD,IAAI","ignoreList":[]}
|