@cloudscape-design/components 3.0.869 → 3.0.871

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 (158) hide show
  1. package/app-layout/drawer/resizable-drawer.d.ts.map +1 -1
  2. package/app-layout/drawer/resizable-drawer.js +2 -3
  3. package/app-layout/drawer/resizable-drawer.js.map +1 -1
  4. package/app-layout/utils/use-focus-control.d.ts +1 -2
  5. package/app-layout/utils/use-focus-control.d.ts.map +1 -1
  6. package/app-layout/utils/use-focus-control.js +0 -2
  7. package/app-layout/utils/use-focus-control.js.map +1 -1
  8. package/app-layout/utils/use-resize.d.ts.map +1 -1
  9. package/app-layout/utils/use-resize.js +2 -3
  10. package/app-layout/utils/use-resize.js.map +1 -1
  11. package/app-layout/utils/use-split-panel-focus-control.d.ts +1 -2
  12. package/app-layout/utils/use-split-panel-focus-control.d.ts.map +1 -1
  13. package/app-layout/utils/use-split-panel-focus-control.js +0 -1
  14. package/app-layout/utils/use-split-panel-focus-control.js.map +1 -1
  15. package/app-layout/visual-refresh-toolbar/drawer/global-drawer.d.ts.map +1 -1
  16. package/app-layout/visual-refresh-toolbar/drawer/global-drawer.js +2 -3
  17. package/app-layout/visual-refresh-toolbar/drawer/global-drawer.js.map +1 -1
  18. package/app-layout/visual-refresh-toolbar/drawer/local-drawer.d.ts.map +1 -1
  19. package/app-layout/visual-refresh-toolbar/drawer/local-drawer.js +2 -3
  20. package/app-layout/visual-refresh-toolbar/drawer/local-drawer.js.map +1 -1
  21. package/button-group/index.d.ts.map +1 -1
  22. package/button-group/index.js +22 -1
  23. package/button-group/index.js.map +1 -1
  24. package/button-group/interfaces.d.ts +2 -1
  25. package/button-group/interfaces.d.ts.map +1 -1
  26. package/button-group/interfaces.js.map +1 -1
  27. package/collection-preferences/content-display/index.d.ts.map +1 -1
  28. package/collection-preferences/content-display/index.js +8 -5
  29. package/collection-preferences/content-display/index.js.map +1 -1
  30. package/date-picker/index.d.ts.map +1 -1
  31. package/date-picker/index.js +1 -5
  32. package/date-picker/index.js.map +1 -1
  33. package/date-range-picker/styles.css.js +38 -38
  34. package/date-range-picker/styles.scoped.css +47 -51
  35. package/date-range-picker/styles.selectors.js +38 -38
  36. package/flashbar/internal/analytics.d.ts.map +1 -1
  37. package/flashbar/internal/analytics.js +1 -3
  38. package/flashbar/internal/analytics.js.map +1 -1
  39. package/internal/components/drag-handle/index.d.ts +2 -2
  40. package/internal/components/drag-handle/index.d.ts.map +1 -1
  41. package/internal/components/drag-handle/index.js +7 -3
  42. package/internal/components/drag-handle/index.js.map +1 -1
  43. package/internal/components/drag-handle/interfaces.d.ts +1 -1
  44. package/internal/components/drag-handle/interfaces.d.ts.map +1 -1
  45. package/internal/components/drag-handle/interfaces.js.map +1 -1
  46. package/internal/components/dropdown/styles.css.js +20 -20
  47. package/internal/components/dropdown/styles.scoped.css +37 -39
  48. package/internal/components/dropdown/styles.selectors.js +20 -20
  49. package/internal/components/options-list/styles.css.js +3 -3
  50. package/internal/components/options-list/styles.scoped.css +5 -3
  51. package/internal/components/options-list/styles.selectors.js +3 -3
  52. package/internal/components/panel-resize-handle/icon.d.ts +5 -0
  53. package/internal/components/panel-resize-handle/icon.d.ts.map +1 -0
  54. package/internal/components/panel-resize-handle/icon.js +9 -0
  55. package/internal/components/panel-resize-handle/icon.js.map +1 -0
  56. package/internal/components/panel-resize-handle/index.d.ts +2 -4
  57. package/internal/components/panel-resize-handle/index.d.ts.map +1 -1
  58. package/internal/components/panel-resize-handle/index.js +5 -8
  59. package/internal/components/panel-resize-handle/index.js.map +1 -1
  60. package/internal/components/panel-resize-handle/styles.css.js +5 -2
  61. package/internal/components/panel-resize-handle/styles.scoped.css +191 -3
  62. package/internal/components/panel-resize-handle/styles.selectors.js +5 -2
  63. package/internal/components/sortable-area/index.d.ts +6 -0
  64. package/internal/components/sortable-area/index.d.ts.map +1 -0
  65. package/internal/components/{dnd-area → sortable-area}/index.js +34 -25
  66. package/internal/components/sortable-area/index.js.map +1 -0
  67. package/internal/components/sortable-area/interfaces.d.ts +42 -0
  68. package/internal/components/sortable-area/interfaces.d.ts.map +1 -0
  69. package/internal/components/sortable-area/interfaces.js.map +1 -0
  70. package/internal/components/sortable-area/keyboard-sensor/defaults.d.ts.map +1 -0
  71. package/internal/components/sortable-area/keyboard-sensor/defaults.js.map +1 -0
  72. package/internal/components/sortable-area/keyboard-sensor/index.d.ts.map +1 -0
  73. package/internal/components/sortable-area/keyboard-sensor/index.js.map +1 -0
  74. package/internal/components/sortable-area/keyboard-sensor/utilities/events.d.ts.map +1 -0
  75. package/internal/components/sortable-area/keyboard-sensor/utilities/events.js.map +1 -0
  76. package/internal/components/sortable-area/keyboard-sensor/utilities/listeners.d.ts.map +1 -0
  77. package/internal/components/sortable-area/keyboard-sensor/utilities/listeners.js.map +1 -0
  78. package/internal/components/sortable-area/keyboard-sensor/utilities/scroll.d.ts.map +1 -0
  79. package/internal/components/sortable-area/keyboard-sensor/utilities/scroll.js.map +1 -0
  80. package/internal/components/sortable-area/styles.css.js +13 -0
  81. package/internal/components/{dnd-area → sortable-area}/styles.scoped.css +17 -17
  82. package/internal/components/sortable-area/styles.selectors.js +14 -0
  83. package/internal/components/{dnd-area → sortable-area}/use-drag-and-drop-reorder.d.ts +4 -3
  84. package/internal/components/sortable-area/use-drag-and-drop-reorder.d.ts.map +1 -0
  85. package/internal/components/{dnd-area → sortable-area}/use-drag-and-drop-reorder.js +4 -4
  86. package/internal/components/sortable-area/use-drag-and-drop-reorder.js.map +1 -0
  87. package/internal/components/sortable-area/use-live-announcements.d.ts +13 -0
  88. package/internal/components/sortable-area/use-live-announcements.d.ts.map +1 -0
  89. package/internal/components/{dnd-area → sortable-area}/use-live-announcements.js +6 -6
  90. package/internal/components/sortable-area/use-live-announcements.js.map +1 -0
  91. package/internal/environment.js +1 -1
  92. package/internal/environment.json +1 -1
  93. package/internal/manifest.json +1 -1
  94. package/internal/metrics.d.ts +3 -0
  95. package/internal/metrics.d.ts.map +1 -0
  96. package/internal/metrics.js +6 -0
  97. package/internal/metrics.js.map +1 -0
  98. package/internal/plugins/api.d.ts.map +1 -1
  99. package/internal/plugins/api.js +4 -0
  100. package/internal/plugins/api.js.map +1 -1
  101. package/internal/plugins/controllers/alert-flash-content.d.ts.map +1 -1
  102. package/internal/plugins/controllers/alert-flash-content.js +2 -1
  103. package/internal/plugins/controllers/alert-flash-content.js.map +1 -1
  104. package/internal/plugins/controllers/drawers.d.ts.map +1 -1
  105. package/internal/plugins/controllers/drawers.js +7 -3
  106. package/internal/plugins/controllers/drawers.js.map +1 -1
  107. package/internal/plugins/helpers/metrics.d.ts +3 -0
  108. package/internal/plugins/helpers/metrics.d.ts.map +1 -0
  109. package/internal/plugins/helpers/metrics.js +15 -0
  110. package/internal/plugins/helpers/metrics.js.map +1 -0
  111. package/internal/plugins/helpers/use-discovered-content.d.ts.map +1 -1
  112. package/internal/plugins/helpers/use-discovered-content.js +2 -1
  113. package/internal/plugins/helpers/use-discovered-content.js.map +1 -1
  114. package/package.json +1 -1
  115. package/split-panel/implementation.d.ts.map +1 -1
  116. package/split-panel/implementation.js +6 -7
  117. package/split-panel/implementation.js.map +1 -1
  118. package/table/table-role/utils.d.ts.map +1 -1
  119. package/table/table-role/utils.js +4 -5
  120. package/table/table-role/utils.js.map +1 -1
  121. package/app-layout/visual-refresh-toolbar/exports.d.ts +0 -6
  122. package/app-layout/visual-refresh-toolbar/exports.d.ts.map +0 -1
  123. package/app-layout/visual-refresh-toolbar/exports.js +0 -8
  124. package/app-layout/visual-refresh-toolbar/exports.js.map +0 -1
  125. package/internal/components/dnd-area/index.d.ts +0 -4
  126. package/internal/components/dnd-area/index.d.ts.map +0 -1
  127. package/internal/components/dnd-area/index.js.map +0 -1
  128. package/internal/components/dnd-area/interfaces.d.ts +0 -39
  129. package/internal/components/dnd-area/interfaces.d.ts.map +0 -1
  130. package/internal/components/dnd-area/interfaces.js.map +0 -1
  131. package/internal/components/dnd-area/keyboard-sensor/defaults.d.ts.map +0 -1
  132. package/internal/components/dnd-area/keyboard-sensor/defaults.js.map +0 -1
  133. package/internal/components/dnd-area/keyboard-sensor/index.d.ts.map +0 -1
  134. package/internal/components/dnd-area/keyboard-sensor/index.js.map +0 -1
  135. package/internal/components/dnd-area/keyboard-sensor/utilities/events.d.ts.map +0 -1
  136. package/internal/components/dnd-area/keyboard-sensor/utilities/events.js.map +0 -1
  137. package/internal/components/dnd-area/keyboard-sensor/utilities/listeners.d.ts.map +0 -1
  138. package/internal/components/dnd-area/keyboard-sensor/utilities/listeners.js.map +0 -1
  139. package/internal/components/dnd-area/keyboard-sensor/utilities/scroll.d.ts.map +0 -1
  140. package/internal/components/dnd-area/keyboard-sensor/utilities/scroll.js.map +0 -1
  141. package/internal/components/dnd-area/styles.css.js +0 -13
  142. package/internal/components/dnd-area/styles.selectors.js +0 -14
  143. package/internal/components/dnd-area/use-drag-and-drop-reorder.d.ts.map +0 -1
  144. package/internal/components/dnd-area/use-drag-and-drop-reorder.js.map +0 -1
  145. package/internal/components/dnd-area/use-live-announcements.d.ts +0 -12
  146. package/internal/components/dnd-area/use-live-announcements.d.ts.map +0 -1
  147. package/internal/components/dnd-area/use-live-announcements.js.map +0 -1
  148. /package/internal/components/{dnd-area → sortable-area}/interfaces.js +0 -0
  149. /package/internal/components/{dnd-area → sortable-area}/keyboard-sensor/defaults.d.ts +0 -0
  150. /package/internal/components/{dnd-area → sortable-area}/keyboard-sensor/defaults.js +0 -0
  151. /package/internal/components/{dnd-area → sortable-area}/keyboard-sensor/index.d.ts +0 -0
  152. /package/internal/components/{dnd-area → sortable-area}/keyboard-sensor/index.js +0 -0
  153. /package/internal/components/{dnd-area → sortable-area}/keyboard-sensor/utilities/events.d.ts +0 -0
  154. /package/internal/components/{dnd-area → sortable-area}/keyboard-sensor/utilities/events.js +0 -0
  155. /package/internal/components/{dnd-area → sortable-area}/keyboard-sensor/utilities/listeners.d.ts +0 -0
  156. /package/internal/components/{dnd-area → sortable-area}/keyboard-sensor/utilities/listeners.js +0 -0
  157. /package/internal/components/{dnd-area → sortable-area}/keyboard-sensor/utilities/scroll.d.ts +0 -0
  158. /package/internal/components/{dnd-area → sortable-area}/keyboard-sensor/utilities/scroll.js +0 -0
