@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.js CHANGED
@@ -946,12 +946,15 @@ function DListItemMovement(_a) {
946
946
  valueFormatted,
947
947
  };
948
948
  }, [format, amount]);
949
- return (jsxRuntime.jsx(DListItem, Object.assign({}, props, { children: jsxRuntime.jsxs("div", Object.assign({ className: classNames__default["default"]('d-flex justify-content-between align-items-center p-3 gap-3', classNameMovement) }, { children: [jsxRuntime.jsxs("div", Object.assign({ className: "d-flex flex-column gap-1" }, { children: [jsxRuntime.jsx("span", Object.assign({ className: "fs-6" }, { children: description })), jsxRuntime.jsx("span", Object.assign({ className: "sp text-gray-700" }, { children: date }))] })), jsxRuntime.jsx("span", Object.assign({ className: classNames__default["default"]('fs-6', value.theme) }, { children: value.valueFormatted }))] })) })));
949
+ return (jsxRuntime.jsx(DListItem, Object.assign({}, props, { children: jsxRuntime.jsxs("div", Object.assign({ className: classNames__default["default"]('d-flex justify-content-between align-items-center p-3 gap-3', classNameMovement) }, { children: [jsxRuntime.jsxs("div", Object.assign({ className: "d-flex flex-column gap-1" }, { children: [jsxRuntime.jsx("span", Object.assign({ className: "fs-6" }, { children: description })), jsxRuntime.jsx("span", Object.assign({ className: "small text-gray-700" }, { children: date }))] })), jsxRuntime.jsx("span", Object.assign({ className: classNames__default["default"]('fs-6', value.theme) }, { children: value.valueFormatted }))] })) })));
950
950
  }
951
951
 
