@hitachivantara/uikit-react-lab 4.0.1-next.1 → 4.0.1-next.4

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 (202) hide show
  1. package/dist/ImageCarousel/ImageCarousel.d.ts +11 -0
  2. package/dist/ImageCarousel/ImageCarousel.js +666 -0
  3. package/dist/ImageCarousel/ImageCarousel.js.map +1 -0
  4. package/dist/ImageCarousel/index.d.ts +2 -0
  5. package/dist/ImageCarousel/index.js +16 -0
  6. package/dist/ImageCarousel/index.js.map +1 -0
  7. package/dist/ImageCarousel/stories/resources/Ahsoka.jpg +0 -0
  8. package/dist/ImageCarousel/stories/resources/AnakinSkywalker.jpg +0 -0
  9. package/dist/ImageCarousel/stories/resources/BobaFett.jpg +0 -0
  10. package/dist/ImageCarousel/stories/resources/DarthVader.jpg +0 -0
  11. package/dist/ImageCarousel/stories/resources/MaceWindu.jpg +0 -0
  12. package/dist/ImageCarousel/stories/resources/ObiWan.png +0 -0
  13. package/dist/ImageCarousel/stories/resources/Panoramic.jpg +0 -0
  14. package/dist/ImageCarousel/stories/resources/Revan.jpg +0 -0
  15. package/dist/ImageCarousel/stories/resources/TheMandalorian.jpg +0 -0
  16. package/dist/ImageCarousel/stories/resources/Yoda.jpg +0 -0
  17. package/dist/ImageCarousel/styles.js +238 -0
  18. package/dist/ImageCarousel/styles.js.map +1 -0
  19. package/dist/StepNavigation/DefaultNavigation/DefaultNavigation.d.ts +58 -0
  20. package/dist/StepNavigation/DefaultNavigation/DefaultNavigation.js +156 -0
  21. package/dist/StepNavigation/DefaultNavigation/DefaultNavigation.js.map +1 -0
  22. package/dist/StepNavigation/DefaultNavigation/Step/Step.d.ts +32 -0
  23. package/dist/StepNavigation/DefaultNavigation/Step/Step.js +201 -0
  24. package/dist/StepNavigation/DefaultNavigation/Step/Step.js.map +1 -0
  25. package/dist/StepNavigation/DefaultNavigation/Step/index.d.ts +2 -0
  26. package/dist/StepNavigation/DefaultNavigation/Step/index.js +16 -0
  27. package/dist/StepNavigation/DefaultNavigation/Step/index.js.map +1 -0
  28. package/dist/StepNavigation/DefaultNavigation/Step/styles.js +53 -0
  29. package/dist/StepNavigation/DefaultNavigation/Step/styles.js.map +1 -0
  30. package/dist/StepNavigation/DefaultNavigation/index.d.ts +2 -0
  31. package/dist/StepNavigation/DefaultNavigation/index.js +16 -0
  32. package/dist/StepNavigation/DefaultNavigation/index.js.map +1 -0
  33. package/dist/StepNavigation/DefaultNavigation/styles.js +16 -0
  34. package/dist/StepNavigation/DefaultNavigation/styles.js.map +1 -0
  35. package/dist/StepNavigation/DefaultNavigation/utils.js +49 -0
  36. package/dist/StepNavigation/DefaultNavigation/utils.js.map +1 -0
  37. package/dist/StepNavigation/SimpleNavigation/Dot/Dot.d.ts +10 -0
  38. package/dist/StepNavigation/SimpleNavigation/Dot/Dot.js +176 -0
  39. package/dist/StepNavigation/SimpleNavigation/Dot/Dot.js.map +1 -0
  40. package/dist/StepNavigation/SimpleNavigation/Dot/index.d.ts +2 -0
  41. package/dist/StepNavigation/SimpleNavigation/Dot/index.js +16 -0
  42. package/dist/StepNavigation/SimpleNavigation/Dot/index.js.map +1 -0
  43. package/dist/StepNavigation/SimpleNavigation/Dot/styles.js +25 -0
  44. package/dist/StepNavigation/SimpleNavigation/Dot/styles.js.map +1 -0
  45. package/dist/StepNavigation/SimpleNavigation/SimpleNavigation.d.ts +58 -0
  46. package/dist/StepNavigation/SimpleNavigation/SimpleNavigation.js +159 -0
  47. package/dist/StepNavigation/SimpleNavigation/SimpleNavigation.js.map +1 -0
  48. package/dist/StepNavigation/SimpleNavigation/index.d.ts +2 -0
  49. package/dist/StepNavigation/SimpleNavigation/index.js +16 -0
  50. package/dist/StepNavigation/SimpleNavigation/index.js.map +1 -0
  51. package/dist/StepNavigation/SimpleNavigation/styles.js +16 -0
  52. package/dist/StepNavigation/SimpleNavigation/styles.js.map +1 -0
  53. package/dist/StepNavigation/SimpleNavigation/utils.js +31 -0
  54. package/dist/StepNavigation/SimpleNavigation/utils.js.map +1 -0
  55. package/dist/StepNavigation/StepNavigation.d.ts +43 -0
  56. package/dist/StepNavigation/StepNavigation.js +400 -0
  57. package/dist/StepNavigation/StepNavigation.js.map +1 -0
  58. package/dist/StepNavigation/index.d.ts +2 -0
  59. package/dist/StepNavigation/index.js +16 -0
  60. package/dist/StepNavigation/index.js.map +1 -0
  61. package/dist/StepNavigation/styles.js +41 -0
  62. package/dist/StepNavigation/styles.js.map +1 -0
  63. package/dist/StepNavigation/utils.js +15 -0
  64. package/dist/StepNavigation/utils.js.map +1 -0
  65. package/dist/index.d.ts +6 -0
  66. package/dist/index.js +19 -1
  67. package/dist/index.js.map +1 -1
  68. package/dist/legacy/ImageCarousel/ImageCarousel.d.ts +11 -0
  69. package/dist/legacy/ImageCarousel/ImageCarousel.js +624 -0
  70. package/dist/legacy/ImageCarousel/ImageCarousel.js.map +1 -0
  71. package/dist/legacy/ImageCarousel/index.d.ts +2 -0
  72. package/dist/legacy/ImageCarousel/index.js +2 -0
  73. package/dist/legacy/ImageCarousel/index.js.map +1 -0
  74. package/dist/legacy/ImageCarousel/stories/resources/Ahsoka.jpg +0 -0
  75. package/dist/legacy/ImageCarousel/stories/resources/AnakinSkywalker.jpg +0 -0
  76. package/dist/legacy/ImageCarousel/stories/resources/BobaFett.jpg +0 -0
  77. package/dist/legacy/ImageCarousel/stories/resources/DarthVader.jpg +0 -0
  78. package/dist/legacy/ImageCarousel/stories/resources/MaceWindu.jpg +0 -0
  79. package/dist/legacy/ImageCarousel/stories/resources/ObiWan.png +0 -0
  80. package/dist/legacy/ImageCarousel/stories/resources/Panoramic.jpg +0 -0
  81. package/dist/legacy/ImageCarousel/stories/resources/Revan.jpg +0 -0
  82. package/dist/legacy/ImageCarousel/stories/resources/TheMandalorian.jpg +0 -0
  83. package/dist/legacy/ImageCarousel/stories/resources/Yoda.jpg +0 -0
  84. package/dist/legacy/ImageCarousel/styles.js +228 -0
  85. package/dist/legacy/ImageCarousel/styles.js.map +1 -0
  86. package/dist/legacy/StepNavigation/DefaultNavigation/DefaultNavigation.d.ts +58 -0
  87. package/dist/legacy/StepNavigation/DefaultNavigation/DefaultNavigation.js +131 -0
  88. package/dist/legacy/StepNavigation/DefaultNavigation/DefaultNavigation.js.map +1 -0
  89. package/dist/legacy/StepNavigation/DefaultNavigation/Step/Step.d.ts +32 -0
  90. package/dist/legacy/StepNavigation/DefaultNavigation/Step/Step.js +181 -0
  91. package/dist/legacy/StepNavigation/DefaultNavigation/Step/Step.js.map +1 -0
  92. package/dist/legacy/StepNavigation/DefaultNavigation/Step/index.d.ts +2 -0
  93. package/dist/legacy/StepNavigation/DefaultNavigation/Step/index.js +2 -0
  94. package/dist/legacy/StepNavigation/DefaultNavigation/Step/index.js.map +1 -0
  95. package/dist/legacy/StepNavigation/DefaultNavigation/Step/styles.js +45 -0
  96. package/dist/legacy/StepNavigation/DefaultNavigation/Step/styles.js.map +1 -0
  97. package/dist/legacy/StepNavigation/DefaultNavigation/index.d.ts +2 -0
  98. package/dist/legacy/StepNavigation/DefaultNavigation/index.js +2 -0
  99. package/dist/legacy/StepNavigation/DefaultNavigation/index.js.map +1 -0
  100. package/dist/legacy/StepNavigation/DefaultNavigation/styles.js +8 -0
  101. package/dist/legacy/StepNavigation/DefaultNavigation/styles.js.map +1 -0
  102. package/dist/legacy/StepNavigation/DefaultNavigation/utils.js +41 -0
  103. package/dist/legacy/StepNavigation/DefaultNavigation/utils.js.map +1 -0
  104. package/dist/legacy/StepNavigation/SimpleNavigation/Dot/Dot.d.ts +10 -0
  105. package/dist/legacy/StepNavigation/SimpleNavigation/Dot/Dot.js +135 -0
  106. package/dist/legacy/StepNavigation/SimpleNavigation/Dot/Dot.js.map +1 -0
  107. package/dist/legacy/StepNavigation/SimpleNavigation/Dot/index.d.ts +2 -0
  108. package/dist/legacy/StepNavigation/SimpleNavigation/Dot/index.js +2 -0
  109. package/dist/legacy/StepNavigation/SimpleNavigation/Dot/index.js.map +1 -0
  110. package/dist/legacy/StepNavigation/SimpleNavigation/Dot/styles.js +18 -0
  111. package/dist/legacy/StepNavigation/SimpleNavigation/Dot/styles.js.map +1 -0
  112. package/dist/legacy/StepNavigation/SimpleNavigation/SimpleNavigation.d.ts +58 -0
  113. package/dist/legacy/StepNavigation/SimpleNavigation/SimpleNavigation.js +132 -0
  114. package/dist/legacy/StepNavigation/SimpleNavigation/SimpleNavigation.js.map +1 -0
  115. package/dist/legacy/StepNavigation/SimpleNavigation/index.d.ts +2 -0
  116. package/dist/legacy/StepNavigation/SimpleNavigation/index.js +2 -0
  117. package/dist/legacy/StepNavigation/SimpleNavigation/index.js.map +1 -0
  118. package/dist/legacy/StepNavigation/SimpleNavigation/styles.js +8 -0
  119. package/dist/legacy/StepNavigation/SimpleNavigation/styles.js.map +1 -0
  120. package/dist/legacy/StepNavigation/SimpleNavigation/utils.js +22 -0
  121. package/dist/legacy/StepNavigation/SimpleNavigation/utils.js.map +1 -0
  122. package/dist/legacy/StepNavigation/StepNavigation.d.ts +43 -0
  123. package/dist/legacy/StepNavigation/StepNavigation.js +364 -0
  124. package/dist/legacy/StepNavigation/StepNavigation.js.map +1 -0
  125. package/dist/legacy/StepNavigation/index.d.ts +2 -0
  126. package/dist/legacy/StepNavigation/index.js +2 -0
  127. package/dist/legacy/StepNavigation/index.js.map +1 -0
  128. package/dist/legacy/StepNavigation/styles.js +33 -0
  129. package/dist/legacy/StepNavigation/styles.js.map +1 -0
  130. package/dist/legacy/StepNavigation/utils.js +6 -0
  131. package/dist/legacy/StepNavigation/utils.js.map +1 -0
  132. package/dist/legacy/index.d.ts +6 -0
  133. package/dist/legacy/index.js +2 -0
  134. package/dist/legacy/index.js.map +1 -1
  135. package/dist/modern/ImageCarousel/ImageCarousel.d.ts +11 -0
  136. package/dist/modern/ImageCarousel/ImageCarousel.js +542 -0
  137. package/dist/modern/ImageCarousel/ImageCarousel.js.map +1 -0
  138. package/dist/modern/ImageCarousel/index.d.ts +2 -0
  139. package/dist/modern/ImageCarousel/index.js +2 -0
  140. package/dist/modern/ImageCarousel/index.js.map +1 -0
  141. package/dist/modern/ImageCarousel/stories/resources/Ahsoka.jpg +0 -0
  142. package/dist/modern/ImageCarousel/stories/resources/AnakinSkywalker.jpg +0 -0
  143. package/dist/modern/ImageCarousel/stories/resources/BobaFett.jpg +0 -0
  144. package/dist/modern/ImageCarousel/stories/resources/DarthVader.jpg +0 -0
  145. package/dist/modern/ImageCarousel/stories/resources/MaceWindu.jpg +0 -0
  146. package/dist/modern/ImageCarousel/stories/resources/ObiWan.png +0 -0
  147. package/dist/modern/ImageCarousel/stories/resources/Panoramic.jpg +0 -0
  148. package/dist/modern/ImageCarousel/stories/resources/Revan.jpg +0 -0
  149. package/dist/modern/ImageCarousel/stories/resources/TheMandalorian.jpg +0 -0
  150. package/dist/modern/ImageCarousel/stories/resources/Yoda.jpg +0 -0
  151. package/dist/modern/ImageCarousel/styles.js +241 -0
  152. package/dist/modern/ImageCarousel/styles.js.map +1 -0
  153. package/dist/modern/StepNavigation/DefaultNavigation/DefaultNavigation.d.ts +58 -0
  154. package/dist/modern/StepNavigation/DefaultNavigation/DefaultNavigation.js +123 -0
  155. package/dist/modern/StepNavigation/DefaultNavigation/DefaultNavigation.js.map +1 -0
  156. package/dist/modern/StepNavigation/DefaultNavigation/Step/Step.d.ts +32 -0
  157. package/dist/modern/StepNavigation/DefaultNavigation/Step/Step.js +179 -0
  158. package/dist/modern/StepNavigation/DefaultNavigation/Step/Step.js.map +1 -0
  159. package/dist/modern/StepNavigation/DefaultNavigation/Step/index.d.ts +2 -0
  160. package/dist/modern/StepNavigation/DefaultNavigation/Step/index.js +2 -0
  161. package/dist/modern/StepNavigation/DefaultNavigation/Step/index.js.map +1 -0
  162. package/dist/modern/StepNavigation/DefaultNavigation/Step/styles.js +43 -0
  163. package/dist/modern/StepNavigation/DefaultNavigation/Step/styles.js.map +1 -0
  164. package/dist/modern/StepNavigation/DefaultNavigation/index.d.ts +2 -0
  165. package/dist/modern/StepNavigation/DefaultNavigation/index.js +2 -0
  166. package/dist/modern/StepNavigation/DefaultNavigation/index.js.map +1 -0
  167. package/dist/modern/StepNavigation/DefaultNavigation/styles.js +6 -0
  168. package/dist/modern/StepNavigation/DefaultNavigation/styles.js.map +1 -0
  169. package/dist/modern/StepNavigation/DefaultNavigation/utils.js +41 -0
  170. package/dist/modern/StepNavigation/DefaultNavigation/utils.js.map +1 -0
  171. package/dist/modern/StepNavigation/SimpleNavigation/Dot/Dot.d.ts +10 -0
  172. package/dist/modern/StepNavigation/SimpleNavigation/Dot/Dot.js +123 -0
  173. package/dist/modern/StepNavigation/SimpleNavigation/Dot/Dot.js.map +1 -0
  174. package/dist/modern/StepNavigation/SimpleNavigation/Dot/index.d.ts +2 -0
  175. package/dist/modern/StepNavigation/SimpleNavigation/Dot/index.js +2 -0
  176. package/dist/modern/StepNavigation/SimpleNavigation/Dot/index.js.map +1 -0
  177. package/dist/modern/StepNavigation/SimpleNavigation/Dot/styles.js +18 -0
  178. package/dist/modern/StepNavigation/SimpleNavigation/Dot/styles.js.map +1 -0
  179. package/dist/modern/StepNavigation/SimpleNavigation/SimpleNavigation.d.ts +58 -0
  180. package/dist/modern/StepNavigation/SimpleNavigation/SimpleNavigation.js +121 -0
  181. package/dist/modern/StepNavigation/SimpleNavigation/SimpleNavigation.js.map +1 -0
  182. package/dist/modern/StepNavigation/SimpleNavigation/index.d.ts +2 -0
  183. package/dist/modern/StepNavigation/SimpleNavigation/index.js +2 -0
  184. package/dist/modern/StepNavigation/SimpleNavigation/index.js.map +1 -0
  185. package/dist/modern/StepNavigation/SimpleNavigation/styles.js +6 -0
  186. package/dist/modern/StepNavigation/SimpleNavigation/styles.js.map +1 -0
  187. package/dist/modern/StepNavigation/SimpleNavigation/utils.js +22 -0
  188. package/dist/modern/StepNavigation/SimpleNavigation/utils.js.map +1 -0
  189. package/dist/modern/StepNavigation/StepNavigation.d.ts +43 -0
  190. package/dist/modern/StepNavigation/StepNavigation.js +346 -0
  191. package/dist/modern/StepNavigation/StepNavigation.js.map +1 -0
  192. package/dist/modern/StepNavigation/index.d.ts +2 -0
  193. package/dist/modern/StepNavigation/index.js +2 -0
  194. package/dist/modern/StepNavigation/index.js.map +1 -0
  195. package/dist/modern/StepNavigation/styles.js +31 -0
  196. package/dist/modern/StepNavigation/styles.js.map +1 -0
  197. package/dist/modern/StepNavigation/utils.js +6 -0
  198. package/dist/modern/StepNavigation/utils.js.map +1 -0
  199. package/dist/modern/index.d.ts +6 -0
  200. package/dist/modern/index.js +2 -0
  201. package/dist/modern/index.js.map +1 -1
  202. package/package.json +3 -3
