diff --git a/eval/evals/110-flight-booking-reshaped/components.json b/eval/evals/110-flight-booking-reshaped/components.json
index c3b408c5..0d5e0253 100644
--- a/eval/evals/110-flight-booking-reshaped/components.json
+++ b/eval/evals/110-flight-booking-reshaped/components.json
@@ -39,13 +39,13 @@
"snippet": "const className = () => (\n
\n);"
}
],
- "import": "import ActionBar from \"components/ActionBar\";\nimport Button from \"components/Button\";\nimport { Example, Placeholder } from \"utilities/storybook\";\nimport View from \"components/View\";",
+ "import": "import { ActionBar, Button, Example, Placeholder, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "ActionBar",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/ActionBar/ActionBar.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/ActionBar/ActionBar.tsx",
"actualName": "ActionBar",
"exportName": "default"
}
@@ -72,13 +72,13 @@
"snippet": "const className = () => (\n \n);"
}
],
- "import": "import Alert from \"components/Alert\";\nimport { Example, Placeholder } from \"utilities/storybook\";\nimport Link from \"components/Link\";",
+ "import": "import { Alert, Example, Link, Placeholder } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Alert",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Alert/Alert.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Alert/Alert.tsx",
"actualName": "Alert",
"exportName": "default"
}
@@ -109,13 +109,13 @@
"snippet": "const multiselect = () => {\n const options = [\n \"Pizza\",\n \"Pie\",\n \"Ice-cream\",\n \"Fries\",\n \"Salad\",\n \"Option 4\",\n \"Option 5\",\n \"Option 6\",\n ];\n\n const inputRef = React.useRef(null);\n const [values, setValues] = React.useState([\n \"Option 4\",\n \"Option 5\",\n \"Option 6\",\n \"Pizza\",\n \"Ice-cream\",\n ]);\n const [query, setQuery] = React.useState(\"\");\n\n const handleDismiss = (dismissedValue: string) => {\n const nextValues = values.filter((value) => value !== dismissedValue);\n setValues(nextValues);\n inputRef.current?.focus();\n };\n\n const valuesNode = values.map((value) => (\n handleDismiss(value)} key={value}>\n {value}\n \n ));\n\n return (\n \n Food\n setQuery(args.value)}\n onBackspace={() => {\n if (query.length === 0) {\n setValues((prev) => prev.slice(0, -1));\n }\n }}\n onItemSelect={(args) => {\n setQuery(\"\");\n setValues((prev) => [...prev, args.value]);\n }}\n >\n {options.map((v) => {\n if (!v.toLowerCase().includes(query.toLowerCase())) return;\n if (values.includes(v)) return;\n\n return (\n \n {v}\n \n );\n })}\n \n \n );\n};"
}
],
- "import": "import Autocomplete from \"components/Autocomplete\";\nimport Badge from \"components/Badge\";\nimport { Example } from \"utilities/storybook\";\nimport FormControl from \"components/FormControl\";",
+ "import": "import { Autocomplete, Badge, Example, FormControl } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Autocomplete",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Autocomplete/Autocomplete.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Autocomplete/Autocomplete.tsx",
"actualName": "Autocomplete",
"exportName": "default"
}
@@ -158,13 +158,13 @@
"snippet": "const className = () => (\n \n);"
}
],
- "import": "import Avatar from \"components/Avatar\";\nimport { Example } from \"utilities/storybook\";\nimport View from \"components/View\";",
+ "import": "import { Avatar, Example, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Avatar",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Avatar/Avatar.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Avatar/Avatar.tsx",
"actualName": "Avatar",
"exportName": "default"
}
@@ -223,13 +223,13 @@
"snippet": "const className = () => (\n \n \n
\n);"
}
],
- "import": "import Avatar from \"components/Avatar\";\nimport Badge from \"components/Badge\";\nimport Button from \"components/Button\";\nimport { Example } from \"utilities/storybook\";\nimport Icon from \"components/Icon\";\nimport View from \"components/View\";",
+ "import": "import { Avatar, Badge, Button, Example, Icon, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Badge",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Badge/Badge.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Badge/Badge.tsx",
"actualName": "Badge",
"exportName": "default"
}
@@ -276,13 +276,13 @@
"snippet": "const className = () => (\n \n \n Trigger\n \n
\n);"
}
],
- "import": "import Badge from \"components/Badge\";\nimport Breadcrumbs from \"components/Breadcrumbs\";\nimport { Example } from \"utilities/storybook\";",
+ "import": "import { Badge, Breadcrumbs, Example } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Breadcrumbs",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Breadcrumbs/Breadcrumbs.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Breadcrumbs/Breadcrumbs.tsx",
"actualName": "Breadcrumbs",
"exportName": "default"
}
@@ -365,13 +365,13 @@
"snippet": "const groupClassName = () => (\n \n \n \n \n
\n);"
}
],
- "import": "import Avatar from \"components/Avatar\";\nimport Button from \"components/Button\";\nimport { Example, Placeholder } from \"utilities/storybook\";\nimport Hotkey from \"components/Hotkey\";\nimport Image from \"components/Image\";\nimport View from \"components/View\";",
+ "import": "import { Avatar, Button, Example, Hotkey, Image, Placeholder, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Button",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Button/Button.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Button/Button.tsx",
"actualName": "Button",
"exportName": "default"
}
@@ -422,13 +422,13 @@
"snippet": "const keyboardNavigation = () => (\n \n \n \n \n \n);"
}
],
- "import": "import Calendar from \"components/Calendar\";\nimport { Example } from \"utilities/storybook\";",
+ "import": "import { Calendar, Example } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Calendar",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Calendar/Calendar.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Calendar/Calendar.tsx",
"actualName": "Calendar",
"exportName": "default"
}
@@ -475,13 +475,13 @@
"snippet": "const className = () => (\n \n \n
\n);"
}
],
- "import": "import Card from \"components/Card\";\nimport { Example, Placeholder } from \"utilities/storybook\";",
+ "import": "import { Card, Example, Placeholder } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Card",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Card/Card.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Card/Card.tsx",
"actualName": "Card",
"exportName": "default"
}
@@ -520,7 +520,7 @@
"snippet": "const className = () => (\n \n
\n Item 0\n Item 1\n Item 2\n Item 3\n Item 4\n Item 5\n \n
\n);"
}
],
- "import": "import Button from \"components/Button\";\nimport Carousel from \"components/Carousel\";\nimport { Example, Placeholder } from \"utilities/storybook\";\nimport View from \"components/View\";",
+ "import": "import { Button, Carousel, Example, Placeholder, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
@@ -540,7 +540,7 @@
}
],
"displayName": "Carousel",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Carousel/Carousel.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Carousel/Carousel.tsx",
"actualName": "Carousel",
"exportName": "default"
}
@@ -583,13 +583,13 @@
"snippet": "const className = () => (\n \n \n Content\n \n
\n);"
}
],
- "import": "import Checkbox from \"components/Checkbox\";\nimport { Example } from \"utilities/storybook\";\nimport View from \"components/View\";",
+ "import": "import { Checkbox, Example, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Checkbox",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Checkbox/Checkbox.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Checkbox/Checkbox.tsx",
"actualName": "Checkbox",
"exportName": "default"
}
@@ -612,13 +612,13 @@
"snippet": "const disabled = () => (\n \n Item 1\n Item 2\n \n);"
}
],
- "import": "import Checkbox from \"components/Checkbox\";\nimport CheckboxGroup from \"components/CheckboxGroup\";\nimport View from \"components/View\";",
+ "import": "import { Checkbox, CheckboxGroup, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "CheckboxGroup",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/CheckboxGroup/CheckboxGroup.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/CheckboxGroup/CheckboxGroup.tsx",
"actualName": "CheckboxGroup",
"exportName": "default"
}
@@ -637,13 +637,13 @@
"snippet": "const handlers = () => \n \n \n \n Item\n \n \n
;"
}
],
- "import": "import ContextMenu from \"components/ContextMenu\";\nimport { Example } from \"utilities/storybook\";\nimport View from \"components/View\";",
+ "import": "import { ContextMenu, Example, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "ContextMenu",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/ContextMenu/ContextMenu.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/ContextMenu/ContextMenu.tsx",
"actualName": "ContextMenu",
"exportName": "default"
}
@@ -670,13 +670,13 @@
"snippet": "const className = () => (\n \n);"
}
],
- "import": "import Divider from \"components/Divider\";\nimport { Example, Placeholder } from \"utilities/storybook\";\nimport View from \"components/View\";",
+ "import": "import { Divider, Example, Placeholder, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Divider",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Divider/Divider.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Divider/Divider.tsx",
"actualName": "Divider",
"exportName": "default"
}
@@ -723,13 +723,13 @@
"snippet": "const testTheme = () => (\n \n \n \n \n \n \n \n \n);"
}
],
- "import": "import Button from \"components/Button\";\nimport DropdownMenu from \"components/DropdownMenu\";\nimport { Example } from \"utilities/storybook\";\nimport Theme from \"components/Theme\";\nimport View from \"components/View\";",
+ "import": "import { Button, DropdownMenu, Example, Theme, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "DropdownMenu",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/DropdownMenu/DropdownMenu.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/DropdownMenu/DropdownMenu.tsx",
"actualName": "DropdownMenu",
"exportName": "default"
}
@@ -760,13 +760,13 @@
"snippet": "const className = () => (\n \n \n Content\n \n
\n);"
}
],
- "import": "import Button from \"components/Button\";\nimport { Example } from \"utilities/storybook\";\nimport FileUpload from \"components/FileUpload\";\nimport Icon from \"components/Icon\";\nimport Image from \"components/Image\";\nimport Link from \"components/Link\";\nimport View from \"components/View\";",
+ "import": "import { Button, Example, FileUpload, Icon, Image, Link, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "FileUpload",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/FileUpload/FileUpload.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/FileUpload/FileUpload.tsx",
"actualName": "FileUpload",
"exportName": "default"
}
@@ -785,13 +785,13 @@
"snippet": "const className = () => (\n \n \n ⌘K\n \n
\n);"
}
],
- "import": "import { Example } from \"utilities/storybook\";\nimport { Hotkey } from \"reshaped\";\nimport TextField from \"components/TextField\";\nimport View from \"components/View\";",
+ "import": "import { Example, Hotkey, TextField, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Hotkey",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Hotkey/Hotkey.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Hotkey/Hotkey.tsx",
"actualName": "Hotkey",
"exportName": "default"
}
@@ -842,13 +842,13 @@
"snippet": "const testMultilineInText = () => (\n \n \n \n Someone asked me to write this text that is boring to ready for everyone and to add \n this very very long link to it.\n
\n \n \n);"
}
],
- "import": "import { Example } from \"utilities/storybook\";\nimport Link from \"components/Link\";\nimport Text from \"components/Text\";",
+ "import": "import { Example, Link, Text } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Link",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Link/Link.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Link/Link.tsx",
"actualName": "Link",
"exportName": "default"
}
@@ -875,13 +875,13 @@
"snippet": "const className = () => (\n \n \n
\n);"
}
],
- "import": "import { Example } from \"utilities/storybook\";\nimport Loader from \"components/Loader\";",
+ "import": "import { Example, Loader } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Loader",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Loader/Loader.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Loader/Loader.tsx",
"actualName": "Loader",
"exportName": "default"
}
@@ -944,13 +944,13 @@
"snippet": "const alignerClassName = () => (\n \n \n \n \n
\n);"
}
],
- "import": "import { Example, Placeholder } from \"utilities/storybook\";\nimport Hotkey from \"components/Hotkey\";\nimport MenuItem from \"components/MenuItem\";\nimport Text from \"components/Text\";\nimport View from \"components/View\";",
+ "import": "import { Example, Hotkey, MenuItem, Placeholder, Text, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "MenuItem",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/MenuItem/MenuItem.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/MenuItem/MenuItem.tsx",
"actualName": "MenuItem",
"exportName": "default"
}
@@ -1013,13 +1013,13 @@
"snippet": "const trapFocusEdgeCases = () => {\n const toggle = useToggle();\n\n return (\n \n \n \n \n \n \n \n Option 1\n \n \n Option 2\n \n \n \n \n \n \n );\n};"
}
],
- "import": "import Button from \"components/Button\";\nimport Dismissible from \"components/Dismissible\";\nimport DropdownMenu from \"components/DropdownMenu\";\nimport { Example, Placeholder } from \"utilities/storybook\";\nimport Modal from \"components/Modal\";\nimport Radio from \"components/Radio\";\nimport Switch from \"components/Switch\";\nimport TextField from \"components/TextField\";\nimport View from \"components/View\";",
+ "import": "import {\n Button,\n Dismissible,\n DropdownMenu,\n Example,\n Modal,\n Placeholder,\n Radio,\n Switch,\n TextField,\n View,\n} from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Modal",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Modal/Modal.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Modal/Modal.tsx",
"actualName": "Modal",
"exportName": "default"
}
@@ -1070,13 +1070,13 @@
"snippet": "const valueChanges = () => (\n \n \n \n \n \n);"
}
],
- "import": "import { Example } from \"utilities/storybook\";\nimport FormControl from \"components/FormControl\";\nimport NumberField from \"components/NumberField\";",
+ "import": "import { Example, FormControl, NumberField } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "NumberField",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/NumberField/NumberField.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/NumberField/NumberField.tsx",
"actualName": "NumberField",
"exportName": "default"
}
@@ -1107,13 +1107,13 @@
"snippet": "const className = () => (\n \n);"
}
],
- "import": "import { Example } from \"utilities/storybook\";\nimport Pagination from \"components/Pagination\";",
+ "import": "import { Example, Pagination } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Pagination",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Pagination/Pagination.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Pagination/Pagination.tsx",
"actualName": "Pagination",
"exportName": "default"
}
@@ -1164,13 +1164,13 @@
"snippet": "const keyboard = () => ;"
}
],
- "import": "import { Example } from \"utilities/storybook\";\nimport FormControl from \"components/FormControl\";\nimport PinField from \"components/PinField\";",
+ "import": "import { Example, FormControl, PinField } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "PinField",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/PinField/PinField.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/PinField/PinField.tsx",
"actualName": "PinField",
"exportName": "default"
}
@@ -1241,13 +1241,13 @@
"snippet": "const variant = () => (\n \n \n \n \n {(attributes) => }\n \n \n \n \n \n \n \n);"
}
],
- "import": "import Button from \"components/Button\";\nimport { Example } from \"utilities/storybook\";\nimport MenuItem from \"components/MenuItem\";\nimport Popover from \"components/Popover\";\nimport ScrollArea from \"components/ScrollArea\";\nimport Tooltip from \"components/Tooltip\";\nimport View from \"components/View\";",
+ "import": "import { Button, Example, MenuItem, Popover, ScrollArea, Tooltip, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Popover",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Popover/Popover.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Popover/Popover.tsx",
"actualName": "Popover",
"exportName": "default"
}
@@ -1282,13 +1282,13 @@
"snippet": "const className = () => (\n \n);"
}
],
- "import": "import Button from \"components/Button\";\nimport { Example } from \"utilities/storybook\";\nimport Progress from \"components/Progress\";\nimport View from \"components/View\";",
+ "import": "import { Button, Example, Progress, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Progress",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Progress/Progress.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Progress/Progress.tsx",
"actualName": "Progress",
"exportName": "default"
}
@@ -1315,13 +1315,13 @@
"snippet": "const className = () => (\n \n);"
}
],
- "import": "import Button from \"components/Button\";\nimport { Example } from \"utilities/storybook\";\nimport ProgressIndicator from \"components/ProgressIndicator\";\nimport Scrim from \"components/Scrim\";\nimport Text from \"components/Text\";\nimport View from \"components/View\";",
+ "import": "import { Button, Example, ProgressIndicator, Scrim, Text, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "ProgressIndicator",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/ProgressIndicator/ProgressIndicator.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/ProgressIndicator/ProgressIndicator.tsx",
"actualName": "ProgressIndicator",
"exportName": "default"
}
@@ -1368,13 +1368,13 @@
"snippet": "const className = () => (\n \n \n Content\n \n
\n);"
}
],
- "import": "import { Example } from \"utilities/storybook\";\nimport Radio from \"components/Radio\";\nimport View from \"components/View\";",
+ "import": "import { Example, Radio, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Radio",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Radio/Radio.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Radio/Radio.tsx",
"actualName": "Radio",
"exportName": "default"
}
@@ -1397,13 +1397,13 @@
"snippet": "const disabled = () => (\n \n Content\n \n);"
}
],
- "import": "import Radio from \"components/Radio\";\nimport RadioGroup from \"components/RadioGroup\";",
+ "import": "import { Radio, RadioGroup } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "RadioGroup",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/RadioGroup/RadioGroup.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/RadioGroup/RadioGroup.tsx",
"actualName": "RadioGroup",
"exportName": "default"
}
@@ -1438,13 +1438,13 @@
"snippet": "const className = () => (\n \n
\n \n \n \n \n \n \n \n \n
\n);"
}
],
- "import": "import Button from \"components/Button\";\nimport { Example } from \"utilities/storybook\";\nimport Resizable from \"components/Resizable\";\nimport View from \"components/View\";",
+ "import": "import { Button, Example, Resizable, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Resizable",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Resizable/Resizable.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Resizable/Resizable.tsx",
"actualName": "Resizable",
"exportName": "default"
}
@@ -1467,13 +1467,13 @@
"snippet": "const composition = () => (\n \n \n \n Text\n
\n \n \n);"
}
],
- "import": "import { Example, Placeholder } from \"utilities/storybook\";\nimport Scrim from \"components/Scrim\";",
+ "import": "import { Example, Placeholder, Scrim } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Scrim",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Scrim/Scrim.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Scrim/Scrim.tsx",
"actualName": "Scrim",
"exportName": "default"
}
@@ -1548,13 +1548,13 @@
"snippet": "const testComposition = () => (\n \n \n \n \n Dog\n Turtle\n \n Hello\n \n \n \n);"
}
],
- "import": "import Badge from \"components/Badge\";\nimport { Example, Placeholder } from \"utilities/storybook\";\nimport FormControl from \"components/FormControl\";\nimport MenuItem from \"components/MenuItem\";\nimport Modal from \"components/Modal\";\nimport Select from \"components/Select\";\nimport Text from \"components/Text\";",
+ "import": "import { Badge, Example, FormControl, MenuItem, Modal, Placeholder, Select, Text } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Select",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Select/Select.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Select/Select.tsx",
"actualName": "Select",
"exportName": "default"
}
@@ -1577,13 +1577,13 @@
"snippet": "const className = () => (\n \n \n
\n);"
}
],
- "import": "import { Example } from \"utilities/storybook\";\nimport Skeleton from \"components/Skeleton\";",
+ "import": "import { Example, Skeleton } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Skeleton",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Skeleton/Skeleton.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Skeleton/Skeleton.tsx",
"actualName": "Skeleton",
"exportName": "default"
}
@@ -1646,13 +1646,13 @@
"snippet": "const testSwipe = () => {\n const toggle = useToggle(true);\n\n return (\n \n \n Modal\n \n \n \n );\n};"
}
],
- "import": "import { Example } from \"utilities/storybook\";\nimport Modal from \"components/Modal\";\nimport Slider from \"components/Slider\";\nimport View from \"components/View\";",
+ "import": "import { Example, Modal, Slider, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Slider",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Slider/Slider.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Slider/Slider.tsx",
"actualName": "Slider",
"exportName": "default"
}
@@ -1683,13 +1683,13 @@
"snippet": "const edgeCases = () => (\n \n \n \n \n \n);"
}
],
- "import": "import Button from \"components/Button\";\nimport { Example, Placeholder } from \"utilities/storybook\";\nimport Stepper from \"components/Stepper\";\nimport View from \"components/View\";",
+ "import": "import { Button, Example, Placeholder, Stepper, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Stepper",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Stepper/Stepper.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Stepper/Stepper.tsx",
"actualName": "Stepper",
"exportName": "default"
}
@@ -1724,13 +1724,13 @@
"snippet": "const className = () => (\n \n \n Label\n \n
\n);"
}
],
- "import": "import { Example } from \"utilities/storybook\";\nimport Switch from \"components/Switch\";\nimport View from \"components/View\";",
+ "import": "import { Example, Switch, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Switch",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Switch/Switch.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Switch/Switch.tsx",
"actualName": "Switch",
"exportName": "default"
}
@@ -1777,13 +1777,13 @@
"snippet": "const examples = () => (\n \n \n \n \n \n);"
}
],
- "import": "import Card from \"components/Card\";\nimport Checkbox from \"components/Checkbox\";\nimport { Example } from \"utilities/storybook\";\nimport Table from \"components/Table\";\nimport View from \"components/View\";",
+ "import": "import { Card, Checkbox, Example, Table, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Table",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Table/Table.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Table/Table.tsx",
"actualName": "Table",
"exportName": "default"
}
@@ -1850,13 +1850,13 @@
"snippet": "const testEdgeCaseDom = () => {\n const [activeItem, setActiveItem] = React.useState(\"1\");\n const sectionsRef = React.useRef(null);\n\n return (\n \n \n \n \n setActiveItem(args.value)}>\n \n Item 1\n Item 2\n Item 3\n Item 4\n \n \n\n {\n setActiveItem(Math.min(4, Math.floor(args.y * 10) + 1).toString());\n }}\n >\n \n \n Section 1\n\n \n {[...Array(4)].map((_, i) => (\n \n ))}\n \n \n\n \n Section 2\n\n \n {[...Array(4)].map((_, i) => (\n \n ))}\n \n \n\n \n Section 3\n\n \n {[...Array(4)].map((_, i) => (\n \n ))}\n \n \n\n \n Section 4\n\n \n {[...Array(4)].map((_, i) => (\n \n ))}\n \n \n \n \n \n \n \n \n );\n};"
}
],
- "import": "import Button from \"components/Button\";\nimport { Example } from \"utilities/storybook\";\nimport ScrollArea from \"components/ScrollArea\";\nimport Tabs from \"components/Tabs\";\nimport Text from \"components/Text\";\nimport View from \"components/View\";",
+ "import": "import { Button, Example, ScrollArea, Tabs, Text, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Tabs",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Tabs/Tabs.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Tabs/Tabs.tsx",
"actualName": "Tabs",
"exportName": "default"
}
@@ -1923,13 +1923,13 @@
"snippet": "const formControl = () => (\n \n \n \n Name\n \n Helper\n This field is required\n \n \n \n \n Name\n \n This field is required\n \n \n \n);"
}
],
- "import": "import Button from \"components/Button\";\nimport { Example } from \"utilities/storybook\";\nimport FormControl from \"components/FormControl\";\nimport Text from \"components/Text\";\nimport TextArea from \"components/TextArea\";\nimport View from \"components/View\";",
+ "import": "import { Button, Example, FormControl, Text, TextArea, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "TextArea",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/TextArea/TextArea.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/TextArea/TextArea.tsx",
"actualName": "TextArea",
"exportName": "default"
}
@@ -1996,13 +1996,13 @@
"snippet": "const formControl = () => (\n \n \n \n Name\n \n Helper\n This field is required\n \n \n \n \n Name\n \n This field is required\n \n \n \n);"
}
],
- "import": "import Badge from \"components/Badge\";\nimport Button from \"components/Button\";\nimport { Example, Placeholder } from \"utilities/storybook\";\nimport FormControl from \"components/FormControl\";\nimport Text from \"components/Text\";\nimport TextField from \"components/TextField\";\nimport View from \"components/View\";",
+ "import": "import { Badge, Button, Example, FormControl, Placeholder, Text, TextField, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "TextField",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/TextField/TextField.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/TextField/TextField.tsx",
"actualName": "TextField",
"exportName": "default"
}
@@ -2025,13 +2025,13 @@
"snippet": "const className = () => (\n \n \n \n Content\n \n Content\n \n
\n);"
}
],
- "import": "import { Example, Placeholder } from \"utilities/storybook\";\nimport Timeline from \"components/Timeline\";",
+ "import": "import { Example, Placeholder, Timeline } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Timeline",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Timeline/Timeline.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Timeline/Timeline.tsx",
"actualName": "Timeline",
"exportName": "default"
}
@@ -2070,11 +2070,11 @@
"snippet": "const edgeCases = () => (\n \n \n \n \n \n \n \n \n \n \n);"
}
],
- "import": "import Button from \"components/Button\";\nimport Dismissible from \"components/Dismissible\";\nimport { Example } from \"utilities/storybook\";\nimport Image from \"components/Image\";\nimport Text from \"components/Text\";\nimport { ToastProvider } from \"components/Toast\";\nimport View from \"components/View\";",
+ "import": "import { Button, Dismissible, Example, Image, Text, ToastProvider, View } from \"reshaped\";",
"jsDocTags": {},
"error": {
- "name": "No meta.component specified",
- "message": "Specify meta.component for the component to be included in the manifest.\n 11 | import { sleep } from \"utilities/helpers\";\n 12 |\n> 13 | export default {\n | ^\n 14 | \ttitle: \"Components/Toast\",\n 15 | \tparameters: {\n 16 | \t\tiframe: {"
+ "name": "No component found",
+ "message": "We could not detect the component from your story file. Specify meta.component.\n 11 | import { sleep } from \"utilities/helpers\";\n 12 |\n> 13 | export default {\n | ^\n 14 | \ttitle: \"Components/Toast\",\n 15 | \tparameters: {\n 16 | \t\tiframe: {\n\n./src/components/Toast/tests/Toast.stories.tsx:\nimport { Example } from \"utilities/storybook\";\nimport { useToast, ToastProvider } from \"components/Toast\";\nimport Button from \"components/Button\";\nimport View from \"components/View\";\nimport Image from \"components/Image\";\nimport Text from \"components/Text\";\nimport Dismissible from \"components/Dismissible\";\nimport IconZap from \"icons/Zap\";\nimport { expect, userEvent, waitFor, within } from \"storybook/test\";\nimport { StoryObj } from \"@storybook/react-vite\";\nimport { sleep } from \"utilities/helpers\";\n\nexport default {\n\ttitle: \"Components/Toast\",\n\tparameters: {\n\t\tiframe: {\n\t\t\turl: \"https://reshaped.so/docs/components/toast\",\n\t\t},\n\t},\n};\n\nconst Size = () => {\n\tconst toast = useToast();\n\tconst props = {\n\t\ticon: IconZap,\n\t\ttitle: \"Hey!\",\n\t\ttext: \"Event completed\",\n\t\tactionsSlot: [],\n\t};\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\n\t);\n};\nexport const size = { name: \"size\", render: () => };\n\nconst Position = () => {\n\tconst toast = useToast();\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t {\n\t\t\t\t\t\ttoast.show({\n\t\t\t\t\t\t\ttext: \"Event completed\",\n\t\t\t\t\t\t\tposition: \"bottom\",\n\t\t\t\t\t\t});\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\tShow toast\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t {\n\t\t\t\t\t\ttoast.show({\n\t\t\t\t\t\t\ttext: \"Event completed\",\n\t\t\t\t\t\t\tposition: \"bottom-end\",\n\t\t\t\t\t\t});\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\tShow toast\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t {\n\t\t\t\t\t\ttoast.show({\n\t\t\t\t\t\t\ttext: \"Event completed\",\n\t\t\t\t\t\t\tposition: \"top-start\",\n\t\t\t\t\t\t});\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\tShow toast\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t {\n\t\t\t\t\t\ttoast.show({\n\t\t\t\t\t\t\ttext: \"Event completed\",\n\t\t\t\t\t\t\tposition: \"top\",\n\t\t\t\t\t\t});\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\tShow toast\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t {\n\t\t\t\t\t\ttoast.show({\n\t\t\t\t\t\t\ttext: \"Event completed\",\n\t\t\t\t\t\t\tposition: \"top-end\",\n\t\t\t\t\t\t});\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\tShow toast\n\t\t\t\t\n\t\t\t\n\t\t\n\t);\n};\nexport const position = { name: \"position\", render: () => };\n\nconst Color = () => {\n\tconst toast = useToast();\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\t {\n\t\t\t\t\t\tconst id = toast.show({\n\t\t\t\t\t\t\ttext: \"Event completed\",\n\t\t\t\t\t\t\tcolor: \"inverted\",\n\t\t\t\t\t\t\ttitle: \"Hey!\",\n\t\t\t\t\t\t\ticon: IconZap,\n\t\t\t\t\t\t\tactionsSlot: [\n\t\t\t\t\t\t\t\t toast.hide(id)}>Undo,\n\t\t\t\t\t\t\t\t toast.hide(id)}>Hide,\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t});\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\tShow toast\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t {\n\t\t\t\t\t\tconst id = toast.show({\n\t\t\t\t\t\t\ttext: \"Event completed\",\n\t\t\t\t\t\t\tcolor: \"neutral\",\n\t\t\t\t\t\t\ttitle: \"Hey!\",\n\t\t\t\t\t\t\ticon: IconZap,\n\t\t\t\t\t\t\tactionsSlot: [\n\t\t\t\t\t\t\t\t toast.hide(id)}>Undo,\n\t\t\t\t\t\t\t\t toast.hide(id)}>Hide,\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t});\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\tShow toast\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t {\n\t\t\t\t\t\tconst id = toast.show({\n\t\t\t\t\t\t\ttext: \"Event completed\",\n\t\t\t\t\t\t\tcolor: \"primary\",\n\t\t\t\t\t\t\ttitle: \"Hey!\",\n\t\t\t\t\t\t\ticon: IconZap,\n\t\t\t\t\t\t\tactionsSlot: [\n\t\t\t\t\t\t\t\t toast.hide(id)}>Undo,\n\t\t\t\t\t\t\t\t toast.hide(id)}>Hide,\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t});\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\tShow toast\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t {\n\t\t\t\t\t\tconst id = toast.show({\n\t\t\t\t\t\t\ttext: \"Event completed\",\n\t\t\t\t\t\t\tcolor: \"positive\",\n\t\t\t\t\t\t\ttitle: \"Hey!\",\n\t\t\t\t\t\t\ticon: IconZap,\n\t\t\t\t\t\t\tactionsSlot: [\n\t\t\t\t\t\t\t\t toast.hide(id)}>Undo,\n\t\t\t\t\t\t\t\t toast.hide(id)}>Hide,\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t});\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\tShow toast\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t {\n\t\t\t\t\t\tconst id = toast.show({\n\t\t\t\t\t\t\ttext: \"Event completed\",\n\t\t\t\t\t\t\tcolor: \"critical\",\n\t\t\t\t\t\t\ttitle: \"Hey!\",\n\t\t\t\t\t\t\ticon: IconZap,\n\t\t\t\t\t\t\tactionsSlot: [\n\t\t\t\t\t\t\t\t toast.hide(id)}>Undo,\n\t\t\t\t\t\t\t\t toast.hide(id)}>Hide,\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t});\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\tShow toast\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t {\n\t\t\t\t\t\tconst id = toast.show({\n\t\t\t\t\t\t\ttext: \"Event completed\",\n\t\t\t\t\t\t\tcolor: \"warning\",\n\t\t\t\t\t\t\ttitle: \"Hey!\",\n\t\t\t\t\t\t\ticon: IconZap,\n\t\t\t\t\t\t\tactionsSlot: [\n\t\t\t\t\t\t\t\t toast.hide(id)}>Undo,\n\t\t\t\t\t\t\t\t toast.hide(id)}>Hide,\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t});\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\tShow toast\n\t\t\t\t\n\t\t\t\n\t\t\n\t);\n};\n\nexport const color = { name: \"color\", render: () => };\n\nconst Timeout = () => {\n\tconst toast = useToast();\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\t {\n\t\t\t\t\t\ttoast.show({\n\t\t\t\t\t\t\ttext: \"Event completed\",\n\t\t\t\t\t\t\ttimeout: \"short\",\n\t\t\t\t\t\t});\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\tShow toast\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t {\n\t\t\t\t\t\ttoast.show({\n\t\t\t\t\t\t\ttext: \"Event completed\",\n\t\t\t\t\t\t\ttimeout: \"long\",\n\t\t\t\t\t\t});\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\tShow toast\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t {\n\t\t\t\t\t\ttoast.show({\n\t\t\t\t\t\t\ttext: \"Event completed\",\n\t\t\t\t\t\t\ttimeout: 0,\n\t\t\t\t\t\t});\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\tShow toast\n\t\t\t\t\n\t\t\t\n\t\t\n\t);\n};\nexport const timeout = { name: \"timeout\", render: () => };\n\nconst Expanded = () => {\n\tconst toast = useToast();\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\t {\n\t\t\t\t\t\ttoast.show({\n\t\t\t\t\t\t\ttext: \"Event completed\",\n\t\t\t\t\t\t\tposition: \"bottom-start\",\n\t\t\t\t\t\t});\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\tShow toast\n\t\t\t\t\n\t\t\t\n\t\t\n\t);\n};\nexport const regionOptions = { name: \"expanded\", render: () => };\n\nconst Slots = () => {\n\tconst toast = useToast();\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\t {\n\t\t\t\t\t\tconst id = toast.show({\n\t\t\t\t\t\t\tchildren: (\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t toast.hide(id)}\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\tLook at this gradient!\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\tIf you start using more gradients, your product will become even more\n\t\t\t\t\t\t\t\t\t\t\t\tsuccesful.\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tcolor: \"neutral\",\n\t\t\t\t\t\t\tposition: \"bottom-start\",\n\t\t\t\t\t\t\ttimeout: 0,\n\t\t\t\t\t\t});\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\tShow toast\n\t\t\t\t\n\t\t\t\n\t\t\n\t);\n};\nexport const slots = { name: \"slots\", render: () => };\n\nexport const base: StoryObj = {\n\tname: \"base\",\n\trender: () => {\n\t\tconst toast = useToast();\n\n\t\treturn (\n\t\t\t {\n\t\t\t\t\tconst id = toast.show({\n\t\t\t\t\t\ttitle: \"Title\",\n\t\t\t\t\t\ttext: \"Text\",\n\t\t\t\t\t\tchildren: \"Children\",\n\t\t\t\t\t\tstartSlot: \"Slot\",\n\t\t\t\t\t\tactionsSlot: (\n\t\t\t\t\t\t\t toast.hide(id)}>\n\t\t\t\t\t\t\t\tTrigger\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t),\n\t\t\t\t\t});\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\tShow toast\n\t\t\t\n\t\t);\n\t},\n\tplay: async ({ canvasElement }) => {\n\t\tconst canvas = within(canvasElement.ownerDocument.body);\n\t\tconst button = canvas.getAllByRole(\"button\")[0];\n\n\t\tawait userEvent.click(button);\n\n\t\tconst title = canvas.getByText(\"Title\");\n\t\tconst text = canvas.getByText(\"Text\");\n\t\tconst children = canvas.getByText(\"Children\");\n\t\tconst slot = canvas.getByText(\"Slot\");\n\t\tconst action = canvas.getByTestId(\"trigger-id\");\n\n\t\texpect(title).toBeInTheDocument();\n\t\texpect(text).toBeInTheDocument();\n\t\texpect(children).toBeInTheDocument();\n\t\texpect(slot).toBeInTheDocument();\n\t\texpect(action).toBeInTheDocument();\n\n\t\tawait userEvent.click(action);\n\n\t\tawait sleep(600);\n\n\t\tawait waitFor(() => {\n\t\t\texpect(title).not.toBeInTheDocument();\n\t\t});\n\t},\n};\n\nconst NestedDemo = () => {\n\tconst toast = useToast();\n\n\treturn (\n\t\t {\n\t\t\t\ttoast.show({\n\t\t\t\t\ttext: \"Content\",\n\t\t\t\t});\n\t\t\t}}\n\t\t>\n\t\t\tShow toast\n\t\t\n\t);\n};\n\nexport const nested: StoryObj = {\n\tname: \"ToastProvider\",\n\trender: () => {\n\t\treturn (\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t);\n\t},\n\tplay: async ({ canvasElement }) => {\n\t\tconst canvas = within(canvasElement.ownerDocument.body);\n\t\tconst button = canvas.getAllByRole(\"button\")[0];\n\n\t\tawait userEvent.click(button);\n\n\t\tconst container = canvas.getByTestId(\"test-container-id\");\n\t\tconst toast = within(container).getByText(\"Content\");\n\n\t\texpect(toast).toBeInTheDocument();\n\t},\n};\n\nexport const className: StoryObj = {\n\tname: \"className, attributes\",\n\trender: () => {\n\t\tconst toast = useToast();\n\n\t\treturn (\n\t\t\t {\n\t\t\t\t\tconst id = toast.show({\n\t\t\t\t\t\ttext: \"Content\",\n\t\t\t\t\t\tattributes: { \"data-testid\": \"test-id\" },\n\t\t\t\t\t\tclassName: \"test-classname\",\n\t\t\t\t\t});\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\tShow toast\n\t\t\t\n\t\t);\n\t},\n\tplay: async ({ canvasElement }) => {\n\t\tconst canvas = within(canvasElement.ownerDocument.body);\n\t\tconst button = canvas.getAllByRole(\"button\")[0];\n\n\t\tawait userEvent.click(button);\n\n\t\tconst toast = canvas.getByTestId(\"test-id\");\n\n\t\texpect(toast).toBeInTheDocument();\n\t\texpect(toast).toHaveClass(\"test-classname\");\n\t},\n};\n\nconst Multiline = () => {\n\tconst toast = useToast();\n\n\treturn (\n\t\t {\n\t\t\t\ttoast.show({\n\t\t\t\t\ttext: \"Very long event completed notification message\",\n\t\t\t\t});\n\t\t\t}}\n\t\t>\n\t\t\tShow toast\n\t\t\n\t);\n};\n\nconst Nested = () => {\n\tconst toast = useToast();\n\n\treturn (\n\t\t\n\t\t\t {\n\t\t\t\t\ttoast.show({\n\t\t\t\t\t\ttext: \"Notification sent\",\n\t\t\t\t\t});\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\tShow toast\n\t\t\t\n\t\t\n\t);\n};\nexport const edgeCases = {\n\tname: \"test: edge cases\",\n\trender: () => (\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\n\t),\n};\n"
}
},
"components-togglebutton": {
@@ -2099,13 +2099,13 @@
"snippet": "const onClick = () => Button;"
}
],
- "import": "import { Example } from \"utilities/storybook\";\nimport { ToggleButton } from \"reshaped\";",
+ "import": "import { Example, ToggleButton } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "ToggleButton",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/ToggleButton/ToggleButton.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/ToggleButton/ToggleButton.tsx",
"actualName": "ToggleButton",
"exportName": "default"
}
@@ -2136,13 +2136,13 @@
"snippet": "const testIcon = () => (\n \n \n \n \n \n \n \n \n \n);"
}
],
- "import": "import { Example } from \"utilities/storybook\";\nimport ToggleButton from \"components/ToggleButton\";\nimport ToggleButtonGroup from \"components/ToggleButtonGroup\";",
+ "import": "import { Example, ToggleButton, ToggleButtonGroup } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "ToggleButtonGroup",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/ToggleButtonGroup/ToggleButtonGroup.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/ToggleButtonGroup/ToggleButtonGroup.tsx",
"actualName": "ToggleButtonGroup",
"exportName": "default"
}
@@ -2169,13 +2169,13 @@
"snippet": "const edgeCases = () => (\n \n \n \n \n\n \n {() => Button}\n \n\n \n \n {(attributes) => (\n \n \n {(popoverAttributes) => (\n Action\n )}\n \n Popover\n \n )}\n \n \n\n \n \n \n {(tooltipAttributes) => (\n \n \n {(attributes) => (\n \n Tooltip with popover\n \n )}\n \n \n \n Popover content\n \n \n {(attributes) => Open}\n \n \n \n Another popover content\n \n \n \n \n \n \n )}\n \n \n {(tooltipAttributes) => Just a tooltip}\n \n \n \n \n);"
}
],
- "import": "import Button from \"components/Button\";\nimport { Example } from \"utilities/storybook\";\nimport Popover from \"components/Popover\";\nimport Tooltip from \"components/Tooltip\";\nimport View from \"components/View\";",
+ "import": "import { Button, Example, Popover, Tooltip, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Tooltip",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Tooltip/Tooltip.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Tooltip/Tooltip.tsx",
"actualName": "Tooltip",
"exportName": "default"
}
@@ -2222,13 +2222,13 @@
"snippet": "const className = () => (\n \n
\n \n Trigger\n \n \n \n \n \n \n \n
\n);"
}
],
- "import": "import Accordion from \"components/Accordion\";\nimport Button from \"components/Button\";\nimport { Placeholder } from \"utilities/storybook\";\nimport View from \"components/View\";",
+ "import": "import { Accordion, Button, Placeholder, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Accordion",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Accordion/Accordion.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Accordion/Accordion.tsx",
"actualName": "Accordion",
"exportName": "default"
}
@@ -2279,13 +2279,13 @@
"snippet": "const className = () => (\n \n);"
}
],
- "import": "import Actionable from \"components/Actionable\";\nimport { Example } from \"utilities/storybook\";\nimport View from \"components/View\";",
+ "import": "import { Actionable, Example, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Actionable",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Actionable/Actionable.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Actionable/Actionable.tsx",
"actualName": "Actionable",
"exportName": "default"
}
@@ -2312,13 +2312,13 @@
"snippet": "const className = () => (\n \n);"
}
],
- "import": "import Container from \"components/Container\";\nimport { Example, Placeholder } from \"utilities/storybook\";",
+ "import": "import { Container, Example, Placeholder } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Container",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Container/Container.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Container/Container.tsx",
"actualName": "Container",
"exportName": "default"
}
@@ -2349,13 +2349,13 @@
"snippet": "const className = () => (\n \n
{}}\n className=\"test-classname\"\n attributes={{ id: \"test-id\" }}\n >\n \n \n
\n);"
}
],
- "import": "import Dismissible from \"components/Dismissible\";\nimport { Example, Placeholder } from \"utilities/storybook\";\nimport Image from \"components/Image\";\nimport View from \"components/View\";",
+ "import": "import { Dismissible, Example, Image, Placeholder, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Dismissible",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Dismissible/Dismissible.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Dismissible/Dismissible.tsx",
"actualName": "Dismissible",
"exportName": "default"
}
@@ -2486,13 +2486,13 @@
"snippet": "const testChangeSize = () => {\n const [position, setPosition] = React.useState(\"bottom-start\");\n const [updatedHeight, setUpdatedHeight] = React.useState(false);\n\n return (\n <>\n \n \n \n \n \n \n
\n >\n );\n};"
}
],
- "import": "import Button from \"components/Button\";\nimport { Example } from \"utilities/storybook\";\nimport Flyout from \"components/Flyout\";\nimport Modal from \"components/Modal\";\nimport React from \"react\";\nimport Reshaped from \"components/Reshaped\";\nimport Select from \"components/Select\";\nimport Switch from \"components/Switch\";\nimport TextField from \"components/TextField\";\nimport Theme from \"components/Theme\";\nimport View from \"components/View\";",
+ "import": "import {\n Button,\n Example,\n Flyout,\n Modal,\n Reshaped,\n Select,\n Switch,\n TextField,\n Theme,\n View,\n} from \"reshaped\";\nimport React from \"react\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Flyout",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Flyout/Flyout.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Flyout/Flyout.tsx",
"actualName": "Flyout",
"exportName": "default"
}
@@ -2531,13 +2531,13 @@
"snippet": "const group = () => (\n \n Label\n \n \n One\n Two\n \n \n \n);"
}
],
- "import": "import { Example } from \"utilities/storybook\";\nimport FormControl from \"components/FormControl\";\nimport Radio from \"components/Radio\";\nimport RadioGroup from \"components/RadioGroup\";\nimport TextField from \"components/TextField\";\nimport View from \"components/View\";",
+ "import": "import { Example, FormControl, Radio, RadioGroup, TextField, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "FormControl",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/FormControl/FormControl.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/FormControl/FormControl.tsx",
"actualName": "FormControl",
"exportName": "default"
}
@@ -2576,13 +2576,13 @@
"snippet": "const className = () => (\n \n \n \n Content\n \n \n
\n);"
}
],
- "import": "import { Example } from \"utilities/storybook\";\nimport Grid from \"components/Grid\";\nimport View from \"components/View\";",
+ "import": "import { Example, Grid, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Grid",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Grid/Grid.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Grid/Grid.tsx",
"actualName": "Grid",
"exportName": "default"
}
@@ -2601,13 +2601,13 @@
"snippet": "const as = () => Content;"
}
],
- "import": "import { Example } from \"utilities/storybook\";\nimport Hidden from \"components/Hidden\";",
+ "import": "import { Example, Hidden } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Hidden",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Hidden/Hidden.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Hidden/Hidden.tsx",
"actualName": "Hidden",
"exportName": "default"
}
@@ -2626,13 +2626,13 @@
"snippet": "const children = () => Content;"
}
],
- "import": "import { Example } from \"utilities/storybook\";\nimport HiddenVisually from \"components/HiddenVisually\";",
+ "import": "import { Example, HiddenVisually } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "HiddenVisually",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/HiddenVisually/HiddenVisually.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/HiddenVisually/HiddenVisually.tsx",
"actualName": "HiddenVisually",
"exportName": "default"
}
@@ -2663,13 +2663,13 @@
"snippet": "const render = () => (\n \n \n
\n);"
}
],
- "import": "import { Example } from \"utilities/storybook\";\nimport Icon from \"components/Icon\";\nimport Text from \"components/Text\";\nimport View from \"components/View\";",
+ "import": "import { Example, Icon, Text, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Icon",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Icon/Icon.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Icon/Icon.tsx",
"actualName": "Icon",
"exportName": "default"
}
@@ -2720,13 +2720,13 @@
"snippet": "const ratio = () => (\n \n \n \n \n \n \n \n \n \n \n \n \n);"
}
],
- "import": "import { Example } from \"utilities/storybook\";\nimport Icon from \"components/Icon\";\nimport { Image } from \"reshaped\";\nimport View from \"components/View\";",
+ "import": "import { Example, Icon, Image, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Image",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Image/Image.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Image/Image.tsx",
"actualName": "Image",
"exportName": "default"
}
@@ -2769,13 +2769,13 @@
"snippet": "const className = () => (\n \n Content\n \n);"
}
],
- "import": "import Button from \"components/Button\";\nimport { Example } from \"utilities/storybook\";\nimport Overlay from \"components/Overlay\";",
+ "import": "import { Button, Example, Overlay } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Overlay",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Overlay/Overlay.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Overlay/Overlay.tsx",
"actualName": "Overlay",
"exportName": "default"
}
@@ -2814,13 +2814,13 @@
"snippet": "const keyboardMode = () => (\n \n Hello\n \n);"
}
],
- "import": "import Button from \"components/Button\";\nimport { Reshaped } from \"reshaped\";",
+ "import": "import { Button, Reshaped } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Reshaped",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Reshaped/Reshaped.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Reshaped/Reshaped.tsx",
"actualName": "Reshaped",
"exportName": "default"
}
@@ -2859,13 +2859,13 @@
"snippet": "const testDynamicHeight = () => {\n const [count, setCount] = React.useState(10);\n\n return (\n \n \n setCount((prev) => prev + 10)}>Add more items\n \n\n \n \n {new Array(count).fill(\"\").map((_, i) => (\n Item {i + 1}\n ))}\n \n \n \n );\n};"
}
],
- "import": "import Button from \"components/Button\";\nimport { Example } from \"utilities/storybook\";\nimport ScrollArea from \"components/ScrollArea\";\nimport View from \"components/View\";",
+ "import": "import { Button, Example, ScrollArea, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "ScrollArea",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/ScrollArea/ScrollArea.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/ScrollArea/ScrollArea.tsx",
"actualName": "ScrollArea",
"exportName": "default"
}
@@ -2916,13 +2916,13 @@
"snippet": "const className = () => (\n \n \n Content\n \n
\n);"
}
],
- "import": "import { Example } from \"utilities/storybook\";\nimport Text from \"components/Text\";",
+ "import": "import { Example, Text } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Text",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Text/Text.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Text/Text.tsx",
"actualName": "Text",
"exportName": "default"
}
@@ -2965,13 +2965,13 @@
"snippet": "const disabledTransition = () => {\n const { invertColorMode } = useTheme();\n\n return (\n \n \n \n Invert mode\n\n \n\n Default card\n\n \n Inverted card\n \n \n \n \n );\n};"
}
],
- "import": "import Button from \"components/Button\";\nimport Card from \"components/Card\";\nimport { Example } from \"utilities/storybook\";\nimport MenuItem from \"components/MenuItem\";\nimport Popover from \"components/Popover\";\nimport Theme from \"components/Theme\";\nimport View from \"components/View\";",
+ "import": "import { Button, Card, Example, MenuItem, Popover, Theme, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Theme",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Theme/Theme.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Theme/Theme.tsx",
"actualName": "Theme",
"exportName": "default"
}
@@ -3114,13 +3114,13 @@
"snippet": "const itemClassName = () => (\n \n \n Content\n \n
\n);"
}
],
- "import": "import Avatar from \"components/Avatar\";\nimport Button from \"components/Button\";\nimport { Example, Placeholder } from \"utilities/storybook\";\nimport Hidden from \"components/Hidden\";\nimport MenuItem from \"components/MenuItem\";\nimport Tabs from \"components/Tabs\";\nimport Text from \"components/Text\";\nimport View from \"components/View\";",
+ "import": "import { Avatar, Button, Example, Hidden, MenuItem, Placeholder, Tabs, Text, View } from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "View",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/View/View.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/View/View.tsx",
"actualName": "View",
"exportName": "default"
}
@@ -3138,8 +3138,8 @@
"import": "",
"jsDocTags": {},
"error": {
- "name": "No meta.component specified",
- "message": "Specify meta.component for the component to be included in the manifest.\n 3 | import useElementId from \"hooks/useElementId\";\n 4 |\n> 5 | export default {\n | ^\n 6 | \ttitle: \"Hooks/useElementId\",\n 7 | \tparameters: {\n 8 | \t\tchromatic: { disableSnapshot: true },"
+ "name": "No component found",
+ "message": "We could not detect the component from your story file. Specify meta.component.\n 3 | import useElementId from \"hooks/useElementId\";\n 4 |\n> 5 | export default {\n | ^\n 6 | \ttitle: \"Hooks/useElementId\",\n 7 | \tparameters: {\n 8 | \t\tchromatic: { disableSnapshot: true },\n\n./src/hooks/tests/useElementId.stories.tsx:\nimport { StoryObj } from \"@storybook/react-vite\";\nimport { expect, waitFor } from \"storybook/test\";\nimport useElementId from \"hooks/useElementId\";\n\nexport default {\n\ttitle: \"Hooks/useElementId\",\n\tparameters: {\n\t\tchromatic: { disableSnapshot: true },\n\t},\n};\n\nconst Component: React.FC<{ id?: string }> = (props) => {\n\tconst id = useElementId(props.id);\n\n\treturn {id}
;\n};\n\nexport const id: StoryObj = {\n\tname: \"passed id\",\n\trender: () => {\n\t\treturn ;\n\t},\n\tplay: async () => {\n\t\twaitFor(() => {\n\t\t\texpect(document.querySelector(\"#hey\")).toBeTruthy();\n\t\t});\n\t},\n};\n"
}
},
"hooks-usehandlerref": {
@@ -3152,11 +3152,11 @@
"snippet": "const base = (args) => {\n const [count, setCount] = React.useState(0);\n\n // Creating a new handler on each render\n const handleEffect = () => {\n args.handleEffect(0);\n };\n\n return (\n \n setCount((prev) => prev + 1)}>Increase count\n \n \n );\n};"
}
],
- "import": "import Button from \"components/Button\";\nimport View from \"components/View\";",
+ "import": "import { Button, View } from \"reshaped\";",
"jsDocTags": {},
"error": {
- "name": "No meta.component specified",
- "message": "Specify meta.component for the component to be included in the manifest.\n 6 | import useHandlerRef from \"hooks/useHandlerRef\";\n 7 |\n> 8 | export default {\n | ^\n 9 | \ttitle: \"Hooks/useHandlerRef\",\n 10 | \tparameters: {\n 11 | \t\tchromatic: { disableSnapshot: true },"
+ "name": "No component found",
+ "message": "We could not detect the component from your story file. Specify meta.component.\n 6 | import useHandlerRef from \"hooks/useHandlerRef\";\n 7 |\n> 8 | export default {\n | ^\n 9 | \ttitle: \"Hooks/useHandlerRef\",\n 10 | \tparameters: {\n 11 | \t\tchromatic: { disableSnapshot: true },\n\n./src/hooks/tests/useHandlerRef.stories.tsx:\nimport React from \"react\";\nimport { StoryObj } from \"@storybook/react-vite\";\nimport { expect, fn, Mock, userEvent } from \"storybook/test\";\nimport Button from \"components/Button\";\nimport View from \"components/View\";\nimport useHandlerRef from \"hooks/useHandlerRef\";\n\nexport default {\n\ttitle: \"Hooks/useHandlerRef\",\n\tparameters: {\n\t\tchromatic: { disableSnapshot: true },\n\t},\n};\n\nconst Component: React.FC<{ onEffect: () => void; count: number }> = (props) => {\n\tconst { onEffect, count } = props;\n\tconst onEffectRef = useHandlerRef(onEffect);\n\n\tReact.useEffect(() => {\n\t\tonEffectRef.current();\n\t}, [onEffectRef]);\n\n\treturn <>Counter: {count}>;\n};\n\nexport const base: StoryObj<{ handleEffect: Mock }> = {\n\tname: \"base\",\n\targs: {\n\t\thandleEffect: fn(),\n\t},\n\trender: (args) => {\n\t\tconst [count, setCount] = React.useState(0);\n\n\t\t// Creating a new handler on each render\n\t\tconst handleEffect = () => {\n\t\t\targs.handleEffect(0);\n\t\t};\n\n\t\treturn (\n\t\t\t\n\t\t\t\t setCount((prev) => prev + 1)}>Increase count\n\t\t\t\t\n\t\t\t\n\t\t);\n\t},\n\tplay: async ({ canvas, args }) => {\n\t\tconst button = canvas.getAllByRole(\"button\")[0];\n\n\t\t// mount, triggerred twice in dev mode\n\t\texpect(args.handleEffect).toHaveBeenCalledTimes(2);\n\n\t\tawait userEvent.click(button);\n\n\t\t// Rerendering the component doesn't re-trigger the effect\n\t\texpect(args.handleEffect).toHaveBeenCalledTimes(2);\n\t},\n};\n"
}
},
"hooks-usehotkeys": {
@@ -3205,11 +3205,11 @@
"snippet": "const optionModified = (args) => (\n \n);"
}
],
- "import": "import View from \"components/View\";",
+ "import": "import { View } from \"reshaped\";",
"jsDocTags": {},
"error": {
- "name": "No meta.component specified",
- "message": "Specify meta.component for the component to be included in the manifest.\n 4 | import useHotkeys from \"hooks/useHotkeys\";\n 5 |\n> 6 | export default {\n | ^\n 7 | \ttitle: \"Hooks/useHotkeys\",\n 8 | \tparameters: {\n 9 | \t\tchromatic: { disableSnapshot: true },"
+ "name": "No component found",
+ "message": "We could not detect the component from your story file. Specify meta.component.\n 4 | import useHotkeys from \"hooks/useHotkeys\";\n 5 |\n> 6 | export default {\n | ^\n 7 | \ttitle: \"Hooks/useHotkeys\",\n 8 | \tparameters: {\n 9 | \t\tchromatic: { disableSnapshot: true },\n\n./src/hooks/tests/useHotkeys.stories.tsx:\nimport { StoryObj } from \"@storybook/react-vite\";\nimport { expect, fn, userEvent } from \"storybook/test\";\nimport View from \"components/View\";\nimport useHotkeys from \"hooks/useHotkeys\";\n\nexport default {\n\ttitle: \"Hooks/useHotkeys\",\n\tparameters: {\n\t\tchromatic: { disableSnapshot: true },\n\t},\n};\n\nexport const base = {\n\tname: \"base\",\n\trender: () => {\n\t\tconst { checkHotkeyState } = useHotkeys({\n\t\t\t\"shift + b + n\": () => console.log(\"pressed\"),\n\t\t\t\"c + v\": () => console.log(\"c + v\"),\n\t\t\t\"Meta + k\": () => console.log(\"meta + k\"),\n\t\t\t\"Meta + f\": () => console.log(\"meta + f\"),\n\t\t\t\"Meta + v\": () => console.log(\"meta + v\"),\n\t\t\t\"Meta + b\": () => console.log(\"meta + b\"),\n\t\t\t\"control + enter\": () => console.log(\"control + enter\"),\n\t\t\t\"meta + enter\": () => console.log(\"meta + enter\"),\n\t\t\t\"mod + enter\": () => console.log(\"mod + enter\"),\n\t\t\t\"mod + ArrowRight\": () => console.log(\"right\"),\n\t\t\t\"mod + ArrowUp\": () => console.log(\"top\"),\n\t\t\t\"shift + ArrowRight\": () => console.log(\"right\"),\n\t\t\t\"shift + ArrowUp\": () => console.log(\"top\"),\n\t\t\t\"alt+shift+n\": () => console.log(\"alt+shift+n\"),\n\t\t\t\"shift+alt+n\": () => console.log(\"shift+alt+n\"),\n\t\t\t\"alt+shiftLeft+n\": () => console.log(\"alt+shiftLeft+n\"),\n\t\t});\n\t\tconst active = checkHotkeyState(\"shift + b + n\");\n\t\tconst shiftActive = checkHotkeyState(\"shift\");\n\t\tconst bActive = checkHotkeyState(\"b\");\n\t\tconst nActive = checkHotkeyState(\"n\");\n\n\t\treturn (\n\t\t\t\n\t\t\t\t\n\t\t\t\t\tShift\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\tb\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\tn\n\t\t\t\t\n\t\t\t\n\t\t);\n\t},\n};\n\nconst Component: React.FC<{ hotkeys: Record void) | null> }> = (props) => {\n\tconst { hotkeys } = props;\n\tuseHotkeys(hotkeys);\n\n\treturn ;\n};\n\nexport const singleKey: StoryObj<{ handleHotkey: ReturnType }> = {\n\tname: \"single key\",\n\targs: {\n\t\thandleHotkey: fn(),\n\t},\n\trender: (args) => ,\n\tplay: async ({ args }) => {\n\t\tawait userEvent.keyboard(\"a\");\n\t\tawait userEvent.keyboard(\"b\");\n\n\t\texpect(args.handleHotkey).toHaveBeenCalledTimes(1);\n\t},\n};\n\nexport const modKey: StoryObj<{ handleHotkey: ReturnType }> = {\n\tname: \"mod key\",\n\targs: {\n\t\thandleHotkey: fn(),\n\t},\n\trender: (args) => ,\n\tplay: async ({ args }) => {\n\t\tawait userEvent.keyboard(\"{Meta/}\");\n\n\t\texpect(args.handleHotkey).toHaveBeenCalledTimes(1);\n\t},\n};\n\nexport const modKeyHold: StoryObj<{ handleHotkey: ReturnType }> = {\n\tname: \"mod key on hold\",\n\targs: {\n\t\thandleHotkey: fn(),\n\t},\n\trender: (args) => ,\n\tplay: async ({ args }) => {\n\t\tawait userEvent.keyboard(\"{Meta>}bb{/Meta}\");\n\t\texpect(args.handleHotkey).toHaveBeenCalledTimes(2);\n\t},\n};\n\nexport const keyList: StoryObj<{ handleHotkey: ReturnType }> = {\n\tname: \"key list\",\n\targs: {\n\t\thandleHotkey: fn(),\n\t},\n\trender: (args) => ,\n\tplay: async ({ args }) => {\n\t\tawait userEvent.keyboard(\"a\");\n\t\texpect(args.handleHotkey).toHaveBeenCalledTimes(1);\n\n\t\tawait userEvent.keyboard(\"b\");\n\t\texpect(args.handleHotkey).toHaveBeenCalledTimes(2);\n\t},\n};\n\nexport const keyCombination: StoryObj<{ handleHotkey: ReturnType }> = {\n\tname: \"key combination\",\n\targs: {\n\t\thandleHotkey: fn(),\n\t},\n\trender: (args) => ,\n\tplay: async ({ args }) => {\n\t\tawait userEvent.keyboard(\"{a>}b{/a}\");\n\n\t\texpect(args.handleHotkey).toHaveBeenCalledTimes(1);\n\t},\n};\n\nexport const keyCombinationFormat: StoryObj<{ handleHotkey: ReturnType }> = {\n\tname: \"key combination without formatting\",\n\targs: {\n\t\thandleHotkey: fn(),\n\t},\n\trender: (args) => ,\n\tplay: async ({ args }) => {\n\t\tawait userEvent.keyboard(\"{a>}b{/a}\");\n\n\t\texpect(args.handleHotkey).toHaveBeenCalledTimes(1);\n\t},\n};\n\nexport const keyCombinationOrder: StoryObj<{ handleHotkey: ReturnType }> = {\n\tname: \"key combination without order\",\n\targs: {\n\t\thandleHotkey: fn(),\n\t},\n\trender: (args) => ,\n\tplay: async ({ args }) => {\n\t\tawait userEvent.keyboard(\"{a>}b{/a}\");\n\n\t\texpect(args.handleHotkey).toHaveBeenCalledTimes(1);\n\t},\n};\n\nexport const keyCombinationMoreThanRequired: StoryObj<{ handleHotkey: ReturnType }> = {\n\tname: \"key combination, more keys pressed\",\n\targs: {\n\t\thandleHotkey: fn(),\n\t},\n\trender: (args) => ,\n\tplay: async ({ args }) => {\n\t\tawait userEvent.keyboard(\"{z>}{x>}c{/x}{/z}\");\n\t\t// When c is pressed, it doesn't trigger a+b for the second time\n\n\t\texpect(args.handleHotkey).toHaveBeenCalledTimes(1);\n\t},\n};\n\nexport const optionModified: StoryObj<{\n\thandleHotkey: ReturnType;\n\thandleHotkeyModified: ReturnType;\n}> = {\n\tname: \"modified with alt/option\",\n\targs: {\n\t\thandleHotkey: fn(),\n\t\thandleHotkeyModified: fn(),\n\t},\n\trender: (args) => (\n\t\t\n\t),\n\tplay: async ({ args }) => {\n\t\tawait userEvent.keyboard(\"{Alt>}n{/Alt}\");\n\t\texpect(args.handleHotkeyModified).toHaveBeenCalledTimes(1);\n\n\t\tawait userEvent.keyboard(\"{Alt>}{Shift}{/Alt}\");\n\t\texpect(args.handleHotkey).toHaveBeenCalledTimes(1);\n\t},\n};\n"
}
},
"hooks-usekeyboardarrownavigation": {
@@ -3238,11 +3238,11 @@
"snippet": "const disabled = () => {\n const ref = useRef(null);\n\n useKeyboardArrowNavigation({ ref, disabled: true });\n\n return (\n \n {}}>Action 1\n {}}>Action 2\n {}}>Action 3\n \n );\n};"
}
],
- "import": "import Button from \"components/Button\";\nimport View from \"components/View\";",
+ "import": "import { Button, View } from \"reshaped\";",
"jsDocTags": {},
"error": {
- "name": "No meta.component specified",
- "message": "Specify meta.component for the component to be included in the manifest.\n 7 | import useKeyboardArrowNavigation from \"hooks/useKeyboardArrowNavigation\";\n 8 |\n> 9 | export default {\n | ^\n 10 | \ttitle: \"Hooks/useKeyboardArrowNavigation\",\n 11 | \tparameters: {\n 12 | \t\tchromatic: { disableSnapshot: true },"
+ "name": "No component found",
+ "message": "We could not detect the component from your story file. Specify meta.component.\n 7 | import useKeyboardArrowNavigation from \"hooks/useKeyboardArrowNavigation\";\n 8 |\n> 9 | export default {\n | ^\n 10 | \ttitle: \"Hooks/useKeyboardArrowNavigation\",\n 11 | \tparameters: {\n 12 | \t\tchromatic: { disableSnapshot: true },\n\n./src/hooks/tests/useKeyboardArrowNavigation.stories.tsx:\nimport React, { useEffect, useRef, useState } from \"react\";\nimport { StoryObj } from \"@storybook/react-vite\";\nimport { expect, userEvent } from \"storybook/test\";\nimport useRTL from \"hooks/useRTL\";\nimport View from \"components/View\";\nimport Button from \"components/Button\";\nimport useKeyboardArrowNavigation from \"hooks/useKeyboardArrowNavigation\";\n\nexport default {\n\ttitle: \"Hooks/useKeyboardArrowNavigation\",\n\tparameters: {\n\t\tchromatic: { disableSnapshot: true },\n\t},\n};\n\nexport const base: StoryObj = {\n\tname: \"base\",\n\trender: () => {\n\t\tconst ref = useRef(null);\n\n\t\tuseKeyboardArrowNavigation({ ref });\n\n\t\treturn (\n\t\t\t\n\t\t\t\t {}}>Action 1\n\t\t\t\t {}}>Action 2\n\t\t\t\t {}}>Action 3\n\t\t\t\n\t\t);\n\t},\n\tplay: async ({ canvas }) => {\n\t\tconst buttons = canvas.getAllByRole(\"button\");\n\n\t\tbuttons[0].focus();\n\n\t\tawait userEvent.keyboard(\"{ArrowRight/}\");\n\n\t\texpect(document.activeElement).toBe(buttons[1]);\n\n\t\tawait userEvent.keyboard(\"{ArrowDown/}\");\n\t\texpect(document.activeElement).toBe(buttons[2]);\n\n\t\tawait userEvent.keyboard(\"{ArrowUp/}\");\n\t\texpect(document.activeElement).toBe(buttons[1]);\n\n\t\tawait userEvent.keyboard(\"{ArrowLeft/}\");\n\t\texpect(document.activeElement).toBe(buttons[0]);\n\t},\n};\n\nexport const horizontal: StoryObj = {\n\tname: \"orientation: horizontal\",\n\trender: () => {\n\t\tconst ref = useRef(null);\n\n\t\tuseKeyboardArrowNavigation({ ref, orientation: \"horizontal\" });\n\n\t\treturn (\n\t\t\t\n\t\t\t\t {}}>Action 1\n\t\t\t\t {}}>Action 2\n\t\t\t\t {}}>Action 3\n\t\t\t\n\t\t);\n\t},\n\tplay: async ({ canvas }) => {\n\t\tconst buttons = canvas.getAllByRole(\"button\");\n\n\t\texpect(buttons[0]).toHaveAttribute(\"tabindex\", \"0\");\n\t\texpect(buttons[1]).toHaveAttribute(\"tabindex\", \"-1\");\n\t\texpect(buttons[2]).toHaveAttribute(\"tabindex\", \"-1\");\n\n\t\tbuttons[0].focus();\n\n\t\tawait userEvent.keyboard(\"{ArrowRight/}\");\n\n\t\texpect(document.activeElement).toBe(buttons[1]);\n\n\t\tawait userEvent.keyboard(\"{ArrowLeft/}\");\n\t\texpect(document.activeElement).toBe(buttons[0]);\n\n\t\tawait userEvent.keyboard(\"{ArrowDown/}\");\n\t\texpect(document.activeElement).toBe(buttons[0]);\n\n\t\tawait userEvent.keyboard(\"{ArrowUp/}\");\n\t\texpect(document.activeElement).toBe(buttons[0]);\n\t},\n};\n\nexport const vertical: StoryObj = {\n\tname: \"orientation: vertical\",\n\trender: () => {\n\t\tconst ref = useRef(null);\n\n\t\tuseKeyboardArrowNavigation({ ref, orientation: \"vertical\" });\n\n\t\treturn (\n\t\t\t\n\t\t\t\t {}}>Action 1\n\t\t\t\t {}}>Action 2\n\t\t\t\t {}}>Action 3\n\t\t\t\n\t\t);\n\t},\n\tplay: async ({ canvas }) => {\n\t\tconst buttons = canvas.getAllByRole(\"button\");\n\n\t\tbuttons[0].focus();\n\n\t\tawait userEvent.keyboard(\"{ArrowDown/}\");\n\n\t\texpect(document.activeElement).toBe(buttons[1]);\n\n\t\tawait userEvent.keyboard(\"{ArrowUp/}\");\n\t\texpect(document.activeElement).toBe(buttons[0]);\n\n\t\tawait userEvent.keyboard(\"{ArrowRight/}\");\n\t\texpect(document.activeElement).toBe(buttons[0]);\n\n\t\tawait userEvent.keyboard(\"{ArrowLeft/}\");\n\t\texpect(document.activeElement).toBe(buttons[0]);\n\t},\n};\n\nexport const circular: StoryObj = {\n\tname: \"circular\",\n\trender: () => {\n\t\tconst ref = useRef(null);\n\n\t\tuseKeyboardArrowNavigation({ ref, circular: true });\n\n\t\treturn (\n\t\t\t\n\t\t\t\t {}}>Action 1\n\t\t\t\t {}}>Action 2\n\t\t\t\t {}}>Action 3\n\t\t\t\n\t\t);\n\t},\n\tplay: async ({ canvas }) => {\n\t\tconst buttons = canvas.getAllByRole(\"button\");\n\n\t\tbuttons[0].focus();\n\n\t\tawait userEvent.keyboard(\"{ArrowRight/}\");\n\t\tawait userEvent.keyboard(\"{ArrowRight/}\");\n\t\texpect(document.activeElement).toBe(buttons[2]);\n\n\t\tawait userEvent.keyboard(\"{ArrowRight/}\");\n\t\texpect(document.activeElement).toBe(buttons[0]);\n\n\t\tawait userEvent.keyboard(\"{ArrowLeft/}\");\n\t\texpect(document.activeElement).toBe(buttons[2]);\n\t},\n};\n\nexport const disabled: StoryObj = {\n\tname: \"disabled\",\n\trender: () => {\n\t\tconst ref = useRef(null);\n\n\t\tuseKeyboardArrowNavigation({ ref, disabled: true });\n\n\t\treturn (\n\t\t\t\n\t\t\t\t {}}>Action 1\n\t\t\t\t {}}>Action 2\n\t\t\t\t {}}>Action 3\n\t\t\t\n\t\t);\n\t},\n\tplay: async ({ canvas }) => {\n\t\tconst buttons = canvas.getAllByRole(\"button\");\n\n\t\tbuttons[0].focus();\n\n\t\tawait userEvent.keyboard(\"{ArrowRight/}\");\n\t\texpect(document.activeElement).toBe(buttons[0]);\n\t\texpect(buttons[0]).not.toHaveAttribute(\"tabindex\");\n\t},\n};\n"
}
},
"hooks-usekeyboardmode": {
@@ -3252,11 +3252,11 @@
"stories": [
{ "name": "base", "snippet": "const base = () => ;" }
],
- "import": "import Button from \"components/Button\";\nimport View from \"components/View\";",
+ "import": "import { Button, View } from \"reshaped\";",
"jsDocTags": {},
"error": {
- "name": "No meta.component specified",
- "message": "Specify meta.component for the component to be included in the manifest.\n 5 | import useKeyboardMode from \"hooks/useKeyboardMode\";\n 6 |\n> 7 | export default {\n | ^\n 8 | \ttitle: \"Hooks/useKeyboardMode\",\n 9 | \tparameters: {\n 10 | \t\tchromatic: { disableSnapshot: true },"
+ "name": "No component found",
+ "message": "We could not detect the component from your story file. Specify meta.component.\n 5 | import useKeyboardMode from \"hooks/useKeyboardMode\";\n 6 |\n> 7 | export default {\n | ^\n 8 | \ttitle: \"Hooks/useKeyboardMode\",\n 9 | \tparameters: {\n 10 | \t\tchromatic: { disableSnapshot: true },\n\n./src/hooks/tests/useKeyboardMode.stories.tsx:\nimport { StoryObj } from \"@storybook/react-vite\";\nimport { expect, userEvent } from \"storybook/test\";\nimport Button from \"components/Button\";\nimport View from \"components/View\";\nimport useKeyboardMode from \"hooks/useKeyboardMode\";\n\nexport default {\n\ttitle: \"Hooks/useKeyboardMode\",\n\tparameters: {\n\t\tchromatic: { disableSnapshot: true },\n\t},\n};\n\nconst Component = () => {\n\tconst { activate, deactivate, disable, enable } = useKeyboardMode();\n\n\treturn (\n\t\t\n\t\t\tActivate\n\t\t\tDeactivate\n\t\t\tDisable\n\t\t\tEnable\n\t\t\n\t);\n};\n\nexport const base: StoryObj = {\n\tname: \"base\",\n\trender: () => ,\n\tplay: async ({ canvas }) => {\n\t\tconst attribute = \"data-rs-keyboard\";\n\t\tconst root = document.documentElement;\n\t\tconst activateTrigger = canvas.getAllByRole(\"button\")[0];\n\t\tconst deactivateTrigger = canvas.getAllByRole(\"button\")[1];\n\t\tconst disableTrigger = canvas.getAllByRole(\"button\")[2];\n\t\tconst enableTrigger = canvas.getAllByRole(\"button\")[3];\n\n\t\texpect(root).not.toHaveAttribute(attribute);\n\n\t\tawait userEvent.click(activateTrigger);\n\t\texpect(root).toHaveAttribute(attribute);\n\n\t\tawait userEvent.click(deactivateTrigger);\n\t\texpect(root).not.toHaveAttribute(attribute);\n\n\t\tawait userEvent.click(disableTrigger);\n\t\tawait userEvent.click(activateTrigger);\n\t\texpect(root).not.toHaveAttribute(attribute);\n\n\t\tawait userEvent.click(enableTrigger);\n\t\tawait userEvent.click(activateTrigger);\n\t\texpect(root).toHaveAttribute(attribute);\n\t},\n};\n"
}
},
"hooks-useonclickoutside": {
@@ -3281,11 +3281,11 @@
"snippet": "const deps = (args) => {\n const ref = React.useRef(null);\n const [count, setCount] = React.useState(0);\n\n useOnClickOutside([ref], () => {\n args.handleOutsideClick({ count });\n });\n\n return (\n setCount((prev) => prev + 1)}>\n Trigger\n \n );\n};"
}
],
- "import": "import Button from \"components/Button\";\nimport View from \"components/View\";",
+ "import": "import { Button, View } from \"reshaped\";",
"jsDocTags": {},
"error": {
- "name": "No meta.component specified",
- "message": "Specify meta.component for the component to be included in the manifest.\n 6 | import View from \"components/View\";\n 7 |\n> 8 | export default {\n | ^\n 9 | \ttitle: \"Hooks/useOnClickOutside\",\n 10 | \tparameters: {\n 11 | \t\tchromatic: { disableSnapshot: true },"
+ "name": "No component found",
+ "message": "We could not detect the component from your story file. Specify meta.component.\n 6 | import View from \"components/View\";\n 7 |\n> 8 | export default {\n | ^\n 9 | \ttitle: \"Hooks/useOnClickOutside\",\n 10 | \tparameters: {\n 11 | \t\tchromatic: { disableSnapshot: true },\n\n./src/hooks/tests/useOnClickOutside.stories.tsx:\nimport React from \"react\";\nimport { StoryObj } from \"@storybook/react-vite\";\nimport { expect, fn, userEvent, type Mock } from \"storybook/test\";\nimport Button from \"components/Button\";\nimport useOnClickOutside from \"hooks/useOnClickOutside\";\nimport View from \"components/View\";\n\nexport default {\n\ttitle: \"Hooks/useOnClickOutside\",\n\tparameters: {\n\t\tchromatic: { disableSnapshot: true },\n\t},\n};\n\nexport const base: StoryObj<{ handleOutsideClick: Mock }> = {\n\tname: \"base\",\n\targs: {\n\t\thandleOutsideClick: fn(),\n\t},\n\trender: (args) => {\n\t\tconst ref = React.useRef(null);\n\t\tconst [target, setTarget] = React.useState<\"inside\" | \"outside\" | null>(null);\n\n\t\tuseOnClickOutside([ref], () => {\n\t\t\targs.handleOutsideClick();\n\t\t\tsetTarget(\"outside\");\n\t\t});\n\n\t\treturn (\n\t\t\t\n\t\t\t\t setTarget(\"inside\")}>\n\t\t\t\t\tTrigger\n\t\t\t\t\n\t\t\t\t{target && `Clicked ${target}`}\n\t\t\t\n\t\t);\n\t},\n\tplay: async ({ canvas, args }) => {\n\t\tconst button = canvas.getAllByRole(\"button\")[0];\n\n\t\tawait userEvent.click(button);\n\n\t\texpect(args.handleOutsideClick).not.toHaveBeenCalled();\n\n\t\tawait userEvent.click(document.body);\n\n\t\texpect(args.handleOutsideClick).toHaveBeenCalledTimes(1);\n\t\texpect(args.handleOutsideClick).toHaveBeenCalledWith();\n\t},\n};\n\nexport const refs: StoryObj<{ handleOutsideClick: Mock }> = {\n\tname: \"multiple refs\",\n\targs: {\n\t\thandleOutsideClick: fn(),\n\t},\n\trender: (args) => {\n\t\tconst ref = React.useRef(null);\n\t\tconst ref2 = React.useRef(null);\n\n\t\tuseOnClickOutside([ref, ref2], () => {\n\t\t\targs.handleOutsideClick();\n\t\t});\n\n\t\treturn (\n\t\t\t\n\t\t\t\tTrigger\n\t\t\t\tTrigger 2\n\t\t\t\n\t\t);\n\t},\n\tplay: async ({ canvas, args }) => {\n\t\tconst [button, button2] = canvas.getAllByRole(\"button\");\n\n\t\tawait userEvent.click(button);\n\n\t\texpect(args.handleOutsideClick).not.toHaveBeenCalled();\n\n\t\tawait userEvent.click(button2);\n\n\t\texpect(args.handleOutsideClick).not.toHaveBeenCalled();\n\n\t\tawait userEvent.click(document.body);\n\n\t\texpect(args.handleOutsideClick).toHaveBeenCalledTimes(1);\n\t\texpect(args.handleOutsideClick).toHaveBeenCalledWith();\n\t},\n};\n\nexport const disabled: StoryObj<{ handleOutsideClick: Mock }> = {\n\tname: \"disabled\",\n\targs: {\n\t\thandleOutsideClick: fn(),\n\t},\n\trender: (args) => {\n\t\tconst ref = React.useRef(null);\n\n\t\tuseOnClickOutside(\n\t\t\t[ref],\n\t\t\t() => {\n\t\t\t\targs.handleOutsideClick();\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisabled: true,\n\t\t\t}\n\t\t);\n\n\t\treturn (\n\t\t\t\n\t\t\t\tTrigger\n\t\t\t\n\t\t);\n\t},\n\tplay: async ({ args }) => {\n\t\tawait userEvent.click(document.body);\n\n\t\texpect(args.handleOutsideClick).not.toHaveBeenCalled();\n\t},\n};\n\nexport const deps: StoryObj<{ handleOutsideClick: Mock }> = {\n\tname: \"test: handler uses latest state\",\n\targs: {\n\t\thandleOutsideClick: fn(),\n\t},\n\trender: (args) => {\n\t\tconst ref = React.useRef(null);\n\t\tconst [count, setCount] = React.useState(0);\n\n\t\tuseOnClickOutside([ref], () => {\n\t\t\targs.handleOutsideClick({ count });\n\t\t});\n\n\t\treturn (\n\t\t\t setCount((prev) => prev + 1)}>\n\t\t\t\tTrigger\n\t\t\t\n\t\t);\n\t},\n\tplay: async ({ canvas, args }) => {\n\t\tconst button = canvas.getAllByRole(\"button\")[0];\n\n\t\tawait userEvent.click(document.body);\n\n\t\texpect(args.handleOutsideClick).toHaveBeenLastCalledWith({ count: 0 });\n\n\t\tawait userEvent.click(button);\n\t\tawait userEvent.click(document.body);\n\n\t\texpect(args.handleOutsideClick).toHaveBeenLastCalledWith({ count: 1 });\n\t},\n};\n"
}
},
"hooks-usertl": {
@@ -3298,8 +3298,8 @@
"import": "",
"jsDocTags": {},
"error": {
- "name": "No meta.component specified",
- "message": "Specify meta.component for the component to be included in the manifest.\n 4 | import useRTL from \"hooks/useRTL\";\n 5 |\n> 6 | export default {\n | ^\n 7 | \ttitle: \"Hooks/useRTL\",\n 8 | \tparameters: {\n 9 | \t\tchromatic: { disableSnapshot: true },"
+ "name": "No component found",
+ "message": "We could not detect the component from your story file. Specify meta.component.\n 4 | import useRTL from \"hooks/useRTL\";\n 5 |\n> 6 | export default {\n | ^\n 7 | \ttitle: \"Hooks/useRTL\",\n 8 | \tparameters: {\n 9 | \t\tchromatic: { disableSnapshot: true },\n\n./src/hooks/tests/useRTL.stories.tsx:\nimport React from \"react\";\nimport { StoryObj } from \"@storybook/react-vite\";\nimport { expect } from \"storybook/test\";\nimport useRTL from \"hooks/useRTL\";\n\nexport default {\n\ttitle: \"Hooks/useRTL\",\n\tparameters: {\n\t\tchromatic: { disableSnapshot: true },\n\t},\n};\n\nconst Component = () => {\n\tconst [rtl, setRTL] = useRTL();\n\n\tReact.useEffect(() => {\n\t\tsetRTL(true);\n\t}, [setRTL]);\n\n\treturn {rtl ? \"RTL\" : \"LTR\"}
;\n};\n\nexport const setRTL: StoryObj = {\n\tname: \"setRTL\",\n\trender: () => ,\n\tplay: async () => {\n\t\texpect(document.documentElement).toHaveAttribute(\"dir\", \"rtl\");\n\t},\n};\n"
}
},
"hooks-useresponsiveclientvalue": {
@@ -3316,11 +3316,11 @@
"snippet": "const boolean = () => {\n const value = useResponsiveClientValue({\n s: true,\n l: false,\n });\n\n return {value?.toString()}
;\n};"
}
],
- "import": "import View from \"components/View\";",
+ "import": "import { View } from \"reshaped\";",
"jsDocTags": {},
"error": {
- "name": "No meta.component specified",
- "message": "Specify meta.component for the component to be included in the manifest.\n 2 | import View, { type ViewProps } from \"components/View\";\n 3 |\n> 4 | export default {\n | ^\n 5 | \ttitle: \"Hooks/useResponsiveClientValue\",\n 6 | \tparameters: {\n 7 | \t\tchromatic: { disableSnapshot: true },"
+ "name": "No component found",
+ "message": "We could not detect the component from your story file. Specify meta.component.\n 2 | import View, { type ViewProps } from \"components/View\";\n 3 |\n> 4 | export default {\n | ^\n 5 | \ttitle: \"Hooks/useResponsiveClientValue\",\n 6 | \tparameters: {\n 7 | \t\tchromatic: { disableSnapshot: true },\n\n./src/hooks/tests/useResponsiveClientValue.stories.tsx:\nimport useResponsiveClientValue from \"hooks/useResponsiveClientValue\";\nimport View, { type ViewProps } from \"components/View\";\n\nexport default {\n\ttitle: \"Hooks/useResponsiveClientValue\",\n\tparameters: {\n\t\tchromatic: { disableSnapshot: true },\n\t},\n};\n\nexport const base = {\n\tname: \"base\",\n\trender: () => {\n\t\tconst value = useResponsiveClientValue({\n\t\t\ts: \"neutral\",\n\t\t\tm: \"critical\",\n\t\t\tl: \"positive\",\n\t\t});\n\n\t\treturn ;\n\t},\n};\n\nexport const boolean = {\n\tname: \"boolean\",\n\tdescribe: \"works with boolean properties\",\n\trender: () => {\n\t\tconst value = useResponsiveClientValue({\n\t\t\ts: true,\n\t\t\tl: false,\n\t\t});\n\n\t\treturn {value?.toString()}
;\n\t},\n};\n"
}
},
"hooks-usescrolllock": {
@@ -3345,11 +3345,11 @@
"snippet": "const testContainerAsync = () => {\n const containerRef = React.useRef(null);\n const globalLock = useScrollLock();\n const scopedLock = useScrollLock({ containerRef });\n\n return (\n \n \n \n \n Toggle\n \n \n Toggle\n \n \n \n \n );\n};"
}
],
- "import": "import Button from \"components/Button\";\nimport { Example } from \"utilities/storybook\";\nimport React from \"react\";\nimport View from \"components/View\";",
+ "import": "import { Button, Example, View } from \"reshaped\";\nimport React from \"react\";",
"jsDocTags": {},
"error": {
- "name": "No meta.component specified",
- "message": "Specify meta.component for the component to be included in the manifest.\n 7 | import View from \"components/View\";\n 8 |\n> 9 | export default {\n | ^\n 10 | \ttitle: \"Hooks/useScrollLock\",\n 11 | \tparameters: {\n 12 | \t\tchromatic: { disableSnapshot: true },"
+ "name": "No component found",
+ "message": "We could not detect the component from your story file. Specify meta.component.\n 7 | import View from \"components/View\";\n 8 |\n> 9 | export default {\n | ^\n 10 | \ttitle: \"Hooks/useScrollLock\",\n 11 | \tparameters: {\n 12 | \t\tchromatic: { disableSnapshot: true },\n\n./src/hooks/tests/useScrollLock.stories.tsx:\nimport React from \"react\";\nimport { StoryObj } from \"@storybook/react-vite\";\nimport { expect, userEvent } from \"storybook/test\";\nimport { Example } from \"utilities/storybook\";\nimport Button from \"components/Button\";\nimport useScrollLock from \"hooks/useScrollLock\";\nimport View from \"components/View\";\n\nexport default {\n\ttitle: \"Hooks/useScrollLock\",\n\tparameters: {\n\t\tchromatic: { disableSnapshot: true },\n\t},\n};\n\nexport const base: StoryObj = {\n\tname: \"base\",\n\trender: () => {\n\t\tconst { lockScroll, unlockScroll, scrollLocked } = useScrollLock();\n\n\t\treturn (\n\t\t\t\n\t\t\t\tToggle\n\t\t\t\t\n\t\t\t\n\t\t);\n\t},\n\tplay: async ({ canvas }) => {\n\t\tconst button = canvas.getAllByRole(\"button\")[0];\n\n\t\tawait userEvent.click(button);\n\n\t\texpect(document.body).toHaveStyle(\"overflow: hidden\");\n\n\t\tawait userEvent.click(button);\n\n\t\texpect(document.body).not.toHaveStyle(\"overflow: hidden\");\n\t},\n};\n\nexport const origin: StoryObj = {\n\tname: \"originRef\",\n\trender: () => {\n\t\tconst originRef = React.useRef(null);\n\t\tconst { lockScroll, unlockScroll, scrollLocked } = useScrollLock({ originRef });\n\n\t\treturn (\n\t\t\t\n\t\t\t\t\n\t\t\t\t\tToggle\n\t\t\t\t\n\t\t\t\n\t\t);\n\t},\n\tplay: async ({ canvas }) => {\n\t\tconst button = canvas.getAllByRole(\"button\")[0];\n\t\tconst root = canvas.getByTestId(\"root\");\n\n\t\tawait userEvent.click(button);\n\n\t\texpect(document.body).not.toHaveStyle(\"overflow: hidden\");\n\t\texpect(root).toHaveStyle(\"overflow: hidden\");\n\n\t\tawait userEvent.click(button);\n\n\t\texpect(root).not.toHaveStyle(\"overflow: hidden\");\n\t},\n};\n\nexport const container: StoryObj = {\n\tname: \"containerRef\",\n\trender: () => {\n\t\tconst containerRef = React.useRef(null);\n\t\tconst { lockScroll, unlockScroll, scrollLocked } = useScrollLock({ containerRef });\n\n\t\treturn (\n\t\t\t\n\t\t\t\tToggle\n\t\t\t\n\t\t);\n\t},\n\tplay: async ({ canvas }) => {\n\t\tconst button = canvas.getAllByRole(\"button\")[0];\n\t\tconst root = canvas.getByTestId(\"root\");\n\n\t\tawait userEvent.click(button);\n\n\t\texpect(document.body).not.toHaveStyle(\"overflow: hidden\");\n\t\texpect(root).toHaveStyle(\"overflow: hidden\");\n\n\t\tawait userEvent.click(button);\n\n\t\texpect(root).not.toHaveStyle(\"overflow: hidden\");\n\t},\n};\n\nexport const testContainerAsync: StoryObj = {\n\tname: \"test: containerRef locked count\",\n\trender: () => {\n\t\tconst containerRef = React.useRef(null);\n\t\tconst globalLock = useScrollLock();\n\t\tconst scopedLock = useScrollLock({ containerRef });\n\n\t\treturn (\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tToggle\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tToggle\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t);\n\t},\n\tplay: async ({ canvas }) => {\n\t\tconst [buttonGlobal, buttonScoped] = canvas.getAllByRole(\"button\");\n\n\t\tawait userEvent.click(buttonGlobal);\n\t\texpect(document.body).toHaveStyle(\"overflow: hidden\");\n\n\t\tawait userEvent.click(buttonScoped);\n\t\tawait userEvent.click(buttonGlobal);\n\n\t\texpect(document.body).not.toHaveStyle(\"overflow: hidden\");\n\t},\n};\n"
}
},
"hooks-usetoggle": {
@@ -3370,11 +3370,11 @@
"snippet": "const deactivate = () => {\n const { deactivate, active } = useToggle(true);\n\n return (\n \n Deactivate\n \n );\n};"
}
],
- "import": "import Button from \"components/Button\";\nimport React from \"react\";",
+ "import": "import { Button } from \"reshaped\";\nimport React from \"react\";",
"jsDocTags": {},
"error": {
- "name": "No meta.component specified",
- "message": "Specify meta.component for the component to be included in the manifest.\n 5 | import useToggle from \"hooks/useToggle\";\n 6 |\n> 7 | export default {\n | ^\n 8 | \ttitle: \"Hooks/useToggle\",\n 9 | \tparameters: {\n 10 | \t\tchromatic: { disableSnapshot: true },"
+ "name": "No component found",
+ "message": "We could not detect the component from your story file. Specify meta.component.\n 5 | import useToggle from \"hooks/useToggle\";\n 6 |\n> 7 | export default {\n | ^\n 8 | \ttitle: \"Hooks/useToggle\",\n 9 | \tparameters: {\n 10 | \t\tchromatic: { disableSnapshot: true },\n\n./src/hooks/tests/useToggle.stories.tsx:\nimport React from \"react\";\nimport { StoryObj } from \"@storybook/react-vite\";\nimport { expect, userEvent } from \"storybook/test\";\nimport Button from \"components/Button\";\nimport useToggle from \"hooks/useToggle\";\n\nexport default {\n\ttitle: \"Hooks/useToggle\",\n\tparameters: {\n\t\tchromatic: { disableSnapshot: true },\n\t},\n};\n\nexport const toggle: StoryObj = {\n\tname: \"toggle\",\n\trender: () => {\n\t\tconst { toggle, active } = useToggle();\n\n\t\treturn (\n\t\t\t toggle()} attributes={{ \"data-active\": active }}>\n\t\t\t\t{active ? \"Deactivate\" : \"Activate\"}\n\t\t\t\n\t\t);\n\t},\n\tplay: async ({ canvas }) => {\n\t\tconst button = canvas.getAllByRole(\"button\")[0];\n\n\t\texpect(button.getAttribute(\"data-active\")).toBe(\"false\");\n\n\t\tawait userEvent.click(button);\n\n\t\texpect(button.getAttribute(\"data-active\")).toBe(\"true\");\n\n\t\tawait userEvent.click(button);\n\n\t\texpect(button.getAttribute(\"data-active\")).toBe(\"false\");\n\t},\n};\n\nexport const activate: StoryObj = {\n\tname: \"activate\",\n\trender: () => {\n\t\tconst { activate, active } = useToggle();\n\n\t\treturn (\n\t\t\t\n\t\t\t\t\n\t\t\t\t\tActivate\n\t\t\t\t\n\t\t\t\n\t\t);\n\t},\n\tplay: async ({ canvas }) => {\n\t\tconst button = canvas.getAllByRole(\"button\")[0];\n\n\t\texpect(button.getAttribute(\"data-active\")).toBe(\"false\");\n\n\t\tawait userEvent.click(button);\n\n\t\texpect(button.getAttribute(\"data-active\")).toBe(\"true\");\n\t},\n};\n\nexport const deactivate: StoryObj = {\n\tname: \"deactivate\",\n\trender: () => {\n\t\tconst { deactivate, active } = useToggle(true);\n\n\t\treturn (\n\t\t\t\n\t\t\t\tDeactivate\n\t\t\t\n\t\t);\n\t},\n\tplay: async ({ canvas }) => {\n\t\tconst button = canvas.getAllByRole(\"button\")[0];\n\n\t\texpect(button.getAttribute(\"data-active\")).toBe(\"true\");\n\n\t\tawait userEvent.click(button);\n\n\t\texpect(button.getAttribute(\"data-active\")).toBe(\"false\");\n\t},\n};\n"
}
},
"utilities-trapfocus": {
@@ -3419,11 +3419,11 @@
"snippet": "const mutationObserver = () => {\n const rootRef = React.useRef(null);\n const trapToggle = useToggle();\n const [mutated, setMutated] = React.useState(false);\n\n React.useEffect(() => {\n if (!trapToggle.active) return;\n if (!rootRef.current) return;\n\n const trapFocus = new TrapFocus();\n\n trapFocus.trap(rootRef.current, {\n mode: \"dialog\",\n });\n\n setTimeout(() => {\n setMutated(true);\n }, 50);\n\n return () => trapFocus.release();\n }, [trapToggle.active]);\n\n return (\n \n \n \n \n Trap focus\n \n\n {trapToggle.active && (\n \n {!mutated && (\n <>\n {}}>Action 1\n {}}>Action 2\n >\n )}\n {}}>Action 3\n Release\n \n )}\n \n \n \n );\n};"
}
],
- "import": "import Button from \"components/Button\";\nimport { Example } from \"utilities/storybook\";\nimport Link from \"components/Link\";\nimport Radio from \"components/Radio\";\nimport RadioGroup from \"components/RadioGroup\";\nimport Select from \"components/Select\";\nimport TextArea from \"components/TextArea\";\nimport TextField from \"components/TextField\";\nimport View from \"components/View\";",
+ "import": "import {\n Button,\n Example,\n Link,\n Radio,\n RadioGroup,\n Select,\n TextArea,\n TextField,\n View,\n} from \"reshaped\";",
"jsDocTags": {},
"error": {
- "name": "No meta.component specified",
- "message": "Specify meta.component for the component to be included in the manifest.\n 16 | import { sleep } from \"utilities/helpers\";\n 17 |\n> 18 | export default {\n | ^\n 19 | \ttitle: \"Utilities/TrapFocus\",\n 20 | };\n 21 |"
+ "name": "No component found",
+ "message": "We could not detect the component from your story file. Specify meta.component.\n 16 | import { sleep } from \"utilities/helpers\";\n 17 |\n> 18 | export default {\n | ^\n 19 | \ttitle: \"Utilities/TrapFocus\",\n 20 | };\n 21 |\n\n./src/utilities/a11y/tests/TrapFocus.stories.tsx:\nimport React from \"react\";\nimport { StoryObj } from \"@storybook/react-vite\";\nimport { expect, userEvent } from \"storybook/test\";\nimport { Example } from \"utilities/storybook\";\nimport Button from \"components/Button\";\nimport useToggle from \"hooks/useToggle\";\nimport View from \"components/View\";\nimport TextField from \"components/TextField\";\nimport RadioGroup from \"components/RadioGroup\";\nimport Radio from \"components/Radio\";\nimport * as keys from \"constants/keys\";\nimport TrapFocus from \"../TrapFocus\";\nimport Link from \"components/Link\";\nimport TextArea from \"components/TextArea\";\nimport Select from \"components/Select\";\nimport { sleep } from \"utilities/helpers\";\n\nexport default {\n\ttitle: \"Utilities/TrapFocus\",\n};\n\nconst TrapContent: React.FC<{\n\trootRef: React.RefObject;\n\tonRelease: () => void;\n}> = (props) => {\n\treturn (\n\t\t\n\t\t\t {}}>Action 1\n\t\t\t {}}>Action 2\n\t\t\t {}}>Action 3\n\t\t\tRelease\n\t\t\n\t);\n};\n\nexport const modeDialog: StoryObj = {\n\tname: \"mode: dialog\",\n\trender: () => {\n\t\tconst rootRef = React.useRef(null);\n\t\tconst trapToggle = useToggle();\n\n\t\tReact.useEffect(() => {\n\t\t\tif (!trapToggle.active) return;\n\t\t\tif (!rootRef.current) return;\n\n\t\t\tconst trapFocus = new TrapFocus();\n\n\t\t\ttrapFocus.trap(rootRef.current, { mode: \"dialog\" });\n\t\t\treturn () => trapFocus.release();\n\t\t}, [trapToggle.active]);\n\n\t\treturn (\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tTrap focus\n\t\t\t\t\t\t\n\n\t\t\t\t\t\t{trapToggle.active && (\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t)}\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t);\n\t},\n\tplay: async ({ canvas }) => {\n\t\tconst trigger = canvas.getAllByRole(\"button\")[0];\n\n\t\tawait userEvent.click(trigger);\n\n\t\tconst trapContentActions = canvas.getAllByRole(\"button\");\n\t\tconst releaseTrigger = canvas.getAllByRole(\"button\")[3];\n\n\t\t// Test screen reader trap\n\t\t// All elements outside have aria-hidden so they're ignored\n\t\texpect(trapContentActions.includes(trigger)).toBeFalsy();\n\t\texpect(trapContentActions[0].parentNode?.previousSibling).toHaveAttribute(\"aria-hidden\");\n\n\t\texpect(releaseTrigger).toBeInTheDocument();\n\t\texpect(document.activeElement).toBe(trapContentActions[0]);\n\n\t\tawait userEvent.keyboard(\"{Tab/}\");\n\t\tawait userEvent.keyboard(\"{Tab/}\");\n\t\tawait userEvent.keyboard(\"{Tab/}\");\n\t\texpect(document.activeElement).toBe(trapContentActions[3]);\n\n\t\tawait userEvent.keyboard(\"{Tab/}\");\n\t\texpect(document.activeElement).toBe(trapContentActions[0]);\n\n\t\tawait userEvent.keyboard(\"{Shift>}{Tab/}\");\n\t\texpect(document.activeElement).toBe(trapContentActions[3]);\n\n\t\t// Doesn't use arrow keys\n\t\tawait userEvent.keyboard(\"{ArrowUp/}\");\n\t\texpect(document.activeElement).toBe(trapContentActions[3]);\n\n\t\tawait userEvent.keyboard(\"{ArrowDown/}\");\n\t\texpect(document.activeElement).toBe(trapContentActions[3]);\n\n\t\tawait userEvent.keyboard(\"{ArrowLeft/}\");\n\t\texpect(document.activeElement).toBe(trapContentActions[3]);\n\n\t\tawait userEvent.keyboard(\"{ArrowRight/}\");\n\t\texpect(document.activeElement).toBe(trapContentActions[3]);\n\n\t\tawait userEvent.keyboard(\"{Enter/}\");\n\t\texpect(document.activeElement).toBe(trigger);\n\t},\n};\n\nexport const modeActionMenu: StoryObj = {\n\tname: \"mode: action-menu\",\n\trender: () => {\n\t\tconst rootRef = React.useRef(null);\n\t\tconst trapToggle = useToggle();\n\n\t\tReact.useEffect(() => {\n\t\t\tif (!trapToggle.active) return;\n\t\t\tif (!rootRef.current) return;\n\n\t\t\tconst trapFocus = new TrapFocus();\n\n\t\t\ttrapFocus.trap(rootRef.current, {\n\t\t\t\tmode: \"action-menu\",\n\t\t\t\tonRelease: () => {\n\t\t\t\t\ttrapToggle.deactivate();\n\t\t\t\t},\n\t\t\t});\n\n\t\t\treturn () => trapFocus.release();\n\t\t}, [trapToggle.active]);\n\n\t\treturn (\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tTrap focus\n\t\t\t\t\t\t\t {}}>Next trigger\n\t\t\t\t\t\t\n\n\t\t\t\t\t\t{trapToggle.active && (\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t)}\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t);\n\t},\n\tplay: async ({ canvas }) => {\n\t\tconst trigger = canvas.getAllByRole(\"button\")[0];\n\t\t// const nextTrigger = canvas.getAllByRole(\"button\")[1];\n\n\t\tawait userEvent.click(trigger);\n\n\t\tconst trapContentActions = canvas.getAllByRole(\"button\").slice(2);\n\n\t\texpect(document.activeElement).toBe(trapContentActions[0]);\n\n\t\tawait userEvent.keyboard(\"{ArrowUp/}\");\n\t\texpect(document.activeElement).toBe(trapContentActions[0]);\n\n\t\tawait userEvent.keyboard(\"{ArrowRight/}\");\n\t\texpect(document.activeElement).toBe(trapContentActions[0]);\n\n\t\tawait userEvent.keyboard(\"{ArrowDown/}\");\n\t\tawait userEvent.keyboard(\"{ArrowDown/}\");\n\t\tawait userEvent.keyboard(\"{ArrowDown/}\");\n\t\texpect(document.activeElement).toBe(trapContentActions[3]);\n\n\t\tawait userEvent.keyboard(\"{ArrowDown/}\");\n\t\texpect(document.activeElement).toBe(trapContentActions[3]);\n\n\t\tawait userEvent.keyboard(\"{ArrowLeft/}\");\n\t\texpect(document.activeElement).toBe(trapContentActions[3]);\n\n\t\tawait userEvent.keyboard(\"{Shift>}{Tab/}\");\n\t\texpect(document.activeElement).toBe(trigger);\n\n\t\tawait userEvent.click(trigger);\n\t\tawait userEvent.keyboard(\"{Tab/}\");\n\n\t\tconsole.log(document.activeElement);\n\n\t\t// FIXME: Storybook moves focus to body\n\t\t// expect(document.activeElement).toBe(nextTrigger);\n\t},\n};\n\nexport const modeActionBar: StoryObj = {\n\tname: \"mode: action-bar\",\n\trender: () => {\n\t\tconst rootRef = React.useRef(null);\n\t\tconst trapToggle = useToggle();\n\n\t\tReact.useEffect(() => {\n\t\t\tif (!trapToggle.active) return;\n\t\t\tif (!rootRef.current) return;\n\n\t\t\tconst trapFocus = new TrapFocus();\n\n\t\t\ttrapFocus.trap(rootRef.current, {\n\t\t\t\tmode: \"action-bar\",\n\t\t\t\tonRelease: () => {\n\t\t\t\t\ttrapToggle.deactivate();\n\t\t\t\t},\n\t\t\t});\n\n\t\t\treturn () => trapFocus.release();\n\t\t}, [trapToggle.active]);\n\n\t\treturn (\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tTrap focus\n\t\t\t\t\t\t\t {}}>Next trigger\n\t\t\t\t\t\t\n\n\t\t\t\t\t\t{trapToggle.active && (\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t)}\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t);\n\t},\n\tplay: async ({ canvas }) => {\n\t\tconst trigger = canvas.getAllByRole(\"button\")[0];\n\t\t// const nextTrigger = canvas.getAllByRole(\"button\")[1];\n\n\t\tawait userEvent.click(trigger);\n\n\t\tconst trapContentActions = canvas.getAllByRole(\"button\").slice(2);\n\n\t\texpect(document.activeElement).toBe(trapContentActions[0]);\n\n\t\tawait userEvent.keyboard(\"{ArrowLeft/}\");\n\t\texpect(document.activeElement).toBe(trapContentActions[0]);\n\n\t\tawait userEvent.keyboard(\"{ArrowDown/}\");\n\t\texpect(document.activeElement).toBe(trapContentActions[0]);\n\n\t\tawait userEvent.keyboard(\"{ArrowRight/}\");\n\t\tawait userEvent.keyboard(\"{ArrowRight/}\");\n\t\tawait userEvent.keyboard(\"{ArrowRight/}\");\n\t\texpect(document.activeElement).toBe(trapContentActions[3]);\n\n\t\tawait userEvent.keyboard(\"{ArrowRight/}\");\n\t\texpect(document.activeElement).toBe(trapContentActions[3]);\n\n\t\tawait userEvent.keyboard(\"{ArrowUp/}\");\n\t\texpect(document.activeElement).toBe(trapContentActions[3]);\n\n\t\tawait userEvent.keyboard(\"{Shift>}{Tab/}\");\n\t\texpect(document.activeElement).toBe(trigger);\n\n\t\tawait userEvent.click(trigger);\n\t\tawait userEvent.keyboard(\"{Tab/}\");\n\n\t\tconsole.log(document.activeElement);\n\n\t\t// FIXME: Storybook moves focus to body\n\t\t// expect(document.activeElement).toBe(nextTrigger);\n\t},\n};\n\nexport const modeContentMenu: StoryObj = {\n\tname: \"mode: content-menu\",\n\trender: () => {\n\t\tconst rootRef = React.useRef(null);\n\t\tconst trapToggle = useToggle();\n\n\t\tReact.useEffect(() => {\n\t\t\tif (!trapToggle.active) return;\n\t\t\tif (!rootRef.current) return;\n\n\t\t\tconst trapFocus = new TrapFocus();\n\n\t\t\ttrapFocus.trap(rootRef.current, {\n\t\t\t\tmode: \"content-menu\",\n\t\t\t\tonRelease: () => {\n\t\t\t\t\ttrapToggle.deactivate();\n\t\t\t\t},\n\t\t\t});\n\n\t\t\treturn () => trapFocus.release();\n\t\t}, [trapToggle.active]);\n\n\t\treturn (\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tTrap focus\n\t\t\t\t\t\t\t {}}>Next trigger\n\t\t\t\t\t\t\n\n\t\t\t\t\t\t{trapToggle.active && (\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t)}\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t);\n\t},\n\tplay: async ({ canvas }) => {\n\t\tconst trigger = canvas.getAllByRole(\"button\")[0];\n\t\t// const nextTrigger = canvas.getAllByRole(\"button\")[1];\n\n\t\tawait userEvent.click(trigger);\n\n\t\tconst trapContentActions = canvas.getAllByRole(\"button\").slice(2);\n\n\t\texpect(document.activeElement).toBe(trapContentActions[0]);\n\n\t\tawait userEvent.keyboard(\"{ArrowRight/}\");\n\t\tawait userEvent.keyboard(\"{ArrowDown/}\");\n\t\texpect(document.activeElement).toBe(trapContentActions[0]);\n\n\t\tawait userEvent.keyboard(\"{ArrowLeft/}\");\n\t\tawait userEvent.keyboard(\"{ArrowUp/}\");\n\t\texpect(document.activeElement).toBe(trapContentActions[0]);\n\n\t\tawait userEvent.keyboard(\"{Tab/}\");\n\t\tawait userEvent.keyboard(\"{Tab/}\");\n\t\tawait userEvent.keyboard(\"{Tab/}\");\n\t\texpect(document.activeElement).toBe(trapContentActions[3]);\n\n\t\tawait userEvent.keyboard(\"{Shift>}{Tab/}\");\n\t\tawait userEvent.keyboard(\"{Shift>}{Tab/}\");\n\t\tawait userEvent.keyboard(\"{Shift>}{Tab/}\");\n\t\texpect(document.activeElement).toBe(trapContentActions[0]);\n\n\t\tawait userEvent.keyboard(\"{Shift>}{Tab/}\");\n\t\texpect(document.activeElement).toBe(trigger);\n\n\t\t// await userEvent.keyboard(\"{Tab/}\");\n\t\t// await userEvent.keyboard(\"{Tab/}\");\n\n\t\t// FIXME: Storybook moves focus to body\n\t\t// expect(document.activeElement).toBe(nextTrigger);\n\t},\n};\n\nexport const includeTrigger: StoryObj = {\n\tname: \"includeTrigger\",\n\trender: () => {\n\t\tconst rootRef = React.useRef(null);\n\t\tconst trapToggle = useToggle();\n\n\t\tReact.useEffect(() => {\n\t\t\tif (!trapToggle.active) return;\n\t\t\tif (!rootRef.current) return;\n\n\t\t\tconst trapFocus = new TrapFocus();\n\n\t\t\ttrapFocus.trap(rootRef.current, {\n\t\t\t\tmode: \"dialog\",\n\t\t\t\tincludeTrigger: true,\n\t\t\t});\n\n\t\t\treturn () => trapFocus.release();\n\t\t}, [trapToggle.active]);\n\n\t\treturn (\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tTrap focus\n\t\t\t\t\t\t\n\n\t\t\t\t\t\t{trapToggle.active && (\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t)}\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t);\n\t},\n\tplay: async ({ canvas }) => {\n\t\tconst trigger = canvas.getAllByRole(\"button\")[0];\n\n\t\tawait userEvent.click(trigger);\n\n\t\tconst trapContentActions = canvas.getAllByRole(\"button\");\n\n\t\texpect(document.activeElement).toBe(trigger);\n\n\t\tawait userEvent.keyboard(\"{Tab/}\");\n\t\texpect(document.activeElement).toBe(trapContentActions[0]);\n\n\t\tawait userEvent.keyboard(\"{Shift>}{Tab/}\");\n\t\texpect(document.activeElement).toBe(trigger);\n\n\t\tawait userEvent.keyboard(\"{Tab/}\");\n\t\texpect(document.activeElement).toBe(trapContentActions[0]);\n\n\t\tawait userEvent.keyboard(\"{Tab/}\");\n\t\tawait userEvent.keyboard(\"{Tab/}\");\n\t\tawait userEvent.keyboard(\"{Tab/}\");\n\t\tawait userEvent.keyboard(\"{Tab/}\");\n\t\texpect(document.activeElement).toBe(trigger);\n\t},\n};\n\nexport const initialFocusEl: StoryObj = {\n\tname: \"initialFocusEl\",\n\trender: () => {\n\t\tconst rootRef = React.useRef(null);\n\t\tconst initialFocusRef = React.useRef(null);\n\t\tconst trapToggle = useToggle();\n\n\t\tReact.useEffect(() => {\n\t\t\tif (!trapToggle.active) return;\n\t\t\tif (!rootRef.current) return;\n\n\t\t\tconst trapFocus = new TrapFocus();\n\n\t\t\ttrapFocus.trap(rootRef.current, {\n\t\t\t\tmode: \"dialog\",\n\t\t\t\tinitialFocusEl: initialFocusRef.current,\n\t\t\t});\n\n\t\t\treturn () => trapFocus.release();\n\t\t}, [trapToggle.active]);\n\n\t\treturn (\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tTrap focus\n\t\t\t\t\t\t\n\n\t\t\t\t\t\t{trapToggle.active && (\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t {}}>Action 1\n\t\t\t\t\t\t\t\t {}} attributes={{ ref: initialFocusRef }}>\n\t\t\t\t\t\t\t\t\tAction 2\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t {}}>Action 3\n\t\t\t\t\t\t\t\tRelease\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t)}\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t);\n\t},\n\tplay: async ({ canvas }) => {\n\t\tconst trigger = canvas.getAllByRole(\"button\")[0];\n\n\t\tawait userEvent.click(trigger);\n\n\t\tconst trapContentActions = canvas.getAllByRole(\"button\");\n\n\t\texpect(document.activeElement).toBe(trapContentActions[1]);\n\t},\n};\n\n/**\n * Testing edge cases\n */\n\nconst Editor = () => {\n\tconst pressedCountRef = React.useRef(0);\n\n\tconst handleKeyDown = (e: React.KeyboardEvent) => {\n\t\tif (e.key !== keys.TAB) return;\n\n\t\tpressedCountRef.current += 1;\n\t\tif (pressedCountRef.current % 2) e.preventDefault();\n\t};\n\n\treturn (\n\t\t\n\t);\n};\n\nexport const focusableElements: StoryObj = {\n\tname: \"test: focusable elements\",\n\trender: () => {\n\t\tconst rootRef = React.useRef(null);\n\t\tconst trapToggle = useToggle();\n\n\t\tReact.useEffect(() => {\n\t\t\tif (!trapToggle.active) return;\n\t\t\tif (!rootRef.current) return;\n\n\t\t\tconst trapFocus = new TrapFocus();\n\n\t\t\ttrapFocus.trap(rootRef.current);\n\t\t\treturn () => trapFocus.release();\n\t\t}, [trapToggle.active]);\n\n\t\treturn (\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tActivate\n\t\t\t\t\t\t\n\n\t\t\t\t\t\t{trapToggle.active && (\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tLink\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tOption 1\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tOption 2\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tdiv with tabIndex\n\t\t\t\t\t\t\t\t
\n\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t {}} attributes={{ \"data-testid\": \"test-hidden-button\" }}>\n\t\t\t\t\t\t\t\t\t\tHidden\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\n\t\t\t\t\t\t\t\t {}}\n\t\t\t\t\t\t\t\t\tattributes={{ tabIndex: -1, \"data-testid\": \"test-button-negative-tabindex\" }}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\tExcluded\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tRelease button\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t)}\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t);\n\t},\n\tplay: async ({ canvas }) => {\n\t\tconst trigger = canvas.getAllByRole(\"button\")[0];\n\n\t\tawait userEvent.click(trigger);\n\n\t\tconst link = canvas.getByTestId(\"test-link\");\n\t\tconst textField = canvas.getByTestId(\"test-text-field\");\n\t\tconst textArea = canvas.getByTestId(\"test-text-area\");\n\t\tconst select = canvas.getByTestId(\"test-select\");\n\t\tconst radio1 = canvas.getByTestId(\"test-radio-1\");\n\t\tconst radio2 = canvas.getByTestId(\"test-radio-2\");\n\t\tconst contentEditable = canvas.getByTestId(\"test-contenteditable\");\n\t\tconst tabIndex = canvas.getByTestId(\"test-tabindex\");\n\t\tconst negativeTabIndex = canvas.getByTestId(\"test-button-negative-tabindex\");\n\t\tconst hiddenButton = canvas.getByTestId(\"test-hidden-button\");\n\t\tconst button = canvas.getByTestId(\"test-button\");\n\n\t\texpect(document.activeElement).toBe(link);\n\n\t\tawait userEvent.keyboard(\"{Tab/}\");\n\t\texpect(document.activeElement).toBe(textField);\n\n\t\tawait userEvent.keyboard(\"{Tab/}\");\n\t\texpect(document.activeElement).toBe(textArea);\n\n\t\tawait userEvent.keyboard(\"{Tab/}\");\n\t\texpect(document.activeElement).toBe(select);\n\n\t\tawait userEvent.keyboard(\"{Tab/}\");\n\t\texpect(document.activeElement).toBe(radio1);\n\n\t\tawait userEvent.keyboard(\"{ArrowDown/}\");\n\t\texpect(document.activeElement).toBe(radio2);\n\n\t\tawait userEvent.keyboard(\"{Tab/}\");\n\t\texpect(document.activeElement).toBe(contentEditable);\n\n\t\t// Stays for the first tab press\n\t\tawait userEvent.keyboard(\"{Tab/}\");\n\t\texpect(document.activeElement).toBe(contentEditable);\n\n\t\tawait userEvent.keyboard(\"{Tab/}\");\n\t\texpect(document.activeElement).toBe(tabIndex);\n\n\t\tawait userEvent.keyboard(\"{Tab/}\");\n\t\texpect(document.activeElement).not.toBe(negativeTabIndex);\n\t\texpect(document.activeElement).not.toBe(hiddenButton);\n\t\texpect(document.activeElement).toBe(button);\n\t},\n};\n\nexport const nested: StoryObj = {\n\tname: \"test: nested\",\n\trender: () => {\n\t\tconst rootRef = React.useRef(null);\n\t\tconst innerRootRef = React.useRef(null);\n\t\tconst trapToggle = useToggle();\n\t\tconst innerTrapToggle = useToggle();\n\n\t\tReact.useEffect(() => {\n\t\t\tif (!trapToggle.active) return;\n\t\t\tif (!rootRef.current) return;\n\n\t\t\tconst trapFocus = new TrapFocus();\n\n\t\t\ttrapFocus.trap(rootRef.current, {\n\t\t\t\tmode: \"dialog\",\n\t\t\t});\n\n\t\t\treturn () => trapFocus.release();\n\t\t}, [trapToggle.active]);\n\n\t\tReact.useEffect(() => {\n\t\t\tif (!innerTrapToggle.active) return;\n\t\t\tif (!innerRootRef.current) return;\n\n\t\t\tconst trapFocus = new TrapFocus();\n\n\t\t\ttrapFocus.trap(innerRootRef.current, {\n\t\t\t\tmode: \"dialog\",\n\t\t\t});\n\n\t\t\treturn () => trapFocus.release();\n\t\t}, [innerTrapToggle.active]);\n\n\t\treturn (\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tTrap focus\n\t\t\t\t\t\t\n\n\t\t\t\t\t\t{trapToggle.active && (\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t {}}>Action\n\t\t\t\t\t\t\t\t\tInner trap focus\n\t\t\t\t\t\t\t\t\tRelease\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\t{innerTrapToggle.active && (\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t {}}>Action\n\t\t\t\t\t\t\t\t\t\tRelease\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t)}\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t);\n\t},\n\tplay: async ({ canvas }) => {\n\t\tconst trigger = canvas.getAllByRole(\"button\")[0];\n\n\t\tawait userEvent.click(trigger);\n\n\t\tconst trapContentActions = canvas.getAllByRole(\"button\");\n\n\t\texpect(document.activeElement).toBe(trapContentActions[0]);\n\n\t\tawait userEvent.keyboard(\"{Tab/}\");\n\t\texpect(document.activeElement).toBe(trapContentActions[1]);\n\n\t\tawait userEvent.click(trapContentActions[1]);\n\n\t\tconst innerTrapContentActions = canvas.getAllByRole(\"button\");\n\n\t\texpect(document.activeElement).toBe(innerTrapContentActions[0]);\n\n\t\tawait userEvent.keyboard(\"{Tab/}\");\n\t\tawait userEvent.click(innerTrapContentActions[1]);\n\n\t\texpect(document.activeElement).toBe(trapContentActions[1]);\n\n\t\tawait userEvent.keyboard(\"{Tab/}\");\n\t\tawait userEvent.click(trapContentActions[2]);\n\n\t\texpect(document.activeElement).toBe(trigger);\n\t},\n};\n\nexport const mutationObserver: StoryObj = {\n\tname: \"test: mutation observer\",\n\trender: () => {\n\t\tconst rootRef = React.useRef(null);\n\t\tconst trapToggle = useToggle();\n\t\tconst [mutated, setMutated] = React.useState(false);\n\n\t\tReact.useEffect(() => {\n\t\t\tif (!trapToggle.active) return;\n\t\t\tif (!rootRef.current) return;\n\n\t\t\tconst trapFocus = new TrapFocus();\n\n\t\t\ttrapFocus.trap(rootRef.current, {\n\t\t\t\tmode: \"dialog\",\n\t\t\t});\n\n\t\t\tsetTimeout(() => {\n\t\t\t\tsetMutated(true);\n\t\t\t}, 50);\n\n\t\t\treturn () => trapFocus.release();\n\t\t}, [trapToggle.active]);\n\n\t\treturn (\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tTrap focus\n\t\t\t\t\t\t\n\n\t\t\t\t\t\t{trapToggle.active && (\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t{!mutated && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t {}}>Action 1\n\t\t\t\t\t\t\t\t\t\t {}}>Action 2\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t {}}>Action 3\n\t\t\t\t\t\t\t\tRelease\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t)}\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t);\n\t},\n\tplay: async ({ canvas }) => {\n\t\tconst trigger = canvas.getAllByRole(\"button\")[0];\n\n\t\tawait userEvent.click(trigger);\n\n\t\tlet trapContentActions = canvas.getAllByRole(\"button\");\n\n\t\texpect(document.activeElement).toBe(trapContentActions[0]);\n\n\t\tawait sleep(100);\n\n\t\ttrapContentActions = canvas.getAllByRole(\"button\");\n\n\t\texpect(document.activeElement).toBe(trapContentActions[0]);\n\n\t\t// Check that trap still works after mutation\n\t\tawait userEvent.keyboard(\"{Tab}\");\n\t\texpect(document.activeElement).toBe(trapContentActions[1]);\n\n\t\tawait userEvent.keyboard(\"{Tab}\");\n\t\texpect(document.activeElement).toBe(trapContentActions[0]);\n\n\t\t// Check that it still knows about the original trigger\n\t\tawait userEvent.click(trapContentActions[1]);\n\t\texpect(document.activeElement).toBe(trigger);\n\t},\n};\n"
}
},
"internal-portal": {
@@ -3436,11 +3436,11 @@
"snippet": "const base = () => {\n\tconst ref = React.useRef(null);\n\tconst [mounted, setMounted] = React.useState(false);\n\n\tReact.useEffect(() => {\n\t\tsetMounted(true);\n\t}, []);\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\tApp\n\t\t\t\t{mounted &&
Ported to green}\n\t\t\t
\n\t\t\t\n\t\t>\n\t);\n};"
}
],
- "import": "import Portal from \"components/_private/Portal\";",
+ "import": "import { Portal } from \"reshaped\";",
"jsDocTags": {},
"error": {
"name": "No component definition found",
- "message": "Could not find a component definition.\nPrefer relative imports if possible.\nAvoid pointing to transpiled files.\nYou can debug your component file in this playground: https://react-docgen.dev/playground\n\nFile: /Users/jeppe/dev/temp/reshaped/src/components/_private/Portal/index.ts\nimport Portal, { PortalScope } from \"./Portal\";\n\nconst PortalRoot = Portal as typeof Portal & {\n\tScope: typeof PortalScope;\n};\n\nPortalRoot.Scope = PortalScope;\n\nexport default PortalRoot;\nexport type { Props as PortalProps } from \"./Portal.types\";\n\nFile: /Users/jeppe/dev/temp/reshaped/src/components/_private/Portal/Portal.types.ts\nimport React from \"react\";\n\nexport type Props = {\n\tchildren?: React.ReactNode;\n\ttargetRef?: React.RefObject;\n};\n\nexport type ScopeProps = {\n\tchildren: (ref: React.RefObject) => React.ReactNode;\n};\n\nexport type Context = {\n\tscopeRef: React.RefObject;\n};\n"
+ "message": "File: /Users/shilman/projects/design-systems/reshaped/src/components/_private/Portal/index.ts\nError:\nNo suitable component definition found.\nYou can debug your component file in this playground: https://react-docgen.dev/playground\nCode:\nimport Portal, { PortalScope } from \"./Portal\";\n\nconst PortalRoot = Portal as typeof Portal & {\n\tScope: typeof PortalScope;\n};\n\nPortalRoot.Scope = PortalScope;\n\nexport default PortalRoot;\nexport type { Props as PortalProps } from \"./Portal.types\";\n\n\nFile: /Users/shilman/projects/design-systems/reshaped/src/components/_private/Portal/Portal.types.ts\nError:\nNo suitable component definition found.\nYou can debug your component file in this playground: https://react-docgen.dev/playground\nCode:\nimport React from \"react\";\n\nexport type Props = {\n\tchildren?: React.ReactNode;\n\ttargetRef?: React.RefObject;\n};\n\nexport type ScopeProps = {\n\tchildren: (ref: React.RefObject) => React.ReactNode;\n};\n\nexport type Context = {\n\tscopeRef: React.RefObject;\n};\n"
}
},
"internal-usedrag": {
@@ -3470,11 +3470,11 @@
"snippet": "const disabled = () => {\n return ;\n};"
}
],
- "import": "import Button from \"components/Button\";\nimport View from \"components/View\";",
+ "import": "import { Button, View } from \"reshaped\";",
"jsDocTags": {},
"error": {
- "name": "No meta.component specified",
- "message": "Specify meta.component for the component to be included in the manifest.\n 7 | import Button from \"components/Button\";\n 8 |\n> 9 | export default {\n | ^\n 10 | \ttitle: \"Internal/useDrag\",\n 11 | \tparameters: {\n 12 | \t\tchromatic: { disableSnapshot: true },"
+ "name": "No component found",
+ "message": "We could not detect the component from your story file. Specify meta.component.\n 7 | import Button from \"components/Button\";\n 8 |\n> 9 | export default {\n | ^\n 10 | \ttitle: \"Internal/useDrag\",\n 11 | \tparameters: {\n 12 | \t\tchromatic: { disableSnapshot: true },\n\n./src/hooks/tests/useDrag.stories.tsx:\nimport React from \"react\";\nimport { StoryObj } from \"@storybook/react-vite\";\nimport { fireEvent, fn, expect } from \"storybook/test\";\nimport View from \"components/View\";\nimport useDrag from \"hooks/_private/useDrag\";\nimport useToggle from \"hooks/useToggle\";\nimport Button from \"components/Button\";\n\nexport default {\n\ttitle: \"Internal/useDrag\",\n\tparameters: {\n\t\tchromatic: { disableSnapshot: true },\n\t},\n};\n\nfunction Example() {\n\tconst [state, setState] = React.useState({ x: 0, y: 0 });\n\tconst disabledToggle = useToggle();\n\n\tconst { ref, containerRef, active } = useDrag(\n\t\t(args) => {\n\t\t\tsetState(args);\n\t\t},\n\t\t{\n\t\t\tdisabled: disabledToggle.active,\n\t\t}\n\t);\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t disabledToggle.toggle()}>\n\t\t\t\t{disabledToggle.active ? \"Enable\" : \"Disable\"}\n\t\t\t\n\t\t\n\t);\n}\n\nexport const base = { name: \"base\", render: () => };\n\nconst Demo: React.FC<{\n\tonDrag: ReturnType;\n\tdisabled?: boolean;\n\torientation?: \"horizontal\" | \"vertical\";\n}> = (props) => {\n\tconst { ref, containerRef } = useDrag(\n\t\t(options) => {\n\t\t\tprops.onDrag(options);\n\t\t},\n\t\t{\n\t\t\torientation: props.orientation,\n\t\t\tdisabled: props.disabled,\n\t\t}\n\t);\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\n\t);\n};\n\nexport const mouseEvents: StoryObj<{ handleDrag: ReturnType }> = {\n\tname: \"onDrag, mouse events\",\n\targs: {\n\t\thandleDrag: fn(),\n\t},\n\trender: (args) => {\n\t\treturn ;\n\t},\n\tplay: ({ canvas, args }) => {\n\t\tconst trigger = canvas.getByTestId(\"test-handle-id\");\n\n\t\tfireEvent.mouseDown(trigger);\n\t\tfireEvent.mouseMove(document.body, { clientX: 100, clientY: 50 });\n\n\t\texpect(args.handleDrag).toHaveBeenCalledTimes(1);\n\t\texpect(args.handleDrag).toHaveBeenCalledWith(expect.objectContaining({ x: 100, y: 50 }));\n\n\t\tfireEvent.mouseUp(trigger);\n\t\tfireEvent.mouseUp(document.body, { clientX: 50, clientY: 100 });\n\n\t\texpect(args.handleDrag).toHaveBeenCalledTimes(1);\n\t},\n};\n\nexport const touchEvents: StoryObj<{ handleDrag: ReturnType }> = {\n\tname: \"onDrag, touch events\",\n\targs: {\n\t\thandleDrag: fn(),\n\t},\n\trender: (args) => {\n\t\treturn ;\n\t},\n\tplay: ({ canvas, args }) => {\n\t\tconst createTouch = (target: HTMLElement, x: number, y: number) => {\n\t\t\treturn new Touch({\n\t\t\t\tidentifier: Date.now(),\n\t\t\t\ttarget,\n\t\t\t\tclientX: x,\n\t\t\t\tclientY: y,\n\t\t\t\tscreenX: x,\n\t\t\t\tscreenY: y,\n\t\t\t\tpageX: x,\n\t\t\t\tpageY: y,\n\t\t\t});\n\t\t};\n\n\t\tconst trigger = canvas.getByTestId(\"test-handle-id\");\n\n\t\tfireEvent.touchStart(trigger, { changedTouches: [createTouch(trigger, 0, 0)] });\n\t\tfireEvent.touchMove(document.body, { changedTouches: [createTouch(trigger, 100, 50)] });\n\n\t\texpect(args.handleDrag).toHaveBeenCalledTimes(1);\n\t\texpect(args.handleDrag).toHaveBeenCalledWith(expect.objectContaining({ x: 100, y: 50 }));\n\n\t\tfireEvent.touchEnd(trigger);\n\t\tfireEvent.touchEnd(document.body, { changedTouches: [createTouch(trigger, 100, 50)] });\n\n\t\texpect(args.handleDrag).toHaveBeenCalledTimes(1);\n\t},\n};\n\nexport const orientationHorizontal: StoryObj<{ handleDrag: ReturnType }> = {\n\tname: \"orientation horizontal\",\n\targs: {\n\t\thandleDrag: fn(),\n\t},\n\trender: (args) => {\n\t\treturn ;\n\t},\n\tplay: ({ canvas, args }) => {\n\t\tconst trigger = canvas.getByTestId(\"test-handle-id\");\n\n\t\tfireEvent.mouseDown(trigger);\n\t\tfireEvent.mouseMove(document.body, { clientX: 100, clientY: 50 });\n\n\t\texpect(args.handleDrag).toHaveBeenCalledTimes(1);\n\t\texpect(args.handleDrag).toHaveBeenCalledWith(expect.objectContaining({ x: 100, y: 0 }));\n\t},\n};\n\nexport const orientationVertical: StoryObj<{ handleDrag: ReturnType }> = {\n\tname: \"orientation vertical\",\n\targs: {\n\t\thandleDrag: fn(),\n\t},\n\trender: (args) => {\n\t\treturn ;\n\t},\n\tplay: ({ canvas, args }) => {\n\t\tconst trigger = canvas.getByTestId(\"test-handle-id\");\n\n\t\tfireEvent.mouseDown(trigger);\n\t\tfireEvent.mouseMove(document.body, { clientX: 100, clientY: 50 });\n\n\t\texpect(args.handleDrag).toHaveBeenCalledTimes(1);\n\t\texpect(args.handleDrag).toHaveBeenCalledWith(expect.objectContaining({ x: 0, y: 50 }));\n\t},\n};\n\nexport const disabled: StoryObj<{ handleDrag: ReturnType }> = {\n\tname: \"disabled\",\n\targs: {\n\t\thandleDrag: fn(),\n\t},\n\trender: (args) => {\n\t\treturn ;\n\t},\n\tplay: ({ canvas, args }) => {\n\t\tconst trigger = canvas.getByTestId(\"test-handle-id\");\n\n\t\tfireEvent.mouseDown(trigger);\n\t\tfireEvent.mouseMove(document.body, { clientX: 100, clientY: 50 });\n\n\t\texpect(args.handleDrag).toHaveBeenCalledTimes(0);\n\t},\n};\n"
}
},
"internal-shadowdom": {
@@ -3487,11 +3487,11 @@
"snippet": "const behavior = () => (\n\t\n\t\t\n\t\t\t\n\t\t\n\t\n);"
}
],
- "import": "import Autocomplete from \"components/Autocomplete\";\nimport Button from \"components/Button\";\nimport DropdownMenu from \"components/DropdownMenu\";\nimport { Example } from \"utilities/storybook\";\nimport Reshaped from \"components/Reshaped\";\nimport root from \"react-shadow\";\nimport Select from \"components/Select\";\nimport Tooltip from \"components/Tooltip\";\nimport View from \"components/View\";",
+ "import": "import {\n Autocomplete,\n Button,\n DropdownMenu,\n Example,\n Reshaped,\n Select,\n Tooltip,\n View,\n} from \"reshaped\";\nimport root from \"react-shadow\";",
"jsDocTags": {},
"error": {
- "name": "No meta.component specified",
- "message": "Specify meta.component for the component to be included in the manifest.\n 10 | import Tooltip from \"components/Tooltip\";\n 11 |\n> 12 | export default {\n | ^\n 13 | \ttitle: \"Internal/ShadowDOM\",\n 14 | };\n 15 |"
+ "name": "No component found",
+ "message": "We could not detect the component from your story file. Specify meta.component.\n 10 | import Tooltip from \"components/Tooltip\";\n 11 |\n> 12 | export default {\n | ^\n 13 | \ttitle: \"Internal/ShadowDOM\",\n 14 | };\n 15 |\n\n./src/tests/ShadowDOM.stories.tsx:\nimport React, { useEffect, useState, useRef, forwardRef } from \"react\";\nimport root from \"react-shadow\";\nimport { Example } from \"utilities/storybook\";\nimport Autocomplete, { type AutocompleteProps } from \"components/Autocomplete\";\nimport View from \"components/View\";\nimport DropdownMenu from \"components/DropdownMenu\";\nimport Reshaped from \"components/Reshaped\";\nimport Select from \"components/Select\";\nimport Button from \"components/Button\";\nimport Tooltip from \"components/Tooltip\";\n\nexport default {\n\ttitle: \"Internal/ShadowDOM\",\n};\n\nconst getStylesData = () => {\n\tconst sourceStylesContainer = document.head;\n\n\treturn Array.from(sourceStylesContainer.children).filter((x) => x instanceof HTMLStyleElement);\n};\n\n// Create a component to render inside the Shadow DOM\nconst ShadowDiv = forwardRef((props, ref) => {\n\tconst shadowRef = useRef(null);\n\n\t// Load styles\n\tuseEffect(() => {\n\t\tif (!shadowRef?.current) return;\n\n\t\t// Add styles to the shadow DOM\n\t\t// const shadowEl = shadowRef?.current.shadowRoot;\n\t\tconst shadowEl = shadowRef?.current.shadowRoot;\n\n\t\tif (!shadowEl) return;\n\n\t\tconst sourceStylesContainer = document.head;\n\n\t\tconst observer = new MutationObserver(getStylesData);\n\t\tobserver.observe(sourceStylesContainer, {\n\t\t\tcharacterData: true,\n\t\t\tchildList: true,\n\t\t\tsubtree: true,\n\t\t});\n\n\t\tlet styleBlock = shadowEl.getElementById(\"custom-outer-style\");\n\n\t\tif (!styleBlock) {\n\t\t\tstyleBlock = document.createElement(\"span\");\n\t\t\tstyleBlock.id = \"custom-outer-style\";\n\t\t\tshadowEl.appendChild(styleBlock);\n\t\t} else {\n\t\t\tstyleBlock.innerHTML = \"\";\n\t\t}\n\n\t\tstyleBlock.append(\n\t\t\t...getStylesData() // finds all \n\t\t\t\n\t\t\t\t\n\t\t\t\t\tPrimary button\n\t\t\t\t\tCritical button\n\t\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\tPrimary button\n\t\t\t\t\tCritical button\n\t\t\t\t\n\t\t\t\n\t\t\n\t\n);"
}
],
- "import": "import Actionable from \"components/Actionable\";\nimport Alert from \"components/Alert\";\nimport Avatar from \"components/Avatar\";\nimport Badge from \"components/Badge\";\nimport Button from \"components/Button\";\nimport Card from \"components/Card\";\nimport DropdownMenu from \"components/DropdownMenu\";\nimport { Example } from \"utilities/storybook\";\nimport Link from \"components/Link\";\nimport Switch from \"components/Switch\";\nimport Text from \"components/Text\";\nimport TextField from \"components/TextField\";\nimport Theme from \"components/Theme\";\nimport { ThemePlayground } from \"reshaped\";\nimport View from \"components/View\";",
+ "import": "import {\n Actionable,\n Alert,\n Avatar,\n Badge,\n Button,\n Card,\n DropdownMenu,\n Example,\n Link,\n Switch,\n Text,\n TextField,\n Theme,\n ThemePlayground,\n View,\n} from \"reshaped\";",
"jsDocTags": {},
"reactDocgen": {
"description": "",
"methods": [],
"displayName": "Theme",
- "definedInFile": "/Users/jeppe/dev/temp/reshaped/src/components/Theme/Theme.tsx",
+ "definedInFile": "/Users/shilman/projects/design-systems/reshaped/src/components/Theme/Theme.tsx",
"actualName": "Theme",
"exportName": "default"
}
@@ -3537,11 +3537,11 @@
"snippet": "const preview = () => {\n\treturn (\n\t\t\n\t\t\t\n\t\t\n\t);\n};"
}
],
- "import": "import Image from \"components/Image\";\nimport MenuItem from \"components/MenuItem\";\nimport Modal from \"components/Modal\";\nimport Select from \"components/Select\";\nimport View from \"components/View\";",
+ "import": "import { Image, MenuItem, Modal, Select, View } from \"reshaped\";",
"jsDocTags": {},
"error": {
- "name": "No meta.component specified",
- "message": "Specify meta.component for the component to be included in the manifest.\n 7 | import MenuItem from \"components/MenuItem\";\n 8 |\n> 9 | export default {\n | ^\n 10 | \ttitle: \"Sandbox\",\n 11 | \tchromatic: { disableSnapshot: true },\n 12 | };"
+ "name": "No component found",
+ "message": "We could not detect the component from your story file. Specify meta.component.\n 7 | import MenuItem from \"components/MenuItem\";\n 8 |\n> 9 | export default {\n | ^\n 10 | \ttitle: \"Sandbox\",\n 11 | \tchromatic: { disableSnapshot: true },\n 12 | };\n\n./src/Sandbox.stories.tsx:\nimport View from \"components/View\";\nimport Image from \"components/Image\";\nimport React from \"react\";\nimport Select from \"components/Select\";\nimport useToggle from \"hooks/useToggle\";\nimport Modal from \"components/Modal\";\nimport MenuItem from \"components/MenuItem\";\n\nexport default {\n\ttitle: \"Sandbox\",\n\tchromatic: { disableSnapshot: true },\n};\n\nconst Preview: React.FC<{ children: React.ReactNode }> = (props) => {\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\n\t\t\t{props.children}\n\t\t\n\t);\n};\n\nexport const preview = () => {\n\treturn (\n\t\t\n\t\t\t\n\t\t\n\t);\n};\n\nconst Component = () => {\n\tconst toggle = useToggle();\n\tconst [value, setValue] = React.useState(\"Dog\");\n\n\tconst handleClick = () => {\n\t\ttoggle.toggle();\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t>\n\t);\n};\n"
}
}
}
diff --git a/eval/evals/110-flight-booking-reshaped/expected/stories/FlightBooking.stories.tsx b/eval/evals/110-flight-booking-reshaped/expected/stories/FlightBooking.stories.tsx
index e8baccfc..5c23b77b 100644
--- a/eval/evals/110-flight-booking-reshaped/expected/stories/FlightBooking.stories.tsx
+++ b/eval/evals/110-flight-booking-reshaped/expected/stories/FlightBooking.stories.tsx
@@ -1,10 +1,12 @@
import FlightBookingComponent from '../src/components/FlightBooking.tsx';
-import { userEvent, fn, expect, screen } from 'storybook/test';
+import { userEvent, fn, expect, screen, waitFor } from 'storybook/test';
+import type { Meta, StoryObj } from '@storybook/react-vite';
+import type { StepFunction } from 'storybook/internal/csf';
import React from 'react';
import { Reshaped } from 'reshaped';
import 'reshaped/themes/slate/theme.css';
-export default {
+const meta = {
component: FlightBookingComponent,
args: {
onSubmit: fn(),
@@ -16,70 +18,267 @@ export default {
),
],
-};
+} satisfies Meta;
+
+export default meta;
+
+type Story = StoryObj;
+
+async function looseGetInteractiveElements(
+ testId: string,
+ label: string,
+ step: StepFunction,
+) {
+ let elements: HTMLElement[] = [];
+ await step(
+ `Get element by test ID '${testId}' or label '${label}'`,
+ async () => {
+ elements = await waitFor(function getElement() {
+ const byTestId = screen.queryAllByTestId(testId);
+ if (byTestId.length > 0) {
+ return byTestId;
+ }
+ const candidates = [
+ ...screen.queryAllByTestId(testId),
+ ...screen.queryAllByLabelText(label, { exact: false }),
+ ...screen.queryAllByPlaceholderText(label, { exact: false }),
+ ...screen.queryAllByText(label, { exact: false }),
+ ];
-export const Initial = {};
+ // Return all interactive elements
+ const interactive = candidates.filter((el) => {
+ if (!el) {
+ return false;
+ }
+ if (
+ el.getAttribute('disabled') === '' ||
+ el.getAttribute('aria-disabled') === 'true'
+ ) {
+ return false;
+ }
+ const tagName = el.tagName.toLowerCase();
+ // Check for naturally interactive HTML elements
+ if (
+ [
+ 'button',
+ 'a',
+ 'input',
+ 'select',
+ 'textarea',
+ 'details',
+ 'summary',
+ 'audio',
+ 'video',
+ ].includes(tagName)
+ ) {
+ return true;
+ }
+ // Check for elements with interactive ARIA roles
+ const role = el.getAttribute('role');
+ if (
+ !!role &&
+ [
+ 'button',
+ 'link',
+ 'textbox',
+ 'checkbox',
+ 'radio',
+ 'combobox',
+ 'listbox',
+ 'option',
+ 'menuitem',
+ 'menuitemcheckbox',
+ 'menuitemradio',
+ 'tab',
+ 'switch',
+ 'slider',
+ 'spinbutton',
+ 'searchbox',
+ 'progressbar',
+ 'scrollbar',
+ ].includes(role)
+ ) {
+ return true;
+ }
+ // Check for cursor: pointer style
+ const computedStyle = window.getComputedStyle(el);
+ if (computedStyle.cursor === 'pointer') {
+ return true;
+ }
+ return false;
+ });
+ interactive.push(null as any);
+
+ return interactive;
+ });
+ },
+ );
+ return elements!;
+}
+
+export const Initial: Story = {};
+
+export const FlightPicker: Story = {
+ play: async ({ step }) => {
+ const fromFlightTrigger = (
+ await looseGetInteractiveElements('flight-trigger-from', 'From', step)
+ )[0];
+ await expect(fromFlightTrigger).toBeInTheDocument();
+
+ if (
+ fromFlightTrigger.tagName.toLowerCase() === 'input' &&
+ (fromFlightTrigger as HTMLInputElement).type === 'text'
+ ) {
+ await userEvent.type(fromFlightTrigger, 'M');
+ } else {
+ await userEvent.click(fromFlightTrigger);
+ }
-export const FlightPicker = {
- play: async ({ canvas }) => {
- await userEvent.click(await canvas.findByText('From'));
await expect(
- await screen.findByText('MEL', { exact: false }),
+ (await looseGetInteractiveElements('airport-MEL', 'MEL', step))[0],
).toBeInTheDocument();
},
};
-export const DatePicker = {
- play: async ({ canvas }) => {
+export const DatePicker: Story = {
+ play: async ({ step }) => {
await userEvent.click(
- await canvas.findByRole('button', { name: 'Departure Date' }),
+ (
+ await looseGetInteractiveElements(
+ 'date-trigger-departure',
+ 'Departure Date',
+ step,
+ )
+ )[0],
);
- await expect(await screen.findByText('27')).toBeInTheDocument();
+ await expect(
+ (await looseGetInteractiveElements('date-27', '27', step))[0],
+ ).toBeInTheDocument();
},
};
-export const ReturnDatePickerIsUnavailableWhenOneWaySelected = {
- play: async ({ canvas }) => {
- await userEvent.click(await canvas.findByText('One Way'));
+export const ReturnDatePickerIsUnavailableWhenOneWaySelected: Story = {
+ play: async ({ step }) => {
+ await userEvent.click(
+ (await looseGetInteractiveElements('one-way', 'One Way', step))[0],
+ );
- const returnDatepicker = await canvas.queryByRole('button', {
- name: 'Return Date',
- });
+ const returnDatePicker = (
+ await looseGetInteractiveElements(
+ 'date-trigger-return',
+ 'Return Date',
+ step,
+ )
+ )[0];
// If the return datepicker exists, ensure it's disabled by trying to open it
- if (returnDatepicker) {
- await userEvent.click(returnDatepicker);
- await expect(await canvas.queryByText('28')).not.toBeInTheDocument();
+ if (returnDatePicker) {
+ await userEvent.click(returnDatePicker);
+ const date15 = (
+ await looseGetInteractiveElements('date-15', '15', step)
+ )[0];
+ await expect(date15).toBeNull();
} else {
- await expect(returnDatepicker).toBeNull();
+ await expect(returnDatePicker).toBeNull();
}
},
};
-export const Submitted = {
- play: async ({ canvas, canvasElement, args }) => {
- await userEvent.click(
- await canvas.findByRole('button', { name: 'Return' }),
- );
- await userEvent.click(await canvas.findByText('From'));
- await userEvent.click(await screen.findByText('MEL', { exact: false }));
+export const Submitted: Story = {
+ play: async ({ canvasElement, args, step }) => {
+ await step('Enable return flight', async () => {
+ const returnToggle = (
+ await looseGetInteractiveElements('return', 'Return', step)
+ )[0];
+ await userEvent.click(returnToggle);
+ });
- await userEvent.click(await canvas.findByText('To'));
- await userEvent.click(await screen.findByText('LAX', { exact: false }));
+ await step('Select from flight', async () => {
+ const fromFlightTrigger = (
+ await looseGetInteractiveElements('flight-trigger-from', 'From', step)
+ )[0];
+ await expect(fromFlightTrigger).toBeInTheDocument();
- await userEvent.click(
- await canvas.findByRole('button', { name: 'Departure Date' }),
- );
- await userEvent.click(await screen.findByText('27'));
- await userEvent.click(canvasElement); // dismiss datepicker popover
+ if (
+ fromFlightTrigger.tagName.toLowerCase() === 'input' &&
+ (fromFlightTrigger as HTMLInputElement).type === 'text'
+ ) {
+ await userEvent.type(fromFlightTrigger, 'M');
+ } else {
+ await userEvent.click(fromFlightTrigger);
+ }
+
+ const melbourneAirport = (
+ await looseGetInteractiveElements('airport-MEL', 'MEL', step)
+ )[0];
+ await userEvent.click(melbourneAirport);
+ });
+
+ await step('Select to flight', async () => {
+ const toFlightTrigger = (
+ await looseGetInteractiveElements('flight-trigger-to', 'To', step)
+ )[0];
+ await expect(toFlightTrigger).toBeInTheDocument();
+
+ if (
+ toFlightTrigger.tagName.toLowerCase() === 'input' &&
+ (toFlightTrigger as HTMLInputElement).type === 'text'
+ ) {
+ await userEvent.type(toFlightTrigger, 'L');
+ } else {
+ await userEvent.click(toFlightTrigger);
+ }
+ const laxAirport = (
+ await looseGetInteractiveElements('airport-LAX', 'LAX', step)
+ )[0];
+ await userEvent.click(laxAirport);
+ });
+
+ await step('Select departure date', async () => {
+ await userEvent.click(
+ (
+ await looseGetInteractiveElements(
+ 'date-trigger-departure',
+ 'Departure Date',
+ step,
+ )
+ )[0],
+ );
+ const date = (
+ await looseGetInteractiveElements('date-27', '27', step)
+ ).at(-1)!;
+ await expect(date).toBeInTheDocument();
+ await userEvent.click(date);
+ await userEvent.click(canvasElement); // dismiss datepicker popover
+ });
+
+ await step('Select return date', async () => {
+ await userEvent.click(
+ (
+ await looseGetInteractiveElements(
+ 'date-trigger-return',
+ 'Return Date',
+ step,
+ )
+ )[0],
+ );
+ const date = (
+ await looseGetInteractiveElements('date-28', '28', step)
+ ).at(-1)!;
+ await expect(date).toBeInTheDocument();
+ await userEvent.click(date);
+ await userEvent.click(canvasElement); // dismiss datepicker popover
+ });
await userEvent.click(
- await canvas.findByRole('button', { name: 'Return Date' }),
+ (
+ await looseGetInteractiveElements(
+ 'search-flights',
+ 'Search Flights',
+ step,
+ )
+ )[0],
);
- await userEvent.click(await screen.findByText('28'));
- await userEvent.click(canvasElement); // dismiss datepicker popover
-
- await userEvent.click(await canvas.findByText('Search Flights'));
await expect(args.onSubmit).toHaveBeenCalledOnce();
},
};
diff --git a/eval/evals/110-flight-booking-reshaped/prompt.md b/eval/evals/110-flight-booking-reshaped/prompt.md
index 897879d6..3be2bc5f 100644
--- a/eval/evals/110-flight-booking-reshaped/prompt.md
+++ b/eval/evals/110-flight-booking-reshaped/prompt.md
@@ -24,13 +24,13 @@ The calendar widget shouldn't allow selecting dates in the past and the return f
1. The component MUST be a default export in src/components/FlightBooking.tsx
2. The component MUST be added to the main.tsx file as the ONLY component being rendered
3. The component MUST take an optional onSubmit() prop that is called when the submit button is clicked
-4. The element for the "One Way"-toggle SHOULD have "One Way" as its only content
-5. The element for the "Return"-toggle SHOULD have a "Return" as its only content
-6. The autocomplete to open the From airport picker SHOULD have "From" as its placeholder
-7. The autocomplete to open the To airport picker SHOULD have "To" as its placeholder
-8. Each element to select an airport in the pickers SHOULD have include both the shortcode and full airport name in its content
-9. The element to open the Departure Date date select SHOULD have "Departure Date" as its initial content
-10. The (optional) element to open the Return Date date select SHOULD have "Return Date" as its initial content
-11. Each date in the date selects SHOULD the day of month as its only content
-12. The submit button SHOULD have "Search Flights" as its only content
+4. The element for the "One Way"-toggle SHOULD have "One Way" as its only content and SHOULD have data-testid="one-way"
+5. The element for the "Return"-toggle SHOULD have a "Return" as its only content and SHOULD have data-testid="return"
+6. The autocomplete to open the From airport picker SHOULD have "From" as its placeholder and SHOULD have data-testid="flight-trigger-from"
+7. The autocomplete to open the To airport picker SHOULD have "To" as its placeholder and SHOULD have data-testid="flight-trigger-to"
+8. Each element to select an airport in the pickers SHOULD have include both the shortcode and full airport name in its content and SHOULD have data-testid="airport-{SHORTCODE}" (e.g., "airport-MEL", "airport-LAX")
+9. The element to open the Departure Date date select SHOULD have "Departure Date" as its initial content and SHOULD have data-testid="date-trigger-departure"
+10. The (optional) element to open the Return Date date select SHOULD have "Return Date" as its initial content and SHOULD have data-testid="date-trigger-return"
+11. Each date in the date selects SHOULD the day of month as its only content and SHOULD have data-testid="date-{DAY}" (e.g., "date-27", "date-15")
+12. The submit button SHOULD have "Search Flights" as its only content and SHOULD have data-testid="search-flights"