@dynamic-framework/ui-react 1.1.5 → 1.2.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/css/dynamic-ui-all.css +1 -0
- package/dist/css/dynamic-ui-react.css +1 -1
- package/dist/css/dynamic-ui.css +1 -0
- package/dist/index.esm.js +107 -26
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +117 -26
- package/dist/index.js.map +1 -1
- package/dist/types/components/MBoxFile.d.ts +1 -1
- package/dist/types/components/MCalendar.d.ts +1 -1
- package/dist/types/components/MCarousel.d.ts +7 -0
- package/dist/types/components/MCarouselSlide.d.ts +5 -0
- package/dist/types/components/MCollapse.d.ts +1 -1
- package/dist/types/components/MCurrencyText.d.ts +1 -2
- package/dist/types/components/MFormikInput.d.ts +1 -1
- package/dist/types/components/MFormikInputCurrency.d.ts +7 -0
- package/dist/types/components/MFormikInputSelect.d.ts +1 -1
- package/dist/types/components/MInputCurrency.d.ts +3 -1
- package/dist/types/components/MList.d.ts +10 -0
- package/dist/types/components/MListItem.d.ts +10 -0
- package/dist/types/components/MListItemMovement.d.ts +10 -0
- package/dist/types/components/MPaginator.d.ts +12 -0
- package/dist/types/components/MPopover.d.ts +1 -1
- package/dist/types/components/MSkeleton.d.ts +1 -1
- package/dist/types/components/MStepper.d.ts +12 -0
- package/dist/types/components/MTabContent.d.ts +1 -1
- package/dist/types/components/MTabs.d.ts +1 -1
- package/dist/types/components/MToastContainer.d.ts +1 -1
- package/dist/types/components/MTooltip.d.ts +1 -1
- package/dist/types/components/banking/MCollapseIconText.d.ts +1 -1
- package/dist/types/components/banking/MPermissionGroup.d.ts +1 -2
- package/dist/types/components/banking/MPermissionItem.d.ts +1 -2
- package/dist/types/components/banking/MSummaryCard.d.ts +1 -1
- package/dist/types/components/index.d.ts +7 -0
- package/dist/types/contexts/LiquidContext.d.ts +1 -1
- package/dist/types/contexts/ModalContext.d.ts +1 -1
- package/dist/types/contexts/OffcanvasContext.d.ts +1 -1
- package/dist/types/stories/components/MCarousel.stories.d.ts +9 -0
- package/dist/types/stories/components/MFormikInputCurrency.stories.d.ts +8 -0
- package/dist/types/stories/components/MList.stories.d.ts +10 -0
- package/dist/types/stories/components/MListItem.stories.d.ts +9 -0
- package/dist/types/stories/components/MListItemMovement.stories.d.ts +7 -0
- package/dist/types/stories/components/MPaginator.stories.d.ts +10 -0
- package/dist/types/stories/components/MStepper.stories.d.ts +7 -0
- package/dist/types/stories/hooks/useFormatCurrency.stories.d.ts +1 -2
- package/dist/types/stories/hooks/useModalContext.stories.d.ts +1 -2
- package/dist/types/stories/hooks/useOffcanvasContext.stories.d.ts +1 -2
- package/dist/types/stories/hooks/useToast.stories.d.ts +1 -2
- package/dist/types/utils/index.d.ts +1 -0
- package/package.json +16 -13
- package/src/style/components/_+import.scss +3 -0
- package/src/style/components/_m-carousel.scss +44 -0
- package/src/style/components/_m-paginator.scss +98 -0
- package/src/style/components/_m-stepper.scss +156 -0
- package/src/style/dynamic-ui-all.scss +3 -0
- package/src/style/dynamic-ui.scss +1 -0
- /package/dist/types/stories/{patterns → components}/MBadge.stories.d.ts +0 -0
- /package/dist/types/stories/{patterns → components}/MChip.stories.d.ts +0 -0
- /package/src/style/{main.scss → dynamic-ui-react.scss} +0 -0
package/dist/index.esm.js
CHANGED
|
@@ -4,8 +4,9 @@ import { DateTime } from 'luxon';
|
|
|
4
4
|
import es from 'date-fns/locale/es';
|
|
5
5
|
import React, { createElement, useState, useEffect, createContext, useMemo, useContext, useCallback, useRef } from 'react';
|
|
6
6
|
import { PREFIX_BS, liquidParser, formatCurrency } from '@dynamic-framework/ui';
|
|
7
|
+
export { liquidParser } from '@dynamic-framework/ui';
|
|
7
8
|
import ContentLoader from 'react-content-loader';
|
|
8
|
-
import
|
|
9
|
+
import classNames from 'classnames';
|
|
9
10
|
import { ToastContainer, Slide, toast } from 'react-toastify';
|
|
10
11
|
import 'react-toastify/dist/ReactToastify.css';
|
|
11
12
|
import { useFloating, offset, flip, shift, autoUpdate, useClick, useDismiss, useRole, useInteractions, useId, FloatingFocusManager, arrow, useHover, useFocus, FloatingPortal, FloatingArrow } from '@floating-ui/react';
|
|
@@ -33,6 +34,7 @@ import { defineCustomElement as defineCustomElement$i } from '@dynamic-framework
|
|
|
33
34
|
import { defineCustomElement as defineCustomElement$j } from '@dynamic-framework/ui/components/m-quick-action-select.js';
|
|
34
35
|
import { defineCustomElement as defineCustomElement$k } from '@dynamic-framework/ui/components/m-quick-action-switch.js';
|
|
35
36
|
import { useDropzone } from 'react-dropzone';
|
|
37
|
+
import { Splide, SplideSlide } from '@splidejs/react-splide';
|
|
36
38
|
import i18n from 'i18next';
|
|
37
39
|
import { initReactI18next } from 'react-i18next';
|
|
38
40
|
import html2canvas from 'html2canvas';
|
|
@@ -274,7 +276,7 @@ function MCollapse({ id, className, Component, hasSeparator = false, defaultColl
|
|
|
274
276
|
useEffect(() => {
|
|
275
277
|
setToggle(defaultCollapsed);
|
|
276
278
|
}, [defaultCollapsed]);
|
|
277
|
-
return (jsxs("div", Object.assign({ id: id, className:
|
|
279
|
+
return (jsxs("div", Object.assign({ id: id, className: classNames('m-collapse collapse-container', className) }, { children: [jsxs("button", Object.assign({ className: "collapse-button", type: "button", onClick: onChangeCollapse }, { children: [jsx("div", Object.assign({ className: "flex-grow-1" }, { children: Component })), jsx(MIcon, { color: `var(--${PREFIX_BS}gray)`, size: `var(--${PREFIX_BS}ref-fs-small)`, icon: toggle ? 'chevron-up' : 'chevron-down' })] })), toggle && (jsx("div", Object.assign({ className: classNames({
|
|
278
280
|
'collapse-body': true,
|
|
279
281
|
}), style: {
|
|
280
282
|
[`--${PREFIX_BS}m-collapse-separator-display`]: hasSeparator ? 'block' : 'none',
|
|
@@ -601,10 +603,10 @@ function MTabs({ children, defaultSelected, onChange, options, className, isVert
|
|
|
601
603
|
const value = useMemo(() => ({
|
|
602
604
|
isSelected,
|
|
603
605
|
}), [isSelected]);
|
|
604
|
-
return (jsx(TabContext.Provider, Object.assign({ value: value }, { children: jsxs("div", Object.assign({ className:
|
|
606
|
+
return (jsx(TabContext.Provider, Object.assign({ value: value }, { children: jsxs("div", Object.assign({ className: classNames({
|
|
605
607
|
'm-tabs': true,
|
|
606
608
|
'm-tabs-vertical': isVertical,
|
|
607
|
-
}) }, { children: [jsx("nav", Object.assign({ className: "nav" }, { children: options.map((option) => (jsx("button", Object.assign({ id: `${option.tab}Tab`, className:
|
|
609
|
+
}) }, { children: [jsx("nav", Object.assign({ className: "nav" }, { children: options.map((option) => (jsx("button", Object.assign({ id: `${option.tab}Tab`, className: classNames('nav-link', {
|
|
608
610
|
active: option.tab === selected,
|
|
609
611
|
}, className), type: "button", role: "tab", "aria-controls": `${option.tab}Pane`, "aria-selected": option.tab === selected, disabled: option.isDisabled, onClick: () => onSelect(option) }, { children: option.label }), option.label))) })), jsx("div", Object.assign({ className: "tab-content" }, { children: children }))] })) })));
|
|
610
612
|
}
|
|
@@ -624,7 +626,7 @@ function MTabContent({ tab, children }) {
|
|
|
624
626
|
return (jsx("div", Object.assign({ className: "tab-pane fade show active", id: `${tab}Pane`, role: "tabpanel", tabIndex: 0, "aria-labelledby": `${tab}Tab` }, { children: children })));
|
|
625
627
|
}
|
|
626
628
|
|
|
627
|
-
function MToastContainer({ style, position = '
|
|
629
|
+
function MToastContainer({ style, position = 'top-right', }) {
|
|
628
630
|
return (jsx(ToastContainer, { toastClassName: () => 'shadow-none p-0 cursor-default', position: position, autoClose: false, hideProgressBar: true, closeOnClick: false, closeButton: false, transition: Slide, style: style }));
|
|
629
631
|
}
|
|
630
632
|
|
|
@@ -675,9 +677,9 @@ function MCurrencyText({ value, className, }) {
|
|
|
675
677
|
}
|
|
676
678
|
|
|
677
679
|
function MFormikInput(_a) {
|
|
678
|
-
var { name } = _a, props = __rest(_a, ["name"]);
|
|
680
|
+
var { name, hint } = _a, props = __rest(_a, ["name", "hint"]);
|
|
679
681
|
const [field, meta, helpers] = useField(name);
|
|
680
|
-
return (jsx(MInput, Object.assign({}, props, { name: field.name, value: field.value, onMChange: ({ detail }) => helpers.setValue(detail), onMBlur: ({ detail }) => field.onBlur(detail), isInvalid: !!meta.error })));
|
|
682
|
+
return (jsx(MInput, Object.assign({}, props, { name: field.name, value: field.value, onMChange: ({ detail }) => helpers.setValue(detail), onMBlur: ({ detail }) => field.onBlur(detail), isInvalid: !!meta.error, hint: meta.error || hint })));
|
|
681
683
|
}
|
|
682
684
|
|
|
683
685
|
function MFormikInputSelect(_a) {
|
|
@@ -745,40 +747,66 @@ function MTooltip({ classNameContainer, className, offSet = ARROW_HEIGHT + GAP,
|
|
|
745
747
|
}
|
|
746
748
|
|
|
747
749
|
function MInputCurrency(_a) {
|
|
748
|
-
var { onChange } = _a, otherProps = __rest(_a, ["onChange"]);
|
|
750
|
+
var { onChange, onBlur, onFocus } = _a, otherProps = __rest(_a, ["onChange", "onBlur", "onFocus"]);
|
|
749
751
|
const { currency } = useLiquidContext();
|
|
750
|
-
return (jsx(MInputCurrencyBase, Object.assign({ currencyOptions: currency, onMChange: ({ detail }) => onChange(detail) }, otherProps)));
|
|
752
|
+
return (jsx(MInputCurrencyBase, Object.assign({ currencyOptions: currency, onMChange: ({ detail }) => onChange(detail), onMBlur: ({ detail }) => onBlur(detail), onMFocus: ({ detail }) => onFocus(detail) }, otherProps)));
|
|
751
753
|
}
|
|
752
754
|
|
|
753
755
|
function MBoxFile(_a) {
|
|
754
756
|
var { icon = 'cloud-upload', iconFamilyClass, iconFamilyPrefix, isDisabled = false, children } = _a, dropzoneOptions = __rest(_a, ["icon", "iconFamilyClass", "iconFamilyPrefix", "isDisabled", "children"]);
|
|
755
757
|
const { acceptedFiles, getRootProps, getInputProps, } = useDropzone(Object.assign({ disabled: isDisabled }, dropzoneOptions));
|
|
756
|
-
return (jsxs("section", Object.assign({ className:
|
|
758
|
+
return (jsxs("section", Object.assign({ className: classNames('m-box-file', {
|
|
757
759
|
'm-box-file-selected': !!acceptedFiles.length,
|
|
758
760
|
}) }, { children: [jsxs("div", Object.assign({}, getRootProps({
|
|
759
|
-
className:
|
|
761
|
+
className: classNames('m-box-file-dropzone', {
|
|
760
762
|
disabled: isDisabled,
|
|
761
763
|
}),
|
|
762
764
|
}), { children: [jsx("input", Object.assign({}, getInputProps())), jsx(MIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }), jsx("div", Object.assign({ className: "m-box-content" }, { children: children }))] })), !!acceptedFiles.length && (jsx("aside", Object.assign({ className: "m-box-files" }, { children: acceptedFiles.map((file) => (jsx("div", Object.assign({ className: "m-box-files-text" }, { children: `${file.name} - ${file.size} bytes` }), file.name))) })))] })));
|
|
763
765
|
}
|
|
764
766
|
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
767
|
+
function MCarousel(_a) {
|
|
768
|
+
var { children, className, options } = _a, props = __rest(_a, ["children", "className", "options"]);
|
|
769
|
+
return (jsx(Splide, Object.assign({ className: classNames('m-carousel', className), options: Object.assign(Object.assign({}, options), { classes: {
|
|
770
|
+
// Arrows
|
|
771
|
+
arrows: 'splide__arrows m-carousel-arrows',
|
|
772
|
+
arrow: 'splide__arrow m-carousel-arrow',
|
|
773
|
+
prev: 'splide__arrow--prev m-carousel-arrow-prev',
|
|
774
|
+
next: 'splide__arrow--next m-carousel-arrow-next',
|
|
775
|
+
// Paginator
|
|
776
|
+
pagination: 'splide__pagination m-carousel-pagination',
|
|
777
|
+
page: 'splide__pagination__page m-carousel-pagination-page',
|
|
778
|
+
} }) }, props, { children: children })));
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
function MCarouselSlide(_a) {
|
|
782
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
783
|
+
return (jsx(SplideSlide, Object.assign({ className: classNames('m-carousel-slide', className) }, props)));
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
function MList({ children, className, isFlush = false, isNumbered = false, isHorizontal = false, horizontalBreakpoint, }) {
|
|
787
|
+
if (isFlush && isHorizontal) {
|
|
788
|
+
throw new Error("Horizontal and Flush props don't work together");
|
|
789
|
+
}
|
|
790
|
+
return (jsx("div", Object.assign({ className: classNames('m-list list-group', {
|
|
791
|
+
'list-group-flush': isFlush && !isHorizontal,
|
|
792
|
+
'list-group-numbered': isNumbered,
|
|
793
|
+
'list-group-horizontal': isHorizontal && !horizontalBreakpoint,
|
|
794
|
+
}, (isHorizontal && horizontalBreakpoint) && `list-group-horizontal-${horizontalBreakpoint}`, className) }, { children: children })));
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
function MListItem({ children, className, isActive = false, isDisabled = false, theme, onMClick, }) {
|
|
798
|
+
const Tag = useMemo(() => (onMClick ? 'button' : 'div'), [onMClick]);
|
|
799
|
+
return (jsx(Tag, Object.assign({}, Tag === 'button' && {
|
|
800
|
+
onClick: onMClick,
|
|
801
|
+
type: 'button',
|
|
802
|
+
}, { className: classNames('m-list-item list-group-item list-group-item-action', theme ? `list-group-item-${theme}` : undefined, className, {
|
|
803
|
+
active: isActive,
|
|
804
|
+
disabled: isDisabled,
|
|
805
|
+
}) }, isActive && { 'aria-current': true }, { children: children })));
|
|
778
806
|
}
|
|
779
807
|
|
|
780
808
|
function useToast() {
|
|
781
|
-
const toast$1 = useCallback((message, { position = '
|
|
809
|
+
const toast$1 = useCallback((message, { position = 'top-right', type = 'info', showClose = true, autoClose = false, } = {}) => {
|
|
782
810
|
toast(({ closeToast }) => (jsx(MAlert, Object.assign({ type: type, showClose: showClose, onMClose: closeToast }, { children: message }))), {
|
|
783
811
|
transition: Slide,
|
|
784
812
|
position,
|
|
@@ -853,5 +881,58 @@ function useScreenshotWebShare() {
|
|
|
853
881
|
};
|
|
854
882
|
}
|
|
855
883
|
|
|
856
|
-
|
|
884
|
+
function MListItemMovement(_a) {
|
|
885
|
+
var { description, date, amount, classNameMovement } = _a, props = __rest(_a, ["description", "date", "amount", "classNameMovement"]);
|
|
886
|
+
const { format } = useFormatCurrency();
|
|
887
|
+
const value = useMemo(() => {
|
|
888
|
+
const valueFormatted = format(amount);
|
|
889
|
+
if (amount > 0) {
|
|
890
|
+
return {
|
|
891
|
+
theme: 'text-success',
|
|
892
|
+
valueFormatted,
|
|
893
|
+
};
|
|
894
|
+
}
|
|
895
|
+
return {
|
|
896
|
+
theme: 'text-danger',
|
|
897
|
+
valueFormatted,
|
|
898
|
+
};
|
|
899
|
+
}, [format, amount]);
|
|
900
|
+
return (jsx(MListItem, Object.assign({}, props, { children: jsxs("div", Object.assign({ className: classNames('m-list-item-movement', '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 }))] })) })));
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
function MStepper({ options, currentStep, successIcon = 'check', isVertical = false, }) {
|
|
904
|
+
return (jsx("div", Object.assign({ className: classNames({
|
|
905
|
+
'm-stepper': true,
|
|
906
|
+
'is-vertical': isVertical,
|
|
907
|
+
}) }, { children: options.map(({ label, value }) => (jsxs("div", Object.assign({ className: "m-step" }, { children: [jsx("div", Object.assign({ className: "m-step-value" }, { children: jsx("div", Object.assign({ className: classNames({
|
|
908
|
+
'm-step-icon-container': true,
|
|
909
|
+
'm-step-check': value < currentStep,
|
|
910
|
+
'm-step-current': value === currentStep,
|
|
911
|
+
}) }, { children: value < currentStep
|
|
912
|
+
? (jsx(MIcon, { icon: successIcon, innerClass: "m-step-icon" }))
|
|
913
|
+
: value })) })), jsx("div", Object.assign({ className: "m-step-label" }, { children: label }))] }), label))) })));
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
function MFormikInputCurrency(_a) {
|
|
917
|
+
var { name, hint } = _a, props = __rest(_a, ["name", "hint"]);
|
|
918
|
+
const [field, meta, helpers] = useField(name);
|
|
919
|
+
return (jsx(MInputCurrency, Object.assign({}, props, { name: field.name, value: field.value, onChange: (value) => helpers.setValue(value), onMBlur: ({ detail }) => field.onBlur(detail), isInvalid: !!meta.error, hint: meta.error || hint })));
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
const LANG = liquidParser.parse('{{site.language}}');
|
|
923
|
+
async function configureI8n(resources, _a = {}) {
|
|
924
|
+
var { lng = LANG, fallbackLng = 'es' } = _a, config = __rest(_a, ["lng", "fallbackLng"]);
|
|
925
|
+
return i18n
|
|
926
|
+
.use(initReactI18next)
|
|
927
|
+
.init(Object.assign({ resources,
|
|
928
|
+
lng, initImmediate: true, fallbackLng, interpolation: {
|
|
929
|
+
escapeValue: false,
|
|
930
|
+
prefix: '{',
|
|
931
|
+
suffix: '}',
|
|
932
|
+
// skipOnVariables: false,
|
|
933
|
+
} }, config))
|
|
934
|
+
.then((t) => t);
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
export { LiquidContext$1 as LiquidContext, LiquidContextProvider, MAlert, MBadge, MBoxFile, MButton, MCalendar, MCarousel, MCarouselSlide, MChip, MCollapse, MCollapseIconText, MCurrencyText, MFormikInput, MFormikInputCurrency, MFormikInputSelect, MIcon, MInput, MInputCheck, MInputCounter, MInputCurrency, MInputCurrencyBase, MInputPassword, MInputPin, MInputSearch, MInputSelect, MInputSwitch, MList, MListItem, MListItemMovement, MModal, MOffcanvas, MPermissionGroup, MPermissionItem, MPopover, MProgressBar, MQuickActionButton, MQuickActionCheck, MQuickActionSelect, MQuickActionSwitch, MSkeleton, MStepper, MSummaryCard, MTabContent, MTabs, MToastContainer, MTooltip, ModalContext, ModalContextProvider, OffcanvasContext, OffcanvasContextProvider, configureI8n as configureI18n, useFormatCurrency, useLiquidContext, useModalContext, useOffcanvasContext, useScreenshot, useScreenshotDownload, useScreenshotWebShare, useTabContext, useToast };
|
|
857
938
|
//# sourceMappingURL=index.esm.js.map
|