@dynamic-framework/ui-react 1.4.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
@@ -933,12 +933,15 @@ function DListItemMovement(_a) {
933
933
  valueFormatted,
934
934
  };
935
935
  }, [format, amount]);
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: "sp text-gray-700" }, { children: date }))] })), jsx("span", Object.assign({ className: classNames('fs-6', value.theme) }, { children: value.valueFormatted }))] })) })));
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) {
@@ -964,7 +1001,7 @@ function DCardBody({ className, children, }) {
964
1001
  }
965
1002
 
966
1003
  function DCardAccount({ className, icon, theme, name, number, balance, balanceText, onEventClick, actionText, }) {
967
- return (jsx(DCard, Object.assign({ className: classNames('d-card-account', className) }, { children: jsxs(DCardBody, { children: [jsxs("div", Object.assign({ className: "d-flex gap-3 align-items-center" }, { children: [jsx(DIcon, { icon: icon, hasCircle: true, theme: theme, size: "1.5rem" }), jsxs("div", Object.assign({ className: "d-block flex-grow-1" }, { children: [jsx("p", Object.assign({ className: "text-gray-700" }, { children: name })), jsx("small", Object.assign({ className: "text-gray" }, { children: number }))] }))] })), jsxs("div", Object.assign({ className: "d-block" }, { children: [jsx("p", Object.assign({ className: "fw-bold fs-6 text-body" }, { children: balance })), jsx("small", Object.assign({ className: "text-gray-700" }, { children: balanceText }))] })), jsx("div", Object.assign({ className: "d-flex justify-content-end" }, { children: jsx(DButton, { text: actionText, variant: "link", size: "sm", theme: "secondary", iconEnd: "chevron-right", onEventClick: onEventClick }) }))] }) })));
1004
+ return (jsx(DCard, Object.assign({ className: classNames('d-card-account', className) }, { children: jsxs(DCardBody, { children: [jsxs("div", Object.assign({ className: "d-flex gap-3 align-items-center" }, { children: [jsx(DIcon, { icon: icon, hasCircle: true, theme: theme, size: "1.5rem" }), jsxs("div", Object.assign({ className: "d-block flex-grow-1" }, { children: [jsx("p", Object.assign({ className: "text-gray-700" }, { children: name })), jsx("small", Object.assign({ className: "text-gray-500" }, { children: number }))] }))] })), jsxs("div", Object.assign({ className: "d-block" }, { children: [jsx("p", Object.assign({ className: "fw-bold fs-6 text-body" }, { children: balance })), jsx("small", Object.assign({ className: "text-gray-700" }, { children: balanceText }))] })), jsx("div", Object.assign({ className: "d-flex justify-content-end" }, { children: jsx(DButton, { text: actionText, variant: "link", size: "sm", theme: "secondary", iconEnd: "chevron-right", onEventClick: onEventClick }) }))] }) })));
968
1005
  }
969
1006
 
970
1007
  function DCardHeader({ className, children, }) {
@@ -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