Skip to content

Commit 94e19e2

Browse files
committed
feat(draggable): align component with fusion designs
1 parent 5808e24 commit 94e19e2

58 files changed

Lines changed: 6867 additions & 1157 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎package-lock.json‎

Lines changed: 7 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎skills/carbon-react/components/card.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ description: Carbon Card component props and usage examples.
1616
| Name | Type | Required | Literals | Deprecated | Deprecation reason | Description | Default |
1717
| --- | --- | --- | --- | --- | --- | --- | --- |
1818
| children | React.ReactNode | Yes | | | | Child nodes | |
19-
| draggable | boolean \| undefined | No | | | | Flag to indicate if card is draggable | |
2019
| footer | React.ReactNode | No | | | | The footer to render underneath the Card content | |
2120
| header | React.ReactNode | No | | | | The header to render above the Card content | |
2221
| height | string \| undefined | No | | | | Height of the component (any valid CSS value) | |
@@ -47,6 +46,7 @@ description: Carbon Card component props and usage examples.
4746
| data-role | string \| undefined | No | | | | Identifier used for testing purposes, applied to the root element of the component. | |
4847
| aria-label | string \| undefined | No | | | | Prop to specify an aria-label for the component | |
4948
| boxShadow | BoxShadowsType \| undefined | No | boxShadow100 \| boxShadow150 \| boxShadow200 \| boxShadow300 \| boxShadow400 \| boxShadow010 \| boxShadow050 \| boxShadow075 \| boxShadow090 \| boxShadow091 | Yes | Design token for custom Box Shadow. Note: please check that the box shadow design token you are using is compatible with the Card component. | | |
49+
| draggable | boolean \| undefined | No | | Yes | The `draggable` props is deprecated, place Card inside a DraggableItem instead. Flag to indicate if card is draggable | | |
5050
| hoverBoxShadow | BoxShadowsType \| undefined | No | boxShadow100 \| boxShadow150 \| boxShadow200 \| boxShadow300 \| boxShadow400 \| boxShadow010 \| boxShadow050 \| boxShadow075 \| boxShadow090 \| boxShadow091 | Yes | Design token for custom Box Shadow on hover. One of `onClick` or `href` props must be true. Note: please check that the box shadow design token you are using is compatible with the Card component. | | |
5151

5252
## Examples

‎skills/carbon-react/components/drag-handle.md‎

Lines changed: 268 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
name: carbon-component-draggable-container-group
3+
description: Carbon DraggableContainerGroup component props and usage examples.
4+
---
5+
6+
# DraggableContainerGroup
7+
8+
## Import
9+
`import { DraggableContainerGroup } from "carbon-react/lib/components/draggable";`
10+
11+
## Source
12+
- Export: `./components/draggable`
13+
- Props interface: `DraggableContainerGroupProps`
14+
15+
## Props
16+
| Name | Type | Required | Literals | Description | Default |
17+
| --- | --- | --- | --- | --- | --- |
18+
| children | React.ReactNode | Yes | | Containers in this group can exchange items. Item IDs must be unique across the group. | |
19+
20+
## Examples
21+
No Storybook examples found.

‎skills/carbon-react/components/draggable-container.md‎

Lines changed: 287 additions & 21 deletions
Large diffs are not rendered by default.

‎skills/carbon-react/components/draggable-item.md‎

Lines changed: 265 additions & 20 deletions
Large diffs are not rendered by default.

‎skills/carbon-react/components/list-item.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ You can use the `as` prop on Typography to inherit list styling while using Typo
6868
| wordWrap | string \| undefined | No | | | | Override the word-wrap | |
6969
| data-element | string \| undefined | No | | | | Identifier used for testing purposes, applied to the root element of the component. | |
7070
| data-role | string \| undefined | No | | | | Identifier used for testing purposes, applied to the root element of the component. | |
71+
| aria-atomic | (boolean \| "true" \| "false") \| undefined | No | | | | Whether assistive technologies announce the entire live region when it changes. | |
7172
| aria-live | "off" \| "assertive" \| "polite" \| undefined | No | off \| assertive \| polite | | | Make the element an aria-live region | |
7273
| backgroundColor | string \| undefined | No | | Yes | This prop no longer has any effect. This prop will eventually be removed. Override the backgroundColor style | | |
7374
| bg | string \| undefined | No | | Yes | This prop no longer has any effect. This prop will eventually be removed. Override the bg value shorthand for backgroundColor | | |

