@dynamic-framework/ui-react 1.2.0 → 1.2.2
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 -1
- package/dist/css/dynamic-ui-react.css +1 -1
- package/dist/css/dynamic-ui.css +1 -1
- package/dist/index.esm.js +95 -32
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +99 -30
- package/dist/index.js.map +1 -1
- package/dist/types/components/MCard.d.ts +7 -0
- package/dist/types/components/MCardAccount.d.ts +13 -0
- package/dist/types/components/MCardBody.d.ts +6 -0
- package/dist/types/components/MCardFooter.d.ts +6 -0
- package/dist/types/components/MCardHeader.d.ts +6 -0
- package/dist/types/components/MDatePicker.d.ts +20 -0
- package/dist/types/components/MDatePickerHeader.d.ts +19 -0
- package/dist/types/components/MDatePickerInput.d.ts +9 -0
- package/dist/types/components/MDatePickerTime.d.ts +9 -0
- package/dist/types/components/MInputCurrency.d.ts +2 -2
- package/dist/types/components/MMonthPicker.d.ts +7 -0
- package/dist/types/components/index.d.ts +7 -1
- package/dist/types/stories/components/MCard.stories.d.ts +10 -0
- package/dist/types/stories/components/MCardAccount.stories.d.ts +6 -0
- package/dist/types/stories/components/MDatePicker.stories.d.ts +14 -0
- package/package.json +3 -3
- package/src/style/components/_+import.scss +4 -1
- package/src/style/components/_m-card-account.scss +15 -0
- package/src/style/components/_m-datepicker.scss +224 -0
- package/src/style/components/_m-monthpicker.scss +90 -0
- package/src/style/components/_m-timepicker.scss +37 -0
- package/dist/types/components/MCalendar.d.ts +0 -25
- package/dist/types/stories/components/MCalendar.stories.d.ts +0 -6
- package/src/style/abstracts/variables/_calendar.scss +0 -19
- package/src/style/components/_m-calendar.scss +0 -205
package/dist/index.js
CHANGED
|
@@ -2,19 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
const tslib = require('tslib');
|
|
5
6
|
const jsxRuntime = require('react/jsx-runtime');
|
|
6
7
|
const DatePicker = require('react-datepicker');
|
|
7
8
|
const luxon = require('luxon');
|
|
8
|
-
const es = require('date-fns/locale/es');
|
|
9
9
|
const React = require('react');
|
|
10
|
-
const ui = require('@dynamic-framework/ui');
|
|
11
|
-
const ContentLoader = require('react-content-loader');
|
|
12
|
-
const classNames = require('classnames');
|
|
13
|
-
const reactToastify = require('react-toastify');
|
|
14
|
-
require('react-toastify/dist/ReactToastify.css');
|
|
15
|
-
const react = require('@floating-ui/react');
|
|
16
|
-
const tslib = require('tslib');
|
|
17
|
-
const formik = require('formik');
|
|
18
10
|
const mAlert_js = require('@dynamic-framework/ui/components/m-alert.js');
|
|
19
11
|
const mBadge_js = require('@dynamic-framework/ui/components/m-badge.js');
|
|
20
12
|
const mButton_js = require('@dynamic-framework/ui/components/m-button.js');
|
|
@@ -36,8 +28,16 @@ const mQuickActionButton_js = require('@dynamic-framework/ui/components/m-quick-
|
|
|
36
28
|
const mQuickActionCheck_js = require('@dynamic-framework/ui/components/m-quick-action-check.js');
|
|
37
29
|
const mQuickActionSelect_js = require('@dynamic-framework/ui/components/m-quick-action-select.js');
|
|
38
30
|
const mQuickActionSwitch_js = require('@dynamic-framework/ui/components/m-quick-action-switch.js');
|
|
31
|
+
const ui = require('@dynamic-framework/ui');
|
|
32
|
+
const ContentLoader = require('react-content-loader');
|
|
33
|
+
const classNames = require('classnames');
|
|
34
|
+
const reactToastify = require('react-toastify');
|
|
35
|
+
require('react-toastify/dist/ReactToastify.css');
|
|
36
|
+
const react = require('@floating-ui/react');
|
|
37
|
+
const formik = require('formik');
|
|
39
38
|
const reactDropzone = require('react-dropzone');
|
|
40
39
|
const reactSplide = require('@splidejs/react-splide');
|
|
40
|
+
const ResponsivePagination = require('react-responsive-pagination');
|
|
41
41
|
const i18n = require('i18next');
|
|
42
42
|
const reactI18next = require('react-i18next');
|
|
43
43
|
const html2canvas = require('html2canvas');
|
|
@@ -46,10 +46,10 @@ const ReactDOM = require('react-dom');
|
|
|
46
46
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
47
47
|
|
|
48
48
|
const DatePicker__default = /*#__PURE__*/_interopDefaultLegacy(DatePicker);
|
|
49
|
-
const es__default = /*#__PURE__*/_interopDefaultLegacy(es);
|
|
50
49
|
const React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
51
50
|
const ContentLoader__default = /*#__PURE__*/_interopDefaultLegacy(ContentLoader);
|
|
52
51
|
const classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
52
|
+
const ResponsivePagination__default = /*#__PURE__*/_interopDefaultLegacy(ResponsivePagination);
|
|
53
53
|
const i18n__default = /*#__PURE__*/_interopDefaultLegacy(i18n);
|
|
54
54
|
const html2canvas__default = /*#__PURE__*/_interopDefaultLegacy(html2canvas);
|
|
55
55
|
|
|
@@ -313,7 +313,7 @@ function MSummaryCard({ title, description, icon, iconSize, iconTheme, Summary,
|
|
|
313
313
|
}
|
|
314
314
|
|
|
315
315
|
const LiquidContext = React.createContext({
|
|
316
|
-
language: 'en
|
|
316
|
+
language: 'en',
|
|
317
317
|
currency: {
|
|
318
318
|
symbol: '$',
|
|
319
319
|
precision: 2,
|
|
@@ -561,25 +561,59 @@ function useOffcanvasContext() {
|
|
|
561
561
|
return context;
|
|
562
562
|
}
|
|
563
563
|
|
|
564
|
-
|
|
565
|
-
|
|
564
|
+
function MDatePickerTime(_a) {
|
|
565
|
+
var { value, onChange, mId, label } = _a, props = tslib.__rest(_a, ["value", "onChange", "mId", "label"]);
|
|
566
|
+
return (jsxRuntime.jsxs("div", Object.assign({ className: "d-flex align-items-center gap-2 flex-column m-datepicker-time" }, { children: [label && (jsxRuntime.jsx("p", Object.assign({ className: "m-datepicker-time-label" }, { children: label }))), jsxRuntime.jsx(MInput, Object.assign({}, onChange && {
|
|
567
|
+
onMChange: (time) => onChange(time),
|
|
568
|
+
}, { type: "time", mId: mId, value: value }, props))] })));
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
function MDatePickerInput(_a, ref) {
|
|
572
|
+
var { value, onClick, mId, iconEnd } = _a, props = tslib.__rest(_a, ["value", "onClick", "mId", "iconEnd"]);
|
|
573
|
+
React.useImperativeHandle(ref, () => ({}), []);
|
|
574
|
+
return (jsxRuntime.jsx("div", Object.assign({ role: "button", onClick: onClick, onKeyDown: () => { }, tabIndex: -1 }, { children: jsxRuntime.jsx(MInput, Object.assign({ isReadOnly: true, type: "text", mId: mId, value: value, onMIconEndClick: onClick, iconEnd: iconEnd }, props)) })));
|
|
575
|
+
}
|
|
576
|
+
const MDatePickerInput$1 = React.forwardRef(MDatePickerInput);
|
|
577
|
+
|
|
578
|
+
function MMonthPicker(_a) {
|
|
579
|
+
var { setDate, date } = _a, props = tslib.__rest(_a, ["setDate", "date"]);
|
|
566
580
|
const dateJS = (value) => luxon.DateTime.fromISO(value).toJSDate();
|
|
567
581
|
const { language } = useLiquidContext();
|
|
568
|
-
const lang = language
|
|
569
|
-
return (jsxRuntime.jsx(DatePicker__default["default"], Object.assign({ selected: dateJS(date), onChange: (value) => {
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
582
|
+
const lang = language || 'en';
|
|
583
|
+
return (jsxRuntime.jsx(DatePicker__default["default"], Object.assign({ showMonthYearPicker: true, selected: dateJS(date), calendarClassName: "m-month-picker", onChange: (value) => {
|
|
584
|
+
setDate(value);
|
|
585
|
+
}, customInput: (jsxRuntime.jsx("p", Object.assign({ className: "fw-bold text-capitalize" }, { children: luxon.DateTime.fromISO(date).setLocale(lang).toFormat('MMMM yyyy') }))), renderCustomHeader: ({ monthDate, decreaseYear, increaseYear, prevYearButtonDisabled, nextYearButtonDisabled, }) => (jsxRuntime.jsxs("div", Object.assign({ className: "d-flex align-items-center justify-content-between gap-4 fs-6 bg-dark" }, { children: [jsxRuntime.jsx(MButton, { iconStart: "chevron-left", size: "sm", variant: "link", theme: "light", onMClick: decreaseYear, isDisabled: prevYearButtonDisabled }), jsxRuntime.jsx("p", Object.assign({ className: "fs-6 fw-bold" }, { children: monthDate.getFullYear() })), jsxRuntime.jsx(MButton, { iconStart: "chevron-right", size: "sm", variant: "link", theme: "light", onMClick: increaseYear, isDisabled: nextYearButtonDisabled })] }))) }, props)));
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
function MDatePickerHeader({ monthDate, changeMonth, changeYear, decreaseMonth, increaseMonth, prevMonthButtonDisabled, nextMonthButtonDisabled, withMonthSelector, decreaseMonthIcon, increaseMonthIcon, iconSize, buttonVariant, buttonTheme, }) {
|
|
589
|
+
const { language } = useLiquidContext();
|
|
590
|
+
const lang = language || 'en';
|
|
591
|
+
return (jsxRuntime.jsxs("div", Object.assign({ className: "d-flex align-items-center justify-content-between m-datepicker-header" }, { children: [jsxRuntime.jsx(MButton, { iconStart: decreaseMonthIcon, size: iconSize, variant: buttonVariant, theme: buttonTheme, onMClick: decreaseMonth, isDisabled: prevMonthButtonDisabled }), jsxRuntime.jsx(MMonthPicker, Object.assign({}, !withMonthSelector && { readOnly: true }, { date: monthDate.toISOString(), setDate: (value) => {
|
|
592
|
+
if (value) {
|
|
593
|
+
changeMonth(luxon.DateTime.fromJSDate(value).month - 1);
|
|
594
|
+
changeYear(luxon.DateTime.fromJSDate(value).year);
|
|
595
|
+
}
|
|
596
|
+
} }, lang && { locale: lang })), jsxRuntime.jsx(MButton, { iconStart: increaseMonthIcon, size: iconSize, variant: buttonVariant, theme: buttonTheme, onMClick: increaseMonth, isDisabled: nextMonthButtonDisabled })] })));
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
function MDatePicker(_a) {
|
|
600
|
+
var { setDate, date, selectsRange, withMonthSelector, inputLabel, inputIcon = 'calendar', inputId = 'input-calendar', timeId = 'input-time', timeLabel, headerDecreaseMonthIcon = 'chevron-left', headerIncreaseMonthIcon = 'chevron-right', headerIconSize = 'sm', headerButtonVariant = 'link', headerButtonTheme = 'dark' } = _a, props = tslib.__rest(_a, ["setDate", "date", "selectsRange", "withMonthSelector", "inputLabel", "inputIcon", "inputId", "timeId", "timeLabel", "headerDecreaseMonthIcon", "headerIncreaseMonthIcon", "headerIconSize", "headerButtonVariant", "headerButtonTheme"]);
|
|
601
|
+
const dateJS = (value) => luxon.DateTime.fromISO(value).toJSDate();
|
|
602
|
+
const { language } = useLiquidContext();
|
|
603
|
+
const lang = language || 'en';
|
|
604
|
+
// eslint-disable-next-line react/no-unstable-nested-components
|
|
605
|
+
const InputPicker = React.forwardRef(({ value, onClick }, ref) => (jsxRuntime.jsx(MDatePickerInput$1, { label: inputLabel, mId: inputId, iconEnd: inputIcon, value: value, onClick: onClick, ref: ref })));
|
|
606
|
+
const TimeInputPicker = React.useCallback(({ value, onChange }) => (jsxRuntime.jsx(MDatePickerTime, { onChange: onChange, value: value, label: timeLabel, mId: timeId })), [timeLabel, timeId]);
|
|
607
|
+
const DatePickerHeader = React.useCallback((headerProps) => (jsxRuntime.jsx(MDatePickerHeader, Object.assign({}, headerProps, { decreaseMonthIcon: headerDecreaseMonthIcon, increaseMonthIcon: headerIncreaseMonthIcon, iconSize: headerIconSize, buttonVariant: headerButtonVariant, buttonTheme: headerButtonTheme, withMonthSelector: !!withMonthSelector }))), [headerButtonTheme,
|
|
608
|
+
headerButtonVariant,
|
|
609
|
+
headerDecreaseMonthIcon,
|
|
610
|
+
headerIconSize,
|
|
611
|
+
headerIncreaseMonthIcon,
|
|
612
|
+
withMonthSelector,
|
|
613
|
+
]);
|
|
614
|
+
return (jsxRuntime.jsx(DatePicker__default["default"], Object.assign({ selected: dateJS(date), calendarClassName: "m-date-picker", onChange: (value) => {
|
|
615
|
+
setDate(value);
|
|
616
|
+
}, renderCustomHeader: (headerProps) => jsxRuntime.jsx(DatePickerHeader, Object.assign({}, headerProps)), customInput: jsxRuntime.jsx(InputPicker, {}), customTimeInput: jsxRuntime.jsx(TimeInputPicker, {}), selectsRange: selectsRange }, lang && { locale: lang }, props)));
|
|
583
617
|
}
|
|
584
618
|
|
|
585
619
|
function MSkeleton({ speed = 2, viewBox, backgroundColor, foregroundColor, children, }) {
|
|
@@ -762,7 +796,11 @@ function MTooltip({ classNameContainer, className, offSet = ARROW_HEIGHT + GAP,
|
|
|
762
796
|
function MInputCurrency(_a) {
|
|
763
797
|
var { onChange, onBlur, onFocus } = _a, otherProps = tslib.__rest(_a, ["onChange", "onBlur", "onFocus"]);
|
|
764
798
|
const { currency } = useLiquidContext();
|
|
765
|
-
return (jsxRuntime.jsx(MInputCurrencyBase, Object.assign({ currencyOptions: currency, onMChange: ({ detail }) => onChange(detail)
|
|
799
|
+
return (jsxRuntime.jsx(MInputCurrencyBase, Object.assign({ currencyOptions: currency, onMChange: ({ detail }) => onChange(detail) }, onBlur && {
|
|
800
|
+
onMBlur: ({ detail }) => onBlur(detail),
|
|
801
|
+
}, onFocus && {
|
|
802
|
+
onMFocus: ({ detail }) => onFocus(detail),
|
|
803
|
+
}, otherProps)));
|
|
766
804
|
}
|
|
767
805
|
|
|
768
806
|
function MBoxFile(_a) {
|
|
@@ -932,6 +970,31 @@ function MFormikInputCurrency(_a) {
|
|
|
932
970
|
return (jsxRuntime.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 })));
|
|
933
971
|
}
|
|
934
972
|
|
|
973
|
+
function MCard({ className, style, children, }) {
|
|
974
|
+
return (jsxRuntime.jsx("div", Object.assign({ style: style, className: classNames__default["default"]('card', className) }, { children: children })));
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
function MCardBody({ className, children, }) {
|
|
978
|
+
return (jsxRuntime.jsx("div", Object.assign({ className: classNames__default["default"]('card-body', className) }, { children: children })));
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
function MCardAccount({ className, icon, theme, name, number, balance, balanceText, onClick, onClickText, }) {
|
|
982
|
+
return (jsxRuntime.jsx(MCard, Object.assign({ className: classNames__default["default"]('m-card-account', className) }, { children: jsxRuntime.jsxs(MCardBody, { children: [jsxRuntime.jsxs("div", Object.assign({ className: "d-flex gap-3 align-items-center" }, { children: [jsxRuntime.jsx(MIcon, { 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(MButton, { text: onClickText, variant: "link", size: "sm", theme: "secondary", iconEnd: "chevron-right", onMClick: onClick }) }))] }) })));
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
function MCardHeader({ className, children, }) {
|
|
986
|
+
return (jsxRuntime.jsx("div", Object.assign({ className: classNames__default["default"]('card-header', className) }, { children: children })));
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
function MCardFooter({ className, children, }) {
|
|
990
|
+
return (jsxRuntime.jsx("div", Object.assign({ className: classNames__default["default"]('card-footer', className) }, { children: children })));
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
function MPaginator(_a) {
|
|
994
|
+
var { className, nextLabel, previousLabel, showArrows = true } = _a, props = tslib.__rest(_a, ["className", "nextLabel", "previousLabel", "showArrows"]);
|
|
995
|
+
return (jsxRuntime.jsx(ResponsivePagination__default["default"], Object.assign({ extraClassName: classNames__default["default"]('m-pagination', className), nextClassName: classNames__default["default"]('m-arrow m-arrow-next', !nextLabel && 'no-label'), nextLabel: nextLabel, previousClassName: classNames__default["default"]('m-arrow m-arrow-prev', !previousLabel && 'no-label'), previousLabel: previousLabel, renderNav: showArrows }, props)));
|
|
996
|
+
}
|
|
997
|
+
|
|
935
998
|
const LANG = ui.liquidParser.parse('{{site.language}}');
|
|
936
999
|
async function configureI8n(resources, _a = {}) {
|
|
937
1000
|
var { lng = LANG, fallbackLng = 'es' } = _a, config = tslib.__rest(_a, ["lng", "fallbackLng"]);
|
|
@@ -957,13 +1020,18 @@ exports.MAlert = MAlert;
|
|
|
957
1020
|
exports.MBadge = MBadge;
|
|
958
1021
|
exports.MBoxFile = MBoxFile;
|
|
959
1022
|
exports.MButton = MButton;
|
|
960
|
-
exports.
|
|
1023
|
+
exports.MCard = MCard;
|
|
1024
|
+
exports.MCardAccount = MCardAccount;
|
|
1025
|
+
exports.MCardBody = MCardBody;
|
|
1026
|
+
exports.MCardFooter = MCardFooter;
|
|
1027
|
+
exports.MCardHeader = MCardHeader;
|
|
961
1028
|
exports.MCarousel = MCarousel;
|
|
962
1029
|
exports.MCarouselSlide = MCarouselSlide;
|
|
963
1030
|
exports.MChip = MChip;
|
|
964
1031
|
exports.MCollapse = MCollapse;
|
|
965
1032
|
exports.MCollapseIconText = MCollapseIconText;
|
|
966
1033
|
exports.MCurrencyText = MCurrencyText;
|
|
1034
|
+
exports.MDatePicker = MDatePicker;
|
|
967
1035
|
exports.MFormikInput = MFormikInput;
|
|
968
1036
|
exports.MFormikInputCurrency = MFormikInputCurrency;
|
|
969
1037
|
exports.MFormikInputSelect = MFormikInputSelect;
|
|
@@ -983,6 +1051,7 @@ exports.MListItem = MListItem;
|
|
|
983
1051
|
exports.MListItemMovement = MListItemMovement;
|
|
984
1052
|
exports.MModal = MModal;
|
|
985
1053
|
exports.MOffcanvas = MOffcanvas;
|
|
1054
|
+
exports.MPaginator = MPaginator;
|
|
986
1055
|
exports.MPermissionGroup = MPermissionGroup;
|
|
987
1056
|
exports.MPermissionItem = MPermissionItem;
|
|
988
1057
|
exports.MPopover = MPopover;
|