@sps-woodland/core 8.56.2 → 8.56.3

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 (262) hide show
  1. package/lib/action-bar/action-bar/ActionBar.js +44 -59
  2. package/lib/action-bar/action-bar/ActionBar.ve.js +4 -11
  3. package/lib/action-bar/action-bar-additional-content/ActionBarAdditionalContent.js +14 -22
  4. package/lib/action-bar/index.js +54 -74
  5. package/lib/action-bar/index.umd.cjs +1 -1
  6. package/lib/action-bar/style.css +2 -1
  7. package/lib/add-to-list/add-to-list/AddToList.js +220 -302
  8. package/lib/add-to-list/add-to-list/AddToList.ve.js +79 -24
  9. package/lib/add-to-list/add-to-list/ItemsList.js +42 -67
  10. package/lib/add-to-list/add-to-list/ListItem.js +24 -50
  11. package/lib/add-to-list/index.js +393 -453
  12. package/lib/add-to-list/index.umd.cjs +1 -1
  13. package/lib/add-to-list/style.css +2 -1
  14. package/lib/buttons/button/Button.js +95 -121
  15. package/lib/buttons/button/Button.ve.js +150 -9
  16. package/lib/buttons/index.js +281 -171
  17. package/lib/buttons/index.umd.cjs +1 -1
  18. package/lib/buttons/style.css +2 -1
  19. package/lib/cards/card/Card.js +19 -27
  20. package/lib/cards/card/Card.ve.js +4 -4
  21. package/lib/cards/card-footer/CardFooter.js +12 -13
  22. package/lib/cards/card-footer/CardFooter.ve.js +4 -4
  23. package/lib/cards/card-header/CardHeader.js +12 -13
  24. package/lib/cards/card-header/CardHeader.ve.js +4 -4
  25. package/lib/cards/card-title/CardTitle.js +11 -12
  26. package/lib/cards/card-title/CardTitle.ve.js +4 -4
  27. package/lib/cards/index.js +52 -52
  28. package/lib/cards/index.umd.cjs +1 -1
  29. package/lib/cards/style.css +2 -1
  30. package/lib/column-manager/column-manager/ColumnManager.js +95 -112
  31. package/lib/column-manager/column-manager/useColumnManager.js +59 -48
  32. package/lib/column-manager/index.js +2 -5
  33. package/lib/components/icon/Icon.ve.js +15 -5
  34. package/lib/components/icon/icons/sprite.svg.js +4 -4
  35. package/lib/content-row/content-row/ContentRow.js +146 -173
  36. package/lib/content-row/content-row/ContentRow.ve.js +105 -18
  37. package/lib/content-row/content-row-col/ContentRowCol.js +37 -48
  38. package/lib/content-row/content-row-col/ContentRowCol.ve.js +49 -6
  39. package/lib/content-row/content-row-expansion/ContentRowExpansion.js +16 -24
  40. package/lib/content-row/index.js +407 -318
  41. package/lib/content-row/index.umd.cjs +1 -1
  42. package/lib/content-row/row-list-auto-layout/RowListAutoLayout.js +24 -39
  43. package/lib/content-row/row-list-auto-layout/RowListAutoLayout.ve.js +13 -5
  44. package/lib/content-row/style.css +2 -1
  45. package/lib/content-tiles/content-tile/ContentTile.js +71 -60
  46. package/lib/content-tiles/content-tile/ContentTile.ve.js +36 -14
  47. package/lib/content-tiles/content-tile-list/ContentTileList.js +12 -13
  48. package/lib/content-tiles/content-tile-list/ContentTileList.ve.js +4 -5
  49. package/lib/content-tiles/index.js +156 -118
  50. package/lib/content-tiles/index.umd.cjs +1 -1
  51. package/lib/content-tiles/style.css +2 -1
  52. package/lib/core.css +2 -1
  53. package/lib/dropdowns/dropdown/Dropdown.js +56 -68
  54. package/lib/dropdowns/dropdown/Dropdown.ve.js +37 -8
  55. package/lib/dropdowns/index.js +171 -171
  56. package/lib/dropdowns/index.umd.cjs +1 -1
  57. package/lib/dropdowns/option-list/Option.js +14 -18
  58. package/lib/dropdowns/option-list/Option.ve.js +4 -5
  59. package/lib/dropdowns/option-list/OptionList.js +28 -44
  60. package/lib/dropdowns/option-list/OptionList.ve.js +4 -5
  61. package/lib/dropdowns/style.css +2 -1
  62. package/lib/editable-table/EditableTable.js +68 -85
  63. package/lib/editable-table/index.js +1 -4
  64. package/lib/feedback-block/FeedbackBlock.js +40 -35
  65. package/lib/feedback-block/FeedbackBlock.ve.js +56 -7
  66. package/lib/feedback-block/index.js +132 -85
  67. package/lib/feedback-block/index.umd.cjs +1 -1
  68. package/lib/feedback-block/style.css +2 -1
  69. package/lib/file-upload/file-upload/FileUpload.js +164 -202
  70. package/lib/file-upload/file-upload/FileUpload.ve.js +84 -18
  71. package/lib/file-upload/file-upload/mime-type.enum.js +106 -106
  72. package/lib/file-upload/index.js +390 -353
  73. package/lib/file-upload/index.umd.cjs +1 -1
  74. package/lib/file-upload/style.css +2 -1
  75. package/lib/filter-tiles/filter-tile/FilterTile.js +41 -46
  76. package/lib/filter-tiles/filter-tile/FilterTile.ve.js +51 -9
  77. package/lib/filter-tiles/filter-tile-set/FilterTileSet.js +12 -15
  78. package/lib/filter-tiles/filter-tile-set/FilterTileSet.ve.js +4 -4
  79. package/lib/filter-tiles/index.js +142 -107
  80. package/lib/filter-tiles/index.umd.cjs +1 -1
  81. package/lib/filter-tiles/style.css +2 -1
  82. package/lib/focused-task/focused-task/FocusedTask.js +52 -74
  83. package/lib/focused-task/focused-task/FocusedTask.ve.js +13 -12
  84. package/lib/focused-task/focused-task/useFocusedTask.js +20 -18
  85. package/lib/focused-task/focused-task-actions/FocusedTaskActions.js +12 -13
  86. package/lib/focused-task/index.js +127 -144
  87. package/lib/focused-task/index.umd.cjs +1 -1
  88. package/lib/focused-task/style.css +2 -1
  89. package/lib/growler/Growler.js +78 -90
  90. package/lib/growler/Growler.ve.js +23 -12
  91. package/lib/growler/GrowlerListProvider.js +38 -39
  92. package/lib/growler/Sonner.ve.js +17 -12
  93. package/lib/growler/index.js +249 -274
  94. package/lib/growler/index.umd.cjs +1 -1
  95. package/lib/growler/sonner.js +73 -102
  96. package/lib/growler/style.css +2 -1
  97. package/lib/index.js +520 -501
  98. package/lib/index.umd.cjs +4 -4
  99. package/lib/insight-card/InsightCard.js +90 -84
  100. package/lib/insight-card/InsightCard.ve.js +148 -15
  101. package/lib/insight-card/InsightCardSet.js +12 -12
  102. package/lib/insight-card/index.js +269 -141
  103. package/lib/insight-card/index.umd.cjs +1 -1
  104. package/lib/insight-card/style.css +2 -1
  105. package/lib/key-value-set/index.js +97 -87
  106. package/lib/key-value-set/index.umd.cjs +1 -1
  107. package/lib/key-value-set/key-value-set/KeyValueSet.js +17 -21
  108. package/lib/key-value-set/key-value-set/KeyValueSet.ve.js +10 -5
  109. package/lib/key-value-set/key-value-set-item/KeyValueSetItem.js +25 -21
  110. package/lib/key-value-set/key-value-set-item/KeyValueSetItem.ve.js +13 -6
  111. package/lib/key-value-set/style.css +2 -1
  112. package/lib/list-bar/advanced-search/AdvancedSearch.js +51 -54
  113. package/lib/list-bar/advanced-search/AdvancedSearch.ve.js +30 -8
  114. package/lib/list-bar/index.js +305 -301
  115. package/lib/list-bar/index.umd.cjs +1 -1
  116. package/lib/list-bar/list-bar/InputGroupWrapper.js +10 -19
  117. package/lib/list-bar/list-bar/ListBar.js +105 -121
  118. package/lib/list-bar/list-bar/ListBar.ve.js +13 -17
  119. package/lib/list-bar/list-bar/ListBarSearch.js +20 -21
  120. package/lib/list-bar/list-bar/ListBarSearchInfo.js +8 -12
  121. package/lib/list-bar/list-bar/ListBarSortBy.js +28 -38
  122. package/lib/list-bar/search-results-bar/SearchResultsBar.js +38 -28
  123. package/lib/list-bar/search-results-bar/SearchResultsBar.ve.js +4 -11
  124. package/lib/list-bar/style.css +2 -1
  125. package/lib/matrix/index.js +79 -87
  126. package/lib/matrix/index.umd.cjs +1 -1
  127. package/lib/matrix/matrix/Matrix.js +18 -26
  128. package/lib/matrix/matrix/Matrix.ve.js +4 -7
  129. package/lib/matrix/matrix-body/MatrixBody.js +10 -13
  130. package/lib/matrix/matrix-cell/MatrixCell.js +23 -18
  131. package/lib/matrix/matrix-head/MatrixHead.js +10 -13
  132. package/lib/matrix/matrix-header/MatrixHeader.js +20 -23
  133. package/lib/matrix/matrix-row/MatrixRow.js +10 -13
  134. package/lib/matrix/style.css +2 -1
  135. package/lib/modal/index.js +197 -187
  136. package/lib/modal/index.umd.cjs +1 -1
  137. package/lib/modal/modal/Modal.js +90 -108
  138. package/lib/modal/modal/Modal.ve.js +43 -13
  139. package/lib/modal/modal/useModal.js +19 -24
  140. package/lib/modal/modal-footer/ModalFooter.js +11 -12
  141. package/lib/modal/style.css +2 -1
  142. package/lib/node_modules/.pnpm/@vanilla-extract_recipes@0.2.5_@vanilla-extract_css@1.21.2/node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.esm.js +49 -0
  143. package/lib/node_modules/.pnpm/nanoid@5.1.16/node_modules/nanoid/index.browser.js +8 -10
  144. package/lib/node_modules/.pnpm/nanoid@5.1.16/node_modules/nanoid/url-alphabet/index.js +4 -4
  145. package/lib/page-title/heading-level/HeadingLevel.js +8 -12
  146. package/lib/page-title/index.js +33 -40
  147. package/lib/page-title/index.umd.cjs +1 -1
  148. package/lib/page-title/page-subtitle/PageSubtitle.js +13 -18
  149. package/lib/page-title/page-subtitle/PageSubtitle.ve.js +4 -5
  150. package/lib/page-title/page-title/PageTitle.js +15 -19
  151. package/lib/page-title/page-title/PageTitle.ve.js +4 -7
  152. package/lib/page-title/style.css +2 -1
  153. package/lib/photo/index.js +174 -177
  154. package/lib/photo/index.umd.cjs +1 -1
  155. package/lib/photo/photo/Photo.js +72 -81
  156. package/lib/photo/photo/Photo.ve.js +21 -7
  157. package/lib/photo/photo-carousel/PhotoCarousel.js +36 -51
  158. package/lib/photo/photo-carousel/PhotoCarousel.ve.js +13 -9
  159. package/lib/photo/style.css +2 -1
  160. package/lib/product-bar/hooks/usePriorityPlus.js +88 -104
  161. package/lib/product-bar/index.js +372 -395
  162. package/lib/product-bar/index.umd.cjs +1 -1
  163. package/lib/product-bar/product-bar/ProductBar.js +77 -103
  164. package/lib/product-bar/product-bar/ProductBar.ve.js +46 -15
  165. package/lib/product-bar/product-bar-name/ProductBarName.js +37 -40
  166. package/lib/product-bar/product-bar-overflow-menu/ProductBarOverflowMenu.js +48 -70
  167. package/lib/product-bar/product-bar-overflow-menu/ProductBarOverflowMenu.ve.js +4 -8
  168. package/lib/product-bar/product-bar-tab/ProductBarTab.js +28 -26
  169. package/lib/product-bar/slack-link/SlackLink.js +26 -30
  170. package/lib/product-bar/slack-link/SlackLink.ve.js +4 -5
  171. package/lib/product-bar/style.css +2 -1
  172. package/lib/product-bar-vertical/index.js +240 -251
  173. package/lib/product-bar-vertical/index.umd.cjs +1 -1
  174. package/lib/product-bar-vertical/product-bar-vertical/ProductBarVertical.js +42 -61
  175. package/lib/product-bar-vertical/product-bar-vertical/ProductBarVertical.ve.js +53 -23
  176. package/lib/product-bar-vertical/product-bar-vertical-header/ProductBarVerticalHeader.js +30 -42
  177. package/lib/product-bar-vertical/product-bar-vertical-item/ProductBarVerticalItem.js +71 -89
  178. package/lib/product-bar-vertical/product-bar-vertical-section/ProductBarVerticalSection.js +22 -29
  179. package/lib/product-bar-vertical/style.css +2 -1
  180. package/lib/progress-indicators/index.js +372 -255
  181. package/lib/progress-indicators/index.umd.cjs +1 -1
  182. package/lib/progress-indicators/progress-bar/ProgressBar.js +66 -110
  183. package/lib/progress-indicators/progress-bar/ProgressBar.ve.js +66 -13
  184. package/lib/progress-indicators/progress-bar/progress-bar-step/ProgressBarStep.js +34 -54
  185. package/lib/progress-indicators/progress-bar/progress-bar-step/ProgressBarStep.ve.js +136 -8
  186. package/lib/progress-indicators/progress-ring/ProgressRing.js +45 -52
  187. package/lib/progress-indicators/style.css +2 -1
  188. package/lib/rich-text-editor/index.js +556 -582
  189. package/lib/rich-text-editor/index.umd.cjs +11 -11
  190. package/lib/rich-text-editor/rich-text-editor/RTELinkModal.js +29 -33
  191. package/lib/rich-text-editor/rich-text-editor/RTEToolbarButton.js +23 -37
  192. package/lib/rich-text-editor/rich-text-editor/RTEToolbarButton.ve.js +13 -6
  193. package/lib/rich-text-editor/rich-text-editor/RichTextEditor.js +68 -77
  194. package/lib/rich-text-editor/rich-text-editor/RichTextEditor.ve.js +21 -8
  195. package/lib/rich-text-editor/rich-text-editor/hooks/useHtmlToMd.js +14 -20
  196. package/lib/rich-text-editor/rich-text-editor/hooks/useMdToHtml.js +14 -20
  197. package/lib/rich-text-editor/rich-text-editor/hooks/useRTEContent.js +33 -27
  198. package/lib/rich-text-editor/rich-text-editor/hooks/useRTEObserver.js +79 -88
  199. package/lib/rich-text-editor/rich-text-editor/hooks/useRTESelectionListener.js +28 -36
  200. package/lib/rich-text-editor/rich-text-editor/hooks/useRTEToolbarButtons.js +195 -211
  201. package/lib/rich-text-editor/rich-text-editor/icons/BOLD.svg.js +4 -4
  202. package/lib/rich-text-editor/rich-text-editor/icons/INDENT.svg.js +4 -4
  203. package/lib/rich-text-editor/rich-text-editor/icons/ITALICS.svg.js +4 -4
  204. package/lib/rich-text-editor/rich-text-editor/icons/LINK.svg.js +4 -4
  205. package/lib/rich-text-editor/rich-text-editor/icons/ORDERED_LIST.svg.js +4 -4
  206. package/lib/rich-text-editor/rich-text-editor/icons/OUTDENT.svg.js +4 -4
  207. package/lib/rich-text-editor/rich-text-editor/icons/REDO.svg.js +4 -4
  208. package/lib/rich-text-editor/rich-text-editor/icons/UNDO.svg.js +4 -4
  209. package/lib/rich-text-editor/rich-text-editor/icons/UNLINK.svg.js +4 -4
  210. package/lib/rich-text-editor/rich-text-editor/icons/UNORDERED_LIST.svg.js +4 -4
  211. package/lib/rich-text-editor/rich-text-editor/utils/flattenListItemParagraphs.js +12 -12
  212. package/lib/rich-text-editor/rich-text-editor/utils/removeUnrepresentableBreaks.js +20 -19
  213. package/lib/rich-text-editor/rich-text-editor/utils/utils.js +11 -15
  214. package/lib/rich-text-editor/style.css +2 -1
  215. package/lib/scrollable-container/ScrollableContainer.js +18 -27
  216. package/lib/scrollable-container/ScrollableContainer.ve.js +4 -4
  217. package/lib/scrollable-container/index.js +20 -27
  218. package/lib/scrollable-container/index.umd.cjs +1 -1
  219. package/lib/scrollable-container/style.css +2 -1
  220. package/lib/side-nav/index.js +190 -228
  221. package/lib/side-nav/index.umd.cjs +1 -1
  222. package/lib/side-nav/side-nav/SideNav.js +43 -60
  223. package/lib/side-nav/side-nav/SideNav.ve.js +22 -16
  224. package/lib/side-nav/side-nav/navContext.js +7 -7
  225. package/lib/side-nav/side-nav-header/SideNavHeader.js +14 -15
  226. package/lib/side-nav/side-nav-item/SideNavItem.js +68 -94
  227. package/lib/side-nav/side-nav-section/SideNavSection.js +16 -26
  228. package/lib/side-nav/style.css +2 -1
  229. package/lib/sorting-header/caret/caret.ve.js +13 -5
  230. package/lib/sorting-header/index.js +269 -251
  231. package/lib/sorting-header/index.umd.cjs +1 -1
  232. package/lib/sorting-header/sorting-header/SortingHeader.js +110 -124
  233. package/lib/sorting-header/sorting-header/SortingHeader.ve.js +30 -6
  234. package/lib/sorting-header/sorting-header-cell/SortingHeaderCell.js +69 -83
  235. package/lib/sorting-header/sorting-header-cell/SortingHeaderCell.ve.js +21 -7
  236. package/lib/sorting-header/style.css +2 -1
  237. package/lib/style.css +2 -1
  238. package/lib/tabs/index.js +255 -201
  239. package/lib/tabs/index.umd.cjs +1 -1
  240. package/lib/tabs/style.css +2 -1
  241. package/lib/tabs/tab/Tab.js +24 -27
  242. package/lib/tabs/tab/Tab.ve.js +76 -6
  243. package/lib/tabs/tab-panel/TabPanel.js +16 -25
  244. package/lib/tabs/tabs/Tabs.js +101 -112
  245. package/lib/tabs/tabs/Tabs.ve.js +13 -11
  246. package/lib/tags/clickable-tag/ClickableTag.js +86 -90
  247. package/lib/tags/clickable-tag/ClickableTag.ve.js +66 -9
  248. package/lib/tags/index.js +342 -199
  249. package/lib/tags/index.umd.cjs +1 -1
  250. package/lib/tags/split-tag/SplitTag.js +49 -30
  251. package/lib/tags/split-tag/SplitTag.ve.js +35 -9
  252. package/lib/tags/style.css +2 -1
  253. package/lib/tags/tag/Tag.js +42 -38
  254. package/lib/tags/tag/Tag.ve.js +41 -6
  255. package/lib/utils/cl.js +5 -5
  256. package/lib/zero-state/ZeroState.js +36 -29
  257. package/lib/zero-state/ZeroState.ve.js +29 -11
  258. package/lib/zero-state/index.js +103 -78
  259. package/lib/zero-state/index.umd.cjs +1 -1
  260. package/lib/zero-state/style.css +2 -1
  261. package/package.json +12 -12
  262. package/lib/node_modules/.pnpm/@vanilla-extract_recipes@0.2.5_@vanilla-extract_css@1.17.4/node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.esm.js +0 -57
@@ -1,304 +1,222 @@
1
- import * as e from "react";
2
- import { nanoid as pe } from "../../node_modules/.pnpm/nanoid@5.1.16/node_modules/nanoid/index.browser.js";
3
- import { useDrop as fe, useDrag as ge, useButton as he, DragPreview as be } from "react-aria";
4
- import { useSpsForm as Le, SpsTextInput as Ee } from "@spscommerce/ds-react";
5
- import { SpsIcon as ve } from "@spscommerce/ds-shared";
6
- import { DOCUMENT_SEARCH_NO_RESULTS_LARGE as Ce, DOCUMENT_SEARCH_NO_RESULTS_SMALL as xe } from "@sps-woodland/illustrations";
7
- import { Metadata as Te, useChildTestIdAttrBuilder as Ne, cl as y } from "@sps-woodland/core";
8
- import { ZeroState as j } from "@sps-woodland/core/zero-state";
9
- import { Card as G } from "@sps-woodland/core/card";
10
- import { grid as K } from "@sps-woodland/tokens";
11
- import { ItemsList as Q } from "./ItemsList.js";
12
- import { phantomDroppableContainer as ye, droppableContainer as Me, draggableBox as Se, dragHandle as X, rowButton as A, dragPreview as ke, filterContainer as De, flexListWrapper as we, leftList as Re, rightList as Ae, offItems as Fe } from "./AddToList.ve.js";
13
- import { ListItem as Y } from "./ListItem.js";
14
- import { useWoodlandLanguage as Pe } from "@spscommerce/i18n";
15
- import { Button as F } from "@sps-woodland/core/buttons";
16
- function Oe({
17
- onList: P,
18
- offList: O,
19
- onHeader: h,
20
- offHeader: b,
21
- showFilter: ee,
22
- showCount: V,
23
- showIcons: $,
24
- showMoveAllLinks: q,
25
- manualSort: i,
26
- maxDisplayedItems: te,
27
- maxHeightPx: H,
28
- maxHeightRem: le,
29
- onChange: p,
30
- onListZeroState: I,
31
- offListZeroState: _,
32
- vertical: f = !1,
33
- onListAlphaSort: B = !0,
34
- "data-testid": Z
35
- }) {
36
- const n = Ne({ "data-testid": Z }), { t: c } = Pe(), { formValue: oe, formMeta: ae } = Le({
37
- filterString: ""
38
- }), [s, re] = e.useState(""), M = H ? H / 16 : le, U = M ? `${M}rem` : "", L = e.useCallback(
39
- (t, l) => (!i && B || l === "right" ? [...t].sort((a, r) => a.label.localeCompare(r.label)) : t).map((a) => {
40
- const r = { ...a };
41
- return r.id || (r.id = pe()), r;
42
- }),
43
- [i, B]
44
- ), o = e.useMemo(() => L(P, "left"), [P, L]), m = e.useMemo(() => L(O, "right"), [O, L]), E = e.useCallback(
45
- (t) => s ? t.label.toLowerCase().includes(s.toLowerCase()) : !0,
46
- [s]
47
- ), S = (t, l, d) => {
48
- const a = d.find((r) => r.label === t);
49
- a ? l === o ? p({
50
- onList: [...o, a],
51
- offList: m.filter((r) => r.label !== a.label)
52
- }) : d === o && p({
53
- onList: o.filter((r) => r.label !== a.label),
54
- offList: [...m, a]
55
- }) : console.error("could not remove item");
56
- };
57
- function ie(t) {
58
- re(t.target.value);
59
- }
60
- function W(t) {
61
- p(t === "left" ? {
62
- onList: o.filter((l) => l.required),
63
- offList: [...m, ...o.filter((l) => !l.required)]
64
- } : {
65
- onList: [...o, ...m],
66
- offList: []
67
- });
68
- }
69
- const z = e.useCallback(
70
- (t) => {
71
- const { className: l, index: d, isPhantomDroppableContainer: a, children: r, ...C } = t, g = e.useRef(null), { dropProps: k, isDropTarget: x } = fe({
72
- ref: g,
73
- async onDrop(D) {
74
- let w = await Promise.all(
75
- D.items.filter((N) => N.kind === "text" && N.types.has("text/plain")).map((N) => N.getText("text/plain"))
76
- );
77
- const { index: T } = JSON.parse(w[0]), R = [...o], [ce] = R.splice(T, 1), ue = d > T ? d - 1 : d;
78
- R.splice(ue, 0, ce), p({
79
- onList: R,
80
- offList: m
81
- });
82
- }
83
- });
84
- return /* @__PURE__ */ e.createElement(
85
- "div",
86
- {
87
- ref: g,
88
- ...i ? k : [],
89
- className: y(
90
- l,
91
- a ? ye({ isDropTarget: x }) : Me({ isDropTarget: x })
92
- ),
93
- ...n("droppable-container"),
94
- ...C
95
- },
96
- r
97
- );
98
- },
99
- [o, i]
100
- ), ne = e.useCallback(
101
- (t) => {
102
- const { label: l, data: d, listIndex: a, required: r } = t, C = e.useRef(null), g = e.useRef(null), k = { ...d, index: a }, { dragProps: x, dragButtonProps: D, isDragging: w } = ge({
103
- preview: C,
104
- hasDragButton: !0,
105
- getItems() {
106
- return [
107
- {
108
- "text/plain": JSON.stringify(k)
109
- }
110
- ];
111
- }
112
- }), { buttonProps: T } = he(D, g);
113
- return /* @__PURE__ */ e.createElement(
114
- "div",
115
- {
116
- ...i ? x : {},
117
- role: i ? "button" : "listitem",
118
- tabIndex: 0,
119
- id: `${l}${a}-drag`,
120
- className: y(Se({ isDragging: w })),
121
- ...n("draggable-item")
122
- },
123
- /* @__PURE__ */ e.createElement(z, { index: a }, i && /* @__PURE__ */ e.createElement(
124
- "i",
125
- {
126
- ...T,
127
- ref: g,
128
- className: X
129
- }
130
- ), l, !r && /* @__PURE__ */ e.createElement(
131
- F,
132
- {
133
- kind: "icon",
134
- icon: "x",
135
- "aria-label": c("addToList.remove", {
136
- elementName: l,
137
- defaultValue: `Remove ${l}`
138
- }),
139
- onClick: () => {
140
- S(l, m, o);
141
- },
142
- className: A,
143
- ...n("move-item-button")
144
- }
145
- )),
146
- /* @__PURE__ */ e.createElement(be, { ref: C }, () => /* @__PURE__ */ e.createElement("div", { className: ke }, /* @__PURE__ */ e.createElement("i", { className: X }), l))
147
- );
148
- },
149
- [o, i]
150
- ), u = e.useMemo(() => o.filter(E), [o, E]), v = e.useMemo(
151
- () => m.filter(E).slice(0, te),
152
- [m, E]
153
- ), se = !s && !!q && u.length > 0, me = !s && !!q && v.length > 0, de = !s && m.length > v.length, J = !!i && !s && u.length > 0 && !M;
154
- return /* @__PURE__ */ e.createElement("div", { "data-testid": Z }, ee && /* @__PURE__ */ e.createElement("div", { className: K.root }, /* @__PURE__ */ e.createElement("div", { className: y(K[12], De) }, /* @__PURE__ */ e.createElement(
155
- Ee,
156
- {
157
- value: oe.filterString,
158
- formMeta: ae.fields.filterString,
159
- icon: ve.FILTER,
160
- onChange: ie,
161
- ...n("filter-input")
162
- }
163
- ))), /* @__PURE__ */ e.createElement("div", { className: y(we({ vertical: f })) }, /* @__PURE__ */ e.createElement(
164
- Q,
165
- {
166
- headerText: h,
167
- showCount: !s && V,
168
- showIcons: $,
169
- showMoveAllLinks: se,
170
- disableMoveAllLinks: o.every((t) => t.required),
171
- maxHeight: U,
172
- vertical: f,
173
- side: "left",
174
- className: Re({
175
- vertical: f
176
- }),
177
- otherHeader: b,
178
- itemCount: o.length,
179
- moveAll: W,
180
- adjustForPhantomDroppableContainer: J,
181
- ...n("on-items-list")
182
- },
183
- u.length > 0 ? /* @__PURE__ */ e.createElement(e.Fragment, null, i && !s && u.map((t, l) => /* @__PURE__ */ e.createElement(e.Fragment, { key: t.id }, /* @__PURE__ */ e.createElement(
184
- ne,
185
- {
186
- data: t,
187
- label: t.label,
188
- required: t.required,
189
- listIndex: l
190
- }
191
- ), l === u.length - 1 && /* @__PURE__ */ e.createElement(z, { isPhantomDroppableContainer: !0, index: l + 1 }))), (!i || s) && u.map((t) => /* @__PURE__ */ e.createElement(
192
- Y,
193
- {
194
- key: t.id,
195
- filtering: !!s,
196
- manualSorting: i,
197
- id: t.id,
198
- ...n("item")
199
- },
200
- t.label,
201
- !t.required && /* @__PURE__ */ e.createElement(
202
- F,
203
- {
204
- kind: "icon",
205
- icon: "x",
206
- "aria-label": c("addToList.remove", {
207
- elementName: t.label,
208
- defaultValue: `Remove ${t.label}`
209
- }),
210
- onClick: () => {
211
- S(t.label, m, o);
212
- },
213
- className: A,
214
- ...n("move-item-button")
215
- }
216
- )
217
- ))) : /* @__PURE__ */ e.createElement(G, null, I ? /* @__PURE__ */ e.createElement(e.Fragment, null, I) : /* @__PURE__ */ e.createElement(
218
- j,
219
- {
220
- heading: c("addToList.noDataZeroStateColumnTitle", {
221
- defaultValue: "This Column is Empty"
222
- }),
223
- subHeading: c("addToList.noDataZeroStateOnColumnSubheading", {
224
- columnName: b,
225
- defaultValue: `Move options from the ${b}`
226
- }),
227
- artwork: Ce,
228
- micro: !0,
229
- ...n("on-list-zero-state")
230
- }
231
- ))
232
- ), /* @__PURE__ */ e.createElement(
233
- Q,
234
- {
235
- headerText: b,
236
- showCount: !s && V,
237
- showIcons: $,
238
- showMoveAllLinks: me,
239
- showMoreOptionsText: de,
240
- maxHeight: U,
241
- vertical: f,
242
- side: "right",
243
- className: Ae({ vertical: f }),
244
- otherHeader: h,
245
- itemCount: m.length,
246
- moveAll: W,
247
- adjustForPhantomDroppableContainer: J,
248
- ...n("off-items-list")
249
- },
250
- v.length > 0 ? v.map((t) => /* @__PURE__ */ e.createElement(Y, { key: t.id, className: Fe, ...n("item") }, t.label, /* @__PURE__ */ e.createElement(
251
- F,
252
- {
253
- kind: "icon",
254
- icon: "plus-sign",
255
- "aria-label": c("addToList.add", {
256
- elementName: t.label,
257
- defaultValue: `Add ${t.label}`
258
- }),
259
- onClick: () => {
260
- S(t.label, o, m);
261
- },
262
- className: A,
263
- ...n("move-item-button")
264
- }
265
- ))) : /* @__PURE__ */ e.createElement(G, null, _ ? /* @__PURE__ */ e.createElement(e.Fragment, null, _) : /* @__PURE__ */ e.createElement(
266
- j,
267
- {
268
- heading: c("addToList.noDataZeroStateColumnTitle", {
269
- defaultValue: "This Column is Empty"
270
- }),
271
- subHeading: c("addToList.noDataZeroStateOffColumnSubheading", {
272
- columnName: h,
273
- defaultValue: `Remove options from the ${h}`
274
- }),
275
- artwork: xe,
276
- micro: !0,
277
- ...n("off-list-zero-state")
278
- }
279
- ))
280
- )));
1
+ import { nanoid as e } from "../../node_modules/.pnpm/nanoid@5.1.16/node_modules/nanoid/index.browser.js";
2
+ import { dragHandle as t, dragPreview as n, draggableBox as r, droppableContainer as i, flexListWrapper as a, leftList as o, offItems as s, phantomDroppableContainer as c, rightList as l, rowButton as u } from "./AddToList.ve.js";
3
+ import { ItemsList as d } from "./ItemsList.js";
4
+ import { ListItem as f } from "./ListItem.js";
5
+ import { Metadata as p, cl as m, useChildTestIdAttrBuilder as h } from "@sps-woodland/core";
6
+ import * as g from "react";
7
+ import { useWoodlandLanguage as ee } from "@spscommerce/i18n";
8
+ import { grid as _ } from "@sps-woodland/tokens";
9
+ import { Button as v } from "@sps-woodland/core/buttons";
10
+ import { SpsTextInput as te, useSpsForm as y } from "@spscommerce/ds-react";
11
+ import { SpsIcon as ne } from "@spscommerce/ds-shared";
12
+ import { DOCUMENT_SEARCH_NO_RESULTS_LARGE as re, DOCUMENT_SEARCH_NO_RESULTS_SMALL as ie } from "@sps-woodland/illustrations";
13
+ import { DragPreview as ae, useButton as oe, useDrag as se, useDrop as ce } from "react-aria";
14
+ import { ZeroState as b } from "@sps-woodland/core/zero-state";
15
+ import { Card as x } from "@sps-woodland/core/card";
16
+ //#region src/add-to-list/add-to-list/AddToList.tsx
17
+ function S({ onList: p, offList: S, onHeader: C, offHeader: w, showFilter: le, showCount: T, showIcons: E, showMoveAllLinks: D, manualSort: O, maxDisplayedItems: ue, maxHeightPx: k, maxHeightRem: de, onChange: A, onListZeroState: j, offListZeroState: M, vertical: N = !1, onListAlphaSort: P = !0, "data-testid": F }) {
18
+ let I = h({ "data-testid": F }), { t: L } = ee(), { formValue: fe, formMeta: R } = y({ filterString: "" }), [z, B] = g.useState(""), V = k ? k / 16 : de, H = V ? `${V}rem` : "", U = g.useCallback((t, n) => (!O && P || n === "right" ? [...t].sort((e, t) => e.label.localeCompare(t.label)) : t).map((t) => {
19
+ let n = { ...t };
20
+ return n.id ||= e(), n;
21
+ }), [O, P]), W = g.useMemo(() => U(p, "left"), [p, U]), G = g.useMemo(() => U(S, "right"), [S, U]), K = g.useCallback((e) => !z || e.label.toLowerCase().includes(z.toLowerCase()), [z]), q = (e, t, n) => {
22
+ let r = n.find((t) => t.label === e);
23
+ r ? t === W ? A({
24
+ onList: [...W, r],
25
+ offList: G.filter((e) => e.label !== r.label)
26
+ }) : n === W && A({
27
+ onList: W.filter((e) => e.label !== r.label),
28
+ offList: [...G, r]
29
+ }) : console.error("could not remove item");
30
+ };
31
+ function pe(e) {
32
+ B(e.target.value);
33
+ }
34
+ function J(e) {
35
+ A(e === "left" ? {
36
+ onList: W.filter((e) => e.required),
37
+ offList: [...G, ...W.filter((e) => !e.required)]
38
+ } : {
39
+ onList: [...W, ...G],
40
+ offList: []
41
+ });
42
+ }
43
+ let Y = g.useCallback((e) => {
44
+ let { className: t, index: n, isPhantomDroppableContainer: r, children: a, ...o } = e, s = g.useRef(null), { dropProps: l, isDropTarget: u } = ce({
45
+ ref: s,
46
+ async onDrop(e) {
47
+ let t = await Promise.all(e.items.filter((e) => e.kind === "text" && e.types.has("text/plain")).map((e) => e.getText("text/plain"))), { index: r } = JSON.parse(t[0]), i = [...W], [a] = i.splice(r, 1), o = n > r ? n - 1 : n;
48
+ i.splice(o, 0, a), A({
49
+ onList: i,
50
+ offList: G
51
+ });
52
+ }
53
+ });
54
+ return /* @__PURE__ */ g.createElement("div", {
55
+ ref: s,
56
+ ...O ? l : [],
57
+ className: m(t, r ? c({ isDropTarget: u }) : i({ isDropTarget: u })),
58
+ ...I("droppable-container"),
59
+ ...o
60
+ }, a);
61
+ }, [W, O]), X = g.useCallback((e) => {
62
+ let { label: i, data: a, listIndex: o, required: s } = e, c = g.useRef(null), l = g.useRef(null), u = {
63
+ ...a,
64
+ index: o
65
+ }, { dragProps: d, dragButtonProps: f, isDragging: p } = se({
66
+ preview: c,
67
+ hasDragButton: !0,
68
+ getItems() {
69
+ return [{ "text/plain": JSON.stringify(u) }];
70
+ }
71
+ }), { buttonProps: h } = oe(f, l);
72
+ return /* @__PURE__ */ g.createElement("div", {
73
+ ...O ? d : {},
74
+ role: O ? "button" : "listitem",
75
+ tabIndex: 0,
76
+ id: `${i}${o}-drag`,
77
+ className: m(r({ isDragging: p })),
78
+ ...I("draggable-item")
79
+ }, /* @__PURE__ */ g.createElement(Y, { index: o }, O && /* @__PURE__ */ g.createElement("i", {
80
+ ...h,
81
+ ref: l,
82
+ className: "pkg_sps-woodland_core__family_add-to-list__version_8_56_3__hash_13b8tx9k"
83
+ }), i, !s && /* @__PURE__ */ g.createElement(v, {
84
+ kind: "icon",
85
+ icon: "x",
86
+ "aria-label": L("addToList.remove", {
87
+ elementName: i,
88
+ defaultValue: `Remove ${i}`
89
+ }),
90
+ onClick: () => {
91
+ q(i, G, W);
92
+ },
93
+ className: "pkg_sps-woodland_core__family_add-to-list__version_8_56_3__hash_13b8tx9x",
94
+ ...I("move-item-button")
95
+ })), /* @__PURE__ */ g.createElement(ae, { ref: c }, () => /* @__PURE__ */ g.createElement("div", { className: n }, /* @__PURE__ */ g.createElement("i", { className: t }), i)));
96
+ }, [W, O]), Z = g.useMemo(() => W.filter(K), [W, K]), Q = g.useMemo(() => G.filter(K).slice(0, ue), [G, K]), me = !z && !!D && Z.length > 0, he = !z && !!D && Q.length > 0, ge = !z && G.length > Q.length, $ = !!O && !z && Z.length > 0 && !V;
97
+ return /* @__PURE__ */ g.createElement("div", { "data-testid": F }, le && /* @__PURE__ */ g.createElement("div", { className: _.root }, /* @__PURE__ */ g.createElement("div", { className: m(_[12], "pkg_sps-woodland_core__family_add-to-list__version_8_56_3__hash_13b8tx912") }, /* @__PURE__ */ g.createElement(te, {
98
+ value: fe.filterString,
99
+ formMeta: R.fields.filterString,
100
+ icon: ne.FILTER,
101
+ onChange: pe,
102
+ ...I("filter-input")
103
+ }))), /* @__PURE__ */ g.createElement("div", { className: m(a({ vertical: N })) }, /* @__PURE__ */ g.createElement(d, {
104
+ headerText: C,
105
+ showCount: !z && T,
106
+ showIcons: E,
107
+ showMoveAllLinks: me,
108
+ disableMoveAllLinks: W.every((e) => e.required),
109
+ maxHeight: H,
110
+ vertical: N,
111
+ side: "left",
112
+ className: o({ vertical: N }),
113
+ otherHeader: w,
114
+ itemCount: W.length,
115
+ moveAll: J,
116
+ adjustForPhantomDroppableContainer: $,
117
+ ...I("on-items-list")
118
+ }, Z.length > 0 ? /* @__PURE__ */ g.createElement(g.Fragment, null, O && !z && Z.map((e, t) => /* @__PURE__ */ g.createElement(g.Fragment, { key: e.id }, /* @__PURE__ */ g.createElement(X, {
119
+ data: e,
120
+ label: e.label,
121
+ required: e.required,
122
+ listIndex: t
123
+ }), t === Z.length - 1 && /* @__PURE__ */ g.createElement(Y, {
124
+ isPhantomDroppableContainer: !0,
125
+ index: t + 1
126
+ }))), (!O || z) && Z.map((e) => /* @__PURE__ */ g.createElement(f, {
127
+ key: e.id,
128
+ filtering: !!z,
129
+ manualSorting: O,
130
+ id: e.id,
131
+ ...I("item")
132
+ }, e.label, !e.required && /* @__PURE__ */ g.createElement(v, {
133
+ kind: "icon",
134
+ icon: "x",
135
+ "aria-label": L("addToList.remove", {
136
+ elementName: e.label,
137
+ defaultValue: `Remove ${e.label}`
138
+ }),
139
+ onClick: () => {
140
+ q(e.label, G, W);
141
+ },
142
+ className: "pkg_sps-woodland_core__family_add-to-list__version_8_56_3__hash_13b8tx9x",
143
+ ...I("move-item-button")
144
+ })))) : /* @__PURE__ */ g.createElement(x, null, j ? /* @__PURE__ */ g.createElement(g.Fragment, null, j) : /* @__PURE__ */ g.createElement(b, {
145
+ heading: L("addToList.noDataZeroStateColumnTitle", { defaultValue: "This Column is Empty" }),
146
+ subHeading: L("addToList.noDataZeroStateOnColumnSubheading", {
147
+ columnName: w,
148
+ defaultValue: `Move options from the ${w}`
149
+ }),
150
+ artwork: re,
151
+ micro: !0,
152
+ ...I("on-list-zero-state")
153
+ }))), /* @__PURE__ */ g.createElement(d, {
154
+ headerText: w,
155
+ showCount: !z && T,
156
+ showIcons: E,
157
+ showMoveAllLinks: he,
158
+ showMoreOptionsText: ge,
159
+ maxHeight: H,
160
+ vertical: N,
161
+ side: "right",
162
+ className: l({ vertical: N }),
163
+ otherHeader: C,
164
+ itemCount: G.length,
165
+ moveAll: J,
166
+ adjustForPhantomDroppableContainer: $,
167
+ ...I("off-items-list")
168
+ }, Q.length > 0 ? Q.map((e) => /* @__PURE__ */ g.createElement(f, {
169
+ key: e.id,
170
+ className: s,
171
+ ...I("item")
172
+ }, e.label, /* @__PURE__ */ g.createElement(v, {
173
+ kind: "icon",
174
+ icon: "plus-sign",
175
+ "aria-label": L("addToList.add", {
176
+ elementName: e.label,
177
+ defaultValue: `Add ${e.label}`
178
+ }),
179
+ onClick: () => {
180
+ q(e.label, W, G);
181
+ },
182
+ className: u,
183
+ ...I("move-item-button")
184
+ }))) : /* @__PURE__ */ g.createElement(x, null, M ? /* @__PURE__ */ g.createElement(g.Fragment, null, M) : /* @__PURE__ */ g.createElement(b, {
185
+ heading: L("addToList.noDataZeroStateColumnTitle", { defaultValue: "This Column is Empty" }),
186
+ subHeading: L("addToList.noDataZeroStateOffColumnSubheading", {
187
+ columnName: C,
188
+ defaultValue: `Remove options from the ${C}`
189
+ }),
190
+ artwork: ie,
191
+ micro: !0,
192
+ ...I("off-list-zero-state")
193
+ })))));
281
194
  }
282
- Te.set(Oe, {
283
- name: "Add To List",
284
- props: {
285
- onList: { type: "ItemProps[]", required: !0 },
286
- offList: { type: "ItemProps[]", required: !0 },
287
- onHeader: { type: "string" },
288
- offHeader: { type: "string" },
289
- showFilter: { type: "boolean" },
290
- showCount: { type: "boolean" },
291
- showIcons: { type: "boolean" },
292
- showMoveAllLinks: { type: "boolean" },
293
- manualSort: { type: "boolean" },
294
- maxDisplayedItems: { type: "number" },
295
- maxHeight: { type: "string" },
296
- onChange: { type: "(newValue: AddToListAggregateValue) => void" },
297
- autoSort: { type: "boolean" },
298
- onListZeroState: { type: "ZeroState" },
299
- offListZeroState: { type: "ZeroState" }
300
- }
195
+ p.set(S, {
196
+ name: "Add To List",
197
+ props: {
198
+ onList: {
199
+ type: "ItemProps[]",
200
+ required: !0
201
+ },
202
+ offList: {
203
+ type: "ItemProps[]",
204
+ required: !0
205
+ },
206
+ onHeader: { type: "string" },
207
+ offHeader: { type: "string" },
208
+ showFilter: { type: "boolean" },
209
+ showCount: { type: "boolean" },
210
+ showIcons: { type: "boolean" },
211
+ showMoveAllLinks: { type: "boolean" },
212
+ manualSort: { type: "boolean" },
213
+ maxDisplayedItems: { type: "number" },
214
+ maxHeight: { type: "string" },
215
+ onChange: { type: "(newValue: AddToListAggregateValue) => void" },
216
+ autoSort: { type: "boolean" },
217
+ onListZeroState: { type: "ZeroState" },
218
+ offListZeroState: { type: "ZeroState" }
219
+ }
301
220
  });
302
- export {
303
- Oe as AddToList
304
- };
221
+ //#endregion
222
+ export { S as AddToList };