@dynamic-framework/ui-react 1.5.0 → 1.6.0

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.esm.js CHANGED
@@ -936,9 +936,12 @@ function DListItemMovement(_a) {
936
936
  return (jsx(DListItem, Object.assign({}, props, { children: jsxs("div", Object.assign({ className: classNames('d-flex justify-content-between align-items-center p-3 gap-3', classNameMovement) }, { children: [jsxs("div", Object.assign({ className: "d-flex flex-column gap-1" }, { children: [jsx("span", Object.assign({ className: "fs-6" }, { children: description })), jsx("span", Object.assign({ className: "small text-gray-700" }, { children: date }))] })), jsx("span", Object.assign({ className: classNames('fs-6', value.theme) }, { children: value.valueFormatted }))] })) })));
937
937
  }
938
938
 
939
- function DStepper({ options, currentStep, successIcon = 'check', isVertical = false, }) {
939
+ function DStepper$2({ options, currentStep, successIcon = 'check', isVertical = false, }) {
940
+ if (currentStep < 1 || currentStep > options.length) {
941
+ throw new Error('Current step should be in the range from 1 to options lenght');
942
+ }
940
943
  return (jsx("div", Object.assign({ className: classNames({
941
- 'd-stepper': true,
944
+ 'd-stepper-desktop': true,
942
945
  'is-vertical': isVertical,
943
946
  }) }, { children: options.map(({ label, value }) => (jsxs("div", Object.assign({ className: "d-step" }, { children: [jsx("div", Object.assign({ className: "d-step-value" }, { children: jsx("div", Object.assign({ className: classNames({
944
947
  'd-step-icon-container': true,
@@ -946,7 +949,41 @@ function DStepper({ options, currentStep, successIcon = 'check', isVertical = fa
946
949
  'd-step-current': value === currentStep,
947
950
  }) }, { children: value < currentStep
948
951
  ? (jsx(DIcon, { icon: successIcon, innerClass: "d-step-icon" }))
949
- : value })) })), jsx("div", Object.assign({ className: "d-step-label" }, { children: label }))] }), label))) })));
952
+ : value })) })), jsx("div", Object.assign({ className: "d-step-label" }, { children: label }))] }), value))) })));
953
+ }
954
+
955
+ function DStepper$1({ options, currentStep, }) {
956
+ if (currentStep < 1 || currentStep > options.length) {
957
+ throw new Error('Current step should be in the range from 1 to options lenght');
958
+ }
959
+ const currentOption = useMemo(() => { var _a; return (_a = options[currentStep - 1]) !== null && _a !== void 0 ? _a : {}; }, [currentStep, options]);
960
+ const [currentAngle, setCurrentAngle] = useState(0);
961
+ useEffect(() => {
962
+ const targetAngle = (currentStep / options.length) * 360;
963
+ const animationInterval = setInterval(() => {
964
+ const angleDifference = targetAngle - currentAngle;
965
+ const step = Math.sign(angleDifference) * 5;
966
+ if (Math.abs(angleDifference) <= Math.abs(step)) {
967
+ setCurrentAngle(targetAngle);
968
+ clearInterval(animationInterval);
969
+ }
970
+ else {
971
+ setCurrentAngle(currentAngle + step);
972
+ }
973
+ }, 16);
974
+ return () => {
975
+ clearInterval(animationInterval);
976
+ };
977
+ }, [currentAngle, currentStep, options.length]);
978
+ const progressStyle = useMemo(() => `conic-gradient(
979
+ from 180deg,
980
+ var(--${PREFIX_BS}step-progress-outter-fill-background-color) ${currentAngle}deg,
981
+ var(--${PREFIX_BS}step-progress-outter-background-color) 0deg)`, [currentAngle]);
982
+ return (jsxs("div", Object.assign({ className: "d-stepper" }, { children: [jsx("div", Object.assign({ className: "d-step-bar", style: { background: progressStyle } }, { children: jsx("p", Object.assign({ className: "d-step-number" }, { children: `${currentStep}/${options.length}` })) })), jsx("div", Object.assign({ className: "d-step-info" }, { children: Object.keys(currentOption).length > 0 && (jsxs(Fragment, { children: [jsx("div", Object.assign({ className: "d-step-label" }, { children: currentOption.label })), jsx("div", Object.assign({ className: "d-step-description" }, { children: currentOption.description || '' }))] })) }))] })));
983
+ }
984
+
985
+ function DStepper({ options, currentStep, successIcon = 'check', isVertical = false, breakpoint = 'lg', }) {
986
+ return (jsxs(Fragment, { children: [jsx("div", Object.assign({ className: `d-block d-${breakpoint}-none` }, { children: jsx(DStepper$1, { options: options, currentStep: currentStep }) })), jsx("div", Object.assign({ className: `d-none d-${breakpoint}-block` }, { children: jsx(DStepper$2, { options: options, currentStep: currentStep, successIcon: successIcon, isVertical: isVertical }) }))] }));
950
987
  }
