@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.
- package/cssModuleSideEffect.ts +22 -0
- package/lib/assets/localization/en/index.d.ts +12 -0
- package/lib/assets/localization/index.d.ts +12 -0
- package/lib/atoms/AnimationVideo/index.d.ts +13 -0
- package/lib/atoms/InlineNotification/index.d.ts +1 -1
- package/lib/atoms/ListButton/ListButtonChildren/index.d.ts +0 -1
- package/lib/atoms/StyledText/PlaceholderStyledText.d.ts +14 -0
- package/lib/atoms/StyledText/index.d.ts +1 -0
- package/lib/atoms/buttons/BasicButton.d.ts +12 -0
- package/lib/atoms/buttons/index.d.ts +1 -0
- package/lib/atoms/index.d.ts +1 -0
- package/lib/hardware-sim/BaseDeck/BaseDeck.d.ts +10 -8
- package/lib/hardware-sim/Deck/FlexTrash.d.ts +4 -1
- package/lib/hardware-sim/Deck/MoveLabwareOnDeck.d.ts +3 -2
- package/lib/hardware-sim/Deck/RobotCoordsForeignDiv.d.ts +6 -5
- package/lib/hardware-sim/Deck/RobotCoordsForeignObject.d.ts +8 -5
- package/lib/hardware-sim/Deck/RobotCoordsText.d.ts +11 -1
- package/lib/hardware-sim/Deck/RobotWorkSpace.d.ts +30 -14
- package/lib/hardware-sim/Deck/__tests__/resolveLabwareLocation.test.d.ts +1 -0
- package/lib/hardware-sim/Deck/resolveLabwareLocation.d.ts +20 -0
- package/lib/hardware-sim/DeckConfigurator/AbsorbanceReaderItem.d.ts +11 -0
- package/lib/hardware-sim/DeckConfigurator/EmptyConfigItem.d.ts +11 -0
- package/lib/hardware-sim/DeckConfigurator/FlexStackerItem.d.ts +12 -0
- package/lib/hardware-sim/DeckConfigurator/HeaterShakerItem.d.ts +11 -0
- package/lib/hardware-sim/DeckConfigurator/MagneticBlockItem.d.ts +12 -0
- package/lib/hardware-sim/DeckConfigurator/StagingAreaConfigItem.d.ts +11 -0
- package/lib/hardware-sim/DeckConfigurator/{StaticFixture.d.ts → StaticItem.d.ts} +1 -1
- package/lib/hardware-sim/DeckConfigurator/TemperatureModuleItem.d.ts +11 -0
- package/lib/hardware-sim/DeckConfigurator/ThermocyclerItem.d.ts +11 -0
- package/lib/hardware-sim/DeckConfigurator/TrashBinConfigItem.d.ts +11 -0
- package/lib/hardware-sim/DeckConfigurator/WasteChuteConfigItem.d.ts +11 -0
- package/lib/hardware-sim/DeckConfigurator/constants.d.ts +5 -8
- package/lib/hardware-sim/DeckConfigurator/index.d.ts +4 -3
- package/lib/hardware-sim/Labware/CalibrationBlockRender.d.ts +15 -0
- package/lib/hardware-sim/Labware/Labware.d.ts +7 -8
- package/lib/hardware-sim/Labware/LabwareAdapter/index.d.ts +2 -2
- package/lib/hardware-sim/Labware/LabwareRender.d.ts +46 -5
- package/lib/hardware-sim/Labware/index.d.ts +1 -0
- package/lib/hardware-sim/Labware/labwareInternals/FilledWells.d.ts +3 -4
- package/lib/hardware-sim/Labware/labwareInternals/LabwareOutline.d.ts +20 -9
- package/lib/hardware-sim/Labware/labwareInternals/LabwareWellLabels.d.ts +2 -2
- package/lib/hardware-sim/Labware/labwareInternals/StaticLabware.d.ts +2 -2
- package/lib/hardware-sim/Labware/labwareInternals/StrokedWells.d.ts +2 -2
- package/lib/hardware-sim/Labware/labwareInternals/StyledWells.d.ts +2 -2
- package/lib/hardware-sim/Labware/labwareInternals/Well.d.ts +1 -2
- package/lib/hardware-sim/Labware/labwareInternals/WellLabels.d.ts +2 -2
- package/lib/hardware-sim/Module/index.d.ts +24 -2
- package/lib/hardware-sim/Pipette/PipetteRender.d.ts +2 -2
- package/lib/hardware-sim/RobotCoordinateSpace/RobotCoordinateSpace.d.ts +5 -3
- package/lib/hocs/withStyleProps.d.ts +26 -0
- package/lib/hooks/useConditionalConfirm.d.ts +4 -0
- package/lib/icons/Icon.d.ts +7 -7
- package/lib/icons/ModuleIcon.d.ts +4 -3
- package/lib/instrument/index.d.ts +0 -2
- package/lib/legacy-hardware-sim/index.d.ts +0 -1
- package/lib/lists/index.d.ts +0 -1
- package/lib/molecules/CustomizeExpandButton/__tests__/CustomizeExpandButton.test.d.ts +1 -0
- package/lib/molecules/CustomizeExpandButton/index.d.ts +29 -0
- package/lib/molecules/DeckInfoLabel/index.d.ts +8 -16
- package/lib/molecules/index.d.ts +2 -1
- package/lib/organisms/CommandText/index.d.ts +2 -2
- package/lib/organisms/CommandText/useCommandTextString/index.d.ts +2 -2
- package/lib/organisms/CommandText/useCommandTextString/utils/getLabwareDefinitionsFromCommands.d.ts +2 -2
- package/lib/organisms/CommandText/useCommandTextString/utils/getLabwareLocation.d.ts +3 -3
- package/lib/organisms/CommandText/useCommandTextString/utils/getLabwareName.d.ts +2 -2
- package/lib/organisms/FixtureOption/index.d.ts +2 -2
- package/lib/organisms/ProtocolDeck/index.d.ts +10 -0
- package/lib/organisms/ProtocolTimelineScrubber/CommandItem.d.ts +2 -2
- package/lib/organisms/ProtocolTimelineScrubber/utils.d.ts +2 -2
- package/lib/organisms/index.d.ts +1 -0
- package/lib/primitives/ForeignObject.d.ts +8 -18
- package/lib/primitives/style-props.d.ts +1 -1
- package/lib/structure/index.d.ts +2 -3
- package/package.json +6 -3
- package/src/alerts/alerts.module.css +2 -2
- package/src/assets/localization/en/deck_configuration.json +12 -0
- package/src/assets/localization/en/index.ts +2 -0
- package/src/assets/localization/en/protocol_command_text.json +1 -1
- package/src/atoms/AnimationVideo/__tests__/AnimationVideo.test.tsx +40 -0
- package/src/atoms/AnimationVideo/index.tsx +44 -0
- package/src/atoms/CheckboxField/__tests__/CheckboxField.test.tsx +0 -3
- package/src/atoms/CheckboxField/index.tsx +1 -1
- package/src/atoms/InlineNotification/index.tsx +86 -70
- package/src/atoms/ListButton/ListButton.stories.tsx +21 -7
- package/src/atoms/ListButton/ListButtonChildren/index.ts +0 -1
- package/src/atoms/ListItem/ListItemChildren/ListItemDescriptor.tsx +2 -2
- package/src/atoms/MenuList/OverflowBtn.tsx +39 -41
- package/src/atoms/Snackbar/Snackbar.stories.tsx +59 -23
- package/src/atoms/Snackbar/index.tsx +48 -38
- package/src/atoms/StyledText/PlaceholderStyledText.tsx +46 -0
- package/src/atoms/StyledText/index.ts +1 -0
- package/src/atoms/StyledText/placeholderstyledtext.module.css +25 -0
- package/src/atoms/buttons/BasicButton.tsx +100 -0
- package/src/atoms/buttons/SecondaryButton.tsx +5 -2
- package/src/atoms/buttons/__tests__/BasicButton.test.tsx +87 -0
- package/src/atoms/buttons/buttons.stories.tsx +91 -55
- package/src/atoms/buttons/index.ts +1 -0
- package/src/atoms/index.ts +1 -0
- package/src/buttons/buttons.module.css +92 -92
- package/src/controls/styles.module.css +15 -15
- package/src/forms/Select.module.css +23 -23
- package/src/forms/forms.module.css +38 -37
- package/src/hardware-sim/BaseDeck/BaseDeck.stories.tsx +7 -7
- package/src/hardware-sim/BaseDeck/BaseDeck.tsx +98 -61
- package/src/hardware-sim/BaseDeck/WasteChuteFixture.tsx +22 -28
- package/src/hardware-sim/BaseDeck/basedeck.module.css +20 -0
- package/src/hardware-sim/Deck/FlexTrash.tsx +50 -30
- package/src/hardware-sim/Deck/MoveLabwareOnDeck.stories.tsx +2 -2
- package/src/hardware-sim/Deck/MoveLabwareOnDeck.tsx +122 -156
- package/src/hardware-sim/Deck/RobotCoordsForeignDiv.tsx +35 -27
- package/src/hardware-sim/Deck/RobotCoordsForeignObject.tsx +32 -29
- package/src/hardware-sim/Deck/RobotCoordsText.tsx +12 -11
- package/src/hardware-sim/Deck/RobotWorkSpace.tsx +74 -54
- package/src/hardware-sim/Deck/SlotLabels.tsx +51 -51
- package/src/hardware-sim/Deck/__tests__/resolveLabwareLocation.test.ts +138 -0
- package/src/hardware-sim/Deck/deck.module.css +54 -0
- package/src/hardware-sim/Deck/resolveLabwareLocation.ts +154 -0
- package/src/hardware-sim/DeckConfigurator/{FlexStackerFixture.tsx → AbsorbanceReaderItem.tsx} +34 -31
- package/src/hardware-sim/DeckConfigurator/{EmptyConfigFixture.tsx → EmptyConfigItem.tsx} +72 -44
- package/src/hardware-sim/DeckConfigurator/{AbsorbanceReaderFixture.tsx → FlexStackerItem.tsx} +46 -27
- package/src/hardware-sim/DeckConfigurator/{HeaterShakerFixture.tsx → HeaterShakerItem.tsx} +40 -28
- package/src/hardware-sim/DeckConfigurator/{MagneticBlockFixture.tsx → MagneticBlockItem.tsx} +41 -58
- package/src/hardware-sim/DeckConfigurator/{StagingAreaConfigFixture.tsx → StagingAreaConfigItem.tsx} +41 -23
- package/src/hardware-sim/DeckConfigurator/{StaticFixture.tsx → StaticItem.tsx} +16 -9
- package/src/hardware-sim/DeckConfigurator/{TemperatureModuleFixture.tsx → TemperatureModuleItem.tsx} +42 -26
- package/src/hardware-sim/DeckConfigurator/{ThermocyclerFixture.tsx → ThermocyclerItem.tsx} +31 -21
- package/src/hardware-sim/DeckConfigurator/{TrashBinConfigFixture.tsx → TrashBinConfigItem.tsx} +42 -27
- package/src/hardware-sim/DeckConfigurator/{WasteChuteConfigFixture.tsx → WasteChuteConfigItem.tsx} +38 -27
- package/src/hardware-sim/DeckConfigurator/constants.ts +5 -9
- package/src/hardware-sim/DeckConfigurator/index.tsx +236 -206
- package/src/hardware-sim/Labware/CalibrationBlockRender.stories.tsx +49 -0
- package/src/hardware-sim/Labware/CalibrationBlockRender.tsx +172 -0
- package/src/hardware-sim/Labware/Labware.tsx +30 -15
- package/src/hardware-sim/Labware/LabwareAdapter/index.tsx +2 -2
- package/src/hardware-sim/Labware/LabwareRender.stories.tsx +36 -21
- package/src/hardware-sim/Labware/LabwareRender.tsx +70 -15
- package/src/hardware-sim/Labware/__tests__/Labware.test.tsx +9 -4
- package/src/hardware-sim/Labware/__tests__/LabwareRender.test.tsx +14 -5
- package/src/hardware-sim/Labware/index.ts +1 -0
- package/src/hardware-sim/Labware/labware.module.css +8 -0
- package/src/hardware-sim/Labware/labwareInternals/FilledWells.tsx +3 -4
- package/src/hardware-sim/Labware/labwareInternals/LabwareOutline.tsx +48 -23
- package/src/hardware-sim/Labware/labwareInternals/LabwareWellLabels.tsx +3 -3
- package/src/hardware-sim/Labware/labwareInternals/StaticLabware.tsx +2 -2
- package/src/hardware-sim/Labware/labwareInternals/StrokedWells.tsx +2 -2
- package/src/hardware-sim/Labware/labwareInternals/StyledWells.tsx +2 -2
- package/src/hardware-sim/Labware/labwareInternals/Well.tsx +1 -2
- package/src/hardware-sim/Labware/labwareInternals/WellLabels.tsx +10 -11
- package/src/hardware-sim/Labware/labwareInternals/__tests__/LabwareWellLabels.test.tsx +2 -2
- package/src/hardware-sim/Labware/labwareInternals/__tests__/StrokedWells.test.tsx +2 -2
- package/src/hardware-sim/Labware/labwareInternals/__tests__/WellLabels.test.tsx +2 -2
- package/src/hardware-sim/Module/Module.stories.tsx +45 -15
- package/src/hardware-sim/Module/Thermocycler/index.tsx +2 -2
- package/src/hardware-sim/Module/index.tsx +41 -18
- package/src/hardware-sim/Pipette/PipetteRender.stories.tsx +2 -2
- package/src/hardware-sim/Pipette/PipetteRender.tsx +5 -7
- package/src/hardware-sim/Pipette/__tests__/PipetteRender.test.tsx +2 -2
- package/src/hardware-sim/RobotCoordinateSpace/RobotCoordinateSpace.tsx +15 -14
- package/src/hardware-sim/RobotCoordinateSpace/robotcoordinatespace.module.css +3 -0
- package/src/hocs/withStyleProps.ts +53 -0
- package/src/hooks/useConditionalConfirm.ts +15 -5
- package/src/icons/Icon.tsx +38 -29
- package/src/icons/ModuleIcon.tsx +5 -3
- package/src/icons/icon-data.ts +26 -2
- package/src/icons/icon.module.css +10 -0
- package/src/index.module.css +1 -0
- package/src/instrument/InstrumentDiagram.tsx +0 -2
- package/src/instrument/PipetteSelect.module.css +3 -3
- package/src/instrument/index.ts +0 -2
- package/src/legacy-hardware-sim/LabwareNameOverlay.module.css +5 -5
- package/src/legacy-hardware-sim/ModuleItem.module.css +19 -19
- package/src/legacy-hardware-sim/index.ts +0 -1
- package/src/lists/index.ts +0 -1
- package/src/lists/lists.module.css +23 -23
- package/src/modals/modals.module.css +55 -55
- package/src/molecules/CustomizeExpandButton/__tests__/CustomizeExpandButton.test.tsx +88 -0
- package/src/molecules/CustomizeExpandButton/index.tsx +189 -0
- package/src/molecules/DeckInfoLabel/DeckInfoLabel.stories.tsx +10 -6
- package/src/molecules/DeckInfoLabel/__tests__/DeckInfoLabel.test.tsx +15 -11
- package/src/molecules/DeckInfoLabel/deckinfolabel.module.css +42 -0
- package/src/molecules/DeckInfoLabel/index.tsx +36 -62
- package/src/molecules/DropdownMenu/index.tsx +17 -13
- package/src/molecules/InfoScreen/index.tsx +6 -2
- package/src/molecules/ReleaseNotes/styles.module.css +15 -15
- package/src/molecules/index.ts +2 -1
- package/src/nav/SidePanel.module.css +6 -6
- package/src/organisms/CommandText/__tests__/CommandText.test.tsx +12 -12
- package/src/organisms/CommandText/index.tsx +2 -2
- package/src/organisms/CommandText/useCommandTextString/index.ts +2 -2
- package/src/organisms/CommandText/useCommandTextString/utils/__tests__/getFinalLabwareLocation.test.ts +4 -4
- package/src/organisms/CommandText/useCommandTextString/utils/commandText/__tests__/getPipettingCommandText.test.tsx +3 -3
- package/src/organisms/CommandText/useCommandTextString/utils/commandText/getFlexStackerCommandText.ts +2 -4
- package/src/organisms/CommandText/useCommandTextString/utils/commandText/getMoveToWellCommandText.ts +19 -3
- package/src/organisms/CommandText/useCommandTextString/utils/commandText/getPipettingCommandText.ts +19 -10
- package/src/organisms/CommandText/useCommandTextString/utils/getLabwareDefinitionsFromCommands.ts +9 -9
- package/src/organisms/CommandText/useCommandTextString/utils/getLabwareLocation.tsx +3 -3
- package/src/organisms/CommandText/useCommandTextString/utils/getLabwareName.ts +2 -2
- package/src/organisms/DeckLabelSet/index.tsx +1 -3
- package/src/organisms/FixtureOption/__tests__/FixtureOption.test.tsx +0 -2
- package/src/organisms/FixtureOption/index.tsx +42 -71
- package/src/organisms/ProtocolDeck/index.tsx +118 -0
- package/src/organisms/ProtocolTimelineScrubber/CommandItem.tsx +2 -2
- package/src/organisms/ProtocolTimelineScrubber/PipetteVisuals.tsx +1 -1
- package/src/organisms/ProtocolTimelineScrubber/utils.ts +3 -3
- package/src/organisms/index.ts +1 -0
- package/src/primitives/ForeignObject.tsx +20 -61
- package/src/primitives/style-props.ts +1 -0
- package/src/slotmap/styles.module.css +1 -1
- package/src/structure/Pill.module.css +1 -1
- package/src/structure/Splash.module.css +1 -1
- package/src/structure/index.ts +2 -4
- package/src/structure/structure.module.css +11 -11
- package/src/styles/colors.module.css +1 -0
- package/src/styles/global.css +179 -0
- package/src/styles/index.module.css +1 -1
- package/src/styles/typography.module.css +1 -0
- package/src/testing/utils/renderWithProviders.tsx +3 -6
- package/src/tooltips/tooltips.module.css +14 -14
- package/vite.config.mts +6 -3
- package/lib/atoms/ListButton/ListButtonChildren/ListButtonRadioButton.d.ts +0 -14
- package/lib/hardware-sim/DeckConfigurator/AbsorbanceReaderFixture.d.ts +0 -10
- package/lib/hardware-sim/DeckConfigurator/EmptyConfigFixture.d.ts +0 -8
- package/lib/hardware-sim/DeckConfigurator/FlexStackerFixture.d.ts +0 -11
- package/lib/hardware-sim/DeckConfigurator/HeaterShakerFixture.d.ts +0 -10
- package/lib/hardware-sim/DeckConfigurator/MagneticBlockFixture.d.ts +0 -11
- package/lib/hardware-sim/DeckConfigurator/StagingAreaConfigFixture.d.ts +0 -10
- package/lib/hardware-sim/DeckConfigurator/TemperatureModuleFixture.d.ts +0 -10
- package/lib/hardware-sim/DeckConfigurator/ThermocyclerFixture.d.ts +0 -10
- package/lib/hardware-sim/DeckConfigurator/TrashBinConfigFixture.d.ts +0 -10
- package/lib/hardware-sim/DeckConfigurator/WasteChuteConfigFixture.d.ts +0 -11
- package/lib/hardware-sim/utils.d.ts +0 -3
- package/lib/instrument/InstrumentGroup.d.ts +0 -11
- package/lib/instrument/InstrumentInfo.d.ts +0 -18
- package/lib/legacy-hardware-sim/ModuleItem.d.ts +0 -17
- package/lib/lists/TitledList.d.ts +0 -44
- package/lib/structure/Card.d.ts +0 -18
- package/src/atoms/ListButton/ListButtonChildren/ListButtonRadioButton.tsx +0 -109
- package/src/atoms/ListButton/__tests__/ListButtonRadioButton.test.tsx +0 -28
- package/src/hardware-sim/utils.ts +0 -18
- package/src/instrument/InstrumentDiagram.stories.tsx +0 -43
- package/src/instrument/InstrumentGroup.stories.tsx +0 -89
- package/src/instrument/InstrumentGroup.tsx +0 -35
- package/src/instrument/InstrumentInfo.tsx +0 -106
- package/src/instrument/__tests__/InstrumentInfo.test.tsx +0 -58
- package/src/instrument/instrument.module.css +0 -45
- package/src/legacy-hardware-sim/ModuleItem.tsx +0 -145
- package/src/lists/TitledList.tsx +0 -154
- package/src/structure/Card.stories.tsx +0 -29
- package/src/structure/Card.tsx +0 -65
- /package/lib/atoms/{ListButton/__tests__/ListButtonRadioButton.test.d.ts → AnimationVideo/__tests__/AnimationVideo.test.d.ts} +0 -0
- /package/lib/{instrument/__tests__/InstrumentInfo.test.d.ts → atoms/buttons/__tests__/BasicButton.test.d.ts} +0 -0
package/src/lists/TitledList.tsx
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
// TitledList component
|
|
2
|
-
import { Children } from 'react'
|
|
3
|
-
import cx from 'classnames'
|
|
4
|
-
|
|
5
|
-
import { LegacyStyledText } from '../atoms'
|
|
6
|
-
import { COLORS } from '../helix-design-system'
|
|
7
|
-
import { Icon } from '../icons'
|
|
8
|
-
import styles from './lists.module.css'
|
|
9
|
-
|
|
10
|
-
import type { MouseEvent, ReactNode } from 'react'
|
|
11
|
-
import type { IconName, IconProps } from '../icons'
|
|
12
|
-
|
|
13
|
-
// TODO(bc, 2021-03-31): reconsider whether this belongs in components library
|
|
14
|
-
// it is bloated with application specific functionality
|
|
15
|
-
|
|
16
|
-
export interface TitledListProps {
|
|
17
|
-
/** id attribute */
|
|
18
|
-
id?: string
|
|
19
|
-
/** text of title */
|
|
20
|
-
title: string
|
|
21
|
-
/** optional icon left of the title */
|
|
22
|
-
iconName?: IconName | null | undefined
|
|
23
|
-
/** props passed down to icon (`className` and `name` are ignored) */
|
|
24
|
-
iconProps?: Omit<IconProps, 'name'>
|
|
25
|
-
/** optional data test id for the container */
|
|
26
|
-
'data-test'?: string
|
|
27
|
-
// TODO(mc, 2018-01-25): enforce <li> children requirement with flow
|
|
28
|
-
/** children must all be `<li>` */
|
|
29
|
-
children?: ReactNode
|
|
30
|
-
/** additional classnames */
|
|
31
|
-
className?: string
|
|
32
|
-
/** component with descriptive text about the list */
|
|
33
|
-
description?: ReactNode
|
|
34
|
-
/** optional click action (on title div, not children) */
|
|
35
|
-
onClick?: (event: MouseEvent) => unknown
|
|
36
|
-
/** optional right click action (on wrapping div) */
|
|
37
|
-
onContextMenu?: (event: MouseEvent) => unknown
|
|
38
|
-
/** optional mouseEnter action */
|
|
39
|
-
onMouseEnter?: (event: MouseEvent) => unknown
|
|
40
|
-
/** optional mouseLeave action */
|
|
41
|
-
onMouseLeave?: (event: MouseEvent) => unknown
|
|
42
|
-
/** caret click action; if defined, list is expandable and carat is visible */
|
|
43
|
-
onCollapseToggle?: (event: MouseEvent) => unknown
|
|
44
|
-
/** collapse the list if true (false by default) */
|
|
45
|
-
collapsed?: boolean
|
|
46
|
-
/** set to true when TitledList is selected (eg, user clicked it) */
|
|
47
|
-
selected?: boolean
|
|
48
|
-
/** set to true when TitledList is hovered (but not when its contents are hovered) */
|
|
49
|
-
hovered?: boolean
|
|
50
|
-
/** disables the whole TitledList if true */
|
|
51
|
-
disabled?: boolean
|
|
52
|
-
/** appear disabled, but preserve collapsibility */
|
|
53
|
-
inert?: boolean
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* An ordered list with optional title, icon, and description.
|
|
58
|
-
*/
|
|
59
|
-
export function TitledList(props: TitledListProps): JSX.Element {
|
|
60
|
-
const {
|
|
61
|
-
id,
|
|
62
|
-
iconName,
|
|
63
|
-
disabled,
|
|
64
|
-
inert,
|
|
65
|
-
'data-test': dataTest,
|
|
66
|
-
onCollapseToggle,
|
|
67
|
-
iconProps,
|
|
68
|
-
onMouseEnter,
|
|
69
|
-
onMouseLeave,
|
|
70
|
-
onContextMenu,
|
|
71
|
-
} = props
|
|
72
|
-
const collapsible = onCollapseToggle != null
|
|
73
|
-
|
|
74
|
-
const onClick = !disabled ? props.onClick : undefined
|
|
75
|
-
|
|
76
|
-
// clicking on the carat will not call props.onClick,
|
|
77
|
-
// so prevent bubbling up if there is an onCollapseToggle fn
|
|
78
|
-
const handleCollapseToggle = (e: MouseEvent): void => {
|
|
79
|
-
if (onCollapseToggle && !disabled) {
|
|
80
|
-
e.stopPropagation()
|
|
81
|
-
onCollapseToggle(e)
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const hasValidChildren = Children.toArray(props.children).some(child => child)
|
|
86
|
-
|
|
87
|
-
const className = cx(styles.titled_list, props.className, {
|
|
88
|
-
[styles.disabled]: disabled || inert,
|
|
89
|
-
[styles.titled_list_selected]: !disabled && props.selected,
|
|
90
|
-
[styles.hover_border]: !disabled && props.hovered,
|
|
91
|
-
})
|
|
92
|
-
// @ts-expect-error(sa, 2021-6-23): cast value to boolean
|
|
93
|
-
const titleBarClass = cx(styles.titled_list_title_bar, {
|
|
94
|
-
[styles.clickable]: props.onClick,
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
const iconClass = cx(
|
|
98
|
-
styles.title_bar_icon,
|
|
99
|
-
styles.icon_left_of_title,
|
|
100
|
-
iconProps && iconProps.className
|
|
101
|
-
)
|
|
102
|
-
|
|
103
|
-
let textColor = ''
|
|
104
|
-
if (disabled) {
|
|
105
|
-
// the below hex code is for our legacy --c-font-disabled to match other text colors
|
|
106
|
-
textColor = '#9c9c9c'
|
|
107
|
-
} else if (props.selected && !disabled) {
|
|
108
|
-
// the below hex code is for our legacy --c-highlight to match other text colors
|
|
109
|
-
textColor = '#5fd8ee'
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return (
|
|
113
|
-
<div
|
|
114
|
-
id={id}
|
|
115
|
-
className={className}
|
|
116
|
-
data-test={dataTest}
|
|
117
|
-
{...{ onMouseEnter, onMouseLeave, onContextMenu }}
|
|
118
|
-
>
|
|
119
|
-
<div onClick={onClick} className={titleBarClass}>
|
|
120
|
-
{iconName && (
|
|
121
|
-
<Icon {...iconProps} className={iconClass} name={iconName} />
|
|
122
|
-
)}
|
|
123
|
-
<LegacyStyledText
|
|
124
|
-
as="h3"
|
|
125
|
-
backgroundColor={COLORS.white}
|
|
126
|
-
color={textColor}
|
|
127
|
-
>
|
|
128
|
-
{props.title}
|
|
129
|
-
</LegacyStyledText>
|
|
130
|
-
{collapsible && (
|
|
131
|
-
<div
|
|
132
|
-
onClick={handleCollapseToggle}
|
|
133
|
-
className={styles.title_bar_carat}
|
|
134
|
-
>
|
|
135
|
-
<Icon
|
|
136
|
-
className={styles.title_bar_icon}
|
|
137
|
-
name={
|
|
138
|
-
props.selected
|
|
139
|
-
? 'chevron-right'
|
|
140
|
-
: props.collapsed
|
|
141
|
-
? 'chevron-down'
|
|
142
|
-
: 'chevron-up'
|
|
143
|
-
}
|
|
144
|
-
/>
|
|
145
|
-
</div>
|
|
146
|
-
)}
|
|
147
|
-
</div>
|
|
148
|
-
{!props.collapsed && props.description}
|
|
149
|
-
{!props.collapsed && hasValidChildren && (
|
|
150
|
-
<ol className={styles.list}>{props.children}</ol>
|
|
151
|
-
)}
|
|
152
|
-
</div>
|
|
153
|
-
)
|
|
154
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Box, SIZE_4, SPACING_3, Text } from '@opentrons/components'
|
|
2
|
-
|
|
3
|
-
import { Card as CardComponent } from './Card'
|
|
4
|
-
|
|
5
|
-
import type { Meta, Story } from '@storybook/react'
|
|
6
|
-
import type * as React from 'react'
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
title: 'Library/Molecules/Card',
|
|
10
|
-
} as Meta
|
|
11
|
-
|
|
12
|
-
const Template: Story<React.ComponentProps<typeof CardComponent>> = args => (
|
|
13
|
-
<CardComponent {...args} />
|
|
14
|
-
)
|
|
15
|
-
export const Card = Template.bind({})
|
|
16
|
-
Card.args = {
|
|
17
|
-
title: 'Main Title Goes Here',
|
|
18
|
-
disabled: false,
|
|
19
|
-
children: (
|
|
20
|
-
<>
|
|
21
|
-
<Box size={SIZE_4} padding={SPACING_3}>
|
|
22
|
-
<Text>Some text contents</Text>
|
|
23
|
-
</Box>
|
|
24
|
-
<Box size={SIZE_4} padding={SPACING_3}>
|
|
25
|
-
<Text>Some more text contents</Text>
|
|
26
|
-
</Box>
|
|
27
|
-
</>
|
|
28
|
-
),
|
|
29
|
-
}
|
package/src/structure/Card.tsx
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
// Card component with drop shadow
|
|
2
|
-
import styled, { css } from 'styled-components'
|
|
3
|
-
|
|
4
|
-
import { isntStyleProp, styleProps } from '../primitives'
|
|
5
|
-
import * as styles from '../styles'
|
|
6
|
-
|
|
7
|
-
import type { ReactNode } from 'react'
|
|
8
|
-
import type { PrimitiveComponent, StyleProps } from '../primitives'
|
|
9
|
-
|
|
10
|
-
export interface CardProps extends StyleProps {
|
|
11
|
-
/** Title for card, all cards should receive a title. */
|
|
12
|
-
title?: ReactNode
|
|
13
|
-
/** Card contents */
|
|
14
|
-
children?: ReactNode
|
|
15
|
-
/** If card can not be used, gray it out and remove pointer events */
|
|
16
|
-
disabled?: boolean
|
|
17
|
-
/** Additional class names */
|
|
18
|
-
className?: string
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Renders a basic card element with a white background, dropshadow, and zero padding.
|
|
23
|
-
*
|
|
24
|
-
* Titles and other children handle their own styles and layout.
|
|
25
|
-
*/
|
|
26
|
-
export function Card(props: CardProps): JSX.Element {
|
|
27
|
-
const { title, children, className, disabled, ...styleProps } = props
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<Section disabled={disabled} className={className} {...styleProps}>
|
|
31
|
-
{title && <Title className={className}>{title}</Title>}
|
|
32
|
-
{children}
|
|
33
|
-
</Section>
|
|
34
|
-
)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const Section: PrimitiveComponent<'section'> = styled.section.withConfig({
|
|
38
|
-
shouldForwardProp: isntStyleProp,
|
|
39
|
-
})`
|
|
40
|
-
font-size: ${styles.FONT_SIZE_BODY_2};
|
|
41
|
-
position: relative;
|
|
42
|
-
overflow: visible;
|
|
43
|
-
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.33);
|
|
44
|
-
${({ disabled }) =>
|
|
45
|
-
disabled &&
|
|
46
|
-
css`
|
|
47
|
-
pointer-events: none;
|
|
48
|
-
background-color: transparent;
|
|
49
|
-
|
|
50
|
-
& * {
|
|
51
|
-
color: ${styles.C_FONT_DISABLED};
|
|
52
|
-
fill: ${styles.C_FONT_DISABLED};
|
|
53
|
-
background-color: transparent;
|
|
54
|
-
}
|
|
55
|
-
`}
|
|
56
|
-
${styleProps}
|
|
57
|
-
`
|
|
58
|
-
|
|
59
|
-
const Title = styled.h3`
|
|
60
|
-
${styles.FONT_HEADER_DARK}
|
|
61
|
-
font-weight: ${styles.FONT_WEIGHT_REGULAR};
|
|
62
|
-
margin: 0;
|
|
63
|
-
padding: ${styles.SPACING_3} ${styles.SPACING_3} 0;
|
|
64
|
-
text-transform: capitalize;
|
|
65
|
-
`
|
|
File without changes
|
|
File without changes
|