playbook_ui 14.17.0.pre.alpha.play1499backgroundkitoverlay7110 → 14.17.0.pre.alpha.play1906overlaykitaddopacityandgradient7232

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 (58) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_background/_background.tsx +0 -1
  3. data/app/pb_kits/playbook/pb_background/docs/_background_overlay.jsx +3 -4
  4. data/app/pb_kits/playbook/pb_background/docs/example.yml +1 -1
  5. data/app/pb_kits/playbook/pb_draggable/_draggable.scss +43 -20
  6. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.jsx +102 -105
  7. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.md +3 -3
  8. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.jsx +50 -48
  9. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.md +1 -1
  10. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_line.jsx +110 -0
  11. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_line.md +5 -0
  12. data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_table_react.jsx → _draggable_with_table.jsx} +1 -1
  13. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table_react.md +3 -1
  14. data/app/pb_kits/playbook/pb_draggable/docs/example.yml +9 -6
  15. data/app/pb_kits/playbook/pb_draggable/docs/index.js +4 -1
  16. data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +68 -0
  17. data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableContainer.tsx +4 -3
  18. data/app/pb_kits/playbook/pb_overlay/_overlay.scss +49 -22
  19. data/app/pb_kits/playbook/pb_overlay/_overlay.tsx +15 -4
  20. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_color.jsx +63 -0
  21. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_color.md +3 -0
  22. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_default.md +1 -7
  23. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_gradient_opacity.jsx +39 -0
  24. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_gradient_opacity.md +1 -0
  25. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_layout.jsx +40 -0
  26. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_layout.md +5 -0
  27. data/app/pb_kits/playbook/pb_overlay/docs/example.yml +3 -0
  28. data/app/pb_kits/playbook/pb_overlay/docs/index.js +3 -0
  29. data/app/pb_kits/playbook/pb_overlay/overlay.test.jsx +39 -1
  30. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless.html.erb +34 -0
  31. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless_rails.md +1 -0
  32. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating.html.erb +36 -0
  33. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_rails.md +1 -0
  34. data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_react.md +1 -1
  35. data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
  36. data/app/pb_kits/playbook/pb_table/styles/_headers.scss +19 -7
  37. data/app/pb_kits/playbook/pb_table/table.rb +13 -1
  38. data/app/pb_kits/playbook/pb_table/table_header.rb +13 -1
  39. data/dist/chunks/{_typeahead-1gVtCLYL.js → _typeahead-C2GOKWtm.js} +1 -1
  40. data/dist/chunks/{_weekday_stacked-Cl62R0Ef.js → _weekday_stacked-Cw9LuHnt.js} +2 -2
  41. data/dist/chunks/vendor.js +1 -1
  42. data/dist/playbook-doc.js +1 -1
  43. data/dist/playbook-rails-react-bindings.js +1 -1
  44. data/dist/playbook-rails.js +1 -1
  45. data/dist/playbook.css +1 -1
  46. data/lib/playbook/version.rb +1 -1
  47. metadata +28 -16
  48. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_default_rails.html.erb → _draggable_default.html.erb} +0 -0
  49. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_default.md → _draggable_default_react.md} +0 -0
  50. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_multiple_containers_rails.html.erb → _draggable_multiple_containers.html.erb} +0 -0
  51. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_multiple_containers.md → _draggable_multiple_containers_react.md} +0 -0
  52. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_cards_rails.html.erb → _draggable_with_cards.html.erb} +0 -0
  53. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_cards.md → _draggable_with_cards_react.md} +0 -0
  54. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_list_rails.html.erb → _draggable_with_list.html.erb} +0 -0
  55. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_list.md → _draggable_with_list_react.md} +0 -0
  56. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_selectable_list_rails.html.erb → _draggable_with_selectable_list.html.erb} +0 -0
  57. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_selectable_list.md → _draggable_with_selectable_list_react.md} +0 -0
  58. /data/app/pb_kits/playbook/pb_draggable/docs/{_draggable_with_table.md → _draggable_with_table_rails.md} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0aa6639822cd2ea1f1956a8e184d0194086ae25e2307d7c6233469ff6889722c
