@sps-woodland/core 8.56.1 → 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 (289) 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.css.d.ts.map +1 -1
  8. package/lib/add-to-list/add-to-list/AddToList.d.ts.map +1 -1
  9. package/lib/add-to-list/add-to-list/AddToList.js +220 -295
  10. package/lib/add-to-list/add-to-list/AddToList.ve.js +79 -24
  11. package/lib/add-to-list/add-to-list/ItemsList.d.ts.map +1 -1
  12. package/lib/add-to-list/add-to-list/ItemsList.js +42 -66
  13. package/lib/add-to-list/add-to-list/ListItem.js +24 -50
  14. package/lib/add-to-list/index.js +393 -444
  15. package/lib/add-to-list/index.umd.cjs +1 -1
  16. package/lib/add-to-list/style.css +2 -1
  17. package/lib/buttons/button/Button.css.d.ts.map +1 -1
  18. package/lib/buttons/button/Button.js +95 -121
  19. package/lib/buttons/button/Button.ve.js +150 -9
  20. package/lib/buttons/index.js +281 -171
  21. package/lib/buttons/index.umd.cjs +1 -1
  22. package/lib/buttons/style.css +2 -1
  23. package/lib/cards/card/Card.css.d.ts.map +1 -1
  24. package/lib/cards/card/Card.js +19 -27
  25. package/lib/cards/card/Card.ve.js +4 -4
  26. package/lib/cards/card-footer/CardFooter.js +12 -13
  27. package/lib/cards/card-footer/CardFooter.ve.js +4 -4
  28. package/lib/cards/card-header/CardHeader.js +12 -13
  29. package/lib/cards/card-header/CardHeader.ve.js +4 -4
  30. package/lib/cards/card-title/CardTitle.js +11 -12
  31. package/lib/cards/card-title/CardTitle.ve.js +4 -4
  32. package/lib/cards/index.js +52 -52
  33. package/lib/cards/index.umd.cjs +1 -1
  34. package/lib/cards/style.css +2 -1
  35. package/lib/column-manager/column-manager/ColumnManager.d.ts.map +1 -1
  36. package/lib/column-manager/column-manager/ColumnManager.js +95 -112
  37. package/lib/column-manager/column-manager/useColumnManager.js +59 -48
  38. package/lib/column-manager/index.js +2 -5
  39. package/lib/components/icon/Icon.ve.js +15 -5
  40. package/lib/components/icon/icons/sprite.svg.js +4 -4
  41. package/lib/content-row/content-row/ContentRow.js +146 -173
  42. package/lib/content-row/content-row/ContentRow.ve.js +105 -18
  43. package/lib/content-row/content-row-col/ContentRowCol.js +37 -48
  44. package/lib/content-row/content-row-col/ContentRowCol.ve.js +49 -6
  45. package/lib/content-row/content-row-expansion/ContentRowExpansion.js +16 -24
  46. package/lib/content-row/index.js +407 -318
  47. package/lib/content-row/index.umd.cjs +1 -1
  48. package/lib/content-row/row-list-auto-layout/RowListAutoLayout.js +24 -39
  49. package/lib/content-row/row-list-auto-layout/RowListAutoLayout.ve.js +13 -5
  50. package/lib/content-row/style.css +2 -1
  51. package/lib/content-tiles/content-tile/ContentTile.css.d.ts.map +1 -1
  52. package/lib/content-tiles/content-tile/ContentTile.js +71 -60
  53. package/lib/content-tiles/content-tile/ContentTile.ve.js +36 -14
  54. package/lib/content-tiles/content-tile-list/ContentTileList.js +12 -13
  55. package/lib/content-tiles/content-tile-list/ContentTileList.ve.js +4 -5
  56. package/lib/content-tiles/index.js +156 -118
  57. package/lib/content-tiles/index.umd.cjs +1 -1
  58. package/lib/content-tiles/style.css +2 -1
  59. package/lib/core.css +2 -1
  60. package/lib/dropdowns/dropdown/Dropdown.css.d.ts.map +1 -1
  61. package/lib/dropdowns/dropdown/Dropdown.js +56 -68
  62. package/lib/dropdowns/dropdown/Dropdown.ve.js +37 -8
  63. package/lib/dropdowns/index.js +171 -171
  64. package/lib/dropdowns/index.umd.cjs +1 -1
  65. package/lib/dropdowns/option-list/Option.css.d.ts.map +1 -1
  66. package/lib/dropdowns/option-list/Option.js +14 -18
  67. package/lib/dropdowns/option-list/Option.ve.js +4 -5
  68. package/lib/dropdowns/option-list/OptionList.js +28 -44
  69. package/lib/dropdowns/option-list/OptionList.ve.js +4 -5
  70. package/lib/dropdowns/style.css +2 -1
  71. package/lib/editable-table/EditableTable.js +68 -85
  72. package/lib/editable-table/index.js +1 -4
  73. package/lib/feedback-block/FeedbackBlock.js +40 -35
  74. package/lib/feedback-block/FeedbackBlock.ve.js +56 -7
  75. package/lib/feedback-block/index.js +132 -85
  76. package/lib/feedback-block/index.umd.cjs +1 -1
  77. package/lib/feedback-block/style.css +2 -1
  78. package/lib/file-upload/file-upload/FileUpload.js +164 -202
  79. package/lib/file-upload/file-upload/FileUpload.ve.js +84 -18
  80. package/lib/file-upload/file-upload/mime-type.enum.js +106 -106
  81. package/lib/file-upload/index.js +390 -353
  82. package/lib/file-upload/index.umd.cjs +1 -1
  83. package/lib/file-upload/style.css +2 -1
  84. package/lib/filter-tiles/filter-tile/FilterTile.css.d.ts.map +1 -1
  85. package/lib/filter-tiles/filter-tile/FilterTile.d.ts.map +1 -1
  86. package/lib/filter-tiles/filter-tile/FilterTile.js +41 -33
  87. package/lib/filter-tiles/filter-tile/FilterTile.ve.js +51 -9
  88. package/lib/filter-tiles/filter-tile-set/FilterTileSet.js +12 -15
  89. package/lib/filter-tiles/filter-tile-set/FilterTileSet.ve.js +4 -4
  90. package/lib/filter-tiles/index.js +142 -94
  91. package/lib/filter-tiles/index.umd.cjs +1 -1
  92. package/lib/filter-tiles/style.css +2 -1
  93. package/lib/focused-task/focused-task/FocusedTask.js +52 -74
  94. package/lib/focused-task/focused-task/FocusedTask.ve.js +13 -12
  95. package/lib/focused-task/focused-task/useFocusedTask.js +20 -18
  96. package/lib/focused-task/focused-task-actions/FocusedTaskActions.js +12 -13
  97. package/lib/focused-task/index.js +127 -144
  98. package/lib/focused-task/index.umd.cjs +1 -1
  99. package/lib/focused-task/style.css +2 -1
  100. package/lib/growler/Growler.js +78 -90
  101. package/lib/growler/Growler.ve.js +23 -12
  102. package/lib/growler/GrowlerListProvider.js +38 -39
  103. package/lib/growler/Sonner.ve.js +17 -12
  104. package/lib/growler/index.js +249 -274
  105. package/lib/growler/index.umd.cjs +1 -1
  106. package/lib/growler/sonner.js +73 -102
  107. package/lib/growler/style.css +2 -1
  108. package/lib/index.js +520 -501
  109. package/lib/index.umd.cjs +4 -4
  110. package/lib/insight-card/InsightCard.js +90 -84
  111. package/lib/insight-card/InsightCard.ve.js +148 -15
  112. package/lib/insight-card/InsightCardSet.js +12 -12
  113. package/lib/insight-card/index.js +269 -141
  114. package/lib/insight-card/index.umd.cjs +1 -1
  115. package/lib/insight-card/style.css +2 -1
  116. package/lib/key-value-set/index.js +97 -87
  117. package/lib/key-value-set/index.umd.cjs +1 -1
  118. package/lib/key-value-set/key-value-set/KeyValueSet.js +17 -21
  119. package/lib/key-value-set/key-value-set/KeyValueSet.ve.js +10 -5
  120. package/lib/key-value-set/key-value-set-item/KeyValueSetItem.js +25 -21
  121. package/lib/key-value-set/key-value-set-item/KeyValueSetItem.ve.js +13 -6
  122. package/lib/key-value-set/style.css +2 -1
  123. package/lib/list-bar/advanced-search/AdvancedSearch.js +51 -54
  124. package/lib/list-bar/advanced-search/AdvancedSearch.ve.js +30 -8
  125. package/lib/list-bar/index.js +305 -301
  126. package/lib/list-bar/index.umd.cjs +1 -1
  127. package/lib/list-bar/list-bar/InputGroupWrapper.js +10 -19
  128. package/lib/list-bar/list-bar/ListBar.js +105 -121
  129. package/lib/list-bar/list-bar/ListBar.ve.js +13 -17
  130. package/lib/list-bar/list-bar/ListBarSearch.js +20 -21
  131. package/lib/list-bar/list-bar/ListBarSearchInfo.js +8 -12
  132. package/lib/list-bar/list-bar/ListBarSortBy.js +28 -38
  133. package/lib/list-bar/search-results-bar/SearchResultsBar.js +38 -28
  134. package/lib/list-bar/search-results-bar/SearchResultsBar.ve.js +4 -11
  135. package/lib/list-bar/style.css +2 -1
  136. package/lib/matrix/index.js +79 -87
  137. package/lib/matrix/index.umd.cjs +1 -1
  138. package/lib/matrix/matrix/Matrix.js +18 -26
  139. package/lib/matrix/matrix/Matrix.ve.js +4 -7
  140. package/lib/matrix/matrix-body/MatrixBody.js +10 -13
  141. package/lib/matrix/matrix-cell/MatrixCell.js +23 -18
  142. package/lib/matrix/matrix-head/MatrixHead.js +10 -13
  143. package/lib/matrix/matrix-header/MatrixHeader.js +20 -23
  144. package/lib/matrix/matrix-row/MatrixRow.js +10 -13
  145. package/lib/matrix/style.css +2 -1
  146. package/lib/modal/index.js +197 -187
  147. package/lib/modal/index.umd.cjs +1 -1
  148. package/lib/modal/modal/Modal.js +90 -108
  149. package/lib/modal/modal/Modal.ve.js +43 -13
  150. package/lib/modal/modal/useModal.js +19 -24
  151. package/lib/modal/modal-footer/ModalFooter.js +11 -12
  152. package/lib/modal/style.css +2 -1
  153. 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
  154. package/lib/node_modules/.pnpm/nanoid@5.1.16/node_modules/nanoid/index.browser.js +8 -10
  155. package/lib/node_modules/.pnpm/nanoid@5.1.16/node_modules/nanoid/url-alphabet/index.js +4 -4
  156. package/lib/page-title/heading-level/HeadingLevel.js +8 -12
  157. package/lib/page-title/index.js +33 -40
  158. package/lib/page-title/index.umd.cjs +1 -1
  159. package/lib/page-title/page-subtitle/PageSubtitle.js +13 -18
  160. package/lib/page-title/page-subtitle/PageSubtitle.ve.js +4 -5
  161. package/lib/page-title/page-title/PageTitle.js +15 -19
  162. package/lib/page-title/page-title/PageTitle.ve.js +4 -7
  163. package/lib/page-title/style.css +2 -1
  164. package/lib/photo/index.js +174 -173
  165. package/lib/photo/index.umd.cjs +1 -1
  166. package/lib/photo/photo/Photo.js +72 -81
  167. package/lib/photo/photo/Photo.ve.js +21 -7
  168. package/lib/photo/photo-carousel/PhotoCarousel.css.d.ts.map +1 -1
  169. package/lib/photo/photo-carousel/PhotoCarousel.d.ts.map +1 -1
  170. package/lib/photo/photo-carousel/PhotoCarousel.js +36 -47
  171. package/lib/photo/photo-carousel/PhotoCarousel.ve.js +13 -9
  172. package/lib/photo/style.css +2 -1
  173. package/lib/product-bar/hooks/usePriorityPlus.js +88 -104
  174. package/lib/product-bar/index.js +372 -395
  175. package/lib/product-bar/index.umd.cjs +1 -1
  176. package/lib/product-bar/product-bar/ProductBar.js +77 -103
  177. package/lib/product-bar/product-bar/ProductBar.ve.js +46 -15
  178. package/lib/product-bar/product-bar-name/ProductBarName.js +37 -40
  179. package/lib/product-bar/product-bar-overflow-menu/ProductBarOverflowMenu.js +48 -70
  180. package/lib/product-bar/product-bar-overflow-menu/ProductBarOverflowMenu.ve.js +4 -8
  181. package/lib/product-bar/product-bar-tab/ProductBarTab.js +28 -26
  182. package/lib/product-bar/slack-link/SlackLink.js +26 -30
  183. package/lib/product-bar/slack-link/SlackLink.ve.js +4 -5
  184. package/lib/product-bar/style.css +2 -1
  185. package/lib/product-bar-vertical/index.js +240 -251
  186. package/lib/product-bar-vertical/index.umd.cjs +1 -1
  187. package/lib/product-bar-vertical/product-bar-vertical/ProductBarVertical.js +42 -61
  188. package/lib/product-bar-vertical/product-bar-vertical/ProductBarVertical.ve.js +53 -23
  189. package/lib/product-bar-vertical/product-bar-vertical-header/ProductBarVerticalHeader.js +30 -42
  190. package/lib/product-bar-vertical/product-bar-vertical-item/ProductBarVerticalItem.js +71 -89
  191. package/lib/product-bar-vertical/product-bar-vertical-section/ProductBarVerticalSection.js +22 -29
  192. package/lib/product-bar-vertical/style.css +2 -1
  193. package/lib/progress-indicators/index.js +372 -255
  194. package/lib/progress-indicators/index.umd.cjs +1 -1
  195. package/lib/progress-indicators/progress-bar/ProgressBar.js +66 -110
  196. package/lib/progress-indicators/progress-bar/ProgressBar.ve.js +66 -13
  197. package/lib/progress-indicators/progress-bar/progress-bar-step/ProgressBarStep.js +34 -54
  198. package/lib/progress-indicators/progress-bar/progress-bar-step/ProgressBarStep.ve.js +136 -8
  199. package/lib/progress-indicators/progress-ring/ProgressRing.js +45 -52
  200. package/lib/progress-indicators/style.css +2 -1
  201. package/lib/rich-text-editor/index.js +556 -582
  202. package/lib/rich-text-editor/index.umd.cjs +11 -11
  203. package/lib/rich-text-editor/rich-text-editor/RTELinkModal.js +29 -33
  204. package/lib/rich-text-editor/rich-text-editor/RTEToolbarButton.css.d.ts.map +1 -1
  205. package/lib/rich-text-editor/rich-text-editor/RTEToolbarButton.js +23 -37
  206. package/lib/rich-text-editor/rich-text-editor/RTEToolbarButton.ve.js +13 -6
  207. package/lib/rich-text-editor/rich-text-editor/RichTextEditor.js +68 -77
  208. package/lib/rich-text-editor/rich-text-editor/RichTextEditor.ve.js +21 -8
  209. package/lib/rich-text-editor/rich-text-editor/hooks/useHtmlToMd.js +14 -20
  210. package/lib/rich-text-editor/rich-text-editor/hooks/useMdToHtml.js +14 -20
  211. package/lib/rich-text-editor/rich-text-editor/hooks/useRTEContent.js +33 -27
  212. package/lib/rich-text-editor/rich-text-editor/hooks/useRTEObserver.js +79 -88
  213. package/lib/rich-text-editor/rich-text-editor/hooks/useRTESelectionListener.js +28 -36
  214. package/lib/rich-text-editor/rich-text-editor/hooks/useRTEToolbarButtons.js +195 -211
  215. package/lib/rich-text-editor/rich-text-editor/icons/BOLD.svg.js +4 -4
  216. package/lib/rich-text-editor/rich-text-editor/icons/INDENT.svg.js +4 -4
  217. package/lib/rich-text-editor/rich-text-editor/icons/ITALICS.svg.js +4 -4
  218. package/lib/rich-text-editor/rich-text-editor/icons/LINK.svg.js +4 -4
  219. package/lib/rich-text-editor/rich-text-editor/icons/ORDERED_LIST.svg.js +4 -4
  220. package/lib/rich-text-editor/rich-text-editor/icons/OUTDENT.svg.js +4 -4
  221. package/lib/rich-text-editor/rich-text-editor/icons/REDO.svg.js +4 -4
  222. package/lib/rich-text-editor/rich-text-editor/icons/UNDO.svg.js +4 -4
  223. package/lib/rich-text-editor/rich-text-editor/icons/UNLINK.svg.js +4 -4
  224. package/lib/rich-text-editor/rich-text-editor/icons/UNORDERED_LIST.svg.js +4 -4
  225. package/lib/rich-text-editor/rich-text-editor/utils/flattenListItemParagraphs.js +12 -12
  226. package/lib/rich-text-editor/rich-text-editor/utils/removeUnrepresentableBreaks.js +20 -19
  227. package/lib/rich-text-editor/rich-text-editor/utils/utils.js +11 -15
  228. package/lib/rich-text-editor/style.css +2 -1
  229. package/lib/scrollable-container/ScrollableContainer.js +18 -27
  230. package/lib/scrollable-container/ScrollableContainer.ve.js +4 -4
  231. package/lib/scrollable-container/index.js +20 -27
  232. package/lib/scrollable-container/index.umd.cjs +1 -1
  233. package/lib/scrollable-container/style.css +2 -1
  234. package/lib/side-nav/index.js +190 -216
  235. package/lib/side-nav/index.umd.cjs +1 -1
  236. package/lib/side-nav/side-nav/SideNav.css.d.ts.map +1 -1
  237. package/lib/side-nav/side-nav/SideNav.js +43 -60
  238. package/lib/side-nav/side-nav/SideNav.ve.js +22 -16
  239. package/lib/side-nav/side-nav/navContext.js +7 -7
  240. package/lib/side-nav/side-nav-header/SideNavHeader.js +14 -15
  241. package/lib/side-nav/side-nav-item/SideNavItem.d.ts.map +1 -1
  242. package/lib/side-nav/side-nav-item/SideNavItem.js +68 -82
  243. package/lib/side-nav/side-nav-section/SideNavSection.js +16 -26
  244. package/lib/side-nav/style.css +2 -1
  245. package/lib/sorting-header/caret/caret.ve.js +13 -5
  246. package/lib/sorting-header/index.js +269 -243
  247. package/lib/sorting-header/index.umd.cjs +1 -1
  248. package/lib/sorting-header/sorting-header/SortingHeader.js +110 -124
  249. package/lib/sorting-header/sorting-header/SortingHeader.ve.js +30 -6
  250. package/lib/sorting-header/sorting-header-cell/SortingHeaderCell.css.d.ts +2 -0
  251. package/lib/sorting-header/sorting-header-cell/SortingHeaderCell.css.d.ts.map +1 -1
  252. package/lib/sorting-header/sorting-header-cell/SortingHeaderCell.d.ts.map +1 -1
  253. package/lib/sorting-header/sorting-header-cell/SortingHeaderCell.js +69 -75
  254. package/lib/sorting-header/sorting-header-cell/SortingHeaderCell.ve.js +21 -5
  255. package/lib/sorting-header/style.css +2 -1
  256. package/lib/style.css +2 -1
  257. package/lib/tabs/index.js +255 -200
  258. package/lib/tabs/index.umd.cjs +1 -1
  259. package/lib/tabs/style.css +2 -1
  260. package/lib/tabs/tab/Tab.css.d.ts.map +1 -1
  261. package/lib/tabs/tab/Tab.js +24 -27
  262. package/lib/tabs/tab/Tab.ve.js +76 -6
  263. package/lib/tabs/tab-panel/TabPanel.d.ts.map +1 -1
  264. package/lib/tabs/tab-panel/TabPanel.js +16 -23
  265. package/lib/tabs/tabs/Tabs.css.d.ts +1 -0
  266. package/lib/tabs/tabs/Tabs.css.d.ts.map +1 -1
  267. package/lib/tabs/tabs/Tabs.js +101 -112
  268. package/lib/tabs/tabs/Tabs.ve.js +13 -10
  269. package/lib/tags/clickable-tag/ClickableTag.css.d.ts +1 -1
  270. package/lib/tags/clickable-tag/ClickableTag.css.d.ts.map +1 -1
  271. package/lib/tags/clickable-tag/ClickableTag.d.ts.map +1 -1
  272. package/lib/tags/clickable-tag/ClickableTag.js +86 -70
  273. package/lib/tags/clickable-tag/ClickableTag.ve.js +66 -9
  274. package/lib/tags/index.js +342 -179
  275. package/lib/tags/index.umd.cjs +1 -1
  276. package/lib/tags/split-tag/SplitTag.css.d.ts.map +1 -1
  277. package/lib/tags/split-tag/SplitTag.js +49 -30
  278. package/lib/tags/split-tag/SplitTag.ve.js +35 -9
  279. package/lib/tags/style.css +2 -1
  280. package/lib/tags/tag/Tag.js +42 -38
  281. package/lib/tags/tag/Tag.ve.js +41 -6
  282. package/lib/utils/cl.js +5 -5
  283. package/lib/zero-state/ZeroState.js +36 -29
  284. package/lib/zero-state/ZeroState.ve.js +29 -11
  285. package/lib/zero-state/index.js +103 -78
  286. package/lib/zero-state/index.umd.cjs +1 -1
  287. package/lib/zero-state/style.css +2 -1
  288. package/package.json +12 -12
  289. 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,83 +1,74 @@
