@opentrons/components 0.1.7-alpha.1 → 0.2.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (251) hide show
  1. package/cssModuleSideEffect.ts +22 -0
  2. package/lib/assets/localization/en/index.d.ts +12 -0
  3. package/lib/assets/localization/index.d.ts +12 -0
  4. package/lib/atoms/AnimationVideo/index.d.ts +13 -0
  5. package/lib/atoms/InlineNotification/index.d.ts +1 -1
  6. package/lib/atoms/ListButton/ListButtonChildren/index.d.ts +0 -1
  7. package/lib/atoms/StyledText/PlaceholderStyledText.d.ts +14 -0
  8. package/lib/atoms/StyledText/index.d.ts +1 -0
  9. package/lib/atoms/buttons/BasicButton.d.ts +12 -0
  10. package/lib/atoms/buttons/index.d.ts +1 -0
  11. package/lib/atoms/index.d.ts +1 -0
  12. package/lib/hardware-sim/BaseDeck/BaseDeck.d.ts +10 -8
  13. package/lib/hardware-sim/Deck/FlexTrash.d.ts +4 -1
  14. package/lib/hardware-sim/Deck/MoveLabwareOnDeck.d.ts +3 -2
  15. package/lib/hardware-sim/Deck/RobotCoordsForeignDiv.d.ts +6 -5
  16. package/lib/hardware-sim/Deck/RobotCoordsForeignObject.d.ts +8 -5
  17. package/lib/hardware-sim/Deck/RobotCoordsText.d.ts +11 -1
  18. package/lib/hardware-sim/Deck/RobotWorkSpace.d.ts +30 -14
  19. package/lib/hardware-sim/Deck/__tests__/resolveLabwareLocation.test.d.ts +1 -0
  20. package/lib/hardware-sim/Deck/resolveLabwareLocation.d.ts +20 -0
  21. package/lib/hardware-sim/DeckConfigurator/AbsorbanceReaderItem.d.ts +11 -0
  22. package/lib/hardware-sim/DeckConfigurator/EmptyConfigItem.d.ts +11 -0
  23. package/lib/hardware-sim/DeckConfigurator/FlexStackerItem.d.ts +12 -0
  24. package/lib/hardware-sim/DeckConfigurator/HeaterShakerItem.d.ts +11 -0
  25. package/lib/hardware-sim/DeckConfigurator/MagneticBlockItem.d.ts +12 -0
  26. package/lib/hardware-sim/DeckConfigurator/StagingAreaConfigItem.d.ts +11 -0
  27. package/lib/hardware-sim/DeckConfigurator/{StaticFixture.d.ts → StaticItem.d.ts} +1 -1
  28. package/lib/hardware-sim/DeckConfigurator/TemperatureModuleItem.d.ts +11 -0
  29. package/lib/hardware-sim/DeckConfigurator/ThermocyclerItem.d.ts +11 -0
  30. package/lib/hardware-sim/DeckConfigurator/TrashBinConfigItem.d.ts +11 -0
  31. package/lib/hardware-sim/DeckConfigurator/WasteChuteConfigItem.d.ts +11 -0
  32. package/lib/hardware-sim/DeckConfigurator/constants.d.ts +5 -8
  33. package/lib/hardware-sim/DeckConfigurator/index.d.ts +4 -3
  34. package/lib/hardware-sim/Labware/CalibrationBlockRender.d.ts +15 -0
  35. package/lib/hardware-sim/Labware/Labware.d.ts +7 -8
  36. package/lib/hardware-sim/Labware/LabwareAdapter/index.d.ts +2 -2
  37. package/lib/hardware-sim/Labware/LabwareRender.d.ts +46 -5
  38. package/lib/hardware-sim/Labware/index.d.ts +1 -0
  39. package/lib/hardware-sim/Labware/labwareInternals/FilledWells.d.ts +3 -4
  40. package/lib/hardware-sim/Labware/labwareInternals/LabwareOutline.d.ts +20 -9
  41. package/lib/hardware-sim/Labware/labwareInternals/LabwareWellLabels.d.ts +2 -2
  42. package/lib/hardware-sim/Labware/labwareInternals/StaticLabware.d.ts +2 -2
  43. package/lib/hardware-sim/Labware/labwareInternals/StrokedWells.d.ts +2 -2
  44. package/lib/hardware-sim/Labware/labwareInternals/StyledWells.d.ts +2 -2
  45. package/lib/hardware-sim/Labware/labwareInternals/Well.d.ts +1 -2
  46. package/lib/hardware-sim/Labware/labwareInternals/WellLabels.d.ts +2 -2
  47. package/lib/hardware-sim/Module/index.d.ts +24 -2
  48. package/lib/hardware-sim/Pipette/PipetteRender.d.ts +2 -2
  49. package/lib/hardware-sim/RobotCoordinateSpace/RobotCoordinateSpace.d.ts +5 -3
  50. package/lib/hocs/withStyleProps.d.ts +26 -0
  51. package/lib/hooks/useConditionalConfirm.d.ts +4 -0
  52. package/lib/icons/Icon.d.ts +7 -7
  53. package/lib/icons/ModuleIcon.d.ts +4 -3
  54. package/lib/instrument/index.d.ts +0 -2
  55. package/lib/legacy-hardware-sim/index.d.ts +0 -1
  56. package/lib/lists/index.d.ts +0 -1
  57. package/lib/molecules/CustomizeExpandButton/__tests__/CustomizeExpandButton.test.d.ts +1 -0
  58. package/lib/molecules/CustomizeExpandButton/index.d.ts +29 -0
  59. package/lib/molecules/DeckInfoLabel/index.d.ts +8 -16
  60. package/lib/molecules/index.d.ts +2 -1
  61. package/lib/organisms/CommandText/index.d.ts +2 -2
  62. package/lib/organisms/CommandText/useCommandTextString/index.d.ts +2 -2
  63. package/lib/organisms/CommandText/useCommandTextString/utils/getLabwareDefinitionsFromCommands.d.ts +2 -2
  64. package/lib/organisms/CommandText/useCommandTextString/utils/getLabwareLocation.d.ts +3 -3
  65. package/lib/organisms/CommandText/useCommandTextString/utils/getLabwareName.d.ts +2 -2
  66. package/lib/organisms/FixtureOption/index.d.ts +2 -2
  67. package/lib/organisms/ProtocolDeck/index.d.ts +10 -0
  68. package/lib/organisms/ProtocolTimelineScrubber/CommandItem.d.ts +2 -2
  69. package/lib/organisms/ProtocolTimelineScrubber/utils.d.ts +2 -2
  70. package/lib/organisms/index.d.ts +1 -0
  71. package/lib/primitives/ForeignObject.d.ts +8 -18
  72. package/lib/primitives/style-props.d.ts +1 -1
  73. package/lib/structure/index.d.ts +2 -3
  74. package/package.json +6 -3
  75. package/src/alerts/alerts.module.css +2 -2
  76. package/src/assets/localization/en/deck_configuration.json +12 -0
  77. package/src/assets/localization/en/index.ts +2 -0
  78. package/src/assets/localization/en/protocol_command_text.json +1 -1
  79. package/src/atoms/AnimationVideo/__tests__/AnimationVideo.test.tsx +40 -0
  80. package/src/atoms/AnimationVideo/index.tsx +44 -0
  81. package/src/atoms/CheckboxField/__tests__/CheckboxField.test.tsx +0 -3
  82. package/src/atoms/CheckboxField/index.tsx +1 -1
  83. package/src/atoms/InlineNotification/index.tsx +86 -70
  84. package/src/atoms/ListButton/ListButton.stories.tsx +21 -7
  85. package/src/atoms/ListButton/ListButtonChildren/index.ts +0 -1
  86. package/src/atoms/ListItem/ListItemChildren/ListItemDescriptor.tsx +2 -2
  87. package/src/atoms/MenuList/OverflowBtn.tsx +39 -41
  88. package/src/atoms/Snackbar/Snackbar.stories.tsx +59 -23
  89. package/src/atoms/Snackbar/index.tsx +48 -38
  90. package/src/atoms/StyledText/PlaceholderStyledText.tsx +46 -0
  91. package/src/atoms/StyledText/index.ts +1 -0
  92. package/src/atoms/StyledText/placeholderstyledtext.module.css +25 -0
  93. package/src/atoms/buttons/BasicButton.tsx +100 -0
  94. package/src/atoms/buttons/SecondaryButton.tsx +5 -2
  95. package/src/atoms/buttons/__tests__/BasicButton.test.tsx +87 -0
  96. package/src/atoms/buttons/buttons.stories.tsx +91 -55
  97. package/src/atoms/buttons/index.ts +1 -0
  98. package/src/atoms/index.ts +1 -0
  99. package/src/buttons/buttons.module.css +92 -92
  100. package/src/controls/styles.module.css +15 -15
  101. package/src/forms/Select.module.css +23 -23
  102. package/src/forms/forms.module.css +38 -37
  103. package/src/hardware-sim/BaseDeck/BaseDeck.stories.tsx +7 -7
  104. package/src/hardware-sim/BaseDeck/BaseDeck.tsx +98 -61
  105. package/src/hardware-sim/BaseDeck/WasteChuteFixture.tsx +22 -28
  106. package/src/hardware-sim/BaseDeck/basedeck.module.css +20 -0
  107. package/src/hardware-sim/Deck/FlexTrash.tsx +50 -30
  108. package/src/hardware-sim/Deck/MoveLabwareOnDeck.stories.tsx +2 -2
  109. package/src/hardware-sim/Deck/MoveLabwareOnDeck.tsx +122 -156
  110. package/src/hardware-sim/Deck/RobotCoordsForeignDiv.tsx +35 -27
  111. package/src/hardware-sim/Deck/RobotCoordsForeignObject.tsx +32 -29
  112. package/src/hardware-sim/Deck/RobotCoordsText.tsx +12 -11
  113. package/src/hardware-sim/Deck/RobotWorkSpace.tsx +74 -54
  114. package/src/hardware-sim/Deck/SlotLabels.tsx +51 -51
  115. package/src/hardware-sim/Deck/__tests__/resolveLabwareLocation.test.ts +138 -0
  116. package/src/hardware-sim/Deck/deck.module.css +54 -0
  117. package/src/hardware-sim/Deck/resolveLabwareLocation.ts +154 -0
  118. package/src/hardware-sim/DeckConfigurator/{FlexStackerFixture.tsx → AbsorbanceReaderItem.tsx} +34 -31
  119. package/src/hardware-sim/DeckConfigurator/{EmptyConfigFixture.tsx → EmptyConfigItem.tsx} +72 -44
  120. package/src/hardware-sim/DeckConfigurator/{AbsorbanceReaderFixture.tsx → FlexStackerItem.tsx} +46 -27
  121. package/src/hardware-sim/DeckConfigurator/{HeaterShakerFixture.tsx → HeaterShakerItem.tsx} +40 -28
  122. package/src/hardware-sim/DeckConfigurator/{MagneticBlockFixture.tsx → MagneticBlockItem.tsx} +41 -58
  123. package/src/hardware-sim/DeckConfigurator/{StagingAreaConfigFixture.tsx → StagingAreaConfigItem.tsx} +41 -23
  124. package/src/hardware-sim/DeckConfigurator/{StaticFixture.tsx → StaticItem.tsx} +16 -9
  125. package/src/hardware-sim/DeckConfigurator/{TemperatureModuleFixture.tsx → TemperatureModuleItem.tsx} +42 -26
  126. package/src/hardware-sim/DeckConfigurator/{ThermocyclerFixture.tsx → ThermocyclerItem.tsx} +31 -21
  127. package/src/hardware-sim/DeckConfigurator/{TrashBinConfigFixture.tsx → TrashBinConfigItem.tsx} +42 -27
  128. package/src/hardware-sim/DeckConfigurator/{WasteChuteConfigFixture.tsx → WasteChuteConfigItem.tsx} +38 -27
  129. package/src/hardware-sim/DeckConfigurator/constants.ts +5 -9
  130. package/src/hardware-sim/DeckConfigurator/index.tsx +236 -206
  131. package/src/hardware-sim/Labware/CalibrationBlockRender.stories.tsx +49 -0
  132. package/src/hardware-sim/Labware/CalibrationBlockRender.tsx +172 -0
  133. package/src/hardware-sim/Labware/Labware.tsx +30 -15
  134. package/src/hardware-sim/Labware/LabwareAdapter/index.tsx +2 -2
  135. package/src/hardware-sim/Labware/LabwareRender.stories.tsx +36 -21
  136. package/src/hardware-sim/Labware/LabwareRender.tsx +70 -15
  137. package/src/hardware-sim/Labware/__tests__/Labware.test.tsx +9 -4
  138. package/src/hardware-sim/Labware/__tests__/LabwareRender.test.tsx +14 -5
  139. package/src/hardware-sim/Labware/index.ts +1 -0
  140. package/src/hardware-sim/Labware/labware.module.css +8 -0
  141. package/src/hardware-sim/Labware/labwareInternals/FilledWells.tsx +3 -4
  142. package/src/hardware-sim/Labware/labwareInternals/LabwareOutline.tsx +48 -23
  143. package/src/hardware-sim/Labware/labwareInternals/LabwareWellLabels.tsx +3 -3
  144. package/src/hardware-sim/Labware/labwareInternals/StaticLabware.tsx +2 -2
  145. package/src/hardware-sim/Labware/labwareInternals/StrokedWells.tsx +2 -2
  146. package/src/hardware-sim/Labware/labwareInternals/StyledWells.tsx +2 -2
  147. package/src/hardware-sim/Labware/labwareInternals/Well.tsx +1 -2
  148. package/src/hardware-sim/Labware/labwareInternals/WellLabels.tsx +10 -11
  149. package/src/hardware-sim/Labware/labwareInternals/__tests__/LabwareWellLabels.test.tsx +2 -2
  150. package/src/hardware-sim/Labware/labwareInternals/__tests__/StrokedWells.test.tsx +2 -2
  151. package/src/hardware-sim/Labware/labwareInternals/__tests__/WellLabels.test.tsx +2 -2
  152. package/src/hardware-sim/Module/Module.stories.tsx +45 -15
  153. package/src/hardware-sim/Module/Thermocycler/index.tsx +2 -2
  154. package/src/hardware-sim/Module/index.tsx +41 -18
  155. package/src/hardware-sim/Pipette/PipetteRender.stories.tsx +2 -2
  156. package/src/hardware-sim/Pipette/PipetteRender.tsx +5 -7
  157. package/src/hardware-sim/Pipette/__tests__/PipetteRender.test.tsx +2 -2
  158. package/src/hardware-sim/RobotCoordinateSpace/RobotCoordinateSpace.tsx +15 -14
  159. package/src/hardware-sim/RobotCoordinateSpace/robotcoordinatespace.module.css +3 -0
  160. package/src/hocs/withStyleProps.ts +53 -0
  161. package/src/hooks/useConditionalConfirm.ts +15 -5
  162. package/src/icons/Icon.tsx +38 -29
  163. package/src/icons/ModuleIcon.tsx +5 -3
  164. package/src/icons/icon-data.ts +26 -2
  165. package/src/icons/icon.module.css +10 -0
  166. package/src/index.module.css +1 -0
  167. package/src/instrument/InstrumentDiagram.tsx +0 -2
  168. package/src/instrument/PipetteSelect.module.css +3 -3
  169. package/src/instrument/index.ts +0 -2
  170. package/src/legacy-hardware-sim/LabwareNameOverlay.module.css +5 -5
  171. package/src/legacy-hardware-sim/ModuleItem.module.css +19 -19
  172. package/src/legacy-hardware-sim/index.ts +0 -1
  173. package/src/lists/index.ts +0 -1
  174. package/src/lists/lists.module.css +23 -23
  175. package/src/modals/modals.module.css +55 -55
  176. package/src/molecules/CustomizeExpandButton/__tests__/CustomizeExpandButton.test.tsx +88 -0
  177. package/src/molecules/CustomizeExpandButton/index.tsx +189 -0
  178. package/src/molecules/DeckInfoLabel/DeckInfoLabel.stories.tsx +10 -6
  179. package/src/molecules/DeckInfoLabel/__tests__/DeckInfoLabel.test.tsx +15 -11
  180. package/src/molecules/DeckInfoLabel/deckinfolabel.module.css +42 -0
  181. package/src/molecules/DeckInfoLabel/index.tsx +36 -62
  182. package/src/molecules/DropdownMenu/index.tsx +17 -13
  183. package/src/molecules/InfoScreen/index.tsx +6 -2
  184. package/src/molecules/ReleaseNotes/styles.module.css +15 -15
  185. package/src/molecules/index.ts +2 -1
  186. package/src/nav/SidePanel.module.css +6 -6
  187. package/src/organisms/CommandText/__tests__/CommandText.test.tsx +12 -12
  188. package/src/organisms/CommandText/index.tsx +2 -2
  189. package/src/organisms/CommandText/useCommandTextString/index.ts +2 -2
  190. package/src/organisms/CommandText/useCommandTextString/utils/__tests__/getFinalLabwareLocation.test.ts +4 -4
  191. package/src/organisms/CommandText/useCommandTextString/utils/commandText/__tests__/getPipettingCommandText.test.tsx +3 -3
  192. package/src/organisms/CommandText/useCommandTextString/utils/commandText/getFlexStackerCommandText.ts +2 -4
  193. package/src/organisms/CommandText/useCommandTextString/utils/commandText/getMoveToWellCommandText.ts +19 -3
  194. package/src/organisms/CommandText/useCommandTextString/utils/commandText/getPipettingCommandText.ts +19 -10
  195. package/src/organisms/CommandText/useCommandTextString/utils/getLabwareDefinitionsFromCommands.ts +9 -9
  196. package/src/organisms/CommandText/useCommandTextString/utils/getLabwareLocation.tsx +3 -3
  197. package/src/organisms/CommandText/useCommandTextString/utils/getLabwareName.ts +2 -2
  198. package/src/organisms/DeckLabelSet/index.tsx +1 -3
  199. package/src/organisms/FixtureOption/__tests__/FixtureOption.test.tsx +0 -2
  200. package/src/organisms/FixtureOption/index.tsx +42 -71
  201. package/src/organisms/ProtocolDeck/index.tsx +118 -0
  202. package/src/organisms/ProtocolTimelineScrubber/CommandItem.tsx +2 -2
  203. package/src/organisms/ProtocolTimelineScrubber/PipetteVisuals.tsx +1 -1
  204. package/src/organisms/ProtocolTimelineScrubber/utils.ts +3 -3
  205. package/src/organisms/index.ts +1 -0
  206. package/src/primitives/ForeignObject.tsx +20 -61
  207. package/src/primitives/style-props.ts +1 -0
  208. package/src/slotmap/styles.module.css +1 -1
  209. package/src/structure/Pill.module.css +1 -1
  210. package/src/structure/Splash.module.css +1 -1
  211. package/src/structure/index.ts +2 -4
  212. package/src/structure/structure.module.css +11 -11
  213. package/src/styles/colors.module.css +1 -0
  214. package/src/styles/global.css +179 -0
  215. package/src/styles/index.module.css +1 -1
  216. package/src/styles/typography.module.css +1 -0
  217. package/src/testing/utils/renderWithProviders.tsx +3 -6
  218. package/src/tooltips/tooltips.module.css +14 -14
  219. package/vite.config.mts +6 -3
  220. package/lib/atoms/ListButton/ListButtonChildren/ListButtonRadioButton.d.ts +0 -14
  221. package/lib/hardware-sim/DeckConfigurator/AbsorbanceReaderFixture.d.ts +0 -10
  222. package/lib/hardware-sim/DeckConfigurator/EmptyConfigFixture.d.ts +0 -8
  223. package/lib/hardware-sim/DeckConfigurator/FlexStackerFixture.d.ts +0 -11
  224. package/lib/hardware-sim/DeckConfigurator/HeaterShakerFixture.d.ts +0 -10
  225. package/lib/hardware-sim/DeckConfigurator/MagneticBlockFixture.d.ts +0 -11
  226. package/lib/hardware-sim/DeckConfigurator/StagingAreaConfigFixture.d.ts +0 -10
  227. package/lib/hardware-sim/DeckConfigurator/TemperatureModuleFixture.d.ts +0 -10
  228. package/lib/hardware-sim/DeckConfigurator/ThermocyclerFixture.d.ts +0 -10
  229. package/lib/hardware-sim/DeckConfigurator/TrashBinConfigFixture.d.ts +0 -10
  230. package/lib/hardware-sim/DeckConfigurator/WasteChuteConfigFixture.d.ts +0 -11
  231. package/lib/hardware-sim/utils.d.ts +0 -3
  232. package/lib/instrument/InstrumentGroup.d.ts +0 -11
  233. package/lib/instrument/InstrumentInfo.d.ts +0 -18
  234. package/lib/legacy-hardware-sim/ModuleItem.d.ts +0 -17
  235. package/lib/lists/TitledList.d.ts +0 -44
  236. package/lib/structure/Card.d.ts +0 -18
  237. package/src/atoms/ListButton/ListButtonChildren/ListButtonRadioButton.tsx +0 -109
  238. package/src/atoms/ListButton/__tests__/ListButtonRadioButton.test.tsx +0 -28
  239. package/src/hardware-sim/utils.ts +0 -18
  240. package/src/instrument/InstrumentDiagram.stories.tsx +0 -43
  241. package/src/instrument/InstrumentGroup.stories.tsx +0 -89
  242. package/src/instrument/InstrumentGroup.tsx +0 -35
  243. package/src/instrument/InstrumentInfo.tsx +0 -106
  244. package/src/instrument/__tests__/InstrumentInfo.test.tsx +0 -58
  245. package/src/instrument/instrument.module.css +0 -45
  246. package/src/legacy-hardware-sim/ModuleItem.tsx +0 -145
  247. package/src/lists/TitledList.tsx +0 -154
  248. package/src/structure/Card.stories.tsx +0 -29
  249. package/src/structure/Card.tsx +0 -65
  250. /package/lib/atoms/{ListButton/__tests__/ListButtonRadioButton.test.d.ts → AnimationVideo/__tests__/AnimationVideo.test.d.ts} +0 -0
  251. /package/lib/{instrument/__tests__/InstrumentInfo.test.d.ts → atoms/buttons/__tests__/BasicButton.test.d.ts} +0 -0
