@seeqdev/qomponents 0.0.126 → 0.0.128
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/Alert/Alert.js +1 -1
- package/dist/Alert/Alert.js.map +1 -1
- package/dist/Carousel/Carousel.d.ts +9 -9
- package/dist/Carousel/Carousel.stories.d.ts +5 -5
- package/dist/Carousel/Carousel.test.d.ts +1 -1
- package/dist/Carousel/Carousel.types.d.ts +23 -23
- package/dist/Carousel/index.d.ts +1 -1
- package/dist/ProgressBar/ProgressBar.js +1 -1
- package/dist/ProgressBar/ProgressBar.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +318 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +318 -0
- package/dist/index.js.map +1 -1
- package/dist/styles.css +53 -0
- package/package.json +1 -1
package/dist/Alert/Alert.js
CHANGED
|
@@ -29,6 +29,6 @@ export const Alert = ({ children, dismissible = true, onClose, show = true, vari
|
|
|
29
29
|
}
|
|
30
30
|
return (React.createElement("div", { "data-testid": testId, id: id, className: appliedClasses },
|
|
31
31
|
children,
|
|
32
|
-
dismissible && (React.createElement(Icon, { icon: "fc-delete", type: variant.match(/danger|warning/) ? 'color' : 'theme', color: variant.match(/danger|warning/) ? 'inherit' : undefined, extraClassNames: `tw-self-end tw-text-[11px] tw-cursor-pointer tw-absolute tw-right-[10px] tw-top-[10px] ${variant.match(/danger|warning|gray/) ? 'tw-text-sq-text-color dark:tw-text-sq-text
|
|
32
|
+
dismissible && (React.createElement(Icon, { icon: "fc-delete", type: variant.match(/danger|warning/) ? 'color' : 'theme', color: variant.match(/danger|warning/) ? 'inherit' : undefined, extraClassNames: `tw-self-end tw-text-[11px] tw-cursor-pointer tw-absolute tw-right-[10px] tw-top-[10px] ${variant.match(/danger|warning|gray/) ? 'tw-text-sq-text-color dark:tw-text-sq-dark-text' : ''}`, testId: `${testId}-close-btn`, onClick: onClose, ...tooltipProps }))));
|
|
33
33
|
};
|
|
34
34
|
//# sourceMappingURL=Alert.js.map
|
package/dist/Alert/Alert.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.js","sourceRoot":"","sources":["../../src/Alert/Alert.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,eAAe,CAAC;AACvB,OAAO,IAAI,MAAM,SAAS,CAAC;AAI3B,MAAM,WAAW,GACf,yGAAyG;IACzG,6FAA6F,CAAC;AAEhG,MAAM,SAAS,GAAG,4DAA4D,CAAC;AAC/E,MAAM,UAAU,GAAG,8CAA8C,CAAC;AAElE,MAAM,YAAY,GAAG,2BAA2B,CAAC;AAEjD,MAAM,kBAAkB,GAAG,yBAAyB,CAAC;AAErD;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAwC,CAAC,EACzD,QAAQ,EACR,WAAW,GAAG,IAAI,EAClB,OAAO,EACP,IAAI,GAAG,IAAI,EACX,OAAO,EACP,MAAM,GAAG,UAAU,EACnB,EAAE,EACF,eAAe,EACf,GAAG,YAAY,EAChB,EAAE,EAAE;IACH,MAAM,YAAY,GAA0C;QAC1D,KAAK,EAAE,GAAG,UAAU,IAAI,SAAS,EAAE;QACnC,MAAM,EAAE,6CAA6C;QACrD,OAAO,EAAE,iDAAiD;QAC1D,IAAI,EAAE,sGAAsG;KAC7G,CAAC;IACF,MAAM,kBAAkB,GAA0C;QAChE,KAAK,EAAE,kBAAkB;QACzB,MAAM,EAAE,YAAY;QACpB,OAAO,EAAE,gBAAgB;QACzB,IAAI,EAAE,2BAA2B;KAClC,CAAC;IACF,MAAM,cAAc,GAAG,GAAG,WAAW,IAAI,YAAY,CAAC,OAAO,CAAC,IAAI,eAAe,IAAI,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC;IAEnH,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,gCAAO,CAAC;KAChB;IACD,OAAO,CACL,4CAAkB,MAAM,EAAE,EAA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ACzB,MAAM,EAAE,YAAY;QACpB,OAAO,EAAE,gBAAgB;QACzB,IAAI,EAAE,2BAA2B;KAClC,CAAC;IACF,MAAM,cAAc,GAAG,GAAG,WAAW,IAAI,YAAY,CAAC,OAAO,CAAC,IAAI,eAAe,IAAI,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC;IAEnH,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,gCAAO,CAAC;KAChB;IACD,OAAO,CACL,4CAAkB,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,cAAc;QACxD,QAAQ;QACR,WAAW,IAAI,CACd,oBAAC,IAAI,IACH,IAAI,EAAC,WAAW,EAChB,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EACzD,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EAC9D,eAAe,EAAE,0FACf,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,iDAAiD,CAAC,CAAC,CAAC,EAC7F,EAAE,EACF,MAAM,EAAE,GAAG,MAAM,YAAY,EAC7B,OAAO,EAAE,OAAO,KACZ,YAAY,GAChB,CACH,CACG,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { CarouselProps } from './Carousel.types';
|
|
3
|
-
/**
|
|
4
|
-
* Carousel:
|
|
5
|
-
* - Easily create a carousel with custom slides.
|
|
6
|
-
* - Supports automatic sliding, navigation arrows, and slide indicators.
|
|
7
|
-
*/
|
|
8
|
-
declare const Carousel: React.FunctionComponent<CarouselProps>;
|
|
9
|
-
export default Carousel;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CarouselProps } from './Carousel.types';
|
|
3
|
+
/**
|
|
4
|
+
* Carousel:
|
|
5
|
+
* - Easily create a carousel with custom slides.
|
|
6
|
+
* - Supports automatic sliding, navigation arrows, and slide indicators.
|
|
7
|
+
*/
|
|
8
|
+
declare const Carousel: React.FunctionComponent<CarouselProps>;
|
|
9
|
+
export default Carousel;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
title: string;
|
|
3
|
-
};
|
|
4
|
-
export default _default;
|
|
5
|
-
export declare const AllCarousels: () => JSX.Element;
|
|
1
|
+
declare const _default: {
|
|
2
|
+
title: string;
|
|
3
|
+
};
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const AllCarousels: () => JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import '@testing-library/jest-dom';
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Properties for the Carousel component.
|
|
3
|
-
*/
|
|
4
|
-
export interface CarouselProps {
|
|
5
|
-
testId?: string;
|
|
6
|
-
extraClassNames?: string;
|
|
7
|
-
activeIndex?: number;
|
|
8
|
-
/**
|
|
9
|
-
* Callback function that is called when the slide changes.
|
|
10
|
-
* @param nextSlide - The index of the next slide.
|
|
11
|
-
* @param direction - The direction of the slide change, either 'left' or 'right'.
|
|
12
|
-
*/
|
|
13
|
-
onSlide?: (nextSlide: number, direction: 'left' | 'right') => void;
|
|
14
|
-
autoSlide?: boolean;
|
|
15
|
-
interval?: number;
|
|
16
|
-
nextIcon?: string;
|
|
17
|
-
prevIcon?: string;
|
|
18
|
-
iconExtraClassNames?: string;
|
|
19
|
-
showArrows?: boolean;
|
|
20
|
-
showIndicators?: boolean;
|
|
21
|
-
continuous?: boolean;
|
|
22
|
-
carouselItems: React.ReactNode[];
|
|
23
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Properties for the Carousel component.
|
|
3
|
+
*/
|
|
4
|
+
export interface CarouselProps {
|
|
5
|
+
testId?: string;
|
|
6
|
+
extraClassNames?: string;
|
|
7
|
+
activeIndex?: number;
|
|
8
|
+
/**
|
|
9
|
+
* Callback function that is called when the slide changes.
|
|
10
|
+
* @param nextSlide - The index of the next slide.
|
|
11
|
+
* @param direction - The direction of the slide change, either 'left' or 'right'.
|
|
12
|
+
*/
|
|
13
|
+
onSlide?: (nextSlide: number, direction: 'left' | 'right') => void;
|
|
14
|
+
autoSlide?: boolean;
|
|
15
|
+
interval?: number;
|
|
16
|
+
nextIcon?: string;
|
|
17
|
+
prevIcon?: string;
|
|
18
|
+
iconExtraClassNames?: string;
|
|
19
|
+
showArrows?: boolean;
|
|
20
|
+
showIndicators?: boolean;
|
|
21
|
+
continuous?: boolean;
|
|
22
|
+
carouselItems: React.ReactNode[];
|
|
23
|
+
}
|
package/dist/Carousel/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from './Carousel';
|
|
1
|
+
export { default } from './Carousel';
|
|
@@ -14,7 +14,7 @@ const ProgressIndicator = (props) => {
|
|
|
14
14
|
}, 100);
|
|
15
15
|
return () => clearTimeout(timeout);
|
|
16
16
|
}, [value]);
|
|
17
|
-
return (React.createElement(Progress.Indicator, { className: `tw-ease-[cubic-bezier(0.65, 0, 0.35, 1)] tw-w-full tw-h-full tw-duration-[660ms] tw-flex tw-bg-sq-color-dark ${extraClasses}`, ...tooltipData, "data-qtip-text": tooltipProps.tooltip ? tooltipProps.tooltip : `${value}%`, "data-testid": `progress-bar-indicator-${testId ? testId : value}`, key: `${index}-${value}`, style: {
|
|
17
|
+
return (React.createElement(Progress.Indicator, { className: `tw-ease-[cubic-bezier(0.65, 0, 0.35, 1)] tw-w-full tw-h-full tw-duration-[660ms] tw-flex tw-bg-sq-color-dark tw-justify-center tw-items-center ${extraClasses}`, ...tooltipData, "data-qtip-text": tooltipProps.tooltip ? tooltipProps.tooltip : `${value}%`, "data-testid": `progress-bar-indicator-${testId ? testId : value}`, key: `${index}-${value}`, style: {
|
|
18
18
|
// Background color will default to the theme color if undefined
|
|
19
19
|
backgroundColor: color ? color : undefined,
|
|
20
20
|
animation: 'width 660ms forwards',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressBar.js","sourceRoot":"","sources":["../../src/ProgressBar/ProgressBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,KAAK,QAAQ,MAAM,0BAA0B,CAAC;AAErD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,iBAAiB,GAEnB,CAAC,KAAK,EAAE,EAAE;IACZ,MAAM,EACJ,KAAK,EACL,KAAK,GAAG,SAAS,EACjB,MAAM,EACN,KAAK,EACL,YAAY,GAAG,EAAE,EACjB,YAAY,GAAG,EAAE,EACjB,YAAY,EACZ,GAAG,EACH,KAAK,EACL,GAAG,YAAY,EAChB,GAAG,KAAK,CAAC;IACV,MAAM,WAAW,GAAG,WAAW,CAAC,YAAY,CAAC,CAAC;IAE9C,MAAM,aAAa,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAChC,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAEhF,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;YAC9B,MAAM,QAAQ,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;YACrD,gBAAgB,CAAC,QAAQ,CAAC,CAAC;YAC3B,aAAa,CAAC,OAAO,GAAG,QAAQ,CAAC;QACnC,CAAC,EAAE,GAAG,CAAC,CAAC;QAER,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO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AC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ import Collapse from './Collapse';
|
|
|
19
19
|
import Slider from './Slider';
|
|
20
20
|
import ProgressBar from './ProgressBar';
|
|
21
21
|
import ButtonGroup from './ButtonGroup';
|
|
22
|
+
import Carousel from './Carousel';
|
|
22
23
|
export { Tabs };
|
|
23
24
|
export { Button };
|
|
24
25
|
export { ToolbarButton };
|
|
@@ -41,3 +42,4 @@ export { Collapse };
|
|
|
41
42
|
export { Slider };
|
|
42
43
|
export { ProgressBar };
|
|
43
44
|
export { ButtonGroup };
|
|
45
|
+
export { Carousel };
|
package/dist/index.esm.js
CHANGED
|
@@ -18958,6 +18958,260 @@ function useSpring(props, deps) {
|
|
|
18958
18958
|
);
|
|
18959
18959
|
return isFn || arguments.length == 2 ? [values, ref] : values;
|
|
18960
18960
|
}
|
|
18961
|
+
function useTransition(data, props, deps) {
|
|
18962
|
+
const propsFn = is.fun(props) && props;
|
|
18963
|
+
const {
|
|
18964
|
+
reset,
|
|
18965
|
+
sort,
|
|
18966
|
+
trail = 0,
|
|
18967
|
+
expires = true,
|
|
18968
|
+
exitBeforeEnter = false,
|
|
18969
|
+
onDestroyed,
|
|
18970
|
+
ref: propsRef,
|
|
18971
|
+
config: propsConfig
|
|
18972
|
+
} = propsFn ? propsFn() : props;
|
|
18973
|
+
const ref = useMemo(
|
|
18974
|
+
() => propsFn || arguments.length == 3 ? SpringRef() : void 0,
|
|
18975
|
+
[]
|
|
18976
|
+
);
|
|
18977
|
+
const items = toArray(data);
|
|
18978
|
+
const transitions = [];
|
|
18979
|
+
const usedTransitions = useRef(null);
|
|
18980
|
+
const prevTransitions = reset ? null : usedTransitions.current;
|
|
18981
|
+
useIsomorphicLayoutEffect(() => {
|
|
18982
|
+
usedTransitions.current = transitions;
|
|
18983
|
+
});
|
|
18984
|
+
useOnce(() => {
|
|
18985
|
+
each(transitions, (t) => {
|
|
18986
|
+
ref?.add(t.ctrl);
|
|
18987
|
+
t.ctrl.ref = ref;
|
|
18988
|
+
});
|
|
18989
|
+
return () => {
|
|
18990
|
+
each(usedTransitions.current, (t) => {
|
|
18991
|
+
if (t.expired) {
|
|
18992
|
+
clearTimeout(t.expirationId);
|
|
18993
|
+
}
|
|
18994
|
+
detachRefs(t.ctrl, ref);
|
|
18995
|
+
t.ctrl.stop(true);
|
|
18996
|
+
});
|
|
18997
|
+
};
|
|
18998
|
+
});
|
|
18999
|
+
const keys = getKeys(items, propsFn ? propsFn() : props, prevTransitions);
|
|
19000
|
+
const expired = reset && usedTransitions.current || [];
|
|
19001
|
+
useIsomorphicLayoutEffect(
|
|
19002
|
+
() => each(expired, ({ ctrl, item, key }) => {
|
|
19003
|
+
detachRefs(ctrl, ref);
|
|
19004
|
+
callProp(onDestroyed, item, key);
|
|
19005
|
+
})
|
|
19006
|
+
);
|
|
19007
|
+
const reused = [];
|
|
19008
|
+
if (prevTransitions)
|
|
19009
|
+
each(prevTransitions, (t, i) => {
|
|
19010
|
+
if (t.expired) {
|
|
19011
|
+
clearTimeout(t.expirationId);
|
|
19012
|
+
expired.push(t);
|
|
19013
|
+
} else {
|
|
19014
|
+
i = reused[i] = keys.indexOf(t.key);
|
|
19015
|
+
if (~i)
|
|
19016
|
+
transitions[i] = t;
|
|
19017
|
+
}
|
|
19018
|
+
});
|
|
19019
|
+
each(items, (item, i) => {
|
|
19020
|
+
if (!transitions[i]) {
|
|
19021
|
+
transitions[i] = {
|
|
19022
|
+
key: keys[i],
|
|
19023
|
+
item,
|
|
19024
|
+
phase: "mount" /* MOUNT */,
|
|
19025
|
+
ctrl: new Controller()
|
|
19026
|
+
};
|
|
19027
|
+
transitions[i].ctrl.item = item;
|
|
19028
|
+
}
|
|
19029
|
+
});
|
|
19030
|
+
if (reused.length) {
|
|
19031
|
+
let i = -1;
|
|
19032
|
+
const { leave } = propsFn ? propsFn() : props;
|
|
19033
|
+
each(reused, (keyIndex, prevIndex) => {
|
|
19034
|
+
const t = prevTransitions[prevIndex];
|
|
19035
|
+
if (~keyIndex) {
|
|
19036
|
+
i = transitions.indexOf(t);
|
|
19037
|
+
transitions[i] = { ...t, item: items[keyIndex] };
|
|
19038
|
+
} else if (leave) {
|
|
19039
|
+
transitions.splice(++i, 0, t);
|
|
19040
|
+
}
|
|
19041
|
+
});
|
|
19042
|
+
}
|
|
19043
|
+
if (is.fun(sort)) {
|
|
19044
|
+
transitions.sort((a, b) => sort(a.item, b.item));
|
|
19045
|
+
}
|
|
19046
|
+
let delay = -trail;
|
|
19047
|
+
const forceUpdate = useForceUpdate();
|
|
19048
|
+
const defaultProps = getDefaultProps(props);
|
|
19049
|
+
const changes = /* @__PURE__ */ new Map();
|
|
19050
|
+
const exitingTransitions = useRef(/* @__PURE__ */ new Map());
|
|
19051
|
+
const forceChange = useRef(false);
|
|
19052
|
+
each(transitions, (t, i) => {
|
|
19053
|
+
const key = t.key;
|
|
19054
|
+
const prevPhase = t.phase;
|
|
19055
|
+
const p = propsFn ? propsFn() : props;
|
|
19056
|
+
let to2;
|
|
19057
|
+
let phase;
|
|
19058
|
+
const propsDelay = callProp(p.delay || 0, key);
|
|
19059
|
+
if (prevPhase == "mount" /* MOUNT */) {
|
|
19060
|
+
to2 = p.enter;
|
|
19061
|
+
phase = "enter" /* ENTER */;
|
|
19062
|
+
} else {
|
|
19063
|
+
const isLeave = keys.indexOf(key) < 0;
|
|
19064
|
+
if (prevPhase != "leave" /* LEAVE */) {
|
|
19065
|
+
if (isLeave) {
|
|
19066
|
+
to2 = p.leave;
|
|
19067
|
+
phase = "leave" /* LEAVE */;
|
|
19068
|
+
} else if (to2 = p.update) {
|
|
19069
|
+
phase = "update" /* UPDATE */;
|
|
19070
|
+
} else
|
|
19071
|
+
return;
|
|
19072
|
+
} else if (!isLeave) {
|
|
19073
|
+
to2 = p.enter;
|
|
19074
|
+
phase = "enter" /* ENTER */;
|
|
19075
|
+
} else
|
|
19076
|
+
return;
|
|
19077
|
+
}
|
|
19078
|
+
to2 = callProp(to2, t.item, i);
|
|
19079
|
+
to2 = is.obj(to2) ? inferTo(to2) : { to: to2 };
|
|
19080
|
+
if (!to2.config) {
|
|
19081
|
+
const config2 = propsConfig || defaultProps.config;
|
|
19082
|
+
to2.config = callProp(config2, t.item, i, phase);
|
|
19083
|
+
}
|
|
19084
|
+
delay += trail;
|
|
19085
|
+
const payload = {
|
|
19086
|
+
...defaultProps,
|
|
19087
|
+
// we need to add our props.delay value you here.
|
|
19088
|
+
delay: propsDelay + delay,
|
|
19089
|
+
ref: propsRef,
|
|
19090
|
+
immediate: p.immediate,
|
|
19091
|
+
// This prevents implied resets.
|
|
19092
|
+
reset: false,
|
|
19093
|
+
// Merge any phase-specific props.
|
|
19094
|
+
...to2
|
|
19095
|
+
};
|
|
19096
|
+
if (phase == "enter" /* ENTER */ && is.und(payload.from)) {
|
|
19097
|
+
const p2 = propsFn ? propsFn() : props;
|
|
19098
|
+
const from = is.und(p2.initial) || prevTransitions ? p2.from : p2.initial;
|
|
19099
|
+
payload.from = callProp(from, t.item, i);
|
|
19100
|
+
}
|
|
19101
|
+
const { onResolve } = payload;
|
|
19102
|
+
payload.onResolve = (result) => {
|
|
19103
|
+
callProp(onResolve, result);
|
|
19104
|
+
const transitions2 = usedTransitions.current;
|
|
19105
|
+
const t2 = transitions2.find((t3) => t3.key === key);
|
|
19106
|
+
if (!t2)
|
|
19107
|
+
return;
|
|
19108
|
+
if (result.cancelled && t2.phase != "update" /* UPDATE */) {
|
|
19109
|
+
return;
|
|
19110
|
+
}
|
|
19111
|
+
if (t2.ctrl.idle) {
|
|
19112
|
+
const idle = transitions2.every((t3) => t3.ctrl.idle);
|
|
19113
|
+
if (t2.phase == "leave" /* LEAVE */) {
|
|
19114
|
+
const expiry = callProp(expires, t2.item);
|
|
19115
|
+
if (expiry !== false) {
|
|
19116
|
+
const expiryMs = expiry === true ? 0 : expiry;
|
|
19117
|
+
t2.expired = true;
|
|
19118
|
+
if (!idle && expiryMs > 0) {
|
|
19119
|
+
if (expiryMs <= 2147483647)
|
|
19120
|
+
t2.expirationId = setTimeout(forceUpdate, expiryMs);
|
|
19121
|
+
return;
|
|
19122
|
+
}
|
|
19123
|
+
}
|
|
19124
|
+
}
|
|
19125
|
+
if (idle && transitions2.some((t3) => t3.expired)) {
|
|
19126
|
+
exitingTransitions.current.delete(t2);
|
|
19127
|
+
if (exitBeforeEnter) {
|
|
19128
|
+
forceChange.current = true;
|
|
19129
|
+
}
|
|
19130
|
+
forceUpdate();
|
|
19131
|
+
}
|
|
19132
|
+
}
|
|
19133
|
+
};
|
|
19134
|
+
const springs = getSprings(t.ctrl, payload);
|
|
19135
|
+
if (phase === "leave" /* LEAVE */ && exitBeforeEnter) {
|
|
19136
|
+
exitingTransitions.current.set(t, { phase, springs, payload });
|
|
19137
|
+
} else {
|
|
19138
|
+
changes.set(t, { phase, springs, payload });
|
|
19139
|
+
}
|
|
19140
|
+
});
|
|
19141
|
+
const context = useContext(SpringContext);
|
|
19142
|
+
const prevContext = usePrev(context);
|
|
19143
|
+
const hasContext = context !== prevContext && hasProps(context);
|
|
19144
|
+
useIsomorphicLayoutEffect(() => {
|
|
19145
|
+
if (hasContext) {
|
|
19146
|
+
each(transitions, (t) => {
|
|
19147
|
+
t.ctrl.start({ default: context });
|
|
19148
|
+
});
|
|
19149
|
+
}
|
|
19150
|
+
}, [context]);
|
|
19151
|
+
each(changes, (_, t) => {
|
|
19152
|
+
if (exitingTransitions.current.size) {
|
|
19153
|
+
const ind = transitions.findIndex((state) => state.key === t.key);
|
|
19154
|
+
transitions.splice(ind, 1);
|
|
19155
|
+
}
|
|
19156
|
+
});
|
|
19157
|
+
useIsomorphicLayoutEffect(
|
|
19158
|
+
() => {
|
|
19159
|
+
each(
|
|
19160
|
+
exitingTransitions.current.size ? exitingTransitions.current : changes,
|
|
19161
|
+
({ phase, payload }, t) => {
|
|
19162
|
+
const { ctrl } = t;
|
|
19163
|
+
t.phase = phase;
|
|
19164
|
+
ref?.add(ctrl);
|
|
19165
|
+
if (hasContext && phase == "enter" /* ENTER */) {
|
|
19166
|
+
ctrl.start({ default: context });
|
|
19167
|
+
}
|
|
19168
|
+
if (payload) {
|
|
19169
|
+
replaceRef(ctrl, payload.ref);
|
|
19170
|
+
if ((ctrl.ref || ref) && !forceChange.current) {
|
|
19171
|
+
ctrl.update(payload);
|
|
19172
|
+
} else {
|
|
19173
|
+
ctrl.start(payload);
|
|
19174
|
+
if (forceChange.current) {
|
|
19175
|
+
forceChange.current = false;
|
|
19176
|
+
}
|
|
19177
|
+
}
|
|
19178
|
+
}
|
|
19179
|
+
}
|
|
19180
|
+
);
|
|
19181
|
+
},
|
|
19182
|
+
reset ? void 0 : deps
|
|
19183
|
+
);
|
|
19184
|
+
const renderTransitions = (render) => /* @__PURE__ */ React.createElement(React.Fragment, null, transitions.map((t, i) => {
|
|
19185
|
+
const { springs } = changes.get(t) || t.ctrl;
|
|
19186
|
+
const elem = render({ ...springs }, t.item, t, i);
|
|
19187
|
+
return elem && elem.type ? /* @__PURE__ */ React.createElement(
|
|
19188
|
+
elem.type,
|
|
19189
|
+
{
|
|
19190
|
+
...elem.props,
|
|
19191
|
+
key: is.str(t.key) || is.num(t.key) ? t.key : t.ctrl.id,
|
|
19192
|
+
ref: elem.ref
|
|
19193
|
+
}
|
|
19194
|
+
) : elem;
|
|
19195
|
+
}));
|
|
19196
|
+
return ref ? [renderTransitions, ref] : renderTransitions;
|
|
19197
|
+
}
|
|
19198
|
+
var nextKey = 1;
|
|
19199
|
+
function getKeys(items, { key, keys = key }, prevTransitions) {
|
|
19200
|
+
if (keys === null) {
|
|
19201
|
+
const reused = /* @__PURE__ */ new Set();
|
|
19202
|
+
return items.map((item) => {
|
|
19203
|
+
const t = prevTransitions && prevTransitions.find(
|
|
19204
|
+
(t2) => t2.item === item && t2.phase !== "leave" /* LEAVE */ && !reused.has(t2)
|
|
19205
|
+
);
|
|
19206
|
+
if (t) {
|
|
19207
|
+
reused.add(t);
|
|
19208
|
+
return t.key;
|
|
19209
|
+
}
|
|
19210
|
+
return nextKey++;
|
|
19211
|
+
});
|
|
19212
|
+
}
|
|
19213
|
+
return is.und(keys) ? items : is.fun(keys) ? items.map(keys) : toArray(keys);
|
|
19214
|
+
}
|
|
18961
19215
|
var Interpolation = class extends FrameValue {
|
|
18962
19216
|
constructor(source, args) {
|
|
18963
19217
|
super();
|
|
@@ -20713,5 +20967,68 @@ const ButtonGroup = (props) => {
|
|
|
20713
20967
|
: ''} ${item.buttonProps.extraClassNames}`, onClick: () => onChange && onChange(item?.buttonProps?.value) })) : (React__default.createElement("div", { key: index, className: ` tw-flex tw-items-center tw-justify-center tw-rounded-none tw-ml-[-1px] active:tw-z-30 ${item?.extraClassNames || ''}` }, item?.element)))));
|
|
20714
20968
|
};
|
|
20715
20969
|
|
|
20716
|
-
|
|
20970
|
+
/**
|
|
20971
|
+
* Carousel:
|
|
20972
|
+
* - Easily create a carousel with custom slides.
|
|
20973
|
+
* - Supports automatic sliding, navigation arrows, and slide indicators.
|
|
20974
|
+
*/
|
|
20975
|
+
const Carousel = ({ testId = 'carousel-id', activeIndex = 0, extraClassNames = '', onSlide = () => { }, autoSlide, showIndicators = true, continuous = true, interval = 4000, prevIcon = 'fc-arrow-dropdown tw-rotate-90', nextIcon = 'fc-arrow-dropdown -tw-rotate-90', showArrows = true, iconExtraClassNames = '', carouselItems = [], }) => {
|
|
20976
|
+
const [currentIndex, setCurrentIndex] = useState(activeIndex);
|
|
20977
|
+
const changeSlide = (nextIndex) => {
|
|
20978
|
+
const newIndex = nextIndex % carouselItems.length;
|
|
20979
|
+
setCurrentIndex(newIndex);
|
|
20980
|
+
onSlide(newIndex, newIndex > currentIndex ? 'right' : 'left');
|
|
20981
|
+
};
|
|
20982
|
+
useEffect(() => {
|
|
20983
|
+
if (autoSlide) {
|
|
20984
|
+
const currentInterval = setInterval(() => {
|
|
20985
|
+
if (continuous) {
|
|
20986
|
+
setCurrentIndex((prevCurrentIndex) => {
|
|
20987
|
+
onSlide((prevCurrentIndex + 1) % carouselItems.length, (prevCurrentIndex + 1) % carouselItems.length > prevCurrentIndex ? 'right' : 'left');
|
|
20988
|
+
return (prevCurrentIndex + 1) % carouselItems.length;
|
|
20989
|
+
});
|
|
20990
|
+
}
|
|
20991
|
+
else if (currentIndex === carouselItems.length - 1) {
|
|
20992
|
+
clearInterval(currentInterval);
|
|
20993
|
+
}
|
|
20994
|
+
else {
|
|
20995
|
+
changeSlide(currentIndex + 1);
|
|
20996
|
+
}
|
|
20997
|
+
}, interval);
|
|
20998
|
+
return () => clearInterval(currentInterval);
|
|
20999
|
+
}
|
|
21000
|
+
}, [autoSlide]);
|
|
21001
|
+
useEffect(() => {
|
|
21002
|
+
if (activeIndex && activeIndex !== currentIndex) {
|
|
21003
|
+
setCurrentIndex(activeIndex);
|
|
21004
|
+
}
|
|
21005
|
+
}, [activeIndex]);
|
|
21006
|
+
const transitions = useTransition([currentIndex], {
|
|
21007
|
+
keys: null,
|
|
21008
|
+
exitBeforeEnter: true,
|
|
21009
|
+
from: { transform: 'translate3d(100%,0,0)' },
|
|
21010
|
+
enter: { transform: 'translate3d(0%,0,0)' },
|
|
21011
|
+
leave: { transform: 'translate3d(0%,0,0)' },
|
|
21012
|
+
});
|
|
21013
|
+
const onBackClick = () => {
|
|
21014
|
+
if (currentIndex === 0 && !continuous) {
|
|
21015
|
+
return;
|
|
21016
|
+
}
|
|
21017
|
+
changeSlide((currentIndex - 1) % carouselItems.length);
|
|
21018
|
+
};
|
|
21019
|
+
const onForwardClick = () => {
|
|
21020
|
+
if (currentIndex === carouselItems.length - 1 && !continuous) {
|
|
21021
|
+
return;
|
|
21022
|
+
}
|
|
21023
|
+
changeSlide((currentIndex + 1) % carouselItems.length);
|
|
21024
|
+
};
|
|
21025
|
+
return (React__default.createElement("div", { "data-testid": testId, className: `tw-flex tw-flex-col tw-items-center tw-justify-center tw-w-full ${extraClassNames}` },
|
|
21026
|
+
React__default.createElement("div", { className: "tw-flex tw-items-center tw-w-full tw-h-max tw-gap-1" },
|
|
21027
|
+
showArrows && (React__default.createElement(Button, { icon: prevIcon, size: "lg", variant: "no-border", testId: "carousel-prev", extraClassNames: `${currentIndex === 0 && !continuous ? 'tw-invisible' : ''} ${iconExtraClassNames} tw-animate-fadeIn`, onClick: onBackClick })),
|
|
21028
|
+
transitions((style, i) => (React__default.createElement(animated.div, { "data-testid": `${testId}-${currentIndex}`, style: style }, carouselItems[currentIndex]))),
|
|
21029
|
+
showArrows && (React__default.createElement(Button, { icon: nextIcon, testId: "carousel-next", size: "lg", variant: "no-border", extraClassNames: `${currentIndex === carouselItems.length - 1 && !continuous ? 'tw-invisible' : ''} ${iconExtraClassNames} tw-animate-fadeIn`, onClick: onForwardClick }))),
|
|
21030
|
+
showIndicators && (React__default.createElement("div", { className: "tw-flex tw-gap-1 tw-mt-2" }, carouselItems.map((_, i) => (React__default.createElement("div", { key: i, className: `tw-w-2 tw-h-2 tw-rounded-full tw-cursor-pointer ${i === currentIndex ? 'tw-bg-sq-color-dark' : 'tw-bg-sq-darkish-gray'}`, onClick: () => changeSlide(i) })))))));
|
|
21031
|
+
};
|
|
21032
|
+
|
|
21033
|
+
export { Accordion, Alert, Button, ButtonGroup, ButtonWithDropdown, ButtonWithPopover, Carousel, Checkbox, Collapse, Icon, InputGroup, Modal, ProgressBar, QTip, SeeqActionDropdown, Select, components as SelectCompoents, Slider, Tabs, TextArea, TextField, ToolbarButton, Tooltip };
|
|
20717
21034
|
//# sourceMappingURL=index.esm.js.map
|