4
- data.tar.gz: ccc5ed747a8511d0fe4f51c6bfe152b5cffc40aab95acc09867ed30874f0acb8
3
+ metadata.gz: c4eed786792f1c5eea97b75faecd6189cb039c81d91a3f999cb9caab3048b63e
4
+ data.tar.gz: a88401324ebf090e25add4d906ac29e974536fc0800bedf80a3c74fb7e346524
5
5
  SHA512:
6
- metadata.gz: d4e5a6fa4924c2cb68814350e0bd7ed4e5f5952c77b0f695ec72d006d3e370c94ed013d7cdfe7998e59e36601e249b3474aa1c1f93e6407958bfc37e1e3f84d9
7
- data.tar.gz: d88379f2a0912b9058238866fd54ed60f15b54c584f828219918343e07963292dfcaef332f535f53049338ff0a9a09f24b31e27691b8fdf4f0a3fddad0ee5fd9
6
+ metadata.gz: a86ebc9438ea0abc1ad6dc17ccad0881ea85af8116da7dcc098f34555ecdbe4191ef2983fb458c1011ac8cc0a4941c0fafbc2a345babe4d9b286ad916f5e6bd3
7
+ data.tar.gz: 2161ae14909692c4433b10399f95862a64685350fb43e03c1329574251291aaaf6bb0212d58f8b753c4c84b9570767293c6533554f0bad23663a9130b325fc18
@@ -171,7 +171,6 @@ const Background = (props: BackgroundProps): React.ReactElement => {
171
171
  >
172
172
  {children}
173
173
  </Tag>
174
-
175
174
  )
176
175
  }
177
176
 