@@ -1,109 +0,0 @@
1
- import styled, { css } from 'styled-components'
2
-
3
- import { BORDERS, COLORS } from '../../../helix-design-system'
4
- import { Flex } from '../../../primitives'
5
- import { CURSOR_POINTER } from '../../../styles'
6
- import { SPACING } from '../../../ui-style-constants'
7
- import { StyledText } from '../../StyledText'
8
-
9
- import type { ChangeEventHandler, MouseEvent } from 'react'
10
- import type { StyleProps } from '../../../primitives'
11
-
12
- interface ListButtonRadioButtonProps extends StyleProps {
13
- buttonText: string
14
- buttonValue: string | number
15
- onChange: ChangeEventHandler<HTMLInputElement>
16
- setNoHover?: () => void
17
- setHovered?: () => void
18
- disabled?: boolean
19
- isSelected?: boolean
20
- id?: string
21
- }
22
-
23
- // used for helix and as a child button to ListButtonAccordion
24
- export function ListButtonRadioButton(
25
- props: ListButtonRadioButtonProps
26
- ): JSX.Element {
27
- const {
28
- buttonText,
29
- buttonValue,
30
- isSelected = false,
31
- onChange,
32
- disabled = false,
33
- setHovered,
34
- setNoHover,
35
- id = buttonText,
36
- } = props
37
-
38
- return (
39
- <Flex
40
- width="100%"
41
- margin={SPACING.spacing4}
42
- onClick={(e: MouseEvent) => {
43
- e.stopPropagation()
44
- }}
45
- >
46
- <SettingButton
47
- checked={isSelected}
48
- id={id}
49
- disabled={disabled}
50
- onChange={onChange}
51
- type="radio"
52
- value={buttonValue}
53
- />
54
- <SettingButtonLabel
55
- role="label"
56
- isSelected={isSelected}
57
- disabled={disabled}
58
- htmlFor={id}
59
- onMouseEnter={setHovered}
60
- onMouseLeave={setNoHover}
61
- >
62
- <StyledText desktopStyle="bodyDefaultRegular">{buttonText}</StyledText>
63
- </SettingButtonLabel>
64
- </Flex>
65
- )
66
- }
67
-
68
- const SettingButton = styled.input`
69
- display: none;
70
- `
71
-
72
- const AVAILABLE_BUTTON_STYLE = css`
73
- background: ${COLORS.white};
74
- color: ${COLORS.black90};
75
-
76
- &:hover {
77
- background-color: ${COLORS.grey10};
78
- }
79
- `
80
-
81
- const SELECTED_BUTTON_STYLE = css`
82
- background: ${COLORS.blue50};
83
- color: ${COLORS.white};
84
-
85
- &:active {
86
- background-color: ${COLORS.blue60};
87
- }
88
- `
89
-
90
- const DISABLED_STYLE = css`
91
- color: ${COLORS.grey40};
92
- background-color: ${COLORS.grey10};
93
- `
94
-
95
- interface ButtonLabelProps {
96
- isSelected: boolean
97
- disabled: boolean
98
- }
99
-
100
- const SettingButtonLabel = styled.label<ButtonLabelProps>`
101
- border-radius: ${BORDERS.borderRadius8};
102
- cursor: ${CURSOR_POINTER};
103
- padding: 14px ${SPACING.spacing12};
104
- width: 100%;
105
-
106
- ${({ isSelected }) =>
107
- isSelected ? SELECTED_BUTTON_STYLE : AVAILABLE_BUTTON_STYLE}
108
- ${({ disabled }) => disabled && DISABLED_STYLE}
109
- `
@@ -1,28 +0,0 @@
1
- import { fireEvent, screen } from '@testing-library/react'
2
- import { beforeEach, describe, expect, it, vi } from 'vitest'
3
-
4
- import { ListButtonRadioButton } from '..'
5
- import { renderWithProviders } from '../../../testing/utils'
6
-
7
- import type { ComponentProps } from 'react'
8
-
9
- const render = (props: ComponentProps<typeof ListButtonRadioButton>) =>
10
- renderWithProviders(<ListButtonRadioButton {...props} />)
11
-
12
- describe('ListButtonRadioButton', () => {
13
- let props: ComponentProps<typeof ListButtonRadioButton>
14
-
15
- beforeEach(() => {
16
- props = {
17
- buttonText: 'mock text',
18
- buttonValue: 'mockValue',
19
- onChange: vi.fn(),
20
- }
21
- })
22
-
23
- it('should render non nested accordion', () => {
24
- render(props)
25
- fireEvent.click(screen.getByText('mock text'))
26
- expect(props.onChange).toHaveBeenCalled()
27
- })
28
- })
@@ -1,18 +0,0 @@
1
- import type { AffineTransformMatrix } from '@opentrons/shared-data'
2
-
3
- export const IDENTITY_AFFINE_TRANSFORM: AffineTransformMatrix = [
4
- [1, 0, 0, 0],
5
- [0, 1, 0, 0],
6
- [0, 0, 1, 0],
7
- [0, 0, 0, 1],
8
- ]
9
-
10
- // multiply two matrices together (dot product)
11
- export function multiplyMatrices(a: number[][], b: number[][]): number[][] {
12
- const transposedB = b[0].map((_val, index) => b.map(row => row[index]))
13
- return a.map(rowA =>
14
- transposedB.map(rowB =>
15
- rowA.reduce((acc, valA, colIndexA) => acc + valA * rowB[colIndexA], 0)
16
- )
17
- )
18
- }
@@ -1,43 +0,0 @@
1
- import keyBy from 'lodash/keyBy'
2
-
3
- import { getAllPipetteNames, getPipetteNameSpecs } from '@opentrons/shared-data'
4
-
5
- import { InstrumentDiagram as InstrumentDiagramComponent } from './InstrumentDiagram'
6
-
7
- import type { Meta, Story } from '@storybook/react'
8
- import type * as React from 'react'
9
-
10
- const allPipetteSpecsByDisplayNames = keyBy(
11
- getAllPipetteNames().map(getPipetteNameSpecs),
12
- 'displayName'
13
- )
14
-
15
- export default {
16
- title: 'Library/Organisms/Instrument Diagram',
17
- argTypes: {
18
- mount: {
19
- control: {
20
- type: 'select',
21
- options: ['left', 'right'],
22
- },
23
- defaultValue: 'left',
24
- },
25
- pipetteSpecs: {
26
- control: {
27
- type: 'select',
28
- options: Object.keys(allPipetteSpecsByDisplayNames),
29
- },
30
- defaultValue: Object.keys(allPipetteSpecsByDisplayNames)[0],
31
- },
32
- },
33
- } as Meta
34
-
35
- const Template: Story<
36
- React.ComponentProps<typeof InstrumentDiagramComponent>
37
- > = ({ pipetteSpecs, ...args }) => (
38
- <InstrumentDiagramComponent
39
- {...args}
40
- pipetteSpecs={allPipetteSpecsByDisplayNames[pipetteSpecs]}
41
- />
42
- )
43
- export const InstrumentDiagram = Template.bind({})
@@ -1,89 +0,0 @@
1
- import keyBy from 'lodash/keyBy'
2
- import reduce from 'lodash/reduce'
3
-
4
- import { getAllPipetteNames, getPipetteNameSpecs } from '@opentrons/shared-data'
5
-
6
- import { InstrumentGroup as InstrumentGroupComponent } from './InstrumentGroup'
7
-
8
- import type { Meta, Story } from '@storybook/react'
9
- import type * as React from 'react'
10
-
11
- const allPipetteSpecsByDisplayNames = keyBy(
12
- getAllPipetteNames().map(getPipetteNameSpecs),
13
- 'displayName'
14
- )
15
- const leftPipettesByName = reduce(
16
- allPipetteSpecsByDisplayNames,
17
- (acc, pipetteSpecs, displayName) => {
18
- return {
19
- ...acc,
20
- [displayName]: {
21
- mount: 'left',
22
- description: displayName,
23
- pipetteSpecs,
24
- isDisabled: false,
25
- },
26
- }
27
- },
28
- {}
29
- )
30
- const rightPipettesByName = reduce(
31
- allPipetteSpecsByDisplayNames,
32
- (acc, pipetteSpecs, displayName) => {
33
- return {
34
- ...acc,
35
- [displayName]: {
36
- mount: 'right',
37
- description: displayName,
38
- pipetteSpecs,
39
- isDisabled: false,
40
- },
41
- }
42
- },
43
- {}
44
- )
45
-
46
- export default {
47
- title: 'Library/Organisms/Instrument Group',
48
- argTypes: {
49
- left: {
50
- control: {
51
- type: 'select',
52
- options: Object.keys(leftPipettesByName),
53
- },
54
- defaultValue: Object.keys(leftPipettesByName)[0],
55
- },
56
- right: {
57
- control: {
58
- type: 'select',
59
- options: Object.keys(rightPipettesByName),
60
- },
61
- defaultValue: Object.keys(rightPipettesByName)[0],
62
- },
63
- },
64
- } as Meta
65
-
66
- const Template: Story<
67
- React.ComponentProps<typeof InstrumentGroupComponent>
68
- > = ({ left, right, ...args }) => (
69
- <InstrumentGroupComponent
70
- {...args}
71
- left={leftPipettesByName[left]}
72
- right={rightPipettesByName[right]}
73
- />
74
- )
75
- export const InstrumentGroup = Template.bind({})
76
- InstrumentGroup.args = {
77
- left: {
78
- mount: 'left',
79
- description: 'p300 8-Channel',
80
- pipetteSpecs: { channels: 8, displayCategory: 'GEN1' },
81
- isDisabled: false,
82
- },
83
- right: {
84
- mount: 'right',
85
- description: 'p10 Single',
86
- pipetteSpecs: { channels: 1, displayCategory: 'GEN2' },
87
- isDisabled: true,
88
- },
89
- }
@@ -1,35 +0,0 @@
1
- import styles from './instrument.module.css'
2
- import { InstrumentInfo } from './InstrumentInfo'
3
-
4
- import type { InstrumentInfoProps } from './InstrumentInfo'
5
-
6
- export interface InstrumentGroupProps {
7
- showMountLabel?: boolean | null | undefined
8
- left?: InstrumentInfoProps | null | undefined
9
- right?: InstrumentInfoProps | null | undefined
10
- }
11
-
12
- const EMPTY_INSTRUMENT_PROPS = {
13
- description: 'None',
14
- tiprackModel: 'N/A',
15
- isDisabled: false,
16
- }
17
-
18
- /**
19
- * Renders a left and right pipette diagram & info.
20
- * Takes child `InstrumentInfo` props in `right` and `left` props.
21
- */
22
- export function InstrumentGroup(props: InstrumentGroupProps): JSX.Element {
23
- const { left, right, showMountLabel } = props
24
-
25
- const leftProps = left || { ...EMPTY_INSTRUMENT_PROPS, mount: 'left' }
26
- const rightProps = right || { ...EMPTY_INSTRUMENT_PROPS, mount: 'right' }
27
- return (
28
- <section className={styles.pipette_group}>
29
- <InstrumentInfo {...leftProps} showMountLabel={showMountLabel} />
30
- {leftProps.pipetteSpecs?.channels === 96 ? null : (
31
- <InstrumentInfo {...rightProps} showMountLabel={showMountLabel} />
32
- )}
33
- </section>
34
- )
35
- }
@@ -1,106 +0,0 @@
1
- import { LEFT, RIGHT } from '@opentrons/shared-data'
2
-
3
- import { LegacyStyledText } from '../atoms'
4
- import { Flex } from '../primitives'
5
- import { DIRECTION_COLUMN, JUSTIFY_CENTER } from '../styles'
6
- import { SPACING, TYPOGRAPHY } from '../ui-style-constants'
7
- import styles from './instrument.module.css'
8
- import { InstrumentDiagram } from './InstrumentDiagram'
9
-
10
- import type { ReactNode } from 'react'
11
- import type { Mount } from '../robot-types'
12
- import type { InstrumentDiagramProps } from './InstrumentDiagram'
13
-
14
- export interface InstrumentInfoProps {
15
- /** 'left' or 'right' */
16
- mount: Mount
17
- /** human-readable description, eg 'p300 Single-channel' */
18
- description: string
19
- /** specs of mounted pipette */
20
- pipetteSpecs?: InstrumentDiagramProps['pipetteSpecs'] | null
21
- /** paired tiprack models */
22
- tiprackModels?: string[]
23
- /** children to display under the info */
24
- children?: ReactNode
25
- /** if true, show labels 'LEFT PIPETTE' / 'RIGHT PIPETTE' */
26
- showMountLabel?: boolean | null
27
- }
28
-
29
- const MAX_WIDTH = '14rem'
30
-
31
- export function InstrumentInfo(props: InstrumentInfoProps): JSX.Element {
32
- const {
33
- mount,
34
- showMountLabel,
35
- description,
36
- tiprackModels,
37
- pipetteSpecs,
38
- children,
39
- } = props
40
-
41
- const has96Channel = pipetteSpecs?.channels === 96
42
- return (
43
- <Flex justifyContent={JUSTIFY_CENTER} gridGap={SPACING.spacing16}>
44
- {mount === RIGHT && pipetteSpecs ? (
45
- <InstrumentDiagram
46
- pipetteSpecs={pipetteSpecs}
47
- className={styles.pipette_icon}
48
- mount={mount}
49
- />
50
- ) : null}
51
- {/* NOTE: the color is our legacy c-font-dark, which matches the other colors in this component **/}
52
- <Flex
53
- flexDirection={DIRECTION_COLUMN}
54
- color="#4a4a4a"
55
- gridGap={SPACING.spacing8}
56
- >
57
- <Flex flexDirection={DIRECTION_COLUMN} gridGap={SPACING.spacing4}>
58
- <LegacyStyledText
59
- as="h3"
60
- fontWeight={TYPOGRAPHY.fontWeightSemiBold}
61
- textTransform={TYPOGRAPHY.textTransformCapitalize}
62
- >
63
- {showMountLabel && !has96Channel ? `${mount} pipette` : 'pipette'}
64
- </LegacyStyledText>
65
- <LegacyStyledText as="p" width="max-content" maxWidth={MAX_WIDTH}>
66
- {description}
67
- </LegacyStyledText>
68
- </Flex>
69
-
70
- <Flex flexDirection={DIRECTION_COLUMN} gridGap={SPACING.spacing4}>
71
- <LegacyStyledText as="h3" fontWeight={TYPOGRAPHY.fontWeightSemiBold}>
72
- {'Tip rack'}
73
- </LegacyStyledText>
74
- <ul>
75
- {tiprackModels != null && tiprackModels.length > 0 ? (
76
- tiprackModels.map((model, index) => (
77
- <li key={`${model}_${index}`}>
78
- <LegacyStyledText
79
- as="p"
80
- width="max-content"
81
- maxWidth={MAX_WIDTH}
82
- >
83
- {model}
84
- </LegacyStyledText>
85
- </li>
86
- ))
87
- ) : (
88
- <LegacyStyledText as="p" width="max-content" maxWidth={MAX_WIDTH}>
89
- {'None'}
90
- </LegacyStyledText>
91
- )}
92
- </ul>
93
- </Flex>
94
- </Flex>
95
-
96
- {children}
97
- {mount === LEFT && pipetteSpecs ? (
98
- <InstrumentDiagram
99
- pipetteSpecs={pipetteSpecs}
100
- className={styles.pipette_icon}
101
- mount={mount}
102
- />
103
- ) : null}
104
- </Flex>
105
- )
106
- }
@@ -1,58 +0,0 @@
1
- import { screen } from '@testing-library/react'
2
- import { beforeEach, describe, it, vi } from 'vitest'
3
-
4
- import { fixtureP1000SingleV2Specs, LEFT, RIGHT } from '@opentrons/shared-data'
5
-
6
- import { renderWithProviders } from '../../testing/utils'
7
- import { InstrumentDiagram } from '../InstrumentDiagram'
8
- import { InstrumentInfo } from '../InstrumentInfo'
9
-
10
- import type { ComponentProps } from 'react'
11
-
12
- vi.mock('../InstrumentDiagram')
13
-
14
- const render = (props: ComponentProps<typeof InstrumentInfo>) => {
15
- return renderWithProviders(<InstrumentInfo {...props} />)[0]
16
- }
17
-
18
- describe('InstrumentInfo', () => {
19
- let props: ComponentProps<typeof InstrumentInfo>
20
-
21
- beforeEach(() => {
22
- props = {
23
- mount: LEFT,
24
- description: 'mock description',
25
- pipetteSpecs: fixtureP1000SingleV2Specs,
26
- tiprackModels: ['mock1', 'mock2'],
27
- showMountLabel: true,
28
- }
29
- vi.mocked(InstrumentDiagram).mockReturnValue(
30
- <div>mock instrumentDiagram</div>
31
- )
32
- })
33
- it('renders a p1000 pipette with 2 tiprack models for left mount', () => {
34
- render(props)
35
- screen.getByText('mock instrumentDiagram')
36
- screen.getByText('left pipette')
37
- screen.getByText('mock description')
38
- screen.getByText('Tip rack')
39
- screen.getByText('mock1')
40
- screen.getByText('mock2')
41
- })
42
- it('renders a p1000 pipette with 1 tiprack model for right mount', () => {
43
- props.mount = RIGHT
44
- props.tiprackModels = ['mock1']
45
- render(props)
46
- screen.getByText('mock instrumentDiagram')
47
- screen.getByText('right pipette')
48
- screen.getByText('mock description')
49
- screen.getByText('Tip rack')
50
- screen.getByText('mock1')
51
- })
52
- it('renders none for pip and tiprack if none are selected', () => {
53
- props.pipetteSpecs = undefined
54
- props.tiprackModels = undefined
55
- render(props)
56
- screen.getByText('None')
57
- })
58
- })
@@ -1,45 +0,0 @@
1
- @import '@opentrons/components/styles';
2
-
3
- .pipette_group {
4
- margin: 0 auto;
5
- max-width: 46rem;
6
- padding-bottom: 2rem;
7
- display: grid;
8
- grid-template-columns: 50% 50%;
9
- grid-template-areas: 'left right';
10
- }
11
-
12
- .right {
13
- grid-area: right;
14
- grid-template-columns: 40% 80%;
15
- grid-template-areas: 'img info';
16
- }
17
-
18
- .pipette_info {
19
- grid-area: info;
20
- min-height: 8rem;
21
- }
22
-
23
- .flipped_image {
24
- transform: scaleX(-1);
25
- filter: FlipH;
26
- }
27
-
28
- .pipette_icon {
29
- grid-area: img;
30
- text-align: center;
31
- }
32
-
33
- .title {
34
- font-size: var(--fs-body-2);
35
- font-weight: var(--fw-semibold);
36
- color: var(--c-font-dark);
37
- text-transform: capitalize;
38
- margin: 2rem 0 0.25rem;
39
- }
40
-
41
- .value {
42
- font-size: var(--fs-body-2); /* from legacy --font-body-2-dark */
43
- font-weight: var(--fw-regular); /* from legacy --font-body-2-dark */
44
- color: var(--c-font-dark); /* from legacy --font-body-2-dark */
45
- }
@@ -1,145 +0,0 @@
1
- import cx from 'classnames'
2
-
3
- import {
4
- getModuleDisplayName,
5
- MAGNETIC_MODULE_V1,
6
- MAGNETIC_MODULE_V2,
7
- TEMPERATURE_MODULE_V1,
8
- TEMPERATURE_MODULE_V2,
9
- THERMOCYCLER_MODULE_V1,
10
- } from '@opentrons/shared-data'
11
-
12
- import { RobotCoordsForeignDiv } from '../hardware-sim/Deck'
13
- import { Icon } from '../icons'
14
- import styles from './ModuleItem.module.css'
15
-
16
- import type { DeckSlot, ModuleModel } from '@opentrons/shared-data'
17
- import type { IconName } from '../icons'
18
-
19
- const FLIPPED_SLOTS = ['3', '6', '9']
20
- export interface ModuleProps {
21
- /** module model */
22
- model: ModuleModel
23
- /** display mode: 'default', 'present', 'missing', or 'info' */
24
- mode: 'default' | 'present' | 'missing' | 'info'
25
- /** slot details of the location of this module */
26
- slot: DeckSlot
27
- /** USB port detail of the connected module */
28
- usbInfoString?: string
29
- }
30
-
31
- /**
32
- * Legacy App-specific Module Rendering. Removable after Protocol Upload Revamp release
33
- *
34
- * @deprecated Use {@link Module}
35
- */
36
- export function ModuleItem(props: ModuleProps): JSX.Element {
37
- const { model, slot } = props
38
- let x = 0
39
- let y = 0
40
- let { xDimension: width, yDimension: height } = slot.boundingBox
41
- const shouldFlip = FLIPPED_SLOTS.includes(slot.id)
42
-
43
- // TODO: BC 2019-7-23 get these from shared-data module defs, once available
44
- switch (model) {
45
- case MAGNETIC_MODULE_V1:
46
- case MAGNETIC_MODULE_V2: {
47
- width = 137
48
- height = 91
49
- x = -7
50
- y = 4
51
- break
52
- }
53
- case TEMPERATURE_MODULE_V1:
54
- case TEMPERATURE_MODULE_V2: {
55
- width = 196
56
- height = 91
57
- x = -66
58
- y = 4
59
- break
60
- }
61
- case THERMOCYCLER_MODULE_V1: {
62
- // TODO: BC 2019-07-24 these are taken from snapshots of the cad file, they should
63
- // be included in the module spec schema and added to the data
64
- width = 172
65
- height = 259.7
66
- x = -22.125
67
- }
68
- }
69
-
70
- return (
71
- <RobotCoordsForeignDiv
72
- width={width}
73
- height={height}
74
- x={x}
75
- y={y - height}
76
- transformWithSVG
77
- extraTransform={`rotate(${shouldFlip ? 180 : 0}, ${
78
- slot.boundingBox.xDimension / 2
79
- }, ${slot.boundingBox.yDimension / -2})`}
80
- innerDivProps={{
81
- className: cx(styles.module, { [styles.flipped]: shouldFlip }),
82
- }}
83
- >
84
- <ModuleItemContents {...props} shouldFlip={shouldFlip} />
85
- </RobotCoordsForeignDiv>
86
- )
87
- }
88
-
89
- interface ModuleItemContentsProps extends ModuleProps {
90
- shouldFlip: boolean
91
- }
92
-
93
- function ModuleItemContents(props: ModuleItemContentsProps): JSX.Element {
94
- const { mode, model, usbInfoString, shouldFlip } = props
95
- const displayName = getModuleDisplayName(model)
96
-
97
- const iconClassName = cx(styles.module_review_icon, {
98
- [styles.module_review_icon_missing]: mode === 'missing',
99
- [styles.module_review_icon_present]: mode === 'present',
100
- })
101
-
102
- const iconNameByMode: Record<string, IconName> = {
103
- missing: 'alert-circle',
104
- present: 'check-circle',
105
- info: 'usb',
106
- default: 'usb',
107
- }
108
-
109
- return (
110
- <>
111
- <div
112
- className={
113
- shouldFlip ? styles.flipped_module_wrapper : styles.module_wrapper
114
- }
115
- >
116
- {mode !== 'missing' && usbInfoString && (
117
- <p
118
- key="usbPortInfo"
119
- className={
120
- usbInfoString.includes('N/A')
121
- ? styles.module_port_text_na
122
- : styles.module_port_text
123
- }
124
- >
125
- {usbInfoString}
126
- </p>
127
- )}
128
- <p key="displayName" className={styles.module_review_text}>
129
- {displayName}
130
- </p>
131
- <div className={styles.module_connect_info_wrapper}>
132
- <Icon
133
- key="icon"
134
- className={iconClassName}
135
- x="8"
136
- y="0"
137
- svgWidth="12"
138
- name={iconNameByMode[mode] || 'usb'}
139
- />
140
- <p>{mode === 'missing' ? 'Not connected' : 'Connected'}</p>
141
- </div>
142
- </div>
143
- </>
144
- )
145
- }