@sikka/hawa 0.16.1-next → 0.16.2-next

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.
package/dist/index.d.mts CHANGED
@@ -407,7 +407,6 @@ declare const DialogFooter: {
407
407
  displayName: string;
408
408
  };
409
409
  interface DialogCarouselProps {
410
- activeStep: string;
411
410
  children: React$1.ReactNode;
412
411
  stepsApi?: any;
413
412
  stepsRef?: any;
@@ -1748,10 +1747,9 @@ declare function useToast(): {
1748
1747
  toasts: ToasterToast[];
1749
1748
  };
1750
1749
 
1751
- declare const useDialogCarousel: (initialStepId: any, stepIds: any) => {
1750
+ declare const useDialogCarousel: () => {
1752
1751
  emblaRef: <ViewportElement extends HTMLElement>(instance: ViewportElement | null) => void;
1753
1752
  emblaApi: embla_carousel_react.EmblaCarouselType | undefined;
1754
- currentStep: any;
1755
1753
  nextStep: () => void;
1756
1754
  prevStep: () => void;
1757
1755
  };
package/dist/index.d.ts CHANGED
@@ -407,7 +407,6 @@ declare const DialogFooter: {
407
407
  displayName: string;
408
408
  };
409
409
  interface DialogCarouselProps {
410
- activeStep: string;
411
410
  children: React$1.ReactNode;
412
411
  stepsApi?: any;
413
412
  stepsRef?: any;
@@ -1748,10 +1747,9 @@ declare function useToast(): {
1748
1747
  toasts: ToasterToast[];
1749
1748
  };
1750
1749
 
1751
- declare const useDialogCarousel: (initialStepId: any, stepIds: any) => {
1750
+ declare const useDialogCarousel: () => {
1752
1751
  emblaRef: <ViewportElement extends HTMLElement>(instance: ViewportElement | null) => void;
1753
1752
  emblaApi: embla_carousel_react.EmblaCarouselType | undefined;
1754
- currentStep: any;
1755
1753
  nextStep: () => void;
1756
1754
  prevStep: () => void;
1757
1755
  };
package/dist/index.js CHANGED
@@ -4202,22 +4202,14 @@ var DialogFooter = function(_param) /* @__PURE__ */ {
4202
4202
  }, props));
4203
4203
  };
4204
4204
  var DialogCarousel = function(param) {
4205
- var stepsApi = param.stepsApi, stepsRef = param.stepsRef, activeStep = param.activeStep, children = param.children;
4205
+ var stepsApi = param.stepsApi, stepsRef = param.stepsRef, children = param.children;
4206
4206
  var _React25_useState = _sliced_to_array(React25.useState(0), 2), selectedIndex = _React25_useState[0], setSelectedIndex = _React25_useState[1];
4207
4207
  var steps = React25.Children.toArray(children);
4208
4208
  React25.useEffect(function() {
4209
4209
  if (stepsApi) {
4210
4210
  stepsApi.reInit();
4211
- var index = steps.findIndex(function(child) {
4212
- return React25.isValidElement(child) && child.props.id === activeStep;
4213
- });
4214
- if (index !== -1) {
4215
- stepsApi.scrollTo(index, false);
4216
- setSelectedIndex(index);
4217
- }
4218
4211
  }
4219
4212
  }, [
4220
- activeStep,
4221
4213
  stepsApi,
4222
4214
  children
4223
4215
  ]);
@@ -5453,7 +5445,7 @@ var FileDropzone = function(param) {
5453
5445
  var import_react26 = __toESM(require("react"));
5454
5446
  var import_embla_carousel_react = __toESM(require("embla-carousel-react"));
5455
5447
  var Carousel = function(props) {
5456
- var children = props.children, items = props.items, showArrows = props.showArrows, _props_autoplay = props.autoplay, autoplay = _props_autoplay === void 0 ? true : _props_autoplay, _props_autoplayInterval = props.autoplayInterval, autoplayInterval = _props_autoplayInterval === void 0 ? 3e3 : _props_autoplayInterval, options = _object_without_properties(props, [
5448
+ var children = props.children, items = props.items, showArrows = props.showArrows, autoplay = props.autoplay, _props_autoplayInterval = props.autoplayInterval, autoplayInterval = _props_autoplayInterval === void 0 ? 3e3 : _props_autoplayInterval, options = _object_without_properties(props, [
5457
5449
  "children",
5458
5450
  "items",
5459
5451
  "showArrows",
@@ -10109,45 +10101,46 @@ var import_react71 = require("react");
10109
10101
  // components/hooks/useCarousel.ts
10110
10102
  var import_react72 = require("react");
10111
10103
  // components/hooks/useDialogCarousel.ts
10112
- var import_react73 = require("react");
10113
10104
  var import_embla_carousel_react2 = __toESM(require("embla-carousel-react"));
10114
10105
  var import_embla_carousel_auto_height = __toESM(require("embla-carousel-auto-height"));
10115
- var useDialogCarousel = function(initialStepId, stepIds) {
10106
+ var useDialogCarousel = function() {
10116
10107
  var _ref = _sliced_to_array((0, import_embla_carousel_react2.default)({
10117
10108
  loop: false,
10118
- watchDrag: false
10109
+ watchDrag: false,
10110
+ startIndex: 0
10119
10111
  }, [
10120
10112
  (0, import_embla_carousel_auto_height.default)({
10121
10113
  destroyHeight: "fit",
10122
10114
  active: true
10123
10115
  })
10124
10116
  ]), 2), emblaRef = _ref[0], emblaApi = _ref[1];
10125
- var _ref1 = _sliced_to_array((0, import_react73.useState)(initialStepId), 2), currentStep = _ref1[0], setCurrentStep = _ref1[1];
10126
10117
  var nextStep = function() {
10127
10118
  if (emblaApi) {
10119
+ console.log("going to NEXT \uD83D\uDC49");
10128
10120
  emblaApi.scrollNext();
10129
10121
  }
10130
10122
  };
10131
10123
  var prevStep = function() {
10132
10124
  if (emblaApi) {
10125
+ console.log("going to BACK \uD83D\uDC48");
10133
10126
  emblaApi.scrollPrev();
10134
10127
  }
10135
10128
  };
10136
10129
  return {
10137
10130
  emblaRef: emblaRef,
10138
10131
  emblaApi: emblaApi,
10139
- currentStep: currentStep,
10132
+ // currentStep,
10140
10133
  nextStep: nextStep,
10141
10134
  prevStep: prevStep
10142
10135
  };
10143
10136
  };
10144
10137
  // components/hooks/useDialogSteps.ts
10145
- var import_react74 = require("react");
10138
+ var import_react73 = require("react");
10146
10139
  var useMultiStepDialog = function(initialStep, stepIds, setOpenDialog) {
10147
- var _ref = _sliced_to_array((0, import_react74.useState)(initialStep), 2), currentStep = _ref[0], setCurrentStep = _ref[1];
10148
- var _ref1 = _sliced_to_array((0, import_react74.useState)(null), 2), dialogHeight = _ref1[0], setDialogHeight = _ref1[1];
10149
- var visibleStepRef = (0, import_react74.useRef)(null);
10150
- (0, import_react74.useEffect)(function() {
10140
+ var _ref = _sliced_to_array((0, import_react73.useState)(initialStep), 2), currentStep = _ref[0], setCurrentStep = _ref[1];
10141
+ var _ref1 = _sliced_to_array((0, import_react73.useState)(null), 2), dialogHeight = _ref1[0], setDialogHeight = _ref1[1];
10142
+ var visibleStepRef = (0, import_react73.useRef)(null);
10143
+ (0, import_react73.useEffect)(function() {
10151
10144
  if (visibleStepRef.current) {
10152
10145
  setDialogHeight(visibleStepRef.current.offsetHeight);
10153
10146
  }
@@ -10180,13 +10173,13 @@ var useMultiStepDialog = function(initialStep, stepIds, setOpenDialog) {
10180
10173
  };
10181
10174
  };
10182
10175
  // components/hooks/useWindowSize.ts
10183
- var import_react75 = require("react");
10176
+ var import_react74 = require("react");
10184
10177
  var useWindowSize = function() {
10185
- var _ref = _sliced_to_array((0, import_react75.useState)({
10178
+ var _ref = _sliced_to_array((0, import_react74.useState)({
10186
10179
  width: void 0,
10187
10180
  height: void 0
10188
10181
  }), 2), windowSize = _ref[0], setWindowSize = _ref[1];
10189
- (0, import_react75.useEffect)(function() {
10182
+ (0, import_react74.useEffect)(function() {
10190
10183
  var handleResize = function handleResize() {
10191
10184
  setWindowSize({
10192
10185
  width: window.innerWidth,
@@ -10202,7 +10195,7 @@ var useWindowSize = function() {
10202
10195
  return windowSize;
10203
10196
  };
10204
10197
  // components/hooks/useFocusWithin.ts
10205
- var import_react76 = require("react");
10198
+ var import_react75 = require("react");
10206
10199
  function containsRelatedTarget(event) {
10207
10200
  if (_instanceof(event.currentTarget, HTMLElement) && _instanceof(event.relatedTarget, HTMLElement)) {
10208
10201
  return event.currentTarget.contains(event.relatedTarget);
@@ -10211,9 +10204,9 @@ function containsRelatedTarget(event) {
10211
10204
  }
10212
10205
  function useFocusWithin() {
10213
10206
  var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, onBlur = _ref.onBlur, onFocus = _ref.onFocus;
10214
- var ref = (0, import_react76.useRef)(null);
10215
- var _ref1 = _sliced_to_array((0, import_react76.useState)(false), 2), focused = _ref1[0], _setFocused = _ref1[1];
10216
- var focusedRef = (0, import_react76.useRef)(false);
10207
+ var ref = (0, import_react75.useRef)(null);
10208
+ var _ref1 = _sliced_to_array((0, import_react75.useState)(false), 2), focused = _ref1[0], _setFocused = _ref1[1];
10209
+ var focusedRef = (0, import_react75.useRef)(false);
10217
10210
  var setFocused = function(value) {
10218
10211
  _setFocused(value);
10219
10212
  focusedRef.current = value;
@@ -10230,7 +10223,7 @@ function useFocusWithin() {
10230
10223
  onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
10231
10224
  }
10232
10225
  };
10233
- (0, import_react76.useEffect)(function() {
10226
+ (0, import_react75.useEffect)(function() {
10234
10227
  if (ref.current) {
10235
10228
  ref.current.addEventListener("focusin", handleFocusIn);
10236
10229
  ref.current.addEventListener("focusout", handleFocusOut);
@@ -10251,7 +10244,7 @@ function useFocusWithin() {
10251
10244
  };
10252
10245
  }
10253
10246
  // components/hooks/useMediaQuery.ts
10254
- var import_react77 = require("react");
10247
+ var import_react76 = require("react");
10255
10248
  function attachMediaListener(query, callback) {
10256
10249
  try {
10257
10250
  query.addEventListener("change", callback);
@@ -10278,9 +10271,9 @@ function useMediaQuery(query, initialValue) {
10278
10271
  var getInitialValueInEffect = (arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
10279
10272
  getInitialValueInEffect: true
10280
10273
  }).getInitialValueInEffect;
10281
- var _ref = _sliced_to_array((0, import_react77.useState)(getInitialValueInEffect ? initialValue : getInitialValue(query, initialValue)), 2), matches = _ref[0], setMatches = _ref[1];
10282
- var queryRef = (0, import_react77.useRef)();
10283
- (0, import_react77.useEffect)(function() {
10274
+ var _ref = _sliced_to_array((0, import_react76.useState)(getInitialValueInEffect ? initialValue : getInitialValue(query, initialValue)), 2), matches = _ref[0], setMatches = _ref[1];
10275
+ var queryRef = (0, import_react76.useRef)();
10276
+ (0, import_react76.useEffect)(function() {
10284
10277
  if ("matchMedia" in window) {
10285
10278
  queryRef.current = window.matchMedia(query);
10286
10279
  setMatches(queryRef.current.matches);
@@ -10295,15 +10288,15 @@ function useMediaQuery(query, initialValue) {
10295
10288
  return matches;
10296
10289
  }
10297
10290
  // components/hooks/useScrollPosition.ts
10298
- var import_react78 = require("react");
10291
+ var import_react77 = require("react");
10299
10292
  // components/hooks/useTable.ts
10300
- var import_react79 = require("react");
10293
+ var import_react78 = require("react");
10301
10294
  // components/hooks/useTabs.ts
10302
- var import_react80 = require("react");
10295
+ var import_react79 = require("react");
10303
10296
  function useTabs() {
10304
10297
  var initialTab = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
10305
- var _ref = _sliced_to_array((0, import_react80.useState)(initialTab), 2), activeTab = _ref[0], setActiveTab = _ref[1];
10306
- (0, import_react80.useEffect)(function() {
10298
+ var _ref = _sliced_to_array((0, import_react79.useState)(initialTab), 2), activeTab = _ref[0], setActiveTab = _ref[1];
10299
+ (0, import_react79.useEffect)(function() {
10307
10300
  var handleHashChange = function() {
10308
10301
  var hash = window.location.hash.substring(1);
10309
10302
  setActiveTab(hash || initialTab);
package/dist/index.mjs CHANGED
@@ -3639,7 +3639,6 @@ var DialogFooter = ({
3639
3639
  var DialogCarousel = ({
3640
3640
  stepsApi,
3641
3641
  stepsRef,
3642
- activeStep,
3643
3642
  children
3644
3643
  }) => {
3645
3644
  const [selectedIndex, setSelectedIndex] = React25.useState(0);
@@ -3647,15 +3646,8 @@ var DialogCarousel = ({
3647
3646
  React25.useEffect(() => {
3648
3647
  if (stepsApi) {
3649
3648
  stepsApi.reInit();
3650
- const index = steps.findIndex(
3651
- (child) => React25.isValidElement(child) && child.props.id === activeStep
3652
- );
3653
- if (index !== -1) {
3654
- stepsApi.scrollTo(index, false);
3655
- setSelectedIndex(index);
3656
- }
3657
3649
  }
3658
- }, [activeStep, stepsApi, children]);
3650
+ }, [stepsApi, children]);
3659
3651
  return /* @__PURE__ */ React25.createElement("div", { className: "hawa-overflow-hidden" }, /* @__PURE__ */ React25.createElement("div", { ref: stepsRef }, /* @__PURE__ */ React25.createElement(
3660
3652
  "div",
3661
3653
  {
@@ -5137,7 +5129,7 @@ var Carousel = (props) => {
5137
5129
  children,
5138
5130
  items,
5139
5131
  showArrows,
5140
- autoplay = true,
5132
+ autoplay,
5141
5133
  autoplayInterval = 3e3,
5142
5134
  ...options
5143
5135
  } = props;
@@ -10139,41 +10131,41 @@ import { useEffect as useEffect24, useRef as useRef14, useState as useState38 }
10139
10131
  import { useState as useState39, useRef as useRef15 } from "react";
10140
10132
 
10141
10133
  // components/hooks/useDialogCarousel.ts
10142
- import { useState as useState40 } from "react";
10143
10134
  import useEmblaCarousel2 from "embla-carousel-react";
10144
10135
  import AutoHeight from "embla-carousel-auto-height";
10145
- var useDialogCarousel = (initialStepId, stepIds) => {
10136
+ var useDialogCarousel = () => {
10146
10137
  const [emblaRef, emblaApi] = useEmblaCarousel2(
10147
- { loop: false, watchDrag: false },
10138
+ { loop: false, watchDrag: false, startIndex: 0 },
10148
10139
  [AutoHeight({ destroyHeight: "fit", active: true })]
10149
10140
  );
10150
- const [currentStep, setCurrentStep] = useState40(initialStepId);
10151
10141
  const nextStep = () => {
10152
10142
  if (emblaApi) {
10143
+ console.log("going to NEXT \u{1F449}");
10153
10144
  emblaApi.scrollNext();
10154
10145
  }
10155
10146
  };
10156
10147
  const prevStep = () => {
10157
10148
  if (emblaApi) {
10149
+ console.log("going to BACK \u{1F448}");
10158
10150
  emblaApi.scrollPrev();
10159
10151
  }
10160
10152
  };
10161
10153
  return {
10162
10154
  emblaRef,
10163
10155
  emblaApi,
10164
- currentStep,
10156
+ // currentStep,
10165
10157
  nextStep,
10166
10158
  prevStep
10167
10159
  };
10168
10160
  };
10169
10161
 
10170
10162
  // components/hooks/useDialogSteps.ts
10171
- import { useState as useState41, useEffect as useEffect26, useRef as useRef16 } from "react";
10163
+ import { useState as useState40, useEffect as useEffect25, useRef as useRef16 } from "react";
10172
10164
  var useMultiStepDialog = (initialStep, stepIds, setOpenDialog) => {
10173
- const [currentStep, setCurrentStep] = useState41(initialStep);
10174
- const [dialogHeight, setDialogHeight] = useState41(null);
10165
+ const [currentStep, setCurrentStep] = useState40(initialStep);
10166
+ const [dialogHeight, setDialogHeight] = useState40(null);
10175
10167
  const visibleStepRef = useRef16(null);
10176
- useEffect26(() => {
10168
+ useEffect25(() => {
10177
10169
  if (visibleStepRef.current) {
10178
10170
  setDialogHeight(visibleStepRef.current.offsetHeight);
10179
10171
  }
@@ -10204,13 +10196,13 @@ var useMultiStepDialog = (initialStep, stepIds, setOpenDialog) => {
10204
10196
  };
10205
10197
 
10206
10198
  // components/hooks/useWindowSize.ts
10207
- import { useEffect as useEffect27, useState as useState42 } from "react";
10199
+ import { useEffect as useEffect26, useState as useState41 } from "react";
10208
10200
  var useWindowSize = () => {
10209
- const [windowSize, setWindowSize] = useState42({
10201
+ const [windowSize, setWindowSize] = useState41({
10210
10202
  width: void 0,
10211
10203
  height: void 0
10212
10204
  });
10213
- useEffect27(() => {
10205
+ useEffect26(() => {
10214
10206
  function handleResize() {
10215
10207
  setWindowSize({
10216
10208
  width: window.innerWidth,
@@ -10225,7 +10217,7 @@ var useWindowSize = () => {
10225
10217
  };
10226
10218
 
10227
10219
  // components/hooks/useFocusWithin.ts
10228
- import { useRef as useRef17, useState as useState43, useEffect as useEffect28 } from "react";
10220
+ import { useRef as useRef17, useState as useState42, useEffect as useEffect27 } from "react";
10229
10221
  function containsRelatedTarget(event) {
10230
10222
  if (event.currentTarget instanceof HTMLElement && event.relatedTarget instanceof HTMLElement) {
10231
10223
  return event.currentTarget.contains(event.relatedTarget);
@@ -10237,7 +10229,7 @@ function useFocusWithin({
10237
10229
  onFocus
10238
10230
  } = {}) {
10239
10231
  const ref = useRef17(null);
10240
- const [focused, _setFocused] = useState43(false);
10232
+ const [focused, _setFocused] = useState42(false);
10241
10233
  const focusedRef = useRef17(false);
10242
10234
  const setFocused = (value) => {
10243
10235
  _setFocused(value);
@@ -10255,7 +10247,7 @@ function useFocusWithin({
10255
10247
  onBlur?.(event);
10256
10248
  }
10257
10249
  };
10258
- useEffect28(() => {
10250
+ useEffect27(() => {
10259
10251
  if (ref.current) {
10260
10252
  ref.current.addEventListener("focusin", handleFocusIn);
10261
10253
  ref.current.addEventListener("focusout", handleFocusOut);
@@ -10270,7 +10262,7 @@ function useFocusWithin({
10270
10262
  }
10271
10263
 
10272
10264
  // components/hooks/useMediaQuery.ts
10273
- import { useState as useState44, useEffect as useEffect29, useRef as useRef18 } from "react";
10265
+ import { useState as useState43, useEffect as useEffect28, useRef as useRef18 } from "react";
10274
10266
  function attachMediaListener(query, callback) {
10275
10267
  try {
10276
10268
  query.addEventListener("change", callback);
@@ -10292,11 +10284,11 @@ function getInitialValue(query, initialValue) {
10292
10284
  function useMediaQuery(query, initialValue, { getInitialValueInEffect } = {
10293
10285
  getInitialValueInEffect: true
10294
10286
  }) {
10295
- const [matches, setMatches] = useState44(
10287
+ const [matches, setMatches] = useState43(
10296
10288
  getInitialValueInEffect ? initialValue : getInitialValue(query, initialValue)
10297
10289
  );
10298
10290
  const queryRef = useRef18();
10299
- useEffect29(() => {
10291
+ useEffect28(() => {
10300
10292
  if ("matchMedia" in window) {
10301
10293
  queryRef.current = window.matchMedia(query);
10302
10294
  setMatches(queryRef.current.matches);
@@ -10311,16 +10303,16 @@ function useMediaQuery(query, initialValue, { getInitialValueInEffect } = {
10311
10303
  }
10312
10304
 
10313
10305
  // components/hooks/useScrollPosition.ts
10314
- import { useState as useState45, useEffect as useEffect30 } from "react";
10306
+ import { useState as useState44, useEffect as useEffect29 } from "react";
10315
10307
 
10316
10308
  // components/hooks/useTable.ts
10317
- import { useState as useState46, useEffect as useEffect31 } from "react";
10309
+ import { useState as useState45, useEffect as useEffect30 } from "react";
10318
10310
 
10319
10311
  // components/hooks/useTabs.ts
10320
- import { useEffect as useEffect32, useState as useState47 } from "react";
10312
+ import { useEffect as useEffect31, useState as useState46 } from "react";
10321
10313
  function useTabs(initialTab = "") {
10322
- const [activeTab, setActiveTab] = useState47(initialTab);
10323
- useEffect32(() => {
10314
+ const [activeTab, setActiveTab] = useState46(initialTab);
10315
+ useEffect31(() => {
10324
10316
  const handleHashChange = () => {
10325
10317
  const hash = window.location.hash.substring(1);
10326
10318
  setActiveTab(hash || initialTab);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sikka/hawa",
3
- "version": "0.16.1-next",
3
+ "version": "0.16.2-next",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "exports": {