‎skills/carbon-react/components/list.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ Example migration:
8989
| wordWrap | string \| undefined | No | | | | Override the word-wrap | |
9090
| data-element | string \| undefined | No | | | | Identifier used for testing purposes, applied to the root element of the component. | |
9191
| data-role | string \| undefined | No | | | | Identifier used for testing purposes, applied to the root element of the component. | |
92+
| aria-atomic | (boolean \| "true" \| "false") \| undefined | No | | | | Whether assistive technologies announce the entire live region when it changes. | |
9293
| aria-live | "off" \| "assertive" \| "polite" \| undefined | No | off \| assertive \| polite | | | Make the element an aria-live region | |
9394
| backgroundColor | string \| undefined | No | | Yes | This prop no longer has any effect. This prop will eventually be removed. Override the backgroundColor style | | |
9495
| bg | string \| undefined | No | | Yes | This prop no longer has any effect. This prop will eventually be removed. Override the bg value shorthand for backgroundColor | | |

‎skills/carbon-react/components/popover-container.md‎

Lines changed: 0 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -379,91 +379,6 @@ description: Carbon PopoverContainer component props and usage examples.
379379
```
380380

381381

382-
### Complex
383-
384-
**Render**
385-
386-
```tsx
387-
() => {
388-
const [open, setOpen] = useState(defaultOpenState);
389-
const onOpen = () => setOpen(true);
390-
const onClose = () => setOpen(false);
391-
return (
392-
<Box height="400px">
393-
<PopoverContainer
394-
title="Popover Container Title"
395-
open={open}
396-
onOpen={onOpen}
397-
onClose={onClose}
398-
>
399-
<Link href="#example">This is example link text</Link>
400-
<Box p="25px 0 15px 0">
401-
<Button>Small</Button>
402-
<Button ml={2}>Compact</Button>
403-
</Box>
404-
<Box mt="4px" mb="4px">
405-
<Select
406-
name="simple"
407-
id="simple"
408-
label="color"
409-
labelInline
410-
value=""
411-
onChange={() => {}}
412-
>
413-
<Option text="Amber" value="1" />
414-
<Option text="Black" value="2" />
415-
<Option text="Blue" value="3" />
416-
<Option text="Brown" value="4" />
417-
<Option text="Green" value="5" />
418-
<Option text="Orange" value="6" />
419-
<Option text="Pink" value="7" />
420-
<Option text="Purple" value="8" />
421-
<Option text="Red" value="9" />
422-
<Option text="White" value="10" />
423-
<Option text="Yellow" value="11" />
424-
</Select>
425-
</Box>
426-
<DraggableContainer>
427-
<DraggableItem key="1" id={1}>
428-
<Checkbox
429-
name="one"
430-
label="Draggable Label One"
431-
checked
432-
onChange={() => {}}
433-
/>
434-
</DraggableItem>
435-
<DraggableItem key="2" id={2}>
436-
<Checkbox
437-
name="two"
438-
label="Draggable Label Two"
439-
checked
440-
onChange={() => {}}
441-
/>
442-
</DraggableItem>
443-
<DraggableItem key="3" id={3}>
444-
<Checkbox
445-
name="three"
446-
label="Draggable Label Three"
447-
checked
448-
onChange={() => {}}
449-
/>
450-
</DraggableItem>
451-
<DraggableItem key="4" id={4}>
452-
<Checkbox
453-
name="four"
454-
label="Draggable Label Four"
455-
checked
456-
onChange={() => {}}
457-
/>
458-
</DraggableItem>
459-
</DraggableContainer>
460-
</PopoverContainer>
461-
</Box>
462-
);
463-
}
464-
```
465-
466-
467382
### Disable Animation
468383

469384
**Render**

‎skills/carbon-react/components/tile.md‎

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ description: Carbon Tile component props and usage examples.
4747
| pt | ResponsiveValue<TVal, ThemeType> \| undefined | No | | | | Padding on top | |
4848
| px | ResponsiveValue<TVal, ThemeType> \| undefined | No | | | | Padding on left and right | |
4949
| py | ResponsiveValue<TVal, ThemeType> \| undefined | No | | | | Padding on top and bottom | |
50+
| rightChildren | React.ReactNode | No | | | | Content displayed opposite the drag handle when inside a DraggableItem. Use this slot for controls that let users reorder items without dragging. | |
5051
| roundness | Roundness \| LegacyRoundness \| undefined | No | small \| large \| default \| moderate \| curved | | | Sets the level of roundness of the corners. Values can be `"curved"` or `"moderate"`. **Deprecated**: legacy values `"default"`, `"large"`, and `"small"` are deprecated and should not be used. | "curved" |
5152
| statusKeyline | string \| undefined | No | | | | Sets the status keyline to indicate the status of the content within the tile | |
5253
| variant | TileVariants \| DeprecatedTileVariants \| undefined | No | standard \| alt \| transparent \| grey \| negative \| positive \| tile \| unavailable \| active | | | Sets the theme of the tile | "standard" |
@@ -798,3 +799,98 @@ description: Carbon Tile component props and usage examples.
798799
}
799800
```
800801

