@rainbow-robotics/muscat-plugin-kit 1.10.1-dev.1 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +282 -282
- package/cli/README.md +274 -274
- package/cli/bin/create-muscat-plugin.mjs +8 -8
- package/cli/bin/muscat-pk.mjs +155 -155
- package/cli/bundle-templates.mjs +31 -31
- package/cli/docker/Dockerfile.cpp +28 -28
- package/cli/docker/Dockerfile.dev +30 -30
- package/cli/docker/Dockerfile.python +21 -21
- package/cli/m5-e2e.mjs +69 -69
- package/cli/prepack.mjs +10 -10
- package/cli/src/ai-rules.mjs +70 -70
- package/cli/src/build.mjs +447 -447
- package/cli/src/check-package.mjs +13 -13
- package/cli/src/completion.mjs +166 -166
- package/cli/src/cpp.mjs +78 -78
- package/cli/src/cppIde.mjs +75 -75
- package/cli/src/dev.mjs +165 -165
- package/cli/src/devBack.mjs +734 -727
- package/cli/src/devUi.mjs +247 -243
- package/cli/src/esbuild.mjs +56 -56
- package/cli/src/host_agent.py +223 -223
- package/cli/src/manifest.mjs +287 -287
- package/cli/src/mcp.mjs +1071 -1071
- package/cli/src/muscatLocal.mjs +209 -209
- package/cli/src/new.mjs +343 -343
- package/cli/src/pluginDevServer.mjs +111 -111
- package/cli/src/ports.mjs +193 -193
- package/cli/src/python.mjs +112 -112
- package/cli/src/ros2.mjs +109 -109
- package/cli/src/sdk.mjs +117 -117
- package/cli/src/storybook.mjs +168 -168
- package/cli/src/type.mjs +141 -141
- package/cli/src/uninstall.mjs +81 -81
- package/cli/src/update.mjs +295 -295
- package/cli/src/util.mjs +441 -441
- package/cli/src/zenohDev.mjs +83 -81
- package/cli/storybook-dist/_design-tokens.css +4957 -4957
- package/cli/storybook-dist/_stories-src/NxAvatar.stories.tsx +27 -27
- package/cli/storybook-dist/_stories-src/NxPagination.stories.tsx +28 -28
- package/cli/storybook-dist/_stories-src/RBAccordion/RBAccordion.stories.tsx +46 -46
- package/cli/storybook-dist/_stories-src/RBAccordion/RBAccordionGroup.stories.tsx +73 -73
- package/cli/storybook-dist/_stories-src/RBBadge/RBBadge.stories.tsx +93 -93
- package/cli/storybook-dist/_stories-src/RBBattery/RBBattery.stories.tsx +74 -74
- package/cli/storybook-dist/_stories-src/RBButton/RBCheckIconButton.stories.tsx +28 -28
- package/cli/storybook-dist/_stories-src/RBButton/RBCheckLabelButton.stories.tsx +84 -84
- package/cli/storybook-dist/_stories-src/RBButton/RBIconButton.stories.tsx +57 -57
- package/cli/storybook-dist/_stories-src/RBButton/RBInlineLabelButton.stories.tsx +41 -41
- package/cli/storybook-dist/_stories-src/RBButton/RBLabelButton.stories.tsx +60 -60
- package/cli/storybook-dist/_stories-src/RBDatePicker/RBDateInput.stories.tsx +44 -44
- package/cli/storybook-dist/_stories-src/RBDatePicker/RBRangeDateInput.stories.tsx +56 -56
- package/cli/storybook-dist/_stories-src/RBDialog/RBAlert.stories.tsx +51 -51
- package/cli/storybook-dist/_stories-src/RBDialog/RBConfirm.stories.tsx +55 -55
- package/cli/storybook-dist/_stories-src/RBDialog/RBPrompt.stories.tsx +52 -52
- package/cli/storybook-dist/_stories-src/RBDivider/RBDivider.stories.tsx +93 -93
- package/cli/storybook-dist/_stories-src/RBEmptyView/RBEmptyView.stories.tsx +49 -49
- package/cli/storybook-dist/_stories-src/RBIcons/RBColorIcons.stories.tsx +108 -108
- package/cli/storybook-dist/_stories-src/RBIcons/RBIcons.stories.tsx +106 -106
- package/cli/storybook-dist/_stories-src/RBInput/RBCheckBox.stories.tsx +89 -89
- package/cli/storybook-dist/_stories-src/RBInput/RBMultiRangeInput.stories.tsx +64 -64
- package/cli/storybook-dist/_stories-src/RBInput/RBRadioBox.stories.tsx +65 -65
- package/cli/storybook-dist/_stories-src/RBInput/RBRadioButton.stories.tsx +68 -68
- package/cli/storybook-dist/_stories-src/RBInput/RBSelectBox.stories.tsx +216 -216
- package/cli/storybook-dist/_stories-src/RBInput/RBSideNumberInput.stories.tsx +90 -90
- package/cli/storybook-dist/_stories-src/RBInput/RBText/RBTextArea.stories.tsx +45 -45
- package/cli/storybook-dist/_stories-src/RBInput/RBText/RBTextInput.stories.tsx +50 -50
- package/cli/storybook-dist/_stories-src/RBInput/RBTextField.stories.tsx +102 -102
- package/cli/storybook-dist/_stories-src/RBJoyStick/RBJoyStick.stories.tsx +31 -31
- package/cli/storybook-dist/_stories-src/RBLight/RBLight.stories.tsx +36 -36
- package/cli/storybook-dist/_stories-src/RBPagination/RBPagination.stories.tsx +49 -49
- package/cli/storybook-dist/_stories-src/RBShadcn/RBCard/RBCard.stories.tsx +89 -89
- package/cli/storybook-dist/_stories-src/RBShadcn/RBCommand/RBCommand.stories.tsx +116 -116
- package/cli/storybook-dist/_stories-src/RBShadcn/RBDialog/RBDialog.stories.tsx +74 -74
- package/cli/storybook-dist/_stories-src/RBShadcn/RBDrawer/RBDrawer.stories.tsx +99 -99
- package/cli/storybook-dist/_stories-src/RBShadcn/RBDropdownMenu/RBDropdownMenu.stories.tsx +123 -123
- package/cli/storybook-dist/_stories-src/RBShadcn/RBMenubar/RBMenubar.stories.tsx +135 -135
- package/cli/storybook-dist/_stories-src/RBShadcn/RBPopover/RBPopover.stories.tsx +69 -69
- package/cli/storybook-dist/_stories-src/RBShadcn/RBResizable/RBResizable.stories.tsx +49 -49
- package/cli/storybook-dist/_stories-src/RBShadcn/RBSheet/RBSheet.stories.tsx +91 -91
- package/cli/storybook-dist/_stories-src/RBShadcn/RBSlider/RBSlider.stories.tsx +38 -38
- package/cli/storybook-dist/_stories-src/RBShadcn/RBSwitch/RBSwitch.stories.tsx +112 -112
- package/cli/storybook-dist/_stories-src/RBShadcn/RBTabs/RBTabs.stories.tsx +75 -75
- package/cli/storybook-dist/_stories-src/RBShadcn/RBToggle/RBToggle.stories.tsx +51 -51
- package/cli/storybook-dist/_stories-src/RBShadcn/RBToggleGroup/RBToggleGroup.stories.tsx +84 -84
- package/cli/storybook-dist/_stories-src/RBTab/RBChipTab.stories.tsx +102 -102
- package/cli/storybook-dist/_stories-src/RBTab/RBChipsBoxTab.stories.tsx +78 -78
- package/cli/storybook-dist/_stories-src/RBTab/RBTab.stories.tsx +57 -57
- package/cli/storybook-dist/_stories-src/RBTable/RBTable.stories.tsx +177 -177
- package/cli/storybook-dist/_stories-src/RBTable/RBTableRow.stories.tsx +64 -64
- package/cli/storybook-dist/_stories-src/RBToast/RBToast.stories.tsx +117 -117
- package/cli/storybook-dist/_stories-src/RBTooltip/RBTooltip.stories.tsx +50 -50
- package/cli/storybook-dist/_stories-src/loading/RBSpinner.stories.tsx +30 -30
- package/cli/storybook-dist/_stories-src/nx-button/NxButton.stories.tsx +54 -54
- package/cli/storybook-dist/_stories-src/nx-button/NxPointerHoldButton.stories.tsx +57 -57
- package/cli/storybook-dist/_stories-src/nx-icons/NxIcons.stories.tsx +48 -48
- package/cli/storybook-dist/_stories-src/nx-inputs/NxNumberInput.stories.tsx +103 -103
- package/cli/storybook-dist/_stories-src/nx-inputs/NxRangeInput.stories.tsx +27 -27
- package/cli/storybook-dist/_stories-src/nx-inputs/NxSelectBox.stories.tsx +67 -67
- package/cli/storybook-dist/_stories-src/nx-inputs/NxSlideRange.stories.tsx +45 -45
- package/cli/storybook-dist/_stories-src/nx-inputs/NxSwitch.stories.tsx +27 -27
- package/cli/storybook-dist/_stories-src/nx-inputs/NxTextArea.stories.tsx +48 -48
- package/cli/storybook-dist/_stories-src/nx-inputs/NxTextInput.stories.tsx +46 -46
- package/cli/storybook-dist/assets/{Color-YHDXOIA2-D6JqZzDJ.js → Color-YHDXOIA2-B4IER17l.js} +1 -1
- package/cli/storybook-dist/assets/{Docs-ESb7JAHg.js → Docs-C8GCHFtK.js} +3 -3
- package/cli/storybook-dist/assets/{Docs-6gD2kUo1.js → Docs-CgdEMPQP.js} +2 -2
- package/cli/storybook-dist/assets/{Docs-B9wd8Ok7.js → Docs-Ck3WHvk6.js} +3 -3
- package/cli/storybook-dist/assets/{Docs-CgFbWWXM.js → Docs-D9NHsoeZ.js} +2 -2
- package/cli/storybook-dist/assets/{Docs-DBQup8Bu.js → Docs-DNYQC7nl.js} +3 -3
- package/cli/storybook-dist/assets/{Docs-CMjovnSY.js → Docs-DUfeiM4I.js} +4 -4
- package/cli/storybook-dist/assets/{DocsRenderer-CFRXHY34-BOUI1AHi.js → DocsRenderer-CFRXHY34-C0WhyDoR.js} +1 -1
- package/cli/storybook-dist/assets/{NxAvatar.stories-DsYFMUh3.js → NxAvatar.stories-CwnK8AUF.js} +1 -1
- package/cli/storybook-dist/assets/{NxButton.stories-CHfNcqsc.js → NxButton.stories-ueYdosfQ.js} +8 -8
- package/cli/storybook-dist/assets/{NxNumberInput.stories-BFw_4vFE.js → NxNumberInput.stories-M5ZCLbrK.js} +1 -1
- package/cli/storybook-dist/assets/{NxPagination.stories-DVfxyw4M.js → NxPagination.stories-bxxUnHEL.js} +1 -1
- package/cli/storybook-dist/assets/{NxPointerHoldButton.stories-BzyxUWoZ.js → NxPointerHoldButton.stories-BHxB2kr5.js} +1 -1
- package/cli/storybook-dist/assets/{NxRangeInput.stories-DmRdzBc1.js → NxRangeInput.stories-BKfr-fp4.js} +6 -6
- package/cli/storybook-dist/assets/{NxSelectBox.stories-B1KkNUOf.js → NxSelectBox.stories-CG8FuTBq.js} +1 -1
- package/cli/storybook-dist/assets/{NxSlideRange.stories-CyOdvfQ6.js → NxSlideRange.stories-BRTFtMTL.js} +1 -1
- package/cli/storybook-dist/assets/{NxSwitch.stories-DrDBw0qp.js → NxSwitch.stories-Bwuyzn-R.js} +1 -1
- package/cli/storybook-dist/assets/{NxTextArea.stories-DTB2aqNS.js → NxTextArea.stories-COq2sGqu.js} +1 -1
- package/cli/storybook-dist/assets/{NxTextInput.stories-DU0rucmM.js → NxTextInput.stories-CjsBLz05.js} +1 -1
- package/cli/storybook-dist/assets/{RBAccordion.stories-DTfOtXtp.js → RBAccordion.stories-BARwuZ0Q.js} +3 -3
- package/cli/storybook-dist/assets/{RBAccordionGroup.stories-9y9BjrUe.js → RBAccordionGroup.stories-COrPxETW.js} +10 -10
- package/cli/storybook-dist/assets/{RBAlert.stories-DLTAv9fT.js → RBAlert.stories-BQrkjZPt.js} +3 -3
- package/cli/storybook-dist/assets/{RBBadge.stories-BNMACewA.js → RBBadge.stories-BTsLL-lK.js} +1 -1
- package/cli/storybook-dist/assets/{RBBattery.stories-B3kXMAt5.js → RBBattery.stories-DAeQdJbc.js} +1 -1
- package/cli/storybook-dist/assets/{RBCard.stories-Y-s8R2n7.js → RBCard.stories-HyhOE80R.js} +39 -39
- package/cli/storybook-dist/assets/{RBCheckBox.stories-DBuT9tL4.js → RBCheckBox.stories-KFk0WqX_.js} +1 -1
- package/cli/storybook-dist/assets/{RBCheckIconButton.stories-CWu1TL56.js → RBCheckIconButton.stories-CXbbktF5.js} +1 -1
- package/cli/storybook-dist/assets/{RBCheckLabelButton.stories-sCu2MGCX.js → RBCheckLabelButton.stories-DWfYz_9Z.js} +17 -17
- package/cli/storybook-dist/assets/{RBChipTab.stories-BX9qLJkR.js → RBChipTab.stories-JPEgVFAS.js} +5 -5
- package/cli/storybook-dist/assets/{RBChipsBoxTab.stories-35u1aJ-P.js → RBChipsBoxTab.stories-CTPuWXrQ.js} +1 -1
- package/cli/storybook-dist/assets/{RBColorIcons.stories-DAOZ5Ies.js → RBColorIcons.stories-DiFRZ5jk.js} +1 -1
- package/cli/storybook-dist/assets/RBCommand.stories-Pf1HAVIR.js +73 -0
- package/cli/storybook-dist/assets/{RBConfirm.stories-iMXcUh7Z.js → RBConfirm.stories-D1cEPUXk.js} +3 -3
- package/cli/storybook-dist/assets/{RBDateInput.stories-hK5rXECf.js → RBDateInput.stories-RPYpCjig.js} +1 -1
- package/cli/storybook-dist/assets/RBDialog.stories-DJH-0XSR.js +38 -0
- package/cli/storybook-dist/assets/{RBDivider.stories-BAK-iZ1Z.js → RBDivider.stories-uEj1vOgK.js} +1 -1
- package/cli/storybook-dist/assets/{RBDrawer.stories-B2nqf2Nh.js → RBDrawer.stories-BiMzElb2.js} +12 -12
- package/cli/storybook-dist/assets/RBDropdownMenu.stories-Da_TBkla.js +86 -0
- package/cli/storybook-dist/assets/{RBEmptyView.stories-nCenrgBh.js → RBEmptyView.stories-BHeKGfPS.js} +1 -1
- package/cli/storybook-dist/assets/{RBIconButton.stories-DRH7O3sp.js → RBIconButton.stories-NEsRFoYp.js} +1 -1
- package/cli/storybook-dist/assets/{RBIcons.stories-D3PyJXG8.js → RBIcons.stories-CcZ-TTLS.js} +1 -1
- package/cli/storybook-dist/assets/{RBInlineLabelButton.stories-modQbt10.js → RBInlineLabelButton.stories-B0wpdQyR.js} +1 -1
- package/cli/storybook-dist/assets/{RBJoyStick.stories-BY14qVgR.js → RBJoyStick.stories-DEgBou3K.js} +1 -1
- package/cli/storybook-dist/assets/{RBLabelButton.stories-DzF7vGwm.js → RBLabelButton.stories-DT8drIsF.js} +1 -1
- package/cli/storybook-dist/assets/{RBLight.stories-lF4FRmVh.js → RBLight.stories-Dh-aoeyG.js} +1 -1
- package/cli/storybook-dist/assets/{RBMenubar.stories-XhrI7bsV.js → RBMenubar.stories-D-H7UqVh.js} +1 -1
- package/cli/storybook-dist/assets/{RBMultiRangeInput.stories-DprllQDl.js → RBMultiRangeInput.stories-hlclv6jI.js} +1 -1
- package/cli/storybook-dist/assets/{RBPagination.stories-2v2gBJfC.js → RBPagination.stories-DWCeoZ_S.js} +1 -1
- package/cli/storybook-dist/assets/{RBPopover.stories-C8iLIZpv.js → RBPopover.stories-C514M09_.js} +1 -1
- package/cli/storybook-dist/assets/{RBPrompt.stories-Th_HrWHI.js → RBPrompt.stories-BSItvfiT.js} +1 -1
- package/cli/storybook-dist/assets/{RBRadioBox.stories-CoHuLaN3.js → RBRadioBox.stories-BBb4YbFU.js} +1 -1
- package/cli/storybook-dist/assets/{RBRadioButton.stories-DULxE_ff.js → RBRadioButton.stories-CXyOGJCv.js} +1 -1
- package/cli/storybook-dist/assets/{RBRangeDateInput.stories-D8A9KBSS.js → RBRangeDateInput.stories-qvhubu0e.js} +1 -1
- package/cli/storybook-dist/assets/{RBResizable.stories-C41QfrQ3.js → RBResizable.stories-CZKeyGjH.js} +14 -14
- package/cli/storybook-dist/assets/{RBSelectBox.stories-C1gNmwzw.js → RBSelectBox.stories-CRKP3ybf.js} +1 -1
- package/cli/storybook-dist/assets/RBSheet.stories-sCM3ZJUa.js +39 -0
- package/cli/storybook-dist/assets/{RBSideNumberInput.stories-9LlgQ8nh.js → RBSideNumberInput.stories-Bb7gw8RF.js} +3 -3
- package/cli/storybook-dist/assets/{RBSlider.stories-oUgo5K9d.js → RBSlider.stories-23OAQU5z.js} +3 -3
- package/cli/storybook-dist/assets/{RBSpinner.stories-DDpohbY2.js → RBSpinner.stories-2xcQdcmt.js} +1 -1
- package/cli/storybook-dist/assets/{RBSwitch.stories-gW-GN7QO.js → RBSwitch.stories-BACUaJm_.js} +7 -7
- package/cli/storybook-dist/assets/{RBTab.stories-CN-PV3HH.js → RBTab.stories-CDHE3sVs.js} +1 -1
- package/cli/storybook-dist/assets/{RBTable.stories-BAZLpxtM.js → RBTable.stories-C0Cfhfl7.js} +29 -29
- package/cli/storybook-dist/assets/{RBTableRow.stories-CwjVrszB.js → RBTableRow.stories-BF8kIkpp.js} +1 -1
- package/cli/storybook-dist/assets/{RBTabs.stories-JuEo2sUL.js → RBTabs.stories-BdJWRq1o.js} +7 -7
- package/cli/storybook-dist/assets/{RBTextArea.stories-D0_Pv4qZ.js → RBTextArea.stories-CGy2xeYH.js} +3 -3
- package/cli/storybook-dist/assets/{RBTextField.stories-CCsOvZqV.js → RBTextField.stories-IfUOzxCM.js} +15 -15
- package/cli/storybook-dist/assets/{RBTextInput.stories-Cccn3VNm.js → RBTextInput.stories-VjXNFo4R.js} +3 -3
- package/cli/storybook-dist/assets/{RBToast.stories-I5617t0K.js → RBToast.stories-BzcobblV.js} +1 -1
- package/cli/storybook-dist/assets/{RBToggle.stories-DsgKjGsJ.js → RBToggle.stories-DuLE5mKv.js} +4 -4
- package/cli/storybook-dist/assets/{RBToggleGroup.stories-BZEzSDuz.js → RBToggleGroup.stories-CuR0N0GJ.js} +5 -5
- package/cli/storybook-dist/assets/{RBTooltip.stories-4oSyAWsA.js → RBTooltip.stories--aAgNC8_.js} +1 -1
- package/cli/storybook-dist/assets/{SideNumberInput-DSKbd0bG.js → SideNumberInput-DyWQxYUj.js} +743 -743
- package/cli/storybook-dist/assets/{entry-preview-B35XREGs.js → entry-preview-D7IHsza_.js} +1 -1
- package/cli/storybook-dist/assets/{iframe-BB797lmL.js → iframe-CbaIp5I-.js} +2 -2
- package/cli/storybook-dist/assets/{index-BU2567EP.js → index-C6CBgMuG.js} +3 -3
- package/cli/storybook-dist/assets/{preview-C7DaSWyc.js → preview-B-iYLDuW.js} +2 -2
- package/cli/storybook-dist/assets/{preview-CbuRHit4.js → preview-CRWqc9DH.js} +1 -1
- package/cli/storybook-dist/assets/{react-resizable-panels.browser-ChIvlwo7.js → react-resizable-panels.browser-8hC8dr-6.js} +8 -8
- package/cli/storybook-dist/iframe.html +2 -2
- package/cli/storybook-dist/index.html +1 -1
- package/cli/storybook-dist/project.json +1 -1
- package/cli/templates/common/.mcp.json +8 -8
- package/cli/templates/common/README.md +1231 -1231
- package/cli/templates/common/assets/icon.svg +45 -45
- package/cli/templates/common/manifest.json +26 -26
- package/cli/templates/common/package.json +22 -22
- package/cli/templates/common/py/main.py +125 -125
- package/cli/templates/common/tsconfig.json +13 -13
- package/cli/templates/common/ui/content.tsx +216 -216
- package/cli/templates/common/ui/style.css +6 -6
- package/cli/templates/common/vite.config.ts +10 -10
- package/cli/templates/cpp/cpp/main.cpp +73 -73
- package/cli/templates/ros2/ros2_ws/src/__PLUGIN_SLUG__/__PLUGIN_SLUG__/node.py +25 -25
- package/cli/templates/ros2/ros2_ws/src/__PLUGIN_SLUG__/package.xml +10 -10
- package/cli/templates/ros2/ros2_ws/src/__PLUGIN_SLUG__/setup.py +18 -18
- package/cli/templates/ros2-cpp/ros2_ws/src/__PLUGIN_SLUG__/package.xml +11 -11
- package/cli/templates/ros2-cpp/ros2_ws/src/__PLUGIN_SLUG__/src/node.cpp +23 -23
- package/cli/vite.d.mts +25 -25
- package/cli/vite.mjs +292 -292
- package/package.json +3 -3
- package/cli/storybook-dist/assets/RBCommand.stories-BSqXDkKw.js +0 -73
- package/cli/storybook-dist/assets/RBDialog.stories-BAktz-ku.js +0 -38
- package/cli/storybook-dist/assets/RBDropdownMenu.stories-DbW2fWAj.js +0 -86
- package/cli/storybook-dist/assets/RBSheet.stories-_6VH-RUm.js +0 -39
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
import type { Meta, StoryObj, StoryFn } from "@storybook/react";
|
|
3
|
-
|
|
4
|
-
import { RBRadioButton } from "@repo/rb-components/new_components";
|
|
5
|
-
import type { RadioButtonProps } from "@repo/rb-components/new_components";
|
|
6
|
-
|
|
7
|
-
type StoryComponent = StoryObj<typeof RBRadioButton>;
|
|
8
|
-
type StoryTemplate = StoryFn<typeof RBRadioButton>;
|
|
9
|
-
|
|
10
|
-
const Template: StoryTemplate = (args) => {
|
|
11
|
-
const list = [1, 2, 3, 4];
|
|
12
|
-
const [value, setValue] = useState<RadioButtonProps["value"]>();
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<div className="flex flex-col gap-3">
|
|
16
|
-
<div className="flex flex-col gap-2">
|
|
17
|
-
{list.map((num) => (
|
|
18
|
-
<RBRadioButton
|
|
19
|
-
key={num}
|
|
20
|
-
{...args}
|
|
21
|
-
name="rb-radio-button-demo"
|
|
22
|
-
checkValue={String(num)}
|
|
23
|
-
value={value}
|
|
24
|
-
handleChange={setValue}
|
|
25
|
-
>
|
|
26
|
-
{`버튼 라벨 ${num}`}
|
|
27
|
-
</RBRadioButton>
|
|
28
|
-
))}
|
|
29
|
-
</div>
|
|
30
|
-
<div className="text-fg-default text-xs">DATA: {String(value ?? "")}</div>
|
|
31
|
-
</div>
|
|
32
|
-
);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export default {
|
|
36
|
-
component: RBRadioButton,
|
|
37
|
-
tags: ["autodocs"],
|
|
38
|
-
argTypes: {
|
|
39
|
-
size: {
|
|
40
|
-
control: { type: "select" },
|
|
41
|
-
options: ["sm", "md"],
|
|
42
|
-
table: { type: { summary: '"sm" | "md"' } },
|
|
43
|
-
},
|
|
44
|
-
disabled: { control: { type: "boolean" } },
|
|
45
|
-
children: { control: false },
|
|
46
|
-
name: { control: false },
|
|
47
|
-
checkValue: { control: false },
|
|
48
|
-
value: { control: false },
|
|
49
|
-
handleChange: { control: false },
|
|
50
|
-
},
|
|
51
|
-
args: {
|
|
52
|
-
size: "sm",
|
|
53
|
-
disabled: false,
|
|
54
|
-
},
|
|
55
|
-
render: Template,
|
|
56
|
-
} as Meta<typeof RBRadioButton>;
|
|
57
|
-
|
|
58
|
-
export const Default: StoryComponent = {
|
|
59
|
-
parameters: {
|
|
60
|
-
docs: {
|
|
61
|
-
description: {
|
|
62
|
-
story: "",
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
args: {},
|
|
67
|
-
render: Template,
|
|
68
|
-
};
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import type { Meta, StoryObj, StoryFn } from "@storybook/react";
|
|
3
|
+
|
|
4
|
+
import { RBRadioButton } from "@repo/rb-components/new_components";
|
|
5
|
+
import type { RadioButtonProps } from "@repo/rb-components/new_components";
|
|
6
|
+
|
|
7
|
+
type StoryComponent = StoryObj<typeof RBRadioButton>;
|
|
8
|
+
type StoryTemplate = StoryFn<typeof RBRadioButton>;
|
|
9
|
+
|
|
10
|
+
const Template: StoryTemplate = (args) => {
|
|
11
|
+
const list = [1, 2, 3, 4];
|
|
12
|
+
const [value, setValue] = useState<RadioButtonProps["value"]>();
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div className="flex flex-col gap-3">
|
|
16
|
+
<div className="flex flex-col gap-2">
|
|
17
|
+
{list.map((num) => (
|
|
18
|
+
<RBRadioButton
|
|
19
|
+
key={num}
|
|
20
|
+
{...args}
|
|
21
|
+
name="rb-radio-button-demo"
|
|
22
|
+
checkValue={String(num)}
|
|
23
|
+
value={value}
|
|
24
|
+
handleChange={setValue}
|
|
25
|
+
>
|
|
26
|
+
{`버튼 라벨 ${num}`}
|
|
27
|
+
</RBRadioButton>
|
|
28
|
+
))}
|
|
29
|
+
</div>
|
|
30
|
+
<div className="text-fg-default text-xs">DATA: {String(value ?? "")}</div>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default {
|
|
36
|
+
component: RBRadioButton,
|
|
37
|
+
tags: ["autodocs"],
|
|
38
|
+
argTypes: {
|
|
39
|
+
size: {
|
|
40
|
+
control: { type: "select" },
|
|
41
|
+
options: ["sm", "md"],
|
|
42
|
+
table: { type: { summary: '"sm" | "md"' } },
|
|
43
|
+
},
|
|
44
|
+
disabled: { control: { type: "boolean" } },
|
|
45
|
+
children: { control: false },
|
|
46
|
+
name: { control: false },
|
|
47
|
+
checkValue: { control: false },
|
|
48
|
+
value: { control: false },
|
|
49
|
+
handleChange: { control: false },
|
|
50
|
+
},
|
|
51
|
+
args: {
|
|
52
|
+
size: "sm",
|
|
53
|
+
disabled: false,
|
|
54
|
+
},
|
|
55
|
+
render: Template,
|
|
56
|
+
} as Meta<typeof RBRadioButton>;
|
|
57
|
+
|
|
58
|
+
export const Default: StoryComponent = {
|
|
59
|
+
parameters: {
|
|
60
|
+
docs: {
|
|
61
|
+
description: {
|
|
62
|
+
story: "",
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
args: {},
|
|
67
|
+
render: Template,
|
|
68
|
+
};
|
|
@@ -1,216 +1,216 @@
|
|
|
1
|
-
import type { Meta, StoryFn, StoryObj } from "@storybook/react";
|
|
2
|
-
import { expect, userEvent, waitFor, within } from "@storybook/test";
|
|
3
|
-
|
|
4
|
-
import { RBSelectBox, Option } from "@repo/rb-components/new_components";
|
|
5
|
-
import { VStack } from "@repo/rb-components";
|
|
6
|
-
|
|
7
|
-
type StoryComponent = StoryObj<typeof RBSelectBox>;
|
|
8
|
-
type StoryTemplate = StoryFn<typeof RBSelectBox>;
|
|
9
|
-
|
|
10
|
-
const options = Array.from({ length: 40 }, (_, i) => ({
|
|
11
|
-
value: `option-${i + 1}`,
|
|
12
|
-
label: `옵션 ${i + 1}`,
|
|
13
|
-
}));
|
|
14
|
-
|
|
15
|
-
const Template: StoryTemplate = (args) => {
|
|
16
|
-
return (
|
|
17
|
-
<div className="min-h-80 overflow-visible">
|
|
18
|
-
<RBSelectBox {...args} className="w-96">
|
|
19
|
-
{/* <Option value="option-1">옵션 1</Option>
|
|
20
|
-
<Option value="option-2">옵션 2</Option>
|
|
21
|
-
<Option value="option-3">옵션 3</Option>
|
|
22
|
-
<Option value="option-4" disabled>
|
|
23
|
-
옵션 4 (disabled)
|
|
24
|
-
</Option> */}
|
|
25
|
-
{options.map(({ value, label }) => (
|
|
26
|
-
<Option key={value} value={value}>
|
|
27
|
-
{label}
|
|
28
|
-
</Option>
|
|
29
|
-
))}
|
|
30
|
-
</RBSelectBox>
|
|
31
|
-
</div>
|
|
32
|
-
);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const HasInfoListTemplate: StoryTemplate = (args) => {
|
|
36
|
-
return (
|
|
37
|
-
<div className="min-h-80 overflow-visible">
|
|
38
|
-
<RBSelectBox {...args} className="w-96">
|
|
39
|
-
<Option value="option-1" label="옵션 1" className="h-12">
|
|
40
|
-
<VStack>
|
|
41
|
-
옵션 1
|
|
42
|
-
<span className="typo-compact-xs-normal">
|
|
43
|
-
Additional Information goes here
|
|
44
|
-
</span>
|
|
45
|
-
</VStack>
|
|
46
|
-
</Option>
|
|
47
|
-
<Option value="option-2" label="옵션 2" className="h-12">
|
|
48
|
-
<VStack>
|
|
49
|
-
옵션 2
|
|
50
|
-
<span className="typo-compact-xs-normal">
|
|
51
|
-
Additional Information goes here
|
|
52
|
-
</span>
|
|
53
|
-
</VStack>
|
|
54
|
-
</Option>
|
|
55
|
-
<Option value="option-3" label="옵션 3" disabled className="h-12">
|
|
56
|
-
<VStack>
|
|
57
|
-
옵션 3
|
|
58
|
-
<span className="typo-compact-xs-normal">
|
|
59
|
-
Additional Information goes here
|
|
60
|
-
</span>
|
|
61
|
-
</VStack>
|
|
62
|
-
</Option>
|
|
63
|
-
</RBSelectBox>
|
|
64
|
-
</div>
|
|
65
|
-
);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export default {
|
|
69
|
-
component: RBSelectBox,
|
|
70
|
-
tags: ["autodocs"],
|
|
71
|
-
parameters: {
|
|
72
|
-
layout: "padded",
|
|
73
|
-
},
|
|
74
|
-
argTypes: {
|
|
75
|
-
size: {
|
|
76
|
-
control: { type: "select" },
|
|
77
|
-
options: ["xs2", "sm", "md", "lg"],
|
|
78
|
-
},
|
|
79
|
-
maxDropBoxHeight: { control: { type: "number" } },
|
|
80
|
-
disabled: { control: { type: "boolean" } },
|
|
81
|
-
readOnly: { control: { type: "boolean" } },
|
|
82
|
-
search: { control: { type: "boolean" } },
|
|
83
|
-
keepDropDown: { control: { type: "boolean" } },
|
|
84
|
-
showCloseBtn: { control: { type: "boolean" } },
|
|
85
|
-
whenScrollCloseDropBox: { control: { type: "boolean" } },
|
|
86
|
-
enableModal: { control: { type: "boolean" } },
|
|
87
|
-
error: { control: { type: "boolean" } },
|
|
88
|
-
searchPlaceholder: { control: { type: "text" } },
|
|
89
|
-
mobileLabel: { control: { type: "text" } },
|
|
90
|
-
placeholder: { control: { type: "text" } },
|
|
91
|
-
selectArrow: { control: false, table: { disable: true } },
|
|
92
|
-
noDataMsg: { control: false, table: { disable: true } },
|
|
93
|
-
onClick: { action: false, control: false, table: { disable: true } },
|
|
94
|
-
onChange: { action: "onChange", control: false },
|
|
95
|
-
handleChange: { action: "handleChange", control: false },
|
|
96
|
-
},
|
|
97
|
-
args: {
|
|
98
|
-
size: "md",
|
|
99
|
-
maxDropBoxHeight: 200,
|
|
100
|
-
disabled: false,
|
|
101
|
-
readOnly: false,
|
|
102
|
-
placeholder: "placeholder",
|
|
103
|
-
search: false,
|
|
104
|
-
keepDropDown: false,
|
|
105
|
-
showCloseBtn: false,
|
|
106
|
-
whenScrollCloseDropBox: false,
|
|
107
|
-
enableModal: false,
|
|
108
|
-
error: false,
|
|
109
|
-
searchPlaceholder: "Search",
|
|
110
|
-
onClick: undefined,
|
|
111
|
-
},
|
|
112
|
-
render: Template,
|
|
113
|
-
} as Meta<typeof RBSelectBox>;
|
|
114
|
-
|
|
115
|
-
// RBSelectBox는 마운트 시점 기준 300ms 이내의 클릭을 더블클릭 방지 가드로 무시하므로
|
|
116
|
-
// play 함수의 첫 클릭 전에 가드 구간을 지나도록 대기
|
|
117
|
-
const waitPastClickGuard = () =>
|
|
118
|
-
new Promise((resolve) => setTimeout(resolve, 350));
|
|
119
|
-
|
|
120
|
-
export const Default: StoryComponent = {
|
|
121
|
-
play: async ({ canvasElement }) => {
|
|
122
|
-
const canvas = within(canvasElement);
|
|
123
|
-
const doc = canvasElement.ownerDocument;
|
|
124
|
-
|
|
125
|
-
await waitPastClickGuard();
|
|
126
|
-
await userEvent.click(canvas.getByText("placeholder"));
|
|
127
|
-
|
|
128
|
-
const dropBox = await waitFor(() => {
|
|
129
|
-
const el = doc.querySelector('[data-slot="select-drop-box"]');
|
|
130
|
-
if (!el) throw new Error("drop box not opened");
|
|
131
|
-
return el as HTMLElement;
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
const option = within(dropBox).getByText("옵션 3");
|
|
135
|
-
await userEvent.click(option);
|
|
136
|
-
|
|
137
|
-
await waitFor(() => {
|
|
138
|
-
expect(
|
|
139
|
-
canvasElement.querySelector('[data-slot="select-box-value"] span')
|
|
140
|
-
?.textContent,
|
|
141
|
-
).toBe("옵션 3");
|
|
142
|
-
expect(doc.querySelector('[data-slot="select-drop-box"]')).toBeNull();
|
|
143
|
-
});
|
|
144
|
-
},
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
export const HasInfoList: StoryComponent = {
|
|
148
|
-
args: {
|
|
149
|
-
value: "option-2",
|
|
150
|
-
},
|
|
151
|
-
render: HasInfoListTemplate,
|
|
152
|
-
play: async ({ canvasElement }) => {
|
|
153
|
-
const canvas = within(canvasElement);
|
|
154
|
-
const doc = canvasElement.ownerDocument;
|
|
155
|
-
// DropBox가 열려있을 때는 옵션 목록에도 같은 라벨 텍스트가 존재해
|
|
156
|
-
// canvas.getByText가 trigger와 옵션을 동시에 매칭해버리므로, trigger는
|
|
157
|
-
// select-box-value 슬롯을 직접 조회해 값이 바뀌었는지 확인한다
|
|
158
|
-
const getTriggerText = () =>
|
|
159
|
-
canvasElement.querySelector('[data-slot="select-box-value"] span')
|
|
160
|
-
?.textContent;
|
|
161
|
-
|
|
162
|
-
await waitPastClickGuard();
|
|
163
|
-
await userEvent.click(canvas.getByText("옵션 2"));
|
|
164
|
-
|
|
165
|
-
const dropBox = await waitFor(() => {
|
|
166
|
-
const el = doc.querySelector('[data-slot="select-drop-box"]');
|
|
167
|
-
if (!el) throw new Error("drop box not opened");
|
|
168
|
-
return el as HTMLElement;
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
const optionEls = within(dropBox).getAllByRole("button");
|
|
172
|
-
const disabledOption = optionEls.find((el) =>
|
|
173
|
-
el.textContent?.startsWith("옵션 3"),
|
|
174
|
-
);
|
|
175
|
-
expect(disabledOption?.textContent).toContain(
|
|
176
|
-
"Additional Information goes here",
|
|
177
|
-
);
|
|
178
|
-
|
|
179
|
-
// disabled 옵션은 클릭해도 선택이 바뀌지 않고 DropBox도 닫히지 않음
|
|
180
|
-
await userEvent.click(disabledOption!);
|
|
181
|
-
expect(getTriggerText()).toBe("옵션 2");
|
|
182
|
-
expect(doc.querySelector('[data-slot="select-drop-box"]')).not.toBeNull();
|
|
183
|
-
|
|
184
|
-
const enabledOption = optionEls.find((el) =>
|
|
185
|
-
el.textContent?.startsWith("옵션 1"),
|
|
186
|
-
);
|
|
187
|
-
await userEvent.click(enabledOption!);
|
|
188
|
-
|
|
189
|
-
await waitFor(() => {
|
|
190
|
-
expect(getTriggerText()).toBe("옵션 1");
|
|
191
|
-
expect(doc.querySelector('[data-slot="select-drop-box"]')).toBeNull();
|
|
192
|
-
});
|
|
193
|
-
},
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
export const MaxDropBoxHeight: StoryComponent = {
|
|
197
|
-
args: {
|
|
198
|
-
maxDropBoxHeight: 120,
|
|
199
|
-
},
|
|
200
|
-
play: async ({ canvasElement }) => {
|
|
201
|
-
const canvas = within(canvasElement);
|
|
202
|
-
|
|
203
|
-
await waitPastClickGuard();
|
|
204
|
-
await userEvent.click(canvas.getByText("placeholder"));
|
|
205
|
-
|
|
206
|
-
const doc = canvasElement.ownerDocument;
|
|
207
|
-
await waitFor(() => {
|
|
208
|
-
const dropBox = doc.querySelector(
|
|
209
|
-
'[data-slot="select-drop-box"]',
|
|
210
|
-
) as HTMLElement;
|
|
211
|
-
|
|
212
|
-
expect(dropBox).toBeTruthy();
|
|
213
|
-
expect(dropBox.getBoundingClientRect().height).toBeLessThanOrEqual(121);
|
|
214
|
-
});
|
|
215
|
-
},
|
|
216
|
-
};
|
|
1
|
+
import type { Meta, StoryFn, StoryObj } from "@storybook/react";
|
|
2
|
+
import { expect, userEvent, waitFor, within } from "@storybook/test";
|
|
3
|
+
|
|
4
|
+
import { RBSelectBox, Option } from "@repo/rb-components/new_components";
|
|
5
|
+
import { VStack } from "@repo/rb-components";
|
|
6
|
+
|
|
7
|
+
type StoryComponent = StoryObj<typeof RBSelectBox>;
|
|
8
|
+
type StoryTemplate = StoryFn<typeof RBSelectBox>;
|
|
9
|
+
|
|
10
|
+
const options = Array.from({ length: 40 }, (_, i) => ({
|
|
11
|
+
value: `option-${i + 1}`,
|
|
12
|
+
label: `옵션 ${i + 1}`,
|
|
13
|
+
}));
|
|
14
|
+
|
|
15
|
+
const Template: StoryTemplate = (args) => {
|
|
16
|
+
return (
|
|
17
|
+
<div className="min-h-80 overflow-visible">
|
|
18
|
+
<RBSelectBox {...args} className="w-96">
|
|
19
|
+
{/* <Option value="option-1">옵션 1</Option>
|
|
20
|
+
<Option value="option-2">옵션 2</Option>
|
|
21
|
+
<Option value="option-3">옵션 3</Option>
|
|
22
|
+
<Option value="option-4" disabled>
|
|
23
|
+
옵션 4 (disabled)
|
|
24
|
+
</Option> */}
|
|
25
|
+
{options.map(({ value, label }) => (
|
|
26
|
+
<Option key={value} value={value}>
|
|
27
|
+
{label}
|
|
28
|
+
</Option>
|
|
29
|
+
))}
|
|
30
|
+
</RBSelectBox>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const HasInfoListTemplate: StoryTemplate = (args) => {
|
|
36
|
+
return (
|
|
37
|
+
<div className="min-h-80 overflow-visible">
|
|
38
|
+
<RBSelectBox {...args} className="w-96">
|
|
39
|
+
<Option value="option-1" label="옵션 1" className="h-12">
|
|
40
|
+
<VStack>
|
|
41
|
+
옵션 1
|
|
42
|
+
<span className="typo-compact-xs-normal">
|
|
43
|
+
Additional Information goes here
|
|
44
|
+
</span>
|
|
45
|
+
</VStack>
|
|
46
|
+
</Option>
|
|
47
|
+
<Option value="option-2" label="옵션 2" className="h-12">
|
|
48
|
+
<VStack>
|
|
49
|
+
옵션 2
|
|
50
|
+
<span className="typo-compact-xs-normal">
|
|
51
|
+
Additional Information goes here
|
|
52
|
+
</span>
|
|
53
|
+
</VStack>
|
|
54
|
+
</Option>
|
|
55
|
+
<Option value="option-3" label="옵션 3" disabled className="h-12">
|
|
56
|
+
<VStack>
|
|
57
|
+
옵션 3
|
|
58
|
+
<span className="typo-compact-xs-normal">
|
|
59
|
+
Additional Information goes here
|
|
60
|
+
</span>
|
|
61
|
+
</VStack>
|
|
62
|
+
</Option>
|
|
63
|
+
</RBSelectBox>
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export default {
|
|
69
|
+
component: RBSelectBox,
|
|
70
|
+
tags: ["autodocs"],
|
|
71
|
+
parameters: {
|
|
72
|
+
layout: "padded",
|
|
73
|
+
},
|
|
74
|
+
argTypes: {
|
|
75
|
+
size: {
|
|
76
|
+
control: { type: "select" },
|
|
77
|
+
options: ["xs2", "sm", "md", "lg"],
|
|
78
|
+
},
|
|
79
|
+
maxDropBoxHeight: { control: { type: "number" } },
|
|
80
|
+
disabled: { control: { type: "boolean" } },
|
|
81
|
+
readOnly: { control: { type: "boolean" } },
|
|
82
|
+
search: { control: { type: "boolean" } },
|
|
83
|
+
keepDropDown: { control: { type: "boolean" } },
|
|
84
|
+
showCloseBtn: { control: { type: "boolean" } },
|
|
85
|
+
whenScrollCloseDropBox: { control: { type: "boolean" } },
|
|
86
|
+
enableModal: { control: { type: "boolean" } },
|
|
87
|
+
error: { control: { type: "boolean" } },
|
|
88
|
+
searchPlaceholder: { control: { type: "text" } },
|
|
89
|
+
mobileLabel: { control: { type: "text" } },
|
|
90
|
+
placeholder: { control: { type: "text" } },
|
|
91
|
+
selectArrow: { control: false, table: { disable: true } },
|
|
92
|
+
noDataMsg: { control: false, table: { disable: true } },
|
|
93
|
+
onClick: { action: false, control: false, table: { disable: true } },
|
|
94
|
+
onChange: { action: "onChange", control: false },
|
|
95
|
+
handleChange: { action: "handleChange", control: false },
|
|
96
|
+
},
|
|
97
|
+
args: {
|
|
98
|
+
size: "md",
|
|
99
|
+
maxDropBoxHeight: 200,
|
|
100
|
+
disabled: false,
|
|
101
|
+
readOnly: false,
|
|
102
|
+
placeholder: "placeholder",
|
|
103
|
+
search: false,
|
|
104
|
+
keepDropDown: false,
|
|
105
|
+
showCloseBtn: false,
|
|
106
|
+
whenScrollCloseDropBox: false,
|
|
107
|
+
enableModal: false,
|
|
108
|
+
error: false,
|
|
109
|
+
searchPlaceholder: "Search",
|
|
110
|
+
onClick: undefined,
|
|
111
|
+
},
|
|
112
|
+
render: Template,
|
|
113
|
+
} as Meta<typeof RBSelectBox>;
|
|
114
|
+
|
|
115
|
+
// RBSelectBox는 마운트 시점 기준 300ms 이내의 클릭을 더블클릭 방지 가드로 무시하므로
|
|
116
|
+
// play 함수의 첫 클릭 전에 가드 구간을 지나도록 대기
|
|
117
|
+
const waitPastClickGuard = () =>
|
|
118
|
+
new Promise((resolve) => setTimeout(resolve, 350));
|
|
119
|
+
|
|
120
|
+
export const Default: StoryComponent = {
|
|
121
|
+
play: async ({ canvasElement }) => {
|
|
122
|
+
const canvas = within(canvasElement);
|
|
123
|
+
const doc = canvasElement.ownerDocument;
|
|
124
|
+
|
|
125
|
+
await waitPastClickGuard();
|
|
126
|
+
await userEvent.click(canvas.getByText("placeholder"));
|
|
127
|
+
|
|
128
|
+
const dropBox = await waitFor(() => {
|
|
129
|
+
const el = doc.querySelector('[data-slot="select-drop-box"]');
|
|
130
|
+
if (!el) throw new Error("drop box not opened");
|
|
131
|
+
return el as HTMLElement;
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
const option = within(dropBox).getByText("옵션 3");
|
|
135
|
+
await userEvent.click(option);
|
|
136
|
+
|
|
137
|
+
await waitFor(() => {
|
|
138
|
+
expect(
|
|
139
|
+
canvasElement.querySelector('[data-slot="select-box-value"] span')
|
|
140
|
+
?.textContent,
|
|
141
|
+
).toBe("옵션 3");
|
|
142
|
+
expect(doc.querySelector('[data-slot="select-drop-box"]')).toBeNull();
|
|
143
|
+
});
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export const HasInfoList: StoryComponent = {
|
|
148
|
+
args: {
|
|
149
|
+
value: "option-2",
|
|
150
|
+
},
|
|
151
|
+
render: HasInfoListTemplate,
|
|
152
|
+
play: async ({ canvasElement }) => {
|
|
153
|
+
const canvas = within(canvasElement);
|
|
154
|
+
const doc = canvasElement.ownerDocument;
|
|
155
|
+
// DropBox가 열려있을 때는 옵션 목록에도 같은 라벨 텍스트가 존재해
|
|
156
|
+
// canvas.getByText가 trigger와 옵션을 동시에 매칭해버리므로, trigger는
|
|
157
|
+
// select-box-value 슬롯을 직접 조회해 값이 바뀌었는지 확인한다
|
|
158
|
+
const getTriggerText = () =>
|
|
159
|
+
canvasElement.querySelector('[data-slot="select-box-value"] span')
|
|
160
|
+
?.textContent;
|
|
161
|
+
|
|
162
|
+
await waitPastClickGuard();
|
|
163
|
+
await userEvent.click(canvas.getByText("옵션 2"));
|
|
164
|
+
|
|
165
|
+
const dropBox = await waitFor(() => {
|
|
166
|
+
const el = doc.querySelector('[data-slot="select-drop-box"]');
|
|
167
|
+
if (!el) throw new Error("drop box not opened");
|
|
168
|
+
return el as HTMLElement;
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
const optionEls = within(dropBox).getAllByRole("button");
|
|
172
|
+
const disabledOption = optionEls.find((el) =>
|
|
173
|
+
el.textContent?.startsWith("옵션 3"),
|
|
174
|
+
);
|
|
175
|
+
expect(disabledOption?.textContent).toContain(
|
|
176
|
+
"Additional Information goes here",
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
// disabled 옵션은 클릭해도 선택이 바뀌지 않고 DropBox도 닫히지 않음
|
|
180
|
+
await userEvent.click(disabledOption!);
|
|
181
|
+
expect(getTriggerText()).toBe("옵션 2");
|
|
182
|
+
expect(doc.querySelector('[data-slot="select-drop-box"]')).not.toBeNull();
|
|
183
|
+
|
|
184
|
+
const enabledOption = optionEls.find((el) =>
|
|
185
|
+
el.textContent?.startsWith("옵션 1"),
|
|
186
|
+
);
|
|
187
|
+
await userEvent.click(enabledOption!);
|
|
188
|
+
|
|
189
|
+
await waitFor(() => {
|
|
190
|
+
expect(getTriggerText()).toBe("옵션 1");
|
|
191
|
+
expect(doc.querySelector('[data-slot="select-drop-box"]')).toBeNull();
|
|
192
|
+
});
|
|
193
|
+
},
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
export const MaxDropBoxHeight: StoryComponent = {
|
|
197
|
+
args: {
|
|
198
|
+
maxDropBoxHeight: 120,
|
|
199
|
+
},
|
|
200
|
+
play: async ({ canvasElement }) => {
|
|
201
|
+
const canvas = within(canvasElement);
|
|
202
|
+
|
|
203
|
+
await waitPastClickGuard();
|
|
204
|
+
await userEvent.click(canvas.getByText("placeholder"));
|
|
205
|
+
|
|
206
|
+
const doc = canvasElement.ownerDocument;
|
|
207
|
+
await waitFor(() => {
|
|
208
|
+
const dropBox = doc.querySelector(
|
|
209
|
+
'[data-slot="select-drop-box"]',
|
|
210
|
+
) as HTMLElement;
|
|
211
|
+
|
|
212
|
+
expect(dropBox).toBeTruthy();
|
|
213
|
+
expect(dropBox.getBoundingClientRect().height).toBeLessThanOrEqual(121);
|
|
214
|
+
});
|
|
215
|
+
},
|
|
216
|
+
};
|