@@ -2,10 +2,198 @@
2
2
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
- .awsui_handle-wrapper-side_cqzlk_1qkms_5:not(#\9) {
5
+ /*
6
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
7
+ SPDX-License-Identifier: Apache-2.0
8
+ */
9
+ /*
10
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
11
+ SPDX-License-Identifier: Apache-2.0
12
+ */
13
+ /*
14
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
15
+ SPDX-License-Identifier: Apache-2.0
16
+ */
17
+ /*
18
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
19
+ SPDX-License-Identifier: Apache-2.0
20
+ */
21
+ /*
22
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
23
+ SPDX-License-Identifier: Apache-2.0
24
+ */
25
+ /*
26
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
27
+ SPDX-License-Identifier: Apache-2.0
28
+ */
29
+ /*
30
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
31
+ SPDX-License-Identifier: Apache-2.0
32
+ */
33
+ /*
34
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
35
+ SPDX-License-Identifier: Apache-2.0
36
+ */
37
+ /*
38
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
39
+ SPDX-License-Identifier: Apache-2.0
40
+ */
41
+ /*
42
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
43
+ SPDX-License-Identifier: Apache-2.0
44
+ */
45
+ /*
46
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
47
+ SPDX-License-Identifier: Apache-2.0
48
+ */
49
+ /*
50
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
51
+ SPDX-License-Identifier: Apache-2.0
52
+ */
53
+ /*
54
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
55
+ SPDX-License-Identifier: Apache-2.0
56
+ */
57
+ /*
58
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
59
+ SPDX-License-Identifier: Apache-2.0
60
+ */
61
+ /*
62
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
63
+ SPDX-License-Identifier: Apache-2.0
64
+ */
65
+ /*
66
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
67
+ SPDX-License-Identifier: Apache-2.0
68
+ */
69
+ /*
70
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
71
+ SPDX-License-Identifier: Apache-2.0
72
+ */
73
+ /*
74
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
75
+ SPDX-License-Identifier: Apache-2.0
76
+ */
77
+ /*
78
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
79
+ SPDX-License-Identifier: Apache-2.0
80
+ */
81
+ /*
82
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
83
+ SPDX-License-Identifier: Apache-2.0
84
+ */
85
+ /*
86
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
87
+ SPDX-License-Identifier: Apache-2.0
88
+ */
89
+ /*
90
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
91
+ SPDX-License-Identifier: Apache-2.0
92
+ */
93
+ /*
94
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
95
+ SPDX-License-Identifier: Apache-2.0
96
+ */
97
+ /*
98
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
99
+ SPDX-License-Identifier: Apache-2.0
100
+ */
101
+ /*
102
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
103
+ SPDX-License-Identifier: Apache-2.0
104
+ */
105
+ /*
106
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
107
+ SPDX-License-Identifier: Apache-2.0
108
+ */
109
+ /*
110
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
111
+ SPDX-License-Identifier: Apache-2.0
112
+ */
113
+ /* stylelint-disable @cloudscape-design/no-motion-outside-of-mixin, selector-combinator-disallowed-list, selector-pseudo-class-no-unknown, selector-class-pattern */
114
+ /* stylelint-enable @cloudscape-design/no-motion-outside-of-mixin, selector-combinator-disallowed-list, selector-pseudo-class-no-unknown, selector-class-pattern */
115
+ /*
116
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
117
+ SPDX-License-Identifier: Apache-2.0
118
+ */
119
+ /*
120
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
121
+ SPDX-License-Identifier: Apache-2.0
122
+ */
123
+ /*
124
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
125
+ SPDX-License-Identifier: Apache-2.0
126
+ */
127
+ /*
128
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
129
+ SPDX-License-Identifier: Apache-2.0
130
+ */
131
+ /*
132
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
133
+ SPDX-License-Identifier: Apache-2.0
134
+ */
135
+ /*
136
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
137
+ SPDX-License-Identifier: Apache-2.0
138
+ */
139
+ /*
140
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
141
+ SPDX-License-Identifier: Apache-2.0
142
+ */
143
+ /* Style used for links in slots/components that are text heavy, to help links stand out among
144
+ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F73#description */
145
+ .awsui_slider_cqzlk_1vl2o_145:not(#\9) {
146
+ padding-block: 0;
147
+ padding-inline: 0;
148
+ cursor: ns-resize;
149
+ margin-block-start: 2px;
150
+ margin-block-end: 0;
151
+ margin-inline: 0;
152
+ block-size: 16px;
153
+ touch-action: none;
154
+ }
155
+ .awsui_slider_cqzlk_1vl2o_145:not(#\9):focus {
156
+ outline: none;
157
+ }
158
+ body[data-awsui-focus-visible=true] .awsui_slider_cqzlk_1vl2o_145:not(#\9):focus {
159
+ position: relative;
160
+ }
161
+ body[data-awsui-focus-visible=true] .awsui_slider_cqzlk_1vl2o_145:not(#\9):focus {
162
+ outline: 2px dotted transparent;
163
+ outline-offset: calc(0px - 1px);
164
+ }
165
+ body[data-awsui-focus-visible=true] .awsui_slider_cqzlk_1vl2o_145:not(#\9):focus::before {
166
+ content: " ";
167
+ display: block;
168
+ position: absolute;
169
+ inset-inline-start: calc(-1 * 0px);
170
+ inset-block-start: calc(-1 * 0px);
171
+ inline-size: calc(100% + 0px + 0px);
172
+ block-size: calc(100% + 0px + 0px);
173
+ border-start-start-radius: var(--border-radius-control-default-focus-ring-u8zbsz, 4px);
174
+ border-start-end-radius: var(--border-radius-control-default-focus-ring-u8zbsz, 4px);
175
+ border-end-start-radius: var(--border-radius-control-default-focus-ring-u8zbsz, 4px);
176
+ border-end-end-radius: var(--border-radius-control-default-focus-ring-u8zbsz, 4px);
177
+ box-shadow: 0 0 0 2px var(--color-border-item-focused-nv6mhz, #006ce0);
178
+ }
179
+
180
+ .awsui_slider-side_cqzlk_1vl2o_180:not(#\9) {
181
+ cursor: ew-resize;
182
+ margin-block: 0;
6
183
  margin-inline-start: 2px;
184
+ margin-inline-end: 0;
7
185
  }
8
186
 
9
- .awsui_handle-wrapper-bottom_cqzlk_1qkms_9:not(#\9) {
10
- margin-block-start: 2px;
187
+ .awsui_slider-icon_cqzlk_1vl2o_187:not(#\9) {
188
+ stroke: var(--color-text-interactive-default-tkx8fe, #424650);
189
+ }
190
+ .awsui_slider-icon_cqzlk_1vl2o_187:not(#\9):hover {
191
+ stroke: var(--color-text-interactive-hover-f9gqs8, #0f141a);
192
+ }
193
+ .awsui_slider-icon-bottom_cqzlk_1vl2o_193:not(#\9) {
194
+ margin-block: auto;
195
+ margin-inline: auto;
196
+ }
197
+ .awsui_slider-icon-side_cqzlk_1vl2o_197:not(#\9) {
198
+ transform: rotate(90deg);
11
199
  }
@@ -2,7 +2,10 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "handle-wrapper-side": "awsui_handle-wrapper-side_cqzlk_1qkms_5",
6
- "handle-wrapper-bottom": "awsui_handle-wrapper-bottom_cqzlk_1qkms_9"
5
+ "slider": "awsui_slider_cqzlk_1vl2o_145",
6
+ "slider-side": "awsui_slider-side_cqzlk_1vl2o_180",
7
+ "slider-icon": "awsui_slider-icon_cqzlk_1vl2o_187",
8
+ "slider-icon-bottom": "awsui_slider-icon-bottom_cqzlk_1vl2o_193",
9
+ "slider-icon-side": "awsui_slider-icon-side_cqzlk_1vl2o_197"
7
10
  };
8
11
 
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { SortableAreaProps } from './interfaces';
3
+ export { SortableAreaProps };
4
+ export default function SortableArea<Item>({ items, itemDefinition, renderItem, onItemsChange, disableReorder, i18nStrings, }: SortableAreaProps<Item>): JSX.Element;
5
+ export declare function getBorderRadiusVariant(itemDefinition: SortableAreaProps.ItemDefinition<any>): SortableAreaProps.BorderRadiusVariant;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/sortable-area/index.tsx"],"names":[],"mappings":";AAYA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAMjD,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAE7B,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,IAAI,EAAE,EACzC,KAAK,EACL,cAAc,EACd,UAAU,EACV,aAAa,EACb,cAAc,EACd,WAAW,GACZ,EAAE,iBAAiB,CAAC,IAAI,CAAC,eA4EzB;AAyED,wBAAgB,sBAAsB,CACpC,cAAc,EAAE,iBAAiB,CAAC,cAAc,CAAC,GAAG,CAAC,GACpD,iBAAiB,CAAC,mBAAmB,CAEvC"}
@@ -5,70 +5,75 @@ import { DndContext, DragOverlay } from '@dnd-kit/core';
5
5
  import { arrayMove, SortableContext, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable';
6
6
  import { CSS } from '@dnd-kit/utilities';
7
7
  import clsx from 'clsx';
8
+ import Portal from '../../components/portal';
9
+ import { fireNonCancelableEvent } from '../../events';
8
10
  import { joinStrings } from '../../utils/strings';
9
- import Portal from '../portal';
10
11
  import useDragAndDropReorder from './use-drag-and-drop-reorder';
11
12
  import useLiveAnnouncements from './use-live-announcements';
12
13
  import styles from './styles.css.js';
13
- export function DndArea({ items, renderItem, onItemsChange, disableReorder, i18nStrings, borderRadiusVariant = 'item', }) {
14
+ export default function SortableArea({ items, itemDefinition, renderItem, onItemsChange, disableReorder, i18nStrings, }) {
14
15
  var _a;
15
16
  const { activeItemId, setActiveItemId, collisionDetection, handleKeyDown, sensors } = useDragAndDropReorder({
16
17
  items,
18
+ itemDefinition,
17
19
  });
18
- const activeItem = activeItemId ? items.find(item => item.id === activeItemId) : null;
20
+ const activeItem = activeItemId ? items.find(item => itemDefinition.id(item) === activeItemId) : null;
19
21
  const isDragging = activeItemId !== null;
20
- const announcements = useLiveAnnouncements(Object.assign({ items, isDragging }, i18nStrings));
22
+ const announcements = useLiveAnnouncements(Object.assign({ items, itemDefinition, isDragging }, i18nStrings));
21
23
  const portalContainer = usePortalContainer();
22
24
  return (React.createElement(DndContext, { sensors: sensors, collisionDetection: collisionDetection, accessibility: {
23
25
  announcements,
24
26
  restoreFocus: false,
25
- screenReaderInstructions: i18nStrings.dragHandleAriaDescription
27
+ screenReaderInstructions: (i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.dragHandleAriaDescription)
26
28
  ? { draggable: i18nStrings.dragHandleAriaDescription }
27
29
  : undefined,
28
- container: portalContainer,
30
+ container: portalContainer !== null && portalContainer !== void 0 ? portalContainer : undefined,
29
31
  }, onDragStart: ({ active }) => setActiveItemId(active.id), onDragEnd: event => {
30
32
  setActiveItemId(null);
31
33
  const { active, over } = event;
32
34
  if (over && active.id !== over.id) {
33
- const oldIndex = items.findIndex(item => item.id === active.id);
34
- const newIndex = items.findIndex(item => item.id === over.id);
35
- onItemsChange(arrayMove([...items], oldIndex, newIndex));
35
+ const movedItem = items.find(item => itemDefinition.id(item) === active.id);
36
+ const oldIndex = items.findIndex(item => itemDefinition.id(item) === active.id);
37
+ const newIndex = items.findIndex(item => itemDefinition.id(item) === over.id);
38
+ fireNonCancelableEvent(onItemsChange, { items: arrayMove([...items], oldIndex, newIndex), movedItem });
36
39
  }
37
40
  }, onDragCancel: () => setActiveItemId(null) },
38
- React.createElement(SortableContext, { disabled: disableReorder, items: items.map(item => item.id), strategy: verticalListSortingStrategy }, items.map(item => (React.createElement(DraggableItem, { key: item.id, item: item, renderItem: renderItem, onKeyDown: handleKeyDown, dragHandleAriaLabel: i18nStrings.dragHandleAriaLabel, borderRadiusVariant: borderRadiusVariant })))),
41
+ React.createElement(SortableContext, { disabled: disableReorder, items: items.map(item => itemDefinition.id(item)), strategy: verticalListSortingStrategy }, items.map(item => (React.createElement(DraggableItem, { key: itemDefinition.id(item), item: item, itemDefinition: itemDefinition, renderItem: renderItem, onKeyDown: handleKeyDown, dragHandleAriaLabel: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.dragHandleAriaLabel })))),
39
42
  React.createElement(Portal, { container: portalContainer },
40
- React.createElement(DragOverlay, { className: clsx(styles['drag-overlay'], styles[`drag-overlay-${borderRadiusVariant}`]), dropAnimation: null, style: { zIndex: 5000 } }, activeItem &&
43
+ React.createElement(DragOverlay, { className: clsx(styles['drag-overlay'], styles[`drag-overlay-${getBorderRadiusVariant(itemDefinition)}`]), dropAnimation: null, style: { zIndex: 5000 } }, activeItem &&
41
44
  renderItem({
42
45
  item: activeItem,
43
46
  style: {},
44
47
  className: styles.active,
45
- isDragging: true,
46
- isSorting: false,
47
- isActive: true,
48
+ isDropPlaceholder: true,
49
+ isSortingActive: false,
50
+ isDragGhost: true,
48
51
  dragHandleProps: {
49
- ariaLabel: (_a = joinStrings(i18nStrings.dragHandleAriaLabel, activeItem.label)) !== null && _a !== void 0 ? _a : '',
52
+ ariaLabel: (_a = joinStrings(i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.dragHandleAriaLabel, itemDefinition.label(activeItem))) !== null && _a !== void 0 ? _a : '',
50
53
  onKeyDown: handleKeyDown,
51
54
  },
52
55
  })))));
53
56
  }
54
57
  function usePortalContainer() {
55
- const portalContainerRef = useRef(document.createElement('div'));
58
+ const portalContainerRef = useRef(typeof document !== 'undefined' ? document.createElement('div') : null);
56
59
  useEffect(() => {
57
60
  const container = portalContainerRef.current;
58
- if (!container.isConnected) {
61
+ if (container && !container.isConnected) {
59
62
  document.body.appendChild(container);
60
63
  }
61
64
  return () => {
62
- if (container.isConnected) {
65
+ if (container && container.isConnected) {
63
66
  document.body.removeChild(container);
64
67
  }
65
68
  };
66
69
  }, []);
67
70
  return portalContainerRef.current;
68
71
  }
69
- function DraggableItem({ item, dragHandleAriaLabel, onKeyDown, renderItem, borderRadiusVariant, }) {
72
+ function DraggableItem({ item, itemDefinition, dragHandleAriaLabel, onKeyDown, renderItem, }) {
70
73
  var _a;
71
- const { isDragging, isSorting, listeners, setNodeRef, transform, attributes } = useSortable({ id: item.id });
74
+ const { isDragging, isSorting, listeners, setNodeRef, transform, attributes } = useSortable({
75
+ id: itemDefinition.id(item),
76
+ });
72
77
  const style = { transform: CSS.Translate.toString(transform) };
73
78
  const dragHandleListeners = attributes['aria-disabled']
74
79
  ? {}
@@ -80,16 +85,20 @@ function DraggableItem({ item, dragHandleAriaLabel, onKeyDown, renderItem, borde
80
85
  listeners.onKeyDown(event);
81
86
  }
82
87
  } });
83
- const className = clsx(isDragging && clsx(styles.placeholder, styles[`placeholder-${borderRadiusVariant}`]), isSorting && styles.sorting);
88
+ const className = clsx(isDragging && clsx(styles.placeholder, styles[`placeholder-${getBorderRadiusVariant(itemDefinition)}`]), isSorting && styles.sorting);
84
89
  return (React.createElement(React.Fragment, null, renderItem({
85
90
  item,
86
91
  ref: setNodeRef,
87
92
  style,
88
93
  className,
89
- isDragging,
90
- isSorting,
91
- isActive: false,
92
- dragHandleProps: Object.assign(Object.assign({}, dragHandleListeners), { ariaLabel: (_a = joinStrings(dragHandleAriaLabel, item.label)) !== null && _a !== void 0 ? _a : '', ariaDescribedby: attributes['aria-describedby'], disabled: attributes['aria-disabled'] }),
94
+ isDropPlaceholder: isDragging,
95
+ isSortingActive: isSorting,
96
+ isDragGhost: false,
97
+ dragHandleProps: Object.assign(Object.assign({}, dragHandleListeners), { ariaLabel: (_a = joinStrings(dragHandleAriaLabel, itemDefinition.label(item))) !== null && _a !== void 0 ? _a : '', ariaDescribedby: attributes['aria-describedby'], disabled: attributes['aria-disabled'] }),
93
98
  })));
94
99
  }
100
+ export function getBorderRadiusVariant(itemDefinition) {
101
+ var _a;
102
+ return (_a = itemDefinition.borderRadius) !== null && _a !== void 0 ? _a : 'item';
103
+ }
95
104
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/sortable-area/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,WAAW,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AACzG,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,MAAM,MAAM,yBAAyB,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EA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QACJ,GAAG,EAAE,UAAU;QACf,KAAK;QACL,SAAS;QACT,iBAAiB,EAAE,UAAU;QAC7B,eAAe,EAAE,SAAS;QAC1B,WAAW,EAAE,KAAK;QAClB,eAAe,kCACV,mBAAmB,KACtB,SAAS,EAAE,MAAA,WAAW,CAAC,mBAAmB,EAAE,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,mCAAI,EAAE,EAC7E,eAAe,EAAE,UAAU,CAAC,kBAAkB,CAAC,EAC/C,QAAQ,EAAE,UAAU,CAAC,eAAe,CAAC,GACtC;KACF,CAAC,CACD,CACJ,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,cAAqD;;IAErD,OAAO,MAAA,cAAc,CAAC,YAAY,mCAAI,MAAM,CAAC;AAC/C,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useEffect, useRef } from 'react';\nimport { DndContext, DragOverlay } from '@dnd-kit/core';\nimport { arrayMove, SortableContext, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable';\nimport { CSS } from '@dnd-kit/utilities';\nimport clsx from 'clsx';\n\nimport Portal from '../../components/portal';\nimport { fireNonCancelableEvent } from '../../events';\nimport { joinStrings } from '../../utils/strings';\nimport { SortableAreaProps } from './interfaces';\nimport useDragAndDropReorder from './use-drag-and-drop-reorder';\nimport useLiveAnnouncements from './use-live-announcements';\n\nimport styles from './styles.css.js';\n\nexport { SortableAreaProps };\n\nexport default function SortableArea<Item>({\n items,\n itemDefinition,\n renderItem,\n onItemsChange,\n disableReorder,\n i18nStrings,\n}: SortableAreaProps<Item>) {\n const { activeItemId, setActiveItemId, collisionDetection, handleKeyDown, sensors } = useDragAndDropReorder({\n items,\n itemDefinition,\n });\n const activeItem = activeItemId ? items.find(item => itemDefinition.id(item) === activeItemId) : null;\n const isDragging = activeItemId !== null;\n const announcements = useLiveAnnouncements({ items, itemDefinition, isDragging, ...i18nStrings });\n const portalContainer = usePortalContainer();\n return (\n <DndContext\n sensors={sensors}\n collisionDetection={collisionDetection}\n accessibility={{\n announcements,\n restoreFocus: false,\n screenReaderInstructions: i18nStrings?.dragHandleAriaDescription\n ? { draggable: i18nStrings.dragHandleAriaDescription }\n : undefined,\n container: portalContainer ?? undefined,\n }}\n onDragStart={({ active }) => setActiveItemId(active.id)}\n onDragEnd={event => {\n setActiveItemId(null);\n const { active, over } = event;\n if (over && active.id !== over.id) {\n const movedItem = items.find(item => itemDefinition.id(item) === active.id)!;\n const oldIndex = items.findIndex(item => itemDefinition.id(item) === active.id);\n const newIndex = items.findIndex(item => itemDefinition.id(item) === over.id);\n fireNonCancelableEvent(onItemsChange, { items: arrayMove([...items], oldIndex, newIndex), movedItem });\n }\n }}\n onDragCancel={() => setActiveItemId(null)}\n >\n <SortableContext\n disabled={disableReorder}\n items={items.map(item => itemDefinition.id(item))}\n strategy={verticalListSortingStrategy}\n >\n {items.map(item => (\n <DraggableItem\n key={itemDefinition.id(item)}\n item={item}\n itemDefinition={itemDefinition}\n renderItem={renderItem}\n onKeyDown={handleKeyDown}\n dragHandleAriaLabel={i18nStrings?.dragHandleAriaLabel}\n />\n ))}\n </SortableContext>\n\n <Portal container={portalContainer}>\n {/* Make sure that the drag overlay is above the modal by assigning the z-index as inline style\n so that it prevails over dnd-kit's inline z-index of 999 */}\n <DragOverlay\n className={clsx(styles['drag-overlay'], styles[`drag-overlay-${getBorderRadiusVariant(itemDefinition)}`])}\n dropAnimation={null}\n style={{ zIndex: 5000 }}\n >\n {activeItem &&\n renderItem({\n item: activeItem,\n style: {},\n className: styles.active,\n isDropPlaceholder: true,\n isSortingActive: false,\n isDragGhost: true,\n dragHandleProps: {\n ariaLabel: joinStrings(i18nStrings?.dragHandleAriaLabel, itemDefinition.label(activeItem)) ?? '',\n onKeyDown: handleKeyDown,\n },\n })}\n </DragOverlay>\n </Portal>\n </DndContext>\n );\n}\n\nfunction usePortalContainer() {\n const portalContainerRef = useRef(typeof document !== 'undefined' ? document.createElement('div') : null);\n useEffect(() => {\n const container = portalContainerRef.current;\n if (container && !container.isConnected) {\n document.body.appendChild(container);\n }\n return () => {\n if (container && container.isConnected) {\n document.body.removeChild(container);\n }\n };\n }, []);\n return portalContainerRef.current;\n}\n\nfunction DraggableItem<Item>({\n item,\n itemDefinition,\n dragHandleAriaLabel,\n onKeyDown,\n renderItem,\n}: {\n item: Item;\n itemDefinition: SortableAreaProps.ItemDefinition<Item>;\n dragHandleAriaLabel?: string;\n onKeyDown: (event: React.KeyboardEvent) => void;\n renderItem: (props: SortableAreaProps.RenderItemProps<Item>) => React.ReactNode;\n}) {\n const { isDragging, isSorting, listeners, setNodeRef, transform, attributes } = useSortable({\n id: itemDefinition.id(item),\n });\n const style = { transform: CSS.Translate.toString(transform) };\n const dragHandleListeners = attributes['aria-disabled']\n ? {}\n : {\n ...listeners,\n onKeyDown: (event: React.KeyboardEvent) => {\n if (onKeyDown) {\n onKeyDown(event);\n }\n if (listeners?.onKeyDown) {\n listeners.onKeyDown(event);\n }\n },\n };\n const className = clsx(\n isDragging && clsx(styles.placeholder, styles[`placeholder-${getBorderRadiusVariant(itemDefinition)}`]),\n isSorting && styles.sorting\n );\n return (\n <>\n {renderItem({\n item,\n ref: setNodeRef,\n style,\n className,\n isDropPlaceholder: isDragging,\n isSortingActive: isSorting,\n isDragGhost: false,\n dragHandleProps: {\n ...dragHandleListeners,\n ariaLabel: joinStrings(dragHandleAriaLabel, itemDefinition.label(item)) ?? '',\n ariaDescribedby: attributes['aria-describedby'],\n disabled: attributes['aria-disabled'],\n },\n })}\n </>\n );\n}\n\nexport function getBorderRadiusVariant(\n itemDefinition: SortableAreaProps.ItemDefinition<any>\n): SortableAreaProps.BorderRadiusVariant {\n return itemDefinition.borderRadius ?? 'item';\n}\n"]}
@@ -0,0 +1,42 @@
1
+ /// <reference types="react" />
2
+ import { NonCancelableEventHandler } from '../../events';
3
+ import { DragHandleProps } from '../drag-handle/interfaces';
4
+ export interface SortableAreaProps<Item> {
5
+ items: readonly Item[];
6
+ itemDefinition: SortableAreaProps.ItemDefinition<Item>;
7
+ renderItem: (props: SortableAreaProps.RenderItemProps<Item>) => React.ReactNode;
8
+ onItemsChange?: NonCancelableEventHandler<SortableAreaProps.ItemsChangeDetail<Item>>;
9
+ i18nStrings?: SortableAreaProps.DndAreaI18nStrings;
10
+ disableReorder?: boolean;
11
+ }
12
+ export declare namespace SortableAreaProps {
13
+ interface ItemDefinition<Item> {
14
+ id: (item: Item) => string;
15
+ label: (item: Item) => string;
16
+ borderRadius?: BorderRadiusVariant;
17
+ }
18
+ type BorderRadiusVariant = 'item' | 'container';
19
+ interface RenderItemProps<Item> {
20
+ ref?: React.RefCallback<HTMLElement>;
21
+ item: Item;
22
+ style: React.CSSProperties;
23
+ className?: string;
24
+ isDropPlaceholder: boolean;
25
+ isSortingActive: boolean;
26
+ isDragGhost: boolean;
27
+ dragHandleProps: DragHandleProps;
28
+ }
29
+ interface ItemsChangeDetail<Item> {
30
+ items: Item[];
31
+ movedItem: Item;
32
+ }
33
+ interface DndAreaI18nStrings {
34
+ liveAnnouncementDndStarted?: (position: number, total: number) => string;
35
+ liveAnnouncementDndItemReordered?: (initialPosition: number, currentPosition: number, total: number) => string;
36
+ liveAnnouncementDndItemCommitted?: (initialPosition: number, finalPosition: number, total: number) => string;
37
+ liveAnnouncementDndDiscarded?: string;
38
+ dragHandleAriaLabel?: string;
39
+ dragHandleAriaDescription?: string;
40
+ }
41
+ }
42
+ //# sourceMappingURL=interfaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/sortable-area/interfaces.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,MAAM,WAAW,iBAAiB,CAAC,IAAI;IACrC,KAAK,EAAE,SAAS,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AC,eAAe,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;QAC/G,gCAAgC,CAAC,EAAE,CAAC,eAAe,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;QAC7G,4BAA4B,CAAC,EAAE,MAAM,CAAC;QACtC,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAC7B,yBAAyB,CAAC,EAAE,MAAM,CAAC;KACpC;CACF"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../src/internal/components/sortable-area/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { NonCancelableEventHandler } from '../../events';\nimport { DragHandleProps } from '../drag-handle/interfaces';\n\nexport interface SortableAreaProps<Item> {\n items: readonly Item[];\n itemDefinition: SortableAreaProps.ItemDefinition<Item>;\n renderItem: (props: SortableAreaProps.RenderItemProps<Item>) => React.ReactNode;\n onItemsChange?: NonCancelableEventHandler<SortableAreaProps.ItemsChangeDetail<Item>>;\n i18nStrings?: SortableAreaProps.DndAreaI18nStrings;\n disableReorder?: boolean;\n}\n\nexport namespace SortableAreaProps {\n export interface ItemDefinition<Item> {\n id: (item: Item) => string;\n label: (item: Item) => string;\n borderRadius?: BorderRadiusVariant;\n }\n\n export type BorderRadiusVariant = 'item' | 'container';\n\n export interface RenderItemProps<Item> {\n ref?: React.RefCallback<HTMLElement>;\n item: Item;\n style: React.CSSProperties;\n className?: string;\n isDropPlaceholder: boolean;\n isSortingActive: boolean;\n isDragGhost: boolean;\n dragHandleProps: DragHandleProps;\n }\n\n export interface ItemsChangeDetail<Item> {\n items: Item[];\n movedItem: Item;\n }\n\n export interface DndAreaI18nStrings {\n liveAnnouncementDndStarted?: (position: number, total: number) => string;\n liveAnnouncementDndItemReordered?: (initialPosition: number, currentPosition: number, total: number) => string;\n liveAnnouncementDndItemCommitted?: (initialPosition: number, finalPosition: number, total: number) => string;\n liveAnnouncementDndDiscarded?: string;\n dragHandleAriaLabel?: string;\n dragHandleAriaDescription?: string;\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/components/sortable-area/keyboard-sensor/defaults.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,aAAa,EAAE,MAAM,eAAe,CAAC;AAE5D,eAAO,MAAM,oBAAoB,EAAE,aAIlC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../../../../src/internal/components/sortable-area/keyboard-sensor/defaults.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,YAAY,EAAiB,MAAM,eAAe,CAAC;AAE5D,MAAM,CAAC,MAAM,oBAAoB,GAAkB;IACjD,KAAK,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC;IAC/C,MAAM,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC;IAC1B,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC;CAC9C,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { KeyboardCode, KeyboardCodes } from '@dnd-kit/core';\n\nexport const defaultKeyboardCodes: KeyboardCodes = {\n start: [KeyboardCode.Space, KeyboardCode.Enter],\n cancel: [KeyboardCode.Esc],\n end: [KeyboardCode.Space, KeyboardCode.Enter],\n};\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/components/sortable-area/keyboard-sensor/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEhE,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAyB3E,qBAAa,cAAe,YAAW,cAAc;IAMvC,OAAO,CAAC,KAAK;IALlB,iBAAiB,UAAS;IACjC,OAAO,CAAC,oBAAoB,CAA0B;IACtD,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,eAAe,CAAY;gBAEf,KAAK,EAAE,mBAAmB;IAc9C,OAAO,CAAC,MAAM;IAYd,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,aAAa;IA8CrB,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,SAAS;IAQjB,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,MAAM;IAQd,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,qBAAqB,CAAC,CAuBlD;CACH"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/internal/components/sortable-area/keyboard-sensor/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAEL,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,QAAQ,IAAI,mBAAmB,GAChC,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,0DAA0D;AAC1D,wGAAwG;AAExG,6EAA6E;AAC7E,2DAA2D;AAC3D,sEAAsE;AACtE,yEAAyE;AAEzE,8DAA8D;AAE9D,MAAM,OAAO,cAAc;IAMzB,YAAoB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F,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC;QAC3B,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE,CAAC;IACnC,CAAC;;AAEM,yBAAU,GAAsC;IACrD;QACE,SAAS,EAAE,WAAoB;QAC/B,OAAO,EAAE,CAAC,KAA0B,EAAE,EAAE,aAAa,GAAG,oBAAoB,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;YAC1G,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,WAAW,CAAC;YAEnC,IAAI,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE;gBAC5C,MAAM,SAAS,GAAG,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC;gBAE/C,IAAI,SAAS,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,EAAE;oBAC3C,OAAO,KAAK,CAAC;iBACd;gBAED,KAAK,CAAC,cAAc,EAAE,CAAC;gBAEvB,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAG,EAAE,KAAK,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;gBAE7C,OAAO,IAAI,CAAC;aACb;YAED,OAAO,KAAK,CAAC;QACf,CAAC;KACF;CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport type { Activators, SensorInstance } from '@dnd-kit/core';\nimport { defaultCoordinates } from '@dnd-kit/core';\nimport { KeyboardSensorOptions, KeyboardSensorProps } from '@dnd-kit/core';\nimport {\n Coordinates,\n getOwnerDocument,\n getWindow,\n isKeyboardEvent,\n subtract as getCoordinatesDelta,\n} from '@dnd-kit/utilities';\n\nimport { scrollElementIntoView } from '../../../utils/scrollable-containers';\nimport { defaultKeyboardCodes } from './defaults';\nimport { EventName } from './utilities/events';\nimport { Listeners } from './utilities/listeners';\nimport { applyScroll } from './utilities/scroll';\n\n// Slightly modified version of @dnd-kit's KeyboardSensor:\n// https://github.com/clauderic/dnd-kit/blob/master/packages/core/src/sensors/keyboard/KeyboardSensor.ts\n\n// The only difference is that here, reordering is deactivated on blur, as in\n// this PR: https://github.com/clauderic/dnd-kit/pull/1087.\n// If it is merged, then @dnd-kit's KeyboardSensor can be used instead\n// and all files under this directory (`keyboard-sensor`) can be removed.\n\n// Changes from mainstream are marked below as \"Customization\"\n\nexport class KeyboardSensor implements SensorInstance {\n public autoScrollEnabled = false;\n private referenceCoordinates: Coordinates | undefined;\n private listeners: Listeners;\n private windowListeners: Listeners;\n\n constructor(private props: KeyboardSensorProps) {\n const {\n event: { target },\n } = props;\n\n this.props = props;\n this.listeners = new Listeners(getOwnerDocument(target));\n this.windowListeners = new Listeners(getWindow(target));\n this.handleKeyDown = this.handleKeyDown.bind(this);\n this.handleCancel = this.handleCancel.bind(this);\n\n this.attach();\n }\n\n private attach() {\n this.handleStart();\n\n this.windowListeners.add(EventName.Resize, this.handleCancel);\n this.windowListeners.add(EventName.VisibilityChange, this.handleCancel);\n\n // Customization: deactivate reordering on blur event\n this.props.event.target?.addEventListener(EventName.Blur, this.handleCancel);\n\n setTimeout(() => this.listeners.add(EventName.Keydown, this.handleKeyDown));\n }\n\n private handleStart() {\n const { activeNode, onStart } = this.props;\n const node = activeNode.node.current;\n\n if (node) {\n scrollElementIntoView(node);\n }\n\n onStart(defaultCoordinates);\n }\n\n private handleKeyDown(event: Event) {\n if (isKeyboardEvent(event)) {\n const { active, context, options } = this.props;\n const { keyboardCodes = defaultKeyboardCodes, coordinateGetter } = options;\n const { code } = event;\n\n if (keyboardCodes.end.indexOf(code) !== -1) {\n this.handleEnd(event);\n return;\n }\n\n if (keyboardCodes.cancel.indexOf(code) !== -1) {\n this.handleCancel(event);\n return;\n }\n\n const { collisionRect } = context.current;\n const currentCoordinates = collisionRect ? { x: collisionRect.left, y: collisionRect.top } : defaultCoordinates;\n\n if (!this.referenceCoordinates) {\n this.referenceCoordinates = currentCoordinates;\n }\n\n if (!coordinateGetter) {\n return;\n }\n\n const newCoordinates = coordinateGetter(event, {\n active,\n context: context.current,\n currentCoordinates,\n });\n\n if (newCoordinates) {\n const { scrollableAncestors } = context.current;\n const direction = event.code;\n\n const scrolled = applyScroll({ currentCoordinates, direction, newCoordinates, scrollableAncestors });\n\n if (!scrolled) {\n this.handleMove(event, getCoordinatesDelta(newCoordinates, this.referenceCoordinates));\n }\n }\n }\n }\n\n private handleMove(event: Event, coordinates: Coordinates) {\n const { onMove } = this.props;\n\n event.preventDefault();\n onMove(coordinates);\n }\n\n private handleEnd(event: Event) {\n const { onEnd } = this.props;\n\n event.preventDefault();\n this.detach();\n onEnd();\n }\n\n private handleCancel(event: Event) {\n const { onCancel } = this.props;\n\n // Customization: do not prevent browser from managing native focus\n if (event.type !== EventName.Blur) {\n event.preventDefault();\n }\n this.detach();\n onCancel();\n }\n\n private detach() {\n // Customization: clean up listener for blur event\n this.props.event.target?.removeEventListener(EventName.Blur, this.handleCancel);\n\n this.listeners.removeAll();\n this.windowListeners.removeAll();\n }\n\n static activators: Activators<KeyboardSensorOptions> = [\n {\n eventName: 'onKeyDown' as const,\n handler: (event: React.KeyboardEvent, { keyboardCodes = defaultKeyboardCodes, onActivation }, { active }) => {\n const { code } = event.nativeEvent;\n\n if (keyboardCodes.start.indexOf(code) !== -1) {\n const activator = active.activatorNode.current;\n\n if (activator && event.target !== activator) {\n return false;\n }\n\n event.preventDefault();\n\n onActivation?.({ event: event.nativeEvent });\n\n return true;\n }\n\n return false;\n },\n },\n ];\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../../../../src/internal/components/sortable-area/keyboard-sensor/utilities/events.ts"],"names":[],"mappings":"AAEA,oBAAY,SAAS;IACnB,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,gBAAgB,qBAAqB;CACtC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../../../../../../../src/internal/components/sortable-area/keyboard-sensor/utilities/events.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,MAAM,CAAN,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,0BAAa,CAAA;IACb,gCAAmB,CAAA;IACnB,8BAAiB,CAAA;IACjB,kDAAqC,CAAA;AACvC,CAAC,EALW,SAAS,KAAT,SAAS,QAKpB","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport enum EventName {\n Blur = 'blur',\n Keydown = 'keydown',\n Resize = 'resize',\n VisibilityChange = 'visibilitychange',\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listeners.d.ts","sourceRoot":"","sources":["../../../../../../../src/internal/components/sortable-area/keyboard-sensor/utilities/listeners.ts"],"names":[],"mappings":"AAEA,qBAAa,SAAS;IAGR,OAAO,CAAC,MAAM;IAF1B,OAAO,CAAC,SAAS,CAAqG;gBAElG,MAAM,EAAE,WAAW,GAAG,IAAI;IAEvC,GAAG,CAAC,CAAC,SAAS,KAAK,EACxB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,EAC3B,OAAO,CAAC,EAAE,uBAAuB,GAAG,OAAO;IAMtC,SAAS,aAEd;CACH"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listeners.js","sourceRoot":"","sources":["../../../../../../../src/internal/components/sortable-area/keyboard-sensor/utilities/listeners.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,MAAM,OAAO,SAAS;IAGpB,YAAoB,MAA0B;QAA1B,WAAM,GAAN,MAAM,CAAoB;QAFtC,cAAS,GAAkG,EAAE,CAAC;QAa/G,cAAS,GAAG,GAAG,EAAE;YACtB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,WAAC,OAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAC,CAAA,EAAA,CAAC,CAAC;QACpF,CAAC,CAAC;IAb+C,CAAC;IAE3C,GAAG,CACR,SAAiB,EACjB,OAA2B,EAC3B,OAA2C;;QAE3C,MAAA,IAAI,CAAC,MAAM,0CAAE,gBAAgB,CAAC,SAAS,EAAE,OAAwB,EAAE,OAAO,CAAC,CAAC;QAC5E,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,OAAwB,EAAE,OAAO,CAAC,CAAC,CAAC;IACtE,CAAC;CAKF","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport class Listeners {\n private listeners: [string, EventListenerOrEventListenerObject, AddEventListenerOptions | boolean | undefined][] = [];\n\n constructor(private target: EventTarget | null) {}\n\n public add<T extends Event>(\n eventName: string,\n handler: (event: T) => void,\n options?: AddEventListenerOptions | boolean\n ) {\n this.target?.addEventListener(eventName, handler as EventListener, options);\n this.listeners.push([eventName, handler as EventListener, options]);\n }\n\n public removeAll = () => {\n this.listeners.forEach(listener => this.target?.removeEventListener(...listener));\n };\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scroll.d.ts","sourceRoot":"","sources":["../../../../../../../src/internal/components/sortable-area/keyboard-sensor/utilities/scroll.ts"],"names":[],"mappings":"AAGA,OAAO,EAAa,WAAW,EAAmC,MAAM,oBAAoB,CAAC;AAsE7F,wBAAgB,WAAW,CAAC,EAC1B,kBAAkB,EAClB,SAAS,EACT,cAAc,EACd,mBAAmB,GACpB,EAAE;IACD,kBAAkB,EAAE,WAAW,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,WAAW,CAAC;IAC5B,mBAAmB,EAAE,OAAO,EAAE,CAAC;CAChC,WA0CA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scroll.js","sourceRoot":"","sources":["../../../../../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C,iBAAiB,CAAC,MAAM,EAC5B,IAAI,CAAC,GAAG,CACN,SAAS,KAAK,YAAY,CAAC,IAAI;gBAC7B,CAAC,CAAC,iBAAiB,CAAC,GAAG;gBACvB,CAAC,CAAC,iBAAiB,CAAC,GAAG,GAAG,iBAAiB,CAAC,MAAM,GAAG,CAAC,EACxD,cAAc,CAAC,CAAC,CACjB,CACF;SACF,CAAC;QAEF,MAAM,UAAU,GAAG,CAAC,SAAS,KAAK,YAAY,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,KAAK,YAAY,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAE/G,IAAI,UAAU,IAAI,kBAAkB,CAAC,CAAC,KAAK,cAAc,CAAC,CAAC,EAAE;YAC3D,MAAM,oBAAoB,GAAG,eAAe,CAAC,SAAS,GAAG,gBAAgB,CAAC,CAAC,CAAC;YAC5E,MAAM,yBAAyB,GAC7B,CAAC,SAAS,KAAK,YAAY,CAAC,IAAI,IAAI,oBAAoB,IAAI,SAAS,CAAC,CAAC,CAAC;gBACxE,CAAC,SAAS,KAAK,YAAY,CAAC,EAAE,IAAI,oBAAoB,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC;YAEzE,IAAI,yBAAyB,EAAE;gBAC7B,gFAAgF;gBAChF,qDAAqD;gBACrD,eAAe,CAAC,QAAQ,CAAC;oBACvB,GAAG,EAAE,oBAAoB;oBACzB,QAAQ,EAAE,QAAQ;iBACnB,CAAC,CAAC;gBACH,OAAO,IAAI,CAAC;aACb;YAED,MAAM;SACP;KACF;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { KeyboardCode } from '@dnd-kit/core';\nimport { canUseDOM, Coordinates, subtract as getCoordinatesDelta } from '@dnd-kit/utilities';\n\nfunction isDocumentScrollingElement(element: Element | null) {\n if (!canUseDOM || !element) {\n return false;\n }\n\n return element === document.scrollingElement;\n}\n\nfunction getScrollPosition(scrollingContainer: Element) {\n const minScroll = {\n x: 0,\n y: 0,\n };\n const dimensions = isDocumentScrollingElement(scrollingContainer)\n ? {\n height: window.innerHeight,\n width: window.innerWidth,\n }\n : {\n height: scrollingContainer.clientHeight,\n width: scrollingContainer.clientWidth,\n };\n const maxScroll = {\n x: scrollingContainer.scrollWidth - dimensions.width,\n y: scrollingContainer.scrollHeight - dimensions.height,\n };\n\n const isTop = scrollingContainer.scrollTop <= minScroll.y;\n const isLeft = scrollingContainer.scrollLeft <= minScroll.x;\n const isBottom = scrollingContainer.scrollTop >= maxScroll.y;\n const isRight = scrollingContainer.scrollLeft >= maxScroll.x;\n\n return {\n isTop,\n isLeft,\n isBottom,\n isRight,\n maxScroll,\n minScroll,\n };\n}\n\nfunction getScrollElementRect(element: Element) {\n if (element === document.scrollingElement) {\n const { innerWidth, innerHeight } = window;\n\n return {\n top: 0,\n left: 0,\n right: innerWidth,\n bottom: innerHeight,\n width: innerWidth,\n height: innerHeight,\n };\n }\n\n const { top, left, right, bottom } = element.getBoundingClientRect();\n\n return {\n top,\n left,\n right,\n bottom,\n width: element.clientWidth,\n height: element.clientHeight,\n };\n}\n\nexport function applyScroll({\n currentCoordinates,\n direction,\n newCoordinates,\n scrollableAncestors,\n}: {\n currentCoordinates: Coordinates;\n direction: string;\n newCoordinates: Coordinates;\n scrollableAncestors: Element[];\n}) {\n for (const scrollContainer of scrollableAncestors) {\n const coordinatesDelta = getCoordinatesDelta(newCoordinates, currentCoordinates);\n const { isTop, isBottom, maxScroll, minScroll } = getScrollPosition(scrollContainer);\n const scrollElementRect = getScrollElementRect(scrollContainer);\n\n const clampedCoordinates = {\n y: Math.min(\n direction === KeyboardCode.Down\n ? scrollElementRect.bottom - scrollElementRect.height / 2\n : scrollElementRect.bottom,\n Math.max(\n direction === KeyboardCode.Down\n ? scrollElementRect.top\n : scrollElementRect.top + scrollElementRect.height / 2,\n newCoordinates.y\n )\n ),\n };\n\n const canScrollY = (direction === KeyboardCode.Down && !isBottom) || (direction === KeyboardCode.Up && !isTop);\n\n if (canScrollY && clampedCoordinates.y !== newCoordinates.y) {\n const newScrollCoordinates = scrollContainer.scrollTop + coordinatesDelta.y;\n const canScrollToNewCoordinates =\n (direction === KeyboardCode.Down && newScrollCoordinates <= maxScroll.y) ||\n (direction === KeyboardCode.Up && newScrollCoordinates >= minScroll.y);\n\n if (canScrollToNewCoordinates) {\n // We don't need to update coordinates, the scroll adjustment alone will trigger\n // logic to auto-detect the new container we are over\n scrollContainer.scrollTo({\n top: newScrollCoordinates,\n behavior: 'smooth',\n });\n return true;\n }\n\n break;\n }\n }\n return false;\n}\n"]}
@@ -0,0 +1,13 @@
1
+
2
+ import './styles.scoped.css';
3
+ export default {
4
+ "drag-overlay": "awsui_drag-overlay_1ksmw_lhzgl_145",
5
+ "drag-overlay-item": "awsui_drag-overlay-item_1ksmw_lhzgl_148",
6
+ "drag-overlay-container": "awsui_drag-overlay-container_1ksmw_lhzgl_175",
7
+ "active": "awsui_active_1ksmw_lhzgl_203",
8
+ "placeholder": "awsui_placeholder_1ksmw_lhzgl_213",
9
+ "placeholder-item": "awsui_placeholder-item_1ksmw_lhzgl_222",
10
+ "placeholder-container": "awsui_placeholder-container_1ksmw_lhzgl_228",
11
+ "sorting": "awsui_sorting_1ksmw_lhzgl_235"
12
+ };
13
+