952
- function DStepper({ options, currentStep, successIcon = 'check', isVertical = false, }) {
952
+ function DStepper$2({ options, currentStep, successIcon = 'check', isVertical = false, }) {
953
+ if (currentStep < 1 || currentStep > options.length) {
954
+ throw new Error('Current step should be in the range from 1 to options lenght');
955
+ }
953
956
  return (jsxRuntime.jsx("div", Object.assign({ className: classNames__default["default"]({
954
- 'd-stepper': true,
957
+ 'd-stepper-desktop': true,
955
958
  'is-vertical': isVertical,
956
959
  }) }, { children: options.map(({ label, value }) => (jsxRuntime.jsxs("div", Object.assign({ className: "d-step" }, { children: [jsxRuntime.jsx("div", Object.assign({ className: "d-step-value" }, { children: jsxRuntime.jsx("div", Object.assign({ className: classNames__default["default"]({
957
960
  'd-step-icon-container': true,
@@ -959,7 +962,41 @@ function DStepper({ options, currentStep, successIcon = 'check', isVertical = fa
959
962
  'd-step-current': value === currentStep,
960
963
  }) }, { children: value < currentStep
961
964
  ? (jsxRuntime.jsx(DIcon, { icon: successIcon, innerClass: "d-step-icon" }))
962
- : value })) })), jsxRuntime.jsx("div", Object.assign({ className: "d-step-label" }, { children: label }))] }), label))) })));
965
+ : value })) })), jsxRuntime.jsx("div", Object.assign({ className: "d-step-label" }, { children: label }))] }), value))) })));
966
+ }
967
+
968
+ function DStepper$1({ options, currentStep, }) {
969
+ if (currentStep < 1 || currentStep > options.length) {
970
+ throw new Error('Current step should be in the range from 1 to options lenght');
971
+ }
972
+ const currentOption = React.useMemo(() => { var _a; return (_a = options[currentStep - 1]) !== null && _a !== void 0 ? _a : {}; }, [currentStep, options]);
973
+ const [currentAngle, setCurrentAngle] = React.useState(0);
974
+ React.useEffect(() => {
975
+ const targetAngle = (currentStep / options.length) * 360;
976
+ const animationInterval = setInterval(() => {
977
+ const angleDifference = targetAngle - currentAngle;
978
+ const step = Math.sign(angleDifference) * 5;
979
+ if (Math.abs(angleDifference) <= Math.abs(step)) {
980
+ setCurrentAngle(targetAngle);
981
+ clearInterval(animationInterval);
982
+ }
983
+ else {
984
+ setCurrentAngle(currentAngle + step);
985
+ }
986
+ }, 16);
987
+ return () => {
988
+ clearInterval(animationInterval);
989
+ };
990
+ }, [currentAngle, currentStep, options.length]);
991
+ const progressStyle = React.useMemo(() => `conic-gradient(
992
+ from 180deg,
993
+ var(--${ui.PREFIX_BS}step-progress-outter-fill-background-color) ${currentAngle}deg,
994
+ var(--${ui.PREFIX_BS}step-progress-outter-background-color) 0deg)`, [currentAngle]);
995
+ return (jsxRuntime.jsxs("div", Object.assign({ className: "d-stepper" }, { children: [jsxRuntime.jsx("div", Object.assign({ className: "d-step-bar", style: { background: progressStyle } }, { children: jsxRuntime.jsx("p", Object.assign({ className: "d-step-number" }, { children: `${currentStep}/${options.length}` })) })), jsxRuntime.jsx("div", Object.assign({ className: "d-step-info" }, { children: Object.keys(currentOption).length > 0 && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", Object.assign({ className: "d-step-label" }, { children: currentOption.label })), jsxRuntime.jsx("div", Object.assign({ className: "d-step-description" }, { children: currentOption.description || '' }))] })) }))] })));
996
+ }
997
+
998
+ function DStepper({ options, currentStep, successIcon = 'check', isVertical = false, breakpoint = 'lg', }) {
999
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", Object.assign({ className: `d-block d-${breakpoint}-none` }, { children: jsxRuntime.jsx(DStepper$1, { options: options, currentStep: currentStep }) })), jsxRuntime.jsx("div", Object.assign({ className: `d-none d-${breakpoint}-block` }, { children: jsxRuntime.jsx(DStepper$2, { options: options, currentStep: currentStep, successIcon: successIcon, isVertical: isVertical }) }))] }));
963
1000
  }
964
1001
 
965
1002
  function DFormikInputCurrency(_a) {
@@ -977,7 +1014,7 @@ function DCardBody({ className, children, }) {
977
1014
  }
978
1015
 
979
1016
  function DCardAccount({ className, icon, theme, name, number, balance, balanceText, onEventClick, actionText, }) {
980
- return (jsxRuntime.jsx(DCard, Object.assign({ className: classNames__default["default"]('d-card-account', className) }, { children: jsxRuntime.jsxs(DCardBody, { children: [jsxRuntime.jsxs("div", Object.assign({ className: "d-flex gap-3 align-items-center" }, { children: [jsxRuntime.jsx(DIcon, { icon: icon, hasCircle: true, theme: theme, size: "1.5rem" }), jsxRuntime.jsxs("div", Object.assign({ className: "d-block flex-grow-1" }, { children: [jsxRuntime.jsx("p", Object.assign({ className: "text-gray-700" }, { children: name })), jsxRuntime.jsx("small", Object.assign({ className: "text-gray" }, { children: number }))] }))] })), jsxRuntime.jsxs("div", Object.assign({ className: "d-block" }, { children: [jsxRuntime.jsx("p", Object.assign({ className: "fw-bold fs-6 text-body" }, { children: balance })), jsxRuntime.jsx("small", Object.assign({ className: "text-gray-700" }, { children: balanceText }))] })), jsxRuntime.jsx("div", Object.assign({ className: "d-flex justify-content-end" }, { children: jsxRuntime.jsx(DButton, { text: actionText, variant: "link", size: "sm", theme: "secondary", iconEnd: "chevron-right", onEventClick: onEventClick }) }))] }) })));
1017
+ return (jsxRuntime.jsx(DCard, Object.assign({ className: classNames__default["default"]('d-card-account', className) }, { children: jsxRuntime.jsxs(DCardBody, { children: [jsxRuntime.jsxs("div", Object.assign({ className: "d-flex gap-3 align-items-center" }, { children: [jsxRuntime.jsx(DIcon, { icon: icon, hasCircle: true, theme: theme, size: "1.5rem" }), jsxRuntime.jsxs("div", Object.assign({ className: "d-block flex-grow-1" }, { children: [jsxRuntime.jsx("p", Object.assign({ className: "text-gray-700" }, { children: name })), jsxRuntime.jsx("small", Object.assign({ className: "text-gray-500" }, { children: number }))] }))] })), jsxRuntime.jsxs("div", Object.assign({ className: "d-block" }, { children: [jsxRuntime.jsx("p", Object.assign({ className: "fw-bold fs-6 text-body" }, { children: balance })), jsxRuntime.jsx("small", Object.assign({ className: "text-gray-700" }, { children: balanceText }))] })), jsxRuntime.jsx("div", Object.assign({ className: "d-flex justify-content-end" }, { children: jsxRuntime.jsx(DButton, { text: actionText, variant: "link", size: "sm", theme: "secondary", iconEnd: "chevron-right", onEventClick: onEventClick }) }))] }) })));
981
1018
  }
982
1019
 
983
1020
  function DCardHeader({ className, children, }) {
@@ -1061,6 +1098,8 @@ exports.DQuickActionSelect = DQuickActionSelect;
1061
1098
  exports.DQuickActionSwitch = DQuickActionSwitch;
1062
1099
  exports.DSkeleton = DSkeleton;
1063
1100
  exports.DStepper = DStepper;
1101
+ exports.DStepperDesktop = DStepper$2;
1102
+ exports.DStepperMobile = DStepper$1;
1064
1103
  exports.DTabContent = DTabContent;
1065
1104
  exports.DTabs = DTabs;
1066
1105
  exports.DToastContainer = DToastContainer;