@@ -0,0 +1,624 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
+
5
+ var _Close, _Fullscreen, _Backwards, _Forwards, _Backwards2, _Forwards2;
6
+
7
+ var _excluded = ["className", "classes", "documents", "title", "id", "fullscreen", "thumbnails", "lowCardinality", "infiniteCarousel", "xs", "onChange", "counter", "currentStep", "setCurrentStep", "visibleArrows", "variant"];
8
+
9
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
+
11
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
12
+
13
+ import "core-js/modules/es.array.map.js";
14
+ import "core-js/modules/es.array.slice.js";
15
+ import "core-js/modules/es.array.concat.js";
16
+ import "core-js/modules/es.object.keys.js";
17
+ import "core-js/modules/es.symbol.js";
18
+ import "core-js/modules/es.array.filter.js";
19
+ import "core-js/modules/es.object.to-string.js";
20
+ import "core-js/modules/es.object.get-own-property-descriptor.js";
21
+ import "core-js/modules/web.dom-collections.for-each.js";
22
+ import "core-js/modules/es.object.get-own-property-descriptors.js";
23
+ import React, { useState, useRef, useEffect, useCallback } from "react";
24
+ import PropTypes from "prop-types";
25
+ import clsx from "clsx";
26
+ import { setId, useUniqueId, HvButton, HvContainer, HvTypography, HvGrid, HvStack, HvPanel, useScrollTo } from "@hitachivantara/uikit-react-core";
27
+ import { Button, Fade } from "@mui/material";
28
+ import { withStyles, makeStyles } from "@mui/styles";
29
+ import { Backwards, Forwards, Close, Fullscreen } from "@hitachivantara/uikit-react-icons";
30
+ import styles from "./styles";
31
+ /**
32
+ * ImageCarousel description/documentation paragraph
33
+ */
34
+
35
+ import { jsx as _jsx } from "react/jsx-runtime";
36
+ import { jsxs as _jsxs } from "react/jsx-runtime";
37
+ import { Fragment as _Fragment } from "react/jsx-runtime";
38
+
39
+ var HvImageCarousel = function HvImageCarousel(props) {
40
+ var className = props.className,
41
+ classes = props.classes,
42
+ documents = props.documents,
43
+ title = props.title,
44
+ id = props.id,
45
+ _props$fullscreen = props.fullscreen,
46
+ fullscreenProp = _props$fullscreen === void 0 ? false : _props$fullscreen,
47
+ _props$thumbnails = props.thumbnails,
48
+ thumbnails = _props$thumbnails === void 0 ? false : _props$thumbnails,
49
+ _props$lowCardinality = props.lowCardinality,
50
+ lowCardinality = _props$lowCardinality === void 0 ? false : _props$lowCardinality,
51
+ _props$infiniteCarous = props.infiniteCarousel,
52
+ infiniteCarousel = _props$infiniteCarous === void 0 ? false : _props$infiniteCarous,
53
+ _props$xs = props.xs,
54
+ xs = _props$xs === void 0 ? false : _props$xs,
55
+ onChange = props.onChange,
56
+ _props$counter = props.counter,
57
+ counter = _props$counter === void 0 ? false : _props$counter,
58
+ _props$currentStep = props.currentStep,
59
+ currentStep = _props$currentStep === void 0 ? 0 : _props$currentStep,
60
+ setCurrentStep = props.setCurrentStep,
61
+ _props$visibleArrows = props.visibleArrows,
62
+ visibleArrows = _props$visibleArrows === void 0 ? false : _props$visibleArrows,
63
+ _props$variant = props.variant,
64
+ variant = _props$variant === void 0 ? "contain" : _props$variant,
65
+ others = _objectWithoutProperties(props, _excluded);
66
+
67
+ var elementId = useUniqueId(id, "hvcarousel");
68
+
69
+ var _useState = useState(false),
70
+ _useState2 = _slicedToArray(_useState, 2),
71
+ fullscreen = _useState2[0],
72
+ setFullscreen = _useState2[1];
73
+
74
+ var options = documents.map(function (element) {
75
+ return {
76
+ src: element.src,
77
+ value: setId(elementId, element.value)
78
+ };
79
+ });
80
+
81
+ var _useState3 = useState(0),
82
+ _useState4 = _slicedToArray(_useState3, 2),
83
+ sliceStart = _useState4[0],
84
+ setSliceStart = _useState4[1];
85
+
86
+ var _useState5 = useState(currentStep),
87
+ _useState6 = _slicedToArray(_useState5, 2),
88
+ selImage = _useState6[0],
89
+ setImage = _useState6[1];
90
+
91
+ var _useState7 = useState(0),
92
+ _useState8 = _slicedToArray(_useState7, 2),
93
+ offset = _useState8[0],
94
+ setOffset = _useState8[1];
95
+
96
+ var _useState9 = useState(false),
97
+ _useState10 = _slicedToArray(_useState9, 2),
98
+ imageHover = _useState10[0],
99
+ setImageHover = _useState10[1];
100
+
101
+ var direction = "next";
102
+ var useStyles = makeStyles(function (theme) {
103
+ return {
104
+ button: {
105
+ backgroundColor: theme.hv.palette.atmosphere.atmo3
106
+ },
107
+ imageBox: {
108
+ minWidth: "100%",
109
+ display: "flex",
110
+ justifyContent: "center"
111
+ },
112
+ allImages: {
113
+ width: "max-content",
114
+ display: "flex"
115
+ }
116
+ };
117
+ });
118
+ var style = useStyles();
119
+
120
+ var _useScrollTo = useScrollTo(0, setId(elementId, "panel"), false, 100, documents, onChange, "row"),
121
+ _useScrollTo2 = _slicedToArray(_useScrollTo, 2),
122
+ selectedIndex = _useScrollTo2[0],
123
+ setScrollTo = _useScrollTo2[1];
124
+
125
+ var _useScrollTo3 = useScrollTo(0, setId(elementId, "bigPanel"), false, 0, options, onChange, "row"),
126
+ _useScrollTo4 = _slicedToArray(_useScrollTo3, 2),
127
+ selectedBigIndex = _useScrollTo4[0],
128
+ setBigScrollTo = _useScrollTo4[1];
129
+
130
+ var refBackwards = useRef(null);
131
+ var refForwards = useRef(null);
132
+ var typeCircle = "circle";
133
+ var handleSelection = useCallback(function (event, value, index) {
134
+ var wrappedOnChange = function wrappedOnChange() {
135
+ onChange === null || onChange === void 0 ? void 0 : onChange(event, index);
136
+ };
137
+
138
+ setScrollTo(event, value, index, wrappedOnChange);
139
+ }, [onChange, setScrollTo]);
140
+
141
+ var handleFocus = function handleFocus(focus) {
142
+ if (focus === refBackwards.current || focus === refForwards.current) focus.focus();
143
+ };
144
+
145
+ var handleBigSelection = useCallback(function (event, value, index) {
146
+ var wrappedOnChange = function wrappedOnChange() {
147
+ onChange === null || onChange === void 0 ? void 0 : onChange(event, index);
148
+ };
149
+
150
+ setBigScrollTo(event, value, index, wrappedOnChange);
151
+ }, [onChange, setBigScrollTo]);
152
+ var handleVisibility = useCallback(function (event, value, index) {
153
+ var image = document.getElementById(value);
154
+ var panel = document.getElementById(setId(elementId, "panel"));
155
+ var container = document.getElementById(setId(elementId, "container"));
156
+ var containerWidth = container.offsetWidth;
157
+ var offsetPanel = panel.offsetLeft;
158
+ var offsetImage = image.offsetLeft;
159
+ var imageWidth = image.offsetWidth;
160
+ var scroll = panel.scrollLeft;
161
+ var focus = document.activeElement;
162
+
163
+ if (offsetPanel + offsetImage + offset + imageWidth - scroll > containerWidth || offsetImage - scroll < 0) {
164
+ handleSelection(event, value, index);
165
+ handleFocus(focus);
166
+ }
167
+ }, [elementId, handleSelection, offset]);
168
+ useEffect(function () {
169
+ setCurrentStep === null || setCurrentStep === void 0 ? void 0 : setCurrentStep(selImage);
170
+ }, [selImage, setCurrentStep]);
171
+ useEffect(function () {
172
+ if (fullscreen) setOffset(150);else setOffset(0);
173
+
174
+ if (thumbnails) {
175
+ handleVisibility(undefined, documents[selImage].value, selImage, selectedIndex);
176
+ }
177
+
178
+ handleBigSelection(undefined, options[selImage].value, selImage, selectedBigIndex);
179
+ }, [documents, fullscreen, handleBigSelection, handleVisibility, options, selImage, selectedBigIndex, selectedIndex, thumbnails]);
180
+
181
+ var changeSlice = function changeSlice() {
182
+ if (direction === "next") {
183
+ if (infiniteCarousel && selImage === documents.length - 1) setSliceStart(0);else if (selImage > sliceStart + 2 && selImage !== documents.length - 2) setSliceStart(sliceStart + 1);
184
+ }
185
+
186
+ if (direction === "prev") {
187
+ if (infiniteCarousel && selImage === 0) setSliceStart(documents.length > 5 ? documents.length - 5 : 0);else if (selImage < sliceStart + 2 && selImage !== 1) setSliceStart(sliceStart - 1);
188
+ }
189
+ };
190
+
191
+ var nextImage = function nextImage() {
192
+ var next;
193
+ if (selImage !== documents.length - 1) next = selImage + 1;else if (infiniteCarousel) next = 0;
194
+ setImage(next);
195
+
196
+ if (xs) {
197
+ direction = "next";
198
+ changeSlice();
199
+ }
200
+ };
201
+
202
+ var previousImage = function previousImage() {
203
+ var previous;
204
+ if (selImage !== 0) previous = selImage - 1;else if (infiniteCarousel) previous = documents.length - 1;
205
+ setImage(previous);
206
+
207
+ if (xs) {
208
+ direction = "prev";
209
+ changeSlice();
210
+ }
211
+ };
212
+
213
+ var styleThumbnail = function styleThumbnail(index) {
214
+ if (index !== selImage) return classes.img;
215
+ return classes.thumbnailSelected;
216
+ };
217
+
218
+ var circleType = function circleType(index) {
219
+ if (index === selImage) {
220
+ typeCircle = "BigCircle";
221
+ if (xs) return classes.xsSelectedCircle;
222
+ return classes.selectedCircle;
223
+ }
224
+
225
+ typeCircle = "Circle";
226
+ return classes.miniCircle;
227
+ };
228
+
229
+ return /*#__PURE__*/_jsxs(HvContainer, _objectSpread(_objectSpread({
230
+ id: setId(elementId, "container"),
231
+ className: clsx(className, classes.root, xs ? "xs" : "nxs", fullscreen && classes.fullscreenStyle)
232
+ }, others), {}, {
233
+ children: [!xs && /*#__PURE__*/_jsxs("div", {
234
+ className: classes.title,
235
+ children: [/*#__PURE__*/_jsx("div", {
236
+ children: title
237
+ }), fullscreenProp && /*#__PURE__*/_jsx("div", {
238
+ children: fullscreen ? /*#__PURE__*/_jsx(HvButton, {
239
+ className: classes.closeButton,
240
+ icon: true,
241
+ "aria-label": "Close",
242
+ onClick: function onClick() {
243
+ return setFullscreen(!fullscreen);
244
+ },
245
+ children: _Close || (_Close = /*#__PURE__*/_jsx(Close, {}))
246
+ }) : /*#__PURE__*/_jsx(HvButton, {
247
+ icon: true,
248
+ "aria-label": "Fullscreen",
249
+ onClick: function onClick() {
250
+ return setFullscreen(true);
251
+ },
252
+ children: _Fullscreen || (_Fullscreen = /*#__PURE__*/_jsx(Fullscreen, {}))
253
+ })
254
+ })]
255
+ }), /*#__PURE__*/_jsxs(HvContainer, {
256
+ className: clsx(classes.imageContainer, fullscreen ? "fullscreen" : "notFullscreen", !xs && "nxs"),
257
+ onFocus: function onFocus() {
258
+ return setImageHover(true);
259
+ },
260
+ onMouseOver: function onMouseOver() {
261
+ return setImageHover(true);
262
+ },
263
+ onBlur: function onBlur() {
264
+ return setImageHover(false);
265
+ },
266
+ onMouseOut: function onMouseOut() {
267
+ return setImageHover(false);
268
+ },
269
+ children: [/*#__PURE__*/_jsx(HvPanel, {
270
+ className: clsx(classes.stack, xs ? "xs" : "nxs"),
271
+ id: setId(elementId, "bigPanel"),
272
+ children: options.map(function (element, index) {
273
+ return /*#__PURE__*/_jsx("div", {
274
+ className: style.imageBox,
275
+ id: element.value,
276
+ children: /*#__PURE__*/_jsx(Fade, {
277
+ in: selImage === index || xs,
278
+ timeout: {
279
+ appear: 500,
280
+ enter: 1200,
281
+ exit: 200
282
+ },
283
+ children: /*#__PURE__*/_jsx("img", {
284
+ className: clsx(classes.selectedImage, xs ? "xs" : "nxs", fullscreen ? "fullscreen" : "notFullscreen", variant),
285
+ src: element.src,
286
+ alt: element.value
287
+ }, "image ".concat(element.value))
288
+ })
289
+ }, "div ".concat(element.value));
290
+ })
291
+ }), (xs || lowCardinality) && /*#__PURE__*/_jsxs("div", {
292
+ className: clsx(classes.lowButtons, !xs && "nxs"),
293
+ children: [/*#__PURE__*/_jsx("div", {
294
+ children: /*#__PURE__*/_jsx(Fade, {
295
+ in: imageHover || visibleArrows,
296
+ children: /*#__PURE__*/_jsx(HvButton, {
297
+ ref: refBackwards,
298
+ className: classes.button,
299
+ icon: true,
300
+ "aria-label": "Backwards",
301
+ onClick: function onClick(event) {
302
+ return previousImage(event);
303
+ },
304
+ children: _Backwards || (_Backwards = /*#__PURE__*/_jsx(Backwards, {}))
305
+ })
306
+ })
307
+ }), /*#__PURE__*/_jsx("div", {
308
+ children: /*#__PURE__*/_jsx(Fade, {
309
+ in: imageHover || visibleArrows,
310
+ children: /*#__PURE__*/_jsx(HvButton, {
311
+ ref: refForwards,
312
+ className: classes.button,
313
+ icon: true,
314
+ "aria-label": "Forwards",
315
+ onClick: function onClick(event) {
316
+ return nextImage(event);
317
+ },
318
+ children: _Forwards || (_Forwards = /*#__PURE__*/_jsx(Forwards, {}))
319
+ })
320
+ })
321
+ })]
322
+ }), xs && /*#__PURE__*/_jsx("div", {
323
+ className: classes.xsCircles,
324
+ children: documents.map(function (element, index) {
325
+ return /*#__PURE__*/_jsx("span", {
326
+ className: circleType(index),
327
+ title: typeCircle
328
+ }, "Circle ".concat(element.value));
329
+ }).slice(sliceStart, sliceStart + 5)
330
+ }), counter && /*#__PURE__*/_jsx("div", {
331
+ className: clsx(classes.divCounter, !xs && "nxs"),
332
+ children: /*#__PURE__*/_jsx("span", {
333
+ className: classes.counter,
334
+ children: /*#__PURE__*/_jsx(HvTypography, {
335
+ variant: "normalText",
336
+ style: {
337
+ color: "white"
338
+ },
339
+ children: "".concat(selImage + 1, "/").concat(documents.length)
340
+ })
341
+ })
342
+ })]
343
+ }), !xs && /*#__PURE__*/_jsxs(_Fragment, {
344
+ children: [lowCardinality ? /*#__PURE__*/_jsx("div", {
345
+ className: classes.circles,
346
+ children: documents.map(function (element, index) {
347
+ return /*#__PURE__*/_jsx("span", {
348
+ className: circleType(index),
349
+ title: "".concat(typeCircle, " ").concat(index)
350
+ }, "Circle ".concat(element.value));
351
+ })
352
+ }) : /*#__PURE__*/_jsxs(HvGrid, {
353
+ className: clsx(classes.normalButtons),
354
+ container: true,
355
+ justifyContent: "space-between",
356
+ alignItems: "center",
357
+ children: [/*#__PURE__*/_jsx(HvGrid, {
358
+ item: true,
359
+ children: /*#__PURE__*/_jsx(HvButton, {
360
+ className: infiniteCarousel || selImage !== 0 ? "" : classes.hidden,
361
+ ref: refBackwards,
362
+ icon: true,
363
+ "aria-label": "Backwards",
364
+ onClick: function onClick(event) {
365
+ return previousImage(event);
366
+ },
367
+ children: _Backwards2 || (_Backwards2 = /*#__PURE__*/_jsx(Backwards, {}))
368
+ })
369
+ }), /*#__PURE__*/_jsxs(HvGrid, {
370
+ item: true,
371
+ children: [/*#__PURE__*/_jsx(HvTypography, {
372
+ variant: "highlightText",
373
+ component: "a",
374
+ children: selImage + 1
375
+ }), /*#__PURE__*/_jsx(HvTypography, {
376
+ variant: "normalText",
377
+ component: "a",
378
+ children: " / ".concat(documents.length)
379
+ })]
380
+ }), /*#__PURE__*/_jsx(HvGrid, {
381
+ item: true,
382
+ children: /*#__PURE__*/_jsx(HvButton, {
383
+ className: infiniteCarousel || selImage !== documents.length - 1 ? "" : classes.hidden,
384
+ ref: refForwards,
385
+ icon: true,
386
+ "aria-label": "Forwards",
387
+ onClick: function onClick(event) {
388
+ return nextImage(event);
389
+ },
390
+ children: _Forwards2 || (_Forwards2 = /*#__PURE__*/_jsx(Forwards, {}))
391
+ })
392
+ })]
393
+ }), thumbnails && /*#__PURE__*/_jsx(HvPanel, {
394
+ className: classes.panel,
395
+ id: setId(elementId, "panel"),
396
+ children: /*#__PURE__*/_jsx(HvStack, {
397
+ direction: "row",
398
+ spacing: "xs",
399
+ withNavigation: true,
400
+ children: documents.map(function (element, i) {
401
+ return /*#__PURE__*/_jsx(Button, {
402
+ id: element.value,
403
+ className: classes.thumbnailButton,
404
+ onClick: function onClick() {
405
+ return setImage(i);
406
+ },
407
+ children: /*#__PURE__*/_jsx("img", {
408
+ className: styleThumbnail(i),
409
+ src: element.src,
410
+ alt: element.value
411
+ }, "Thumbnail ".concat(element.value))
412
+ }, "Button ".concat(element.value));
413
+ })
414
+ }, "Thumbnails")
415
+ })]
416
+ })]
417
+ }));
418
+ };
419
+
420
+ process.env.NODE_ENV !== "production" ? HvImageCarousel.propTypes = {
421
+ /**
422
+ * Class names to be applied.
423
+ */
424
+ className: PropTypes.string,
425
+
426
+ /**
427
+ * A Jss Object used to override or extend the styles applied.
428
+ */
429
+ classes: PropTypes.shape({
430
+ /**
431
+ * Styles applied to the component root class.
432
+ */
433
+ root: PropTypes.string,
434
+
435
+ /**
436
+ * Styles applied to the component SelectedImage.
437
+ */
438
+ selectedImage: PropTypes.string,
439
+
440
+ /**
441
+ * Styles applied to xs mode
442
+ */
443
+ xsMode: PropTypes.string,
444
+
445
+ /**
446
+ * Styles applied to image in xsMode
447
+ */
448
+ xsImage: PropTypes.string,
449
+
450
+ /**
451
+ * Styles applied to panel with low cardinality circles
452
+ */
453
+ circles: PropTypes.string,
454
+
455
+ /**
456
+ * Styles applied to xs mode circles
457
+ */
458
+ xsCircles: PropTypes.string,
459
+
460
+ /**
461
+ * Styles applied to unavailable button
462
+ */
463
+ hidden: PropTypes.string,
464
+
465
+ /**
466
+ * Styles applied to the carousel title
467
+ */
468
+ title: PropTypes.string,
469
+
470
+ /**
471
+ * Styles applied to the counter
472
+ */
473
+ counter: PropTypes.string,
474
+
475
+ /**
476
+ * Styles applied to the div with the counter
477
+ */
478
+ divCounter: PropTypes.string,
479
+
480
+ /**
481
+ * Styles applied to the thumbnails
482
+ */
483
+ img: PropTypes.string,
484
+
485
+ /**
486
+ * Styles applied to the selected thumbnail
487
+ */
488
+ thumbnailSelected: PropTypes.string,
489
+
490
+ /**
491
+ * Styles applied to the thumbnail button
492
+ */
493
+ thumbnailButton: PropTypes.string,
494
+
495
+ /**
496
+ * Styles applied to the low cardinality circles
497
+ */
498
+ miniCircle: PropTypes.string,
499
+
500
+ /**
501
+ * Styles applied to the circle of the selected image
502
+ */
503
+ selectedCircle: PropTypes.string,
504
+
505
+ /**
506
+ * Styles applied to the circle of the selected image in xsmode
507
+ */
508
+ xsSelectedCircle: PropTypes.string,
509
+
510
+ /**
511
+ * Styles applied to the panel with low cardinality buttons
512
+ */
513
+ lowButtons: PropTypes.string,
514
+
515
+ /**
516
+ * Styles applied to the container of the selected image
517
+ */
518
+ imageContainer: PropTypes.string,
519
+
520
+ /**
521
+ * Styles applied to the panel with the thumbnails
522
+ */
523
+ stack: PropTypes.string,
524
+
525
+ /**
526
+ * Styles applied to the panel that contains the buttons and counter in default mode
527
+ */
528
+ normalButtons: PropTypes.string,
529
+
530
+ /**
531
+ * Styles applied to fullscreen mode.
532
+ */
533
+ fullscreenStyle: PropTypes.string,
534
+
535
+ /**
536
+ * Styles applied to close button in fullscreen mode.
537
+ */
538
+ closeButton: PropTypes.string,
539
+
540
+ /**
541
+ * Styles applied to change image buttons.
542
+ */
543
+ button: PropTypes.string,
544
+
545
+ /**
546
+ * Styles applied to thumbnails panel.
547
+ */
548
+ panel: PropTypes.string
549
+ }).isRequired,
550
+
551
+ /**
552
+ * Documents to be displayed.
553
+ */
554
+ documents: PropTypes.array.isRequired,
555
+
556
+ /**
557
+ * Title of the image carousel
558
+ */
559
+ title: PropTypes.node,
560
+
561
+ /**
562
+ * A function called each time the selected image changes.
563
+ */
564
+ onChange: PropTypes.func,
565
+
566
+ /**
567
+ * Id to be applied to the root node.
568
+ */
569
+ id: PropTypes.string,
570
+
571
+ /**
572
+ * A flag that activates the thumbnails.
573
+ */
574
+ thumbnails: PropTypes.bool,
575
+
576
+ /**
577
+ * A flag that switches to low cardinality mode
578
+ */
579
+ lowCardinality: PropTypes.bool,
580
+
581
+ /**
582
+ * A flag that activates the infinite carousel behavior
583
+ */
584
+ infiniteCarousel: PropTypes.bool,
585
+
586
+ /**
587
+ * A flag that activates a counter on the top right corner of the selected image
588
+ */
589
+ counter: PropTypes.bool,
590
+
591
+ /**
592
+ * Set Image Carousel to fullscreen mode
593
+ */
594
+ fullscreen: PropTypes.bool,
595
+
596
+ /**
597
+ * Set selected image to a particular image in documents
598
+ */
599
+ currentStep: PropTypes.number,
600
+
601
+ /**
602
+ * Function that changes the selected image
603
+ */
604
+ setCurrentStep: PropTypes.func,
605
+
606
+ /**
607
+ * Image Carousel set to xs mode
608
+ */
609
+ xs: PropTypes.bool,
610
+
611
+ /**
612
+ * Arrows always displayed in low cardinality or xs mode
613
+ */
614
+ visibleArrows: PropTypes.bool,
615
+
616
+ /**
617
+ * Selected image fit variant
618
+ */
619
+ variant: PropTypes.string
620
+ } : void 0;
621
+ export default withStyles(styles, {
622
+ name: "HvImageCarousel"
623
+ })(HvImageCarousel);
624
+ //# sourceMappingURL=ImageCarousel.js.map