@@ -8,11 +8,11 @@ const BackgroundOverlay = (props) => {
8
8
  return (
9
9
  <Background
10
10
  alt="colorful background"
11
+ backgroundColor="category_21"
11
12
  className="background lazyload"
12
- imageOverlay="opacity_6"
13
- imageUrl="https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80"
13
+ imageOverlay="opacity_2"
14
+ imageUrl="https://unsplash.it/500/400/?image=633"
14
15
  {...props}
15
- backgroundColor="light"
16
16
  >
17
17
  <Flex
18
18
  orientation="column"
@@ -25,7 +25,6 @@ const BackgroundOverlay = (props) => {
25
25
  padding="lg"
26
26
  size={1}
27
27
  text="Background Kit Image"
28
- {...props}
29
28
  />
30
29
  </FlexItem>
31
30
  </Flex>
@@ -11,7 +11,6 @@ examples:
11
11
  - background_size: Size
12
12
 
13
13
  react:
14
- - background_overlay: Overlay
15
14
  - background_light: Light
16
15
  - background_white: White
17
16
  - background_gradient: Gradient
@@ -20,3 +19,4 @@ examples:
20
19
  - background_status_subtle: Status Subtle
21
20
  - background_category: Category
22
21
  - background_size: Size
22
+ - background_overlay: Overlay
@@ -1,5 +1,6 @@
1
1
  @import "../tokens/colors";
2
2
  @import "../tokens/opacity";
3
+ @import "../tokens/border_radius";
3
4
 
4
5
  .pb_draggable_container {
5
6
  .pb_draggable_item {
@@ -34,7 +35,7 @@
34
35
  width: 100%;
35
36
  height: 100%;
36
37
  border: 2px dashed $neutral;
37
- border-radius: $border-radius-sm;
38
+ border-radius: $border_radius_sm;
38
39
  box-sizing: border-box;
39
40
  z-index: 10;
40
41
  pointer-events: none;
@@ -64,7 +65,7 @@
64
65
  width: 100%;
65
66
  height: 100%;
66
67
  background-color: rgba($neutral, $opacity_5);
67
- border-radius: $border-radius-sm;
68
+ border-radius: $border_radius_sm;
68
69
  z-index: 10;
69
70
  pointer-events: none;
70
71
  }
@@ -73,48 +74,70 @@
73
74
  &.drop_zone_color_primary::before { background-color: rgba($primary, $opacity_5); }
74
75
  &.drop_zone_color_purple::before { background-color: rgba($purple, $opacity_5); }
75
76
  }
76
-
77
- // Line variant
77
+ }
78
+ }
79
+ // Line default - Vertical orientation (horizontal line for draggable items in vertical layout)
80
+ &.line_vertical {
81
+ .pb_draggable_item {
82
+ position: relative;
78
83
  &.drop_zone_line {
79
- // Hide the original content to show the line
84
+ // Hide the original content to show the line only (held draggable item should not take up space in drop zone)
85
+ position: relative;
86
+ z-index: 2;
80
87
  & > * {
81
88
  opacity: 0;
82
89
  }
83
-
90
+ height: 4px;
84
91
  // Style for horizontal line (default)
85
92
  &::before {
86
93
  content: '';
87
94
  position: absolute;
88
95
  left: 0;
89
96
  top: 0;
90
- width: 4px;
91
- height: 100%;
97
+ width: 100%;
98
+ height: 4px;
92
99
  background-color: $neutral;
93
- border-radius: 1000px;
100
+ border-radius: $border_radius_rounded;
94
101
  z-index: 10;
95
102
  pointer-events: none;
103
+ transform: translateY(-50%);
96
104
  }
97
-
98
- // Apply color variants
105
+ // Apply color variants to the ::before element
99
106
  &.drop_zone_color_primary::before { background-color: $primary; }
100
107
  &.drop_zone_color_purple::before { background-color: $purple; }
101
108
  }
102
109
  }
103
110
  }
104
- }
105
-
106
- // Support for vertical layouts (horizontal line)
107
- .pb_draggable_container.vertical {
108
- .pb_draggable_item {
109
- &.is_dragging {
110
- // Line variant for vertical layouts (horizontal line)
111
+ // Line variant - Horizontal orientation (vertical line for draggable items in horizontal layout)
112
+ &.line_horizontal {
113
+ .pb_draggable_item {
114
+ position: relative;
111
115
  &.drop_zone_line {
116
+ position: relative;
117
+ z-index: 2;
118
+ & > * {
119
+ opacity: 0;
120
+ }
121
+ width: 4px;
122
+ height: auto;
123
+ // Style for vertical line
112
124
  &::before {
113
- width: 100%;
114
- height: 4px;
125
+ content: '';
126
+ position: absolute;
115
127
  left: 0;
116
128
  top: 0;
129
+ width: 4px;
130
+ height: 100%;
131
+ background-color: $neutral;
132
+ border-radius: $border_radius_rounded;
133
+ z-index: 10;
134
+ pointer-events: none;
135
+ transform: translateX(-50%);
117
136
  }
137
+
138
+ // Apply color variants to the ::before element
139
+ &.drop_zone_color_primary::before { background-color: $primary; }
140
+ &.drop_zone_color_purple::before { background-color: $purple; }
118
141
  }
119
142
  }
120
143
  }
@@ -60,123 +60,120 @@ const DraggableDropZones = (props) => {
60
60
 
61
61
  return (
62
62
  <>
63
- <Flex justify="between"
64
- {...props}
65
- >
66
- <FlexItem marginRight="xl">
67
- <DraggableProvider
68
- dropZone={{type: "shadow"}}
69
- initialItems={dataShadow}
70
- onReorder={(items) => setInitialShadowState(items)}
71
- >
72
- <Caption
73
- marginBottom="xs"
74
- textAlign="center"
75
- >
76
- {"Shadow"}
77
- </Caption>
78
- <Draggable.Container
79
- htmlOptions={{style:{ width: "200px"}}}
80
- {...props}
81
- >
82
- {initialShadowState.map(({ id, text }) => (
83
- <Card dragId={id}
84
- draggableItem
85
- key={id}
63
+ <Flex justify="between"
64
+ {...props}
65
+ >
66
+ <FlexItem marginRight="xl">
67
+ <DraggableProvider
68
+ dropZone={{type: "shadow"}}
69
+ initialItems={dataShadow}
70
+ onReorder={(items) => setInitialShadowState(items)}
71
+ >
72
+ <Caption
86
73
  marginBottom="xs"
87
- padding="xs"
74
+ text="Shadow"
75
+ textAlign="center"
76
+ />
77
+ <Draggable.Container
78
+ htmlOptions={{style:{ width: "200px"}}}
88
79
  {...props}
89
80
  >
90
- <Flex alignItems="stretch"
91
- flexDirection="column"
81
+ {initialShadowState.map(({ id, text }) => (
82
+ <Card dragId={id}
83
+ draggableItem
84
+ key={id}
85
+ marginBottom="xs"
86
+ padding="xs"
87
+ {...props}
92
88
  >
93
- <Body
94
- text={text}
95
- {...props}
96
- />
97
- </Flex>
98
- </Card>
99
- ))}
100
- </Draggable.Container>
101
- </DraggableProvider>
102
- </FlexItem>
103
- <FlexItem marginRight="xl">
104
- <DraggableProvider
105
- dropZone={{type: "outline"}}
106
- initialItems={dataOutline}
107
- onReorder={(items) => setInitialOutlineState(items)}
108
- >
109
- <Caption
110
- marginBottom="xs"
111
- textAlign="center"
112
- >
113
- {"Outline"}
114
- </Caption>
115
- <Draggable.Container
116
- htmlOptions={{style:{ width: "200px"}}}
117
- {...props}
118
- >
119
- {initialOutlineState.map(({ id, text }) => (
120
- <Card
121
- dragId={id}
122
- draggableItem
123
- key={id}
89
+ <Flex alignItems="stretch"
90
+ flexDirection="column"
91
+ >
92
+ <Body
93
+ text={text}
94
+ {...props}
95
+ />
96
+ </Flex>
97
+ </Card>
98
+ ))}
99
+ </Draggable.Container>
100
+ </DraggableProvider>
101
+ </FlexItem>
102
+ <FlexItem marginRight="xl">
103
+ <DraggableProvider
104
+ dropZone={{type: "outline"}}
105
+ initialItems={dataOutline}
106
+ onReorder={(items) => setInitialOutlineState(items)}
107
+ >
108
+ <Caption
124
109
  marginBottom="xs"
125
- padding="xs"
110
+ text="Outline"
111
+ textAlign="center"
112
+ />
113
+ <Draggable.Container
114
+ htmlOptions={{style:{ width: "200px"}}}
126
115
  {...props}
127
116
  >
128
- <Flex
129
- alignItems="stretch"
130
- flexDirection="column"
117
+ {initialOutlineState.map(({ id, text }) => (
118
+ <Card
119
+ dragId={id}
120
+ draggableItem
121
+ key={id}
122
+ marginBottom="xs"
123
+ padding="xs"
124
+ {...props}
131
125
  >
132
- <Body
133
- text={text}
134
- {...props}
135
- />
136
- </Flex>
137
- </Card>
138
- ))}
139
- </Draggable.Container>
140
- </DraggableProvider>
141
- </FlexItem>
142
- <FlexItem>
143
- <DraggableProvider
144
- dropZone={{type: "line"}}
145
- initialItems={dataLine}
146
- onReorder={(items) => setInitialLineState(items)}
147
- >
148
- <Caption
149
- marginBottom="xs"
150
- textAlign="center"
151
- >
152
- {"Line"}
153
- </Caption>
154
- <Draggable.Container
155
- htmlOptions={{style:{ width: "200px"}}}
156
- {...props}
157
- >
158
- {initialLineState.map(({ id, text }) => (
159
- <Card dragId={id}
160
- draggableItem
161
- key={id}
126
+ <Flex
127
+ alignItems="stretch"
128
+ flexDirection="column"
129
+ >
130
+ <Body
131
+ text={text}
132
+ {...props}
133
+ />
134
+ </Flex>
135
+ </Card>
136
+ ))}
137
+ </Draggable.Container>
138
+ </DraggableProvider>
139
+ </FlexItem>
140
+ <FlexItem>
141
+ <DraggableProvider
142
+ dropZone={{type: "line"}}
143
+ initialItems={dataLine}
144
+ onReorder={(items) => setInitialLineState(items)}
145
+ >
146
+ <Caption
162
147
  marginBottom="xs"
163
- padding="xs"
148
+ text="Line"
149
+ textAlign="center"
150
+ />
151
+ <Draggable.Container
152
+ htmlOptions={{style:{ width: "200px"}}}
164
153
  {...props}
165
154
  >
166
- <Flex alignItems="stretch"
167
- flexDirection="column"
155
+ {initialLineState.map(({ id, text }) => (
156
+ <Card dragId={id}
157
+ draggableItem
158
+ key={id}
159
+ marginBottom="xs"
160
+ padding="xs"
161
+ {...props}
168
162
  >
169
- <Body
170
- text={text}
171
- {...props}
172
- />
173
- </Flex>
174
- </Card>
175
- ))}
176
- </Draggable.Container>
177
- </DraggableProvider>
178
- </FlexItem>
179
- </Flex>
163
+ <Flex alignItems="stretch"
164
+ flexDirection="column"
165
+ >
166
+ <Body
167
+ text={text}
168
+ {...props}
169
+ />
170
+ </Flex>
171
+ </Card>
172
+ ))}
173
+ </Draggable.Container>
174
+ </DraggableProvider>
175
+ </FlexItem>
176
+ </Flex>
180
177
  </>
181
178
  );
182
179
  };
@@ -1,5 +1,5 @@
1
- The Draggable kit allows you to choose the style of drop zones that appear when dragging an item.
1
+ The Draggable kit lets you customize the style of drop zones that appear when dragging an item.
2
2
 
3
- By default, the Draggable kit utilizes the "ghost" style for drop zones, but you can also choose between "shadow", "outline", and "line".
3
+ By default, drop zones are in the "ghost" style, but you can also choose from "shadow," "outline," and "line."
4
4
 
5
- Additionally, when using the "line" style, be sure to set the proper `direction` attribute within the `dropZone` prop depending on the orentation of your draggable view. By default, this attribute is set to "vertical", but can also be used with a "horizontal" direction. The `direction` attribute only applies to the "line" style and will not affect other drop zone styles.
5
+ When using the "line" type, make sure to set the appropriate `direction` attribute within the `dropZone` prop based on the orientation of your draggable view. By default, this is set to "vertical," but it can also be adjusted to "horizontal." Note that the direction attribute only applies to the "line" type and does not affect other drop zone styles. For more on the "line" style in particular, check out the [Draggable Drop Zones Line doc example](https://playbook.powerapp.cloud/kits/draggable/react#draggable-drop-zones-line).
@@ -6,6 +6,8 @@ import Caption from '../../pb_caption/_caption'
6
6
  import Draggable from '../../pb_draggable/_draggable'
7
7
  import { DraggableProvider } from '../../pb_draggable/context'
8
8
 
9
+
10
+
9
11
  // Initial items to be dragged
10
12
  const dataPrimary = [
11
13
  {
@@ -42,54 +44,54 @@ const DraggableDropZonesColors = (props) => {
42
44
 
43
45
  return (
44
46
  <>
45
- <Caption marginBottom="xs">
46
- Primary
47
- </Caption>
48
- <DraggableProvider
49
- dropZone={{type: "shadow", color: "primary"}}
50
- initialItems={dataPrimary}
51
- onReorder={(items) => setInitialPrimaryState(items)}
52
- >
53
- <Draggable.Container {...props}>
54
- <Flex>
55
- {initialPrimaryState.map(({ id, url }) => (
56
- <Draggable.Item dragId={id}
57
- key={id}
58
- marginRight="sm"
59
- >
60
- <Image alt={id}
61
- size="md"
62
- url={url}
63
- />
64
- </Draggable.Item>
65
- ))}
66
- </Flex>
67
- </Draggable.Container>
68
- </DraggableProvider>
69
- <Caption marginBottom="xs">
70
- Purple
71
- </Caption>
72
- <DraggableProvider
73
- dropZone={{type: "outline", color: "purple"}}
74
- initialItems={dataPurple}
75
- onReorder={(items) => setInitialPurpleState(items)}
76
- >
77
- <Draggable.Container {...props}>
78
- <Flex>
79
- {initialPurpleState.map(({ id, url }) => (
80
- <Draggable.Item dragId={id}
81
- key={id}
82
- marginRight="sm"
83
- >
84
- <Image alt={id}
85
- size="md"
86
- url={url}
87
- />
88
- </Draggable.Item>
89
- ))}
90
- </Flex>
91
- </Draggable.Container>
92
- </DraggableProvider>
47
+ <Caption marginBottom="xs"
48
+ text="Primary"
49
+ />
50
+ <DraggableProvider
51
+ dropZone={{type: "shadow", color: "primary"}}
52
+ initialItems={dataPrimary}
53
+ onReorder={(items) => setInitialPrimaryState(items)}
54
+ >
55
+ <Draggable.Container {...props}>
56
+ <Flex>
57
+ {initialPrimaryState.map(({ id, url }) => (
58
+ <Draggable.Item dragId={id}
59
+ key={id}
60
+ marginRight="sm"
61
+ >
62
+ <Image alt={id}
63
+ size="md"
64
+ url={url}
65
+ />
66
+ </Draggable.Item>
67
+ ))}
68
+ </Flex>
69
+ </Draggable.Container>
70
+ </DraggableProvider>
71
+ <Caption marginBottom="xs"
72
+ text="Purple"
73
+ />
74
+ <DraggableProvider
75
+ dropZone={{type: "outline", color: "purple"}}
76
+ initialItems={dataPurple}
77
+ onReorder={(items) => setInitialPurpleState(items)}
78
+ >
79
+ <Draggable.Container {...props}>
80
+ <Flex>
81
+ {initialPurpleState.map(({ id, url }) => (
82
+ <Draggable.Item dragId={id}
83
+ key={id}
84
+ marginRight="sm"
85
+ >
86
+ <Image alt={id}
87
+ size="md"
88
+ url={url}
89
+ />
90
+ </Draggable.Item>
91
+ ))}
92
+ </Flex>
93
+ </Draggable.Container>
94
+ </DraggableProvider>
93
95
  </>
94
96
  );
95
97
  };
@@ -1 +1 @@
1
- By default, the Draggable kit sets the default color of drop zones to "neutral" (or "primary" if using the "line" style.)
1
+ The default `color` for Draggable kit drop zones is "neutral", with "primary" or "purple" as additional options. When `type` is set to "line", the default color is "primary" and "purple" is the only other option.
@@ -0,0 +1,110 @@
1
+ import React, { useState } from "react";
2
+ import Flex from '../../pb_flex/_flex'
3
+ import Caption from '../../pb_caption/_caption'
4
+ import Draggable from '../_draggable'
5
+ import { DraggableProvider } from '../context'
6
+ import Image from '../../pb_image/_image'
7
+
8
+
9
+
10
+ const dataLineVertical = [
11
+ {
12
+ id: "211",
13
+ url: "https://unsplash.it/500/400/?image=633",
14
+ },
15
+ {
16
+ id: "212",
17
+ url: "https://unsplash.it/500/400/?image=634",
18
+ },
19
+ {
20
+ id: "213",
21
+ url: "https://unsplash.it/500/400/?image=637",
22
+ },
23
+ ];
24
+
25
+ const dataLineHorizontal = [
26
+ {
27
+ id: "2111",
28
+ url: "https://unsplash.it/500/400/?image=633",
29
+ },
30
+ {
31
+ id: "2122",
32
+ url: "https://unsplash.it/500/400/?image=634",
33
+ },
34
+ {
35
+ id: "2133",
36
+ url: "https://unsplash.it/500/400/?image=637",
37
+ },
38
+ ];
39
+
40
+ const DraggableDropZones = (props) => {
41
+ const [initialLineVerticalState, setInitialLineVerticalState] = useState(dataLineVertical);
42
+ const [initialLineHorizontalState, setInitialLineHorizontalState] = useState(dataLineHorizontal);
43
+
44
+ return (
45
+ <>
46
+ <Caption marginBottom="xs"
47
+ marginTop="xl"
48
+ text="Vertical"
49
+ />
50
+ <DraggableProvider
51
+ dropZone={{ type: "line", color: "purple" }}
52
+ initialItems={dataLineVertical}
53
+ onReorder={(items) => setInitialLineVerticalState(items)}
54
+ >
55
+ <Draggable.Container {...props}>
56
+ <Flex flexDirection="column"
57
+ height="367px"
58
+ >
59
+ {initialLineVerticalState.map(({ id, url }) => (
60
+ <Draggable.Item dragId={id}
61
+ key={id}
62
+ marginBottom="sm"
63
+ >
64
+ <Image alt={id}
65
+ size="md"
66
+ url={url}
67
+ />
68
+ </Draggable.Item>
69
+ ))}
70
+ </Flex>
71
+ </Draggable.Container>
72
+ </DraggableProvider>
73
+ <Caption marginBottom="xs"
74
+ marginTop="xl"
75
+ text="Horizontal"
76
+ />
77
+ <Flex>
78
+ <DraggableProvider
79
+ dropZone={{ type: "line", direction: "horizontal" }}
80
+ initialItems={dataLineHorizontal}
81
+ onReorder={(items) => setInitialLineHorizontalState(items)}
82
+ >
83
+ <Draggable.Container
84
+ htmlOptions={{style:{ width: "285px"}}}
85
+ {...props}
86
+ >
87
+ <Flex alignItems="stretch"
88
+ flexDirection="row"
89
+ height="110px"
90
+ >
91
+ {initialLineHorizontalState.map(({ id, url }) => (
92
+ <Draggable.Item dragId={id}
93
+ key={id}
94
+ marginRight="sm"
95
+ >
96
+ <Image alt={id}
97
+ size="md"
98
+ url={url}
99
+ />
100
+ </Draggable.Item>
101
+ ))}
102
+ </Flex>
103
+ </Draggable.Container>
104
+ </DraggableProvider>
105
+ </Flex>
106
+ </>
107
+ );
108
+ };
109
+
110
+ export default DraggableDropZones;
@@ -0,0 +1,5 @@
1
+ When using the "line" style, make sure to set the appropriate `direction` attribute within the `dropZone` prop based on the orientation of your draggable view. By default, this is set to "vertical," but it can also be adjusted to "horizontal." Note that the direction attribute only applies to the "line" style and does not affect other drop zone styles. The default `color` for "line" is "primary" and "purple" is the only alternative color option.
2
+
3
+ The length of the line is calculated based off of the width (for "vertical") or height (for "horizontal") of the parent container holding the draggable items.
4
+
5
+ Additionally, if the parent container of the `DraggableProvider`/`DraggableContainer` (or a subcontainer within) does not have a set height (for "vertical") or width (for "horizontal"), like the [Draggable Drop Zones doc example](https://playbook.powerapp.cloud/kits/draggable/react#draggable-drop-zones) does, elements on the page may jump up (for "vertical") or to the left (for "horizontal") when an item is actively being dragged. To prevent this, give a parent element a fixed height (for "vertical") or width (for "horizontal") as demonstrated in this doc example.
@@ -1,7 +1,7 @@
1
1
  import React, { useState } from "react";
2
2
 
3
3
  import Flex from '../../pb_flex/_flex'
4
- import { DraggableProvider } from '../../pb_draggable/context'
4
+ import { DraggableProvider } from '../context'
5
5
  import Avatar from '../../pb_avatar/_avatar'
6
6
  import Body from '../../pb_body/_body'
7
7
  import Table from '../../pb_table/_table'