802+
803+
### Draggable
804+
805+
**Render**
806+
807+
```tsx
808+
() => {
809+
const TileReorderControls = ({ label }: { label: string }) => {
810+
const { index, itemCount, moveTo } = useDraggableItemContext();
811+
812+
return (
813+
<ActionPopover
814+
aria-label={`Reorder ${label}`}
815+
buttonLabel={<Icon type="ellipsis_vertical" />}
816+
size="small"
817+
m={0}
818+
rightAlignMenu
819+
>
820+
<ActionPopoverItem
821+
disabled={index === 0}
822+
onClick={() => moveTo(index - 1)}
823+
>
824+
Move earlier
825+
</ActionPopoverItem>
826+
<ActionPopoverItem
827+
disabled={index === itemCount - 1}
828+
onClick={() => moveTo(index + 1)}
829+
>
830+
Move later
831+
</ActionPopoverItem>
832+
<ActionPopoverItem disabled={index === 0} onClick={() => moveTo(0)}>
833+
Move First
834+
</ActionPopoverItem>
835+
<ActionPopoverItem
836+
disabled={index === itemCount - 1}
837+
onClick={() => moveTo(itemCount - 1)}
838+
>
839+
Move Last
840+
</ActionPopoverItem>
841+
</ActionPopover>
842+
);
843+
};
844+
845+
return (
846+
<DraggableContainer>
847+
<Box display="flex" flexDirection="column" gap={2} width="600px">
848+
<DraggableItem id="first-tile">
849+
<Tile rightChildren={<TileReorderControls label="first tile" />}>
850+
First tile
851+
</Tile>
852+
</DraggableItem>
853+
<DraggableItem id="second-tile">
854+
<Tile rightChildren={<TileReorderControls label="second tile" />}>
855+
Second tile
856+
</Tile>
857+
</DraggableItem>
858+
</Box>
859+
</DraggableContainer>
860+
);
861+
}
862+
```
863+
864+
865+
### MDX Example 1
866+
867+
**Args**
868+
869+
```tsx
870+
import {
871+
Tile,
872+
TileContent,
873+
TileFooter,
874+
FlexTileContainer,
875+
FlexTileCell,
876+
} from "carbon-react/lib/components/tile";
877+
```
878+
879+
880+
### MDX Example 2
881+
882+
**Args**
883+
884+
```tsx
885+
<Tile
886+
rightChildren={
887+
<ActionPopover aria-label="Reorder tile" m={0} rightAlignMenu>
888+
<ActionPopoverItem onClick={moveEarlier}>Move earlier</ActionPopoverItem>
889+
<ActionPopoverItem onClick={moveLater}>Move later</ActionPopoverItem>
890+
</ActionPopover>
891+
}
892+
>
893+
Tile content
894+
</Tile>
895+
```
896+

0 commit comments

Comments
 (0)