1
- import * as e from "react";
2
- import { Metadata as E, cl as y, Icon as S } from "@sps-woodland/core";
3
- import { photoWrapper as b, photo as N, photoPlaceholder as W } from "./Photo.ve.js";
4
- function x({
5
- className: a,
6
- src: o,
7
- altText: f,
8
- mode: s = "fill",
9
- placeholderIcon: d = "photo",
10
- ...m
11
- }) {
12
- const c = e.useRef(null), l = e.useRef(null), n = e.useRef(null), r = e.useRef(null), [i, h] = e.useState(), [g, p] = e.useState(!1);
13
- e.useEffect(() => {
14
- l.current && (n.current && (window.clearInterval(n.current), n.current = null), n.current = window.setInterval(() => {
15
- if (l.current) {
16
- const t = l.current.getBoundingClientRect();
17
- if (t.height) {
18
- n.current && (window.clearInterval(n.current), n.current = null);
19
- const u = t.width / t.height > 1;
20
- p(u === (s === "fit"));
21
- }
22
- }
23
- }, 1e3 / 60));
24
- }, [c.current, l.current, o]), e.useEffect(() => {
25
- r.current && (window.clearInterval(r.current), r.current = null), r.current = window.setInterval(() => {
26
- if (c.current) {
27
- const t = c.current.getBoundingClientRect();
28
- t.width && (w(t.width), r.current && (window.clearInterval(r.current), r.current = null));
29
- }
30
- }, 1e3 / 60);
31
- }, [c.current]);
32
- function w(t) {
33
- if (t) {
34
- const u = document?.body?.parentElement?.style?.fontSize || "16px", v = Number(u.substring(0, u.length - 2));
35
- h(t / v);
36
- }
37
- }
38
- function I() {
39
- if (typeof i < "u")
40
- return i * 0.05;
41
- }
42
- function R() {
43
- if (typeof i < "u")
44
- return 0.75 * i;
45
- }
46
- return /* @__PURE__ */ e.createElement(
47
- "div",
48
- {
49
- ref: c,
50
- className: y(b({ placeholder: !o }), a),
51
- style: {
52
- width: `${i}` && `${i}rem`,
53
- fontSize: `${I()}rem`,
54
- height: `${R()}rem`
55
- },
56
- ...m
57
- },
58
- o ? i ? /* @__PURE__ */ e.createElement(
59
- "img",
60
- {
61
- className: N({ mode: g ? "fit" : "fill" }),
62
- ref: l,
63
- src: o,
64
- alt: f
65
- }
66
- ) : /* @__PURE__ */ e.createElement("span", null) : /* @__PURE__ */ e.createElement(S, { className: W, icon: d })
67
- );
1
+ import { photo as e, photoPlaceholder as t, photoWrapper as n } from "./Photo.ve.js";
2
+ import { Icon as r, Metadata as i, cl as a } from "@sps-woodland/core";
3
+ import * as o from "react";
4
+ //#region src/photo/photo/Photo.tsx
5
+ function s({ className: i, src: s, altText: c, mode: l = "fill", placeholderIcon: u = "photo", ...d }) {
6
+ let f = o.useRef(null), p = o.useRef(null), m = o.useRef(null), h = o.useRef(null), [g, _] = o.useState(), [v, y] = o.useState(!1);
7
+ o.useEffect(() => {
8
+ p.current && (m.current &&= (window.clearInterval(m.current), null), m.current = window.setInterval(() => {
9
+ if (p.current) {
10
+ let e = p.current.getBoundingClientRect();
11
+ if (e.height) {
12
+ m.current &&= (window.clearInterval(m.current), null);
13
+ let t = e.width / e.height > 1;
14
+ y(t === (l === "fit"));
15
+ }
16
+ }
17
+ }, 1e3 / 60));
18
+ }, [
19
+ f.current,
20
+ p.current,
21
+ s
22
+ ]), o.useEffect(() => {
23
+ h.current &&= (window.clearInterval(h.current), null), h.current = window.setInterval(() => {
24
+ if (f.current) {
25
+ let e = f.current.getBoundingClientRect();
26
+ e.width && (b(e.width), h.current &&= (window.clearInterval(h.current), null));
27
+ }
28
+ }, 1e3 / 60);
29
+ }, [f.current]);
30
+ function b(e) {
31
+ if (e) {
32
+ let t = document?.body?.parentElement?.style?.fontSize || "16px", n = Number(t.substring(0, t.length - 2));
33
+ _(e / n);
34
+ }
35
+ }
36
+ function x() {
37
+ if (g !== void 0) return g * .05;
38
+ }
39
+ function S() {
40
+ if (g !== void 0) return .75 * g;
41
+ }
42
+ return /* @__PURE__ */ o.createElement("div", {
43
+ ref: f,
44
+ className: a(n({ placeholder: !s }), i),
45
+ style: {
46
+ width: `${g}` && `${g}rem`,
47
+ fontSize: `${x()}rem`,
48
+ height: `${S()}rem`
49
+ },
50
+ ...d
51
+ }, s ? g ? /* @__PURE__ */ o.createElement("img", {
52
+ className: e({ mode: v ? "fit" : "fill" }),
53
+ ref: p,
54
+ src: s,
55
+ alt: c
56
+ }) : /* @__PURE__ */ o.createElement("span", null) : /* @__PURE__ */ o.createElement(r, {
57
+ className: t,
58
+ icon: u
59
+ }));
68
60
  }
69
- E.set(x, {
70
- name: "Photo",
71
- props: {
72
- src: "string",
73
- altText: "string",
74
- mode: {
75
- type: '"fill" | "fit"',
76
- default: '"fill"'
77
- },
78
- placeholderIcon: "IconName"
79
- }
61
+ i.set(s, {
62
+ name: "Photo",
63
+ props: {
64
+ src: "string",
65
+ altText: "string",
66
+ mode: {
67
+ type: "\"fill\" | \"fit\"",
68
+ default: "\"fill\""
69
+ },
70
+ placeholderIcon: "IconName"
71
+ }
80
72
  });
81
- export {
82
- x as Photo
83
- };
73
+ //#endregion
74
+ export { s as Photo };
@@ -1,8 +1,22 @@
1
+ import { createRuntimeFn as e } from "../../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";
1
2
  /* empty css */
2
- import { createRuntimeFn as _ } from "../../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";
3
- var s = _({ defaultClassName: "pkg_sps-woodland_core__family_photo__version_8_56_1__hash_1orib4w0", variantClassNames: { placeholder: { true: "pkg_sps-woodland_core__family_photo__version_8_56_1__hash_1orib4w1", false: "pkg_sps-woodland_core__family_photo__version_8_56_1__hash_1orib4w2" } }, defaultVariants: { placeholder: !1 }, compoundVariants: [] }), r = _({ defaultClassName: "pkg_sps-woodland_core__family_photo__version_8_56_1__hash_1orib4w3", variantClassNames: { mode: { fill: "pkg_sps-woodland_core__family_photo__version_8_56_1__hash_1orib4w4", fit: "pkg_sps-woodland_core__family_photo__version_8_56_1__hash_1orib4w5" } }, defaultVariants: { mode: "fill" }, compoundVariants: [] }), e = "pkg_sps-woodland_core__family_photo__version_8_56_1__hash_1orib4w6";
4
- export {
5
- r as photo,
6
- e as photoPlaceholder,
7
- s as photoWrapper
8
- };
3
+ //#region src/photo/photo/Photo.css.ts
4
+ var t = e({
5
+ defaultClassName: "pkg_sps-woodland_core__family_photo__version_8_56_3__hash_1orib4w0",
6
+ variantClassNames: { placeholder: {
7
+ true: "pkg_sps-woodland_core__family_photo__version_8_56_3__hash_1orib4w1",
8
+ false: "pkg_sps-woodland_core__family_photo__version_8_56_3__hash_1orib4w2"
9
+ } },
10
+ defaultVariants: { placeholder: !1 },
11
+ compoundVariants: []
12
+ }), n = e({
13
+ defaultClassName: "pkg_sps-woodland_core__family_photo__version_8_56_3__hash_1orib4w3",
14
+ variantClassNames: { mode: {
15
+ fill: "pkg_sps-woodland_core__family_photo__version_8_56_3__hash_1orib4w4",
16
+ fit: "pkg_sps-woodland_core__family_photo__version_8_56_3__hash_1orib4w5"
17
+ } },
18
+ defaultVariants: { mode: "fill" },
19
+ compoundVariants: []
20
+ }), r = "pkg_sps-woodland_core__family_photo__version_8_56_3__hash_1orib4w6";
21
+ //#endregion
22
+ export { n as photo, r as photoPlaceholder, t as photoWrapper };
@@ -1 +1 @@
1
- {"version":3,"file":"PhotoCarousel.css.d.ts","sourceRoot":"","sources":["../../../src/photo/photo-carousel/PhotoCarousel.css.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,0BAA0B,QAGrC,CAAC;AAEH,eAAO,MAAM,mBAAmB,QAG9B,CAAC;AAEH,eAAO,MAAM,iBAAiB,QAI5B,CAAC;AAEH,eAAO,MAAM,yBAAyB,QAIpC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;EAmBjC,CAAC"}
1
+ {"version":3,"file":"PhotoCarousel.css.d.ts","sourceRoot":"","sources":["../../../src/photo/photo-carousel/PhotoCarousel.css.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,0BAA0B,QAGrC,CAAC;AAEH,eAAO,MAAM,mBAAmB,QAG9B,CAAC;AAEH,eAAO,MAAM,iBAAiB,QAI5B,CAAC;AAEH,eAAO,MAAM,yBAAyB,QAIpC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;EAoBjC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"PhotoCarousel.d.ts","sourceRoot":"","sources":["../../../src/photo/photo-carousel/PhotoCarousel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAY,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAcnE,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACR,EAAE,cAAc,CAAC,OAAO,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,YAAY,CAkD9D"}
1
+ {"version":3,"file":"PhotoCarousel.d.ts","sourceRoot":"","sources":["../../../src/photo/photo-carousel/PhotoCarousel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAY,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAcnE,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACR,EAAE,cAAc,CAAC,OAAO,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,YAAY,CAwD9D"}
@@ -1,48 +1,37 @@
1
- import * as e from "react";
2
- import { selectChildren as N, cl as t } from "@sps-woodland/core";
3
- import { Photo as v } from "../photo/Photo.js";
4
- import { grid as r } from "@sps-woodland/tokens";
5
- import { SpsButton as l } from "@spscommerce/ds-react";
6
- import { SpsIcon as s, ButtonKind as m } from "@spscommerce/ds-shared";
7
- import { photoCarouselButtonWrapper as i, photoCarouselButton as p, photoCarouselDisplayPhoto as I, photoCarouselList as f, photoCarouselListPhoto as R } from "./PhotoCarousel.ve.js";
8
- function O({
9
- children: d,
10
- className: x,
11
- ...u
12
- }) {
13
- const [n] = N(d, [{ type: v }]), [o, a] = e.useState(0);
14
- function C() {
15
- o + 1 === n.length ? a(0) : a(o + 1);
16
- }
17
- function h() {
18
- a(o === 0 ? n.length - 1 : o - 1);
19
- }
20
- return /* @__PURE__ */ e.createElement("div", { className: r.root, ...u }, /* @__PURE__ */ e.createElement("div", { className: t(i) }, /* @__PURE__ */ e.createElement("div", { className: t(p) }, /* @__PURE__ */ e.createElement(
21
- l,
22
- {
23
- tabIndex: 0,
24
- kind: m.ICON,
25
- icon: s.ARROW_LEFT_CIRCLE,
26
- onClick: h
27
- }
28
- ))), /* @__PURE__ */ e.createElement("div", { className: r[10] }, /* @__PURE__ */ e.createElement("div", { className: t(I, r[12]) }, n[o]), /* @__PURE__ */ e.createElement("div", { className: t(f, r[12]) }, n.map((E, c) => /* @__PURE__ */ e.createElement(
29
- "button",
30
- {
31
- tabIndex: 0,
32
- className: t(R({ selected: c === o })),
33
- onClick: () => a(c)
34
- },
35
- E
36
- )))), /* @__PURE__ */ e.createElement("div", { className: t(i) }, /* @__PURE__ */ e.createElement("div", { className: t(p) }, /* @__PURE__ */ e.createElement(
37
- l,
38
- {
39
- tabIndex: 0,
40
- kind: m.ICON,
41
- icon: s.ARROW_RIGHT_CIRCLE,
42
- onClick: C
43
- }
44
- ))));
1
+ import { Photo as e } from "../photo/Photo.js";
2
+ import { photoCarouselButton as t, photoCarouselButtonWrapper as n, photoCarouselDisplayPhoto as r, photoCarouselList as i, photoCarouselListPhoto as a } from "./PhotoCarousel.ve.js";
3
+ import { cl as o, selectChildren as s } from "@sps-woodland/core";
4
+ import * as c from "react";
5
+ import { useWoodlandLanguage as l } from "@spscommerce/i18n";
6
+ import { grid as u } from "@sps-woodland/tokens";
7
+ import { Button as d } from "@sps-woodland/core/buttons";
8
+ //#region src/photo/photo-carousel/PhotoCarousel.tsx
9
+ function f({ children: f, className: p, ...m }) {
10
+ let [h] = s(f, [{ type: e }]), [g, _] = c.useState(0), { t: v } = l();
11
+ function y() {
12
+ g + 1 === h.length ? _(0) : _(g + 1);
13
+ }
14
+ function b() {
15
+ _(g === 0 ? h.length - 1 : g - 1);
16
+ }
17
+ return /* @__PURE__ */ c.createElement("div", {
18
+ className: u.root,
19
+ ...m
20
+ }, /* @__PURE__ */ c.createElement("div", { className: o(n) }, /* @__PURE__ */ c.createElement("div", { className: o(t) }, /* @__PURE__ */ c.createElement(d, {
21
+ kind: "icon",
22
+ icon: "arrow-left-circle",
23
+ "aria-label": v("photo.previousPhoto", { defaultValue: "Previous Photo" }),
24
+ onClick: b
25
+ }))), /* @__PURE__ */ c.createElement("div", { className: u[10] }, /* @__PURE__ */ c.createElement("div", { className: o(r, u[12]) }, h[g]), /* @__PURE__ */ c.createElement("div", { className: o(i, u[12]) }, h.map((e, t) => /* @__PURE__ */ c.createElement("button", {
26
+ tabIndex: 0,
27
+ className: o(a({ selected: t === g })),
28
+ onClick: () => _(t)
29
+ }, e)))), /* @__PURE__ */ c.createElement("div", { className: o(n) }, /* @__PURE__ */ c.createElement("div", { className: o(t) }, /* @__PURE__ */ c.createElement(d, {
30
+ kind: "icon",
31
+ icon: "arrow-right-circle",
32
+ "aria-label": v("photo.nextPhoto", { defaultValue: "Next Photo" }),
33
+ onClick: y
34
+ }))));
45
35
  }
46
- export {
47
- O as PhotoCarousel
48
- };
36
+ //#endregion
37
+ export { f as PhotoCarousel };
@@ -1,10 +1,14 @@
1
+ import { createRuntimeFn as e } from "../../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";
1
2
  /* empty css */
2
- import { createRuntimeFn as _ } from "../../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";
3
- var s = "pkg_sps-woodland_core__family_photo__version_8_56_1__hash_1744ba10", e = "pkg_sps-woodland_core__family_photo__version_8_56_1__hash_1744ba11", r = "pkg_sps-woodland_core__family_photo__version_8_56_1__hash_1744ba12", p = "pkg_sps-woodland_core__family_photo__version_8_56_1__hash_1744ba13", t = _({ defaultClassName: "pkg_sps-woodland_core__family_photo__version_8_56_1__hash_1744ba14", variantClassNames: { selected: { true: "pkg_sps-woodland_core__family_photo__version_8_56_1__hash_1744ba15", false: "pkg_sps-woodland_core__family_photo__version_8_56_1__hash_1744ba16" } }, defaultVariants: { selected: !1 }, compoundVariants: [] });
4
- export {
5
- e as photoCarouselButton,
6
- s as photoCarouselButtonWrapper,
7
- p as photoCarouselDisplayPhoto,
8
- r as photoCarouselList,
9
- t as photoCarouselListPhoto
10
- };
3
+ //#region src/photo/photo-carousel/PhotoCarousel.css.ts
4
+ var t = "pkg_sps-woodland_core__family_photo__version_8_56_3__hash_1744ba10", n = "pkg_sps-woodland_core__family_photo__version_8_56_3__hash_1744ba11", r = "pkg_sps-woodland_core__family_photo__version_8_56_3__hash_1744ba12", i = "pkg_sps-woodland_core__family_photo__version_8_56_3__hash_1744ba13", a = e({
5
+ defaultClassName: "pkg_sps-woodland_core__family_photo__version_8_56_3__hash_1744ba14",
6
+ variantClassNames: { selected: {
7
+ true: "pkg_sps-woodland_core__family_photo__version_8_56_3__hash_1744ba15",
8
+ false: "pkg_sps-woodland_core__family_photo__version_8_56_3__hash_1744ba16"
9
+ } },
10
+ defaultVariants: { selected: !1 },
11
+ compoundVariants: []
12
+ });
13
+ //#endregion
14
+ export { n as photoCarouselButton, t as photoCarouselButtonWrapper, i as photoCarouselDisplayPhoto, r as photoCarouselList, a as photoCarouselListPhoto };
@@ -1 +1,2 @@
1
- .pkg_sps-woodland_core__family_photo__version_8_56_1__hash_1orib4w0{align-items:center;display:flex;justify-content:center;overflow:hidden;padding:0!important;vertical-align:middle}.pkg_sps-woodland_core__family_photo__version_8_56_1__hash_1orib4w1{background:#f3f4f4;box-shadow:inset .0625rem 0 #d2d4d4,inset -.0625rem 0 #d2d4d4,inset 0 .0625rem #d2d4d4,inset 0 -.0625rem #d2d4d4,inset 1em 0 #fff,inset -1em 0 #fff,inset 0 1em #fff,inset 0 -1em #fff}.pkg_sps-woodland_core__family_photo__version_8_56_1__hash_1orib4w3{visibility:hidden}.pkg_sps-woodland_core__family_photo__version_8_56_1__hash_1orib4w4{height:100%;visibility:visible;width:auto}.pkg_sps-woodland_core__family_photo__version_8_56_1__hash_1orib4w5{height:auto;visibility:visible;width:100%}.pkg_sps-woodland_core__family_photo__version_8_56_1__hash_1orib4w6{font-size:6em;text-align:center;color:#717779}.pkg_sps-woodland_core__family_photo__version_8_56_1__hash_1744ba10{display:table;float:right}.pkg_sps-woodland_core__family_photo__version_8_56_1__hash_1744ba11{display:table-cell;vertical-align:middle}.pkg_sps-woodland_core__family_photo__version_8_56_1__hash_1744ba12{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:1rem}.pkg_sps-woodland_core__family_photo__version_8_56_1__hash_1744ba13{display:block;margin-bottom:.5rem;width:100%}.pkg_sps-woodland_core__family_photo__version_8_56_1__hash_1744ba14{display:block;background:transparent;border:0;cursor:pointer;padding:0}.pkg_sps-woodland_core__family_photo__version_8_56_1__hash_1744ba16{opacity:.4}
1
+ .pkg_sps-woodland_core__family_photo__version_8_56_3__hash_1orib4w0{vertical-align:middle;justify-content:center;align-items:center;display:flex;overflow:hidden;padding:0!important}.pkg_sps-woodland_core__family_photo__version_8_56_3__hash_1orib4w1{background:#f3f4f4;box-shadow:inset .0625rem 0 #d2d4d4,inset -.0625rem 0 #d2d4d4,inset 0 .0625rem #d2d4d4,inset 0 -.0625rem #d2d4d4,inset 1em 0 #fff,inset -1em 0 #fff,inset 0 1em #fff,inset 0 -1em #fff}.pkg_sps-woodland_core__family_photo__version_8_56_3__hash_1orib4w3{visibility:hidden}.pkg_sps-woodland_core__family_photo__version_8_56_3__hash_1orib4w4{visibility:visible;width:auto;height:100%}.pkg_sps-woodland_core__family_photo__version_8_56_3__hash_1orib4w5{visibility:visible;width:100%;height:auto}.pkg_sps-woodland_core__family_photo__version_8_56_3__hash_1orib4w6{text-align:center;color:#717779;font-size:6em}.pkg_sps-woodland_core__family_photo__version_8_56_3__hash_1744ba10{float:right;display:table}.pkg_sps-woodland_core__family_photo__version_8_56_3__hash_1744ba11{vertical-align:middle;display:table-cell}.pkg_sps-woodland_core__family_photo__version_8_56_3__hash_1744ba12{grid-template-columns:repeat(4,minmax(0,1fr));gap:1rem;display:grid}.pkg_sps-woodland_core__family_photo__version_8_56_3__hash_1744ba13{width:100%;margin-bottom:.5rem;display:block}.pkg_sps-woodland_core__family_photo__version_8_56_3__hash_1744ba14{cursor:pointer;background:0 0;border:0;padding:0;display:block}.pkg_sps-woodland_core__family_photo__version_8_56_3__hash_1744ba14:focus{outline-offset:.125rem;outline:.125rem solid #007db8;box-shadow:0 0 0 6px #fff}.pkg_sps-woodland_core__family_photo__version_8_56_3__hash_1744ba16{opacity:.4}
2
+ /*$vite$:1*/
@@ -1,106 +1,90 @@
1
1
  import * as e from "react";
2
- function j(n, z = {}) {
3
- const {
4
- enabled: i = !0,
5
- minVisibleItems: P = 1,
6
- debounceMs: k = 16
7
- // ~1 frame for responsive resize handling
8
- } = z, R = e.useRef(null), b = e.useRef(null), x = e.useRef(null), A = e.useRef(null), w = e.useRef(null), M = e.useRef([]), E = e.useRef(0), H = e.useRef(0), v = e.useRef(!1), [I, y] = e.useState(n.length), [T, F] = e.useState(!1), N = e.useCallback(() => {
9
- if (!R.current) return !1;
10
- const t = R.current, o = Array.from(t.children), r = x.current;
11
- r && (E.current = r.getBoundingClientRect().width);
12
- const u = o.filter((f) => f !== r);
13
- if (u.length < n.length)
14
- return !1;
15
- if (M.current = u.map((f) => f.getBoundingClientRect().width), w.current) {
16
- const f = w.current.querySelector("span:last-of-type");
17
- if (f) {
18
- const s = f.getBoundingClientRect().width, g = getComputedStyle(w.current), m = parseFloat(g.marginRight) || 0, l = Math.max(0, m - 8);
19
- H.current = s + l;
20
- }
21
- }
22
- return v.current = !0, !0;
23
- }, [n.length]), V = e.useCallback(() => {
24
- if (!b.current) return 0;
25
- const t = b.current, o = t.getBoundingClientRect(), r = getComputedStyle(t), u = parseFloat(r.paddingLeft) + parseFloat(r.paddingRight), f = parseFloat(r.gap) || 0;
26
- let s = u;
27
- const g = Array.from(t.children), m = g.filter((l) => getComputedStyle(l).display !== "none");
28
- m.length > 1 && (s += f * (m.length - 1));
29
- for (const l of g) {
30
- if (l === R.current) continue;
31
- const B = getComputedStyle(l), S = parseFloat(B.marginLeft) + parseFloat(B.marginRight);
32
- if (l === A.current) {
33
- const p = Array.from(l.children), W = getComputedStyle(l), h = parseFloat(W.gap) || 0;
34
- for (const c of p) {
35
- const d = getComputedStyle(c), q = parseFloat(d.marginLeft) + parseFloat(d.marginRight);
36
- s += c.getBoundingClientRect().width + q;
37
- }
38
- p.length > 1 && (s += h * (p.length - 1)), s += parseFloat(W.paddingLeft) + parseFloat(W.paddingRight), s += S;
39
- } else
40
- s += l.getBoundingClientRect().width + S;
41
- }
42
- return Math.max(0, o.width - s - 2);
43
- }, []), a = e.useRef(!1), L = e.useCallback(() => {
44
- if (!i || !v.current) {
45
- F(!1), a.current = !1;
46
- return;
47
- }
48
- let t = V();
49
- const o = M.current, r = E.current || 100, u = H.current || 0;
50
- if (a.current && u > 0 && (t -= u), o.length === 0 || t <= 0) {
51
- y(n.length), F(!1), a.current = !1;
52
- return;
53
- }
54
- if (o.reduce((c, d) => c + d, 0) <= t) {
55
- y(n.length), F(!1), a.current = !1;
56
- return;
57
- }
58
- let s = 0, g = 0;
59
- const m = t - r;
60
- for (let c = 0; c < o.length; c++) {
61
- const d = o[c];
62
- if (s + d <= m)
63
- s += d, g++;
64
- else
65
- break;
66
- }
67
- const C = Math.min(P, n.length), l = Math.max(g, C), S = o.slice(0, C).reduce((c, d) => c + d, 0) + r, p = g < C && S > t && u > 0, W = !p && t > S + u + 20;
68
- let h = a.current;
69
- p && !a.current ? h = !0 : W && a.current && (h = !1), h !== a.current && (a.current = h, F(h)), y(l);
70
- }, [i, n.length, P, V]);
71
- e.useEffect(() => {
72
- if (!i) {
73
- y(n.length);
74
- return;
75
- }
76
- v.current = !1, M.current = [], y(n.length);
77
- }, [i, n.length]), e.useLayoutEffect(() => {
78
- if (!i || !R.current) return;
79
- N() && L();
80
- }), e.useEffect(() => {
81
- if (!i) return;
82
- let t;
83
- const o = () => {
84
- clearTimeout(t), t = setTimeout(() => {
85
- v.current || N(), L();
86
- }, k);
87
- }, r = new ResizeObserver(o);
88
- return b.current && r.observe(b.current), () => {
89
- clearTimeout(t), r.disconnect();
90
- };
91
- }, [i, N, L, k]);
92
- const G = i ? n.slice(0, I) : n, O = i && I < n.length ? n.slice(I) : [];
93
- return {
94
- visibleItems: G,
95
- overflowItems: O,
96
- containerRef: R,
97
- parentRef: b,
98
- overflowButtonRef: x,
99
- contentRef: A,
100
- brandRef: w,
101
- hideProductName: T
102
- };
2
+ //#region src/product-bar/hooks/usePriorityPlus.ts
3
+ function t(t, n = {}) {
4
+ let { enabled: r = !0, minVisibleItems: i = 1, debounceMs: a = 16 } = n, o = e.useRef(null), s = e.useRef(null), c = e.useRef(null), l = e.useRef(null), u = e.useRef(null), d = e.useRef([]), f = e.useRef(0), p = e.useRef(0), m = e.useRef(!1), [h, g] = e.useState(t.length), [_, v] = e.useState(!1), y = e.useCallback(() => {
5
+ if (!o.current) return !1;
6
+ let e = o.current, n = Array.from(e.children), r = c.current;
7
+ r && (f.current = r.getBoundingClientRect().width);
8
+ let i = n.filter((e) => e !== r);
9
+ if (i.length < t.length) return !1;
10
+ if (d.current = i.map((e) => e.getBoundingClientRect().width), u.current) {
11
+ let e = u.current.querySelector("span:last-of-type");
12
+ if (e) {
13
+ let t = e.getBoundingClientRect().width, n = getComputedStyle(u.current), r = parseFloat(n.marginRight) || 0, i = Math.max(0, r - 8);
14
+ p.current = t + i;
15
+ }
16
+ }
17
+ return m.current = !0, !0;
18
+ }, [t.length]), b = e.useCallback(() => {
19
+ if (!s.current) return 0;
20
+ let e = s.current, t = e.getBoundingClientRect(), n = getComputedStyle(e), r = parseFloat(n.paddingLeft) + parseFloat(n.paddingRight), i = parseFloat(n.gap) || 0, a = r, c = Array.from(e.children), u = c.filter((e) => getComputedStyle(e).display !== "none");
21
+ u.length > 1 && (a += i * (u.length - 1));
22
+ for (let e of c) {
23
+ if (e === o.current) continue;
24
+ let t = getComputedStyle(e), n = parseFloat(t.marginLeft) + parseFloat(t.marginRight);
25
+ if (e === l.current) {
26
+ let t = Array.from(e.children), r = getComputedStyle(e), i = parseFloat(r.gap) || 0;
27
+ for (let e of t) {
28
+ let t = getComputedStyle(e), n = parseFloat(t.marginLeft) + parseFloat(t.marginRight);
29
+ a += e.getBoundingClientRect().width + n;
30
+ }
31
+ t.length > 1 && (a += i * (t.length - 1)), a += parseFloat(r.paddingLeft) + parseFloat(r.paddingRight), a += n;
32
+ } else a += e.getBoundingClientRect().width + n;
33
+ }
34
+ return Math.max(0, t.width - a - 2);
35
+ }, []), x = e.useRef(!1), S = e.useCallback(() => {
36
+ if (!r || !m.current) {
37
+ v(!1), x.current = !1;
38
+ return;
39
+ }
40
+ let e = b(), n = d.current, a = f.current || 100, o = p.current || 0;
41
+ if (x.current && o > 0 && (e -= o), n.length === 0 || e <= 0 || n.reduce((e, t) => e + t, 0) <= e) {
42
+ g(t.length), v(!1), x.current = !1;
43
+ return;
44
+ }
45
+ let s = 0, c = 0, l = e - a;
46
+ for (let e = 0; e < n.length; e++) {
47
+ let t = n[e];
48
+ if (s + t <= l) s += t, c++;
49
+ else break;
50
+ }
51
+ let u = Math.min(i, t.length), h = Math.max(c, u), _ = n.slice(0, u).reduce((e, t) => e + t, 0) + a, y = c < u && _ > e && o > 0, S = !y && e > _ + o + 20, C = x.current;
52
+ y && !x.current ? C = !0 : S && x.current && (C = !1), C !== x.current && (x.current = C, v(C)), g(h);
53
+ }, [
54
+ r,
55
+ t.length,
56
+ i,
57
+ b
58
+ ]);
59
+ return e.useEffect(() => {
60
+ r && (m.current = !1, d.current = []), g(t.length);
61
+ }, [r, t.length]), e.useLayoutEffect(() => {
62
+ r && o.current && y() && S();
63
+ }), e.useEffect(() => {
64
+ if (!r) return;
65
+ let e, t = new ResizeObserver(() => {
66
+ clearTimeout(e), e = setTimeout(() => {
67
+ m.current || y(), S();
68
+ }, a);
69
+ });
70
+ return s.current && t.observe(s.current), () => {
71
+ clearTimeout(e), t.disconnect();
72
+ };
73
+ }, [
74
+ r,
75
+ y,
76
+ S,
77
+ a
78
+ ]), {
79
+ visibleItems: r ? t.slice(0, h) : t,
80
+ overflowItems: r && h < t.length ? t.slice(h) : [],
81
+ containerRef: o,
82
+ parentRef: s,
83
+ overflowButtonRef: c,
84
+ contentRef: l,
85
+ brandRef: u,
86
+ hideProductName: _
87
+ };
103
88
  }
104
- export {
105
- j as usePriorityPlus
106
- };
89
+ //#endregion
90
+ export { t as usePriorityPlus };