951
988
 
952
989
  function DFormikInputCurrency(_a) {
@@ -999,5 +1036,5 @@ async function configureI8n(resources, _a = {}) {
999
1036
  .then((t) => t);
1000
1037
  }
1001
1038
 
1002
- export { DAlert, DBadge, DBoxFile, DButton, DCard, DCardAccount, DCardBody, DCardFooter, DCardHeader, DCarousel, DCarouselSlide, DChip, DCollapse, DCollapseIconText, DCurrencyText, DDatePicker, DFormikInput, DFormikInputCurrency, DFormikInputSelect, DIcon, DInput, DInputCheck, DInputCounter, DInputCurrency, DInputCurrencyBase, DInputPassword, DInputPin, DInputSearch, DInputSelect, DInputSwitch, DList, DListItem, DListItemMovement, DModal, DOffcanvas, DPaginator, DPermissionItem, DPopover, DProgress, DQuickActionButton, DQuickActionCheck, DQuickActionSelect, DQuickActionSwitch, DSkeleton, DStepper, DTabContent, DTabs, DToastContainer, DTooltip, LiquidContext$1 as LiquidContext, LiquidContextProvider, MPermissionGroup, MSummaryCard, ModalContext, ModalContextProvider, OffcanvasContext, OffcanvasContextProvider, configureI8n as configureI18n, useFormatCurrency, useLiquidContext, useModalContext, useOffcanvasContext, useScreenshot, useScreenshotDownload, useScreenshotWebShare, useTabContext, useToast };
1039
+ export { DAlert, DBadge, DBoxFile, DButton, DCard, DCardAccount, DCardBody, DCardFooter, DCardHeader, DCarousel, DCarouselSlide, DChip, DCollapse, DCollapseIconText, DCurrencyText, DDatePicker, DFormikInput, DFormikInputCurrency, DFormikInputSelect, DIcon, DInput, DInputCheck, DInputCounter, DInputCurrency, DInputCurrencyBase, DInputPassword, DInputPin, DInputSearch, DInputSelect, DInputSwitch, DList, DListItem, DListItemMovement, DModal, DOffcanvas, DPaginator, DPermissionItem, DPopover, DProgress, DQuickActionButton, DQuickActionCheck, DQuickActionSelect, DQuickActionSwitch, DSkeleton, DStepper, DStepper$2 as DStepperDesktop, DStepper$1 as DStepperMobile, DTabContent, DTabs, DToastContainer, DTooltip, LiquidContext$1 as LiquidContext, LiquidContextProvider, MPermissionGroup, MSummaryCard, ModalContext, ModalContextProvider, OffcanvasContext, OffcanvasContextProvider, configureI8n as configureI18n, useFormatCurrency, useLiquidContext, useModalContext, useOffcanvasContext, useScreenshot, useScreenshotDownload, useScreenshotWebShare, useTabContext, useToast };
1003
1040
  //# sourceMappingURL=index.esm.js.map