@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.esm.js
CHANGED
|
@@ -1,17 +1,8 @@
|
|
|
1
|
+
import { __rest } from 'tslib';
|
|
1
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import DatePicker
|
|
3
|
+
import DatePicker from 'react-datepicker';
|
|
3
4
|
import { DateTime } from 'luxon';
|
|
4
|
-
import
|
|
5
|
-
import React, { createElement, useState, useEffect, createContext, useMemo, useContext, useCallback, useRef } from 'react';
|
|
6
|
-
import { PREFIX_BS, liquidParser, formatCurrency } from '@dynamic-framework/ui';
|
|
7
|
-
export { liquidParser } from '@dynamic-framework/ui';
|
|
8
|
-
import ContentLoader from 'react-content-loader';
|
|
9
|
-
import classNames from 'classnames';
|
|
10
|
-
import { ToastContainer, Slide, toast } from 'react-toastify';
|
|
11
|
-
import 'react-toastify/dist/ReactToastify.css';
|
|
12
|
-
import { useFloating, offset, flip, shift, autoUpdate, useClick, useDismiss, useRole, useInteractions, useId, FloatingFocusManager, arrow, useHover, useFocus, FloatingPortal, FloatingArrow } from '@floating-ui/react';
|
|
13
|
-
import { __rest } from 'tslib';
|
|
14
|
-
import { useField } from 'formik';
|
|
5
|
+
import React, { createElement, useState, useEffect, createContext, useMemo, useContext, useCallback, forwardRef, useImperativeHandle, useRef } from 'react';
|
|
15
6
|
import { defineCustomElement } from '@dynamic-framework/ui/components/m-alert.js';
|
|
16
7
|
import { defineCustomElement as defineCustomElement$1 } from '@dynamic-framework/ui/components/m-badge.js';
|
|
17
8
|
import { defineCustomElement as defineCustomElement$2 } from '@dynamic-framework/ui/components/m-button.js';
|
|
@@ -33,8 +24,17 @@ import { defineCustomElement as defineCustomElement$h } from '@dynamic-framework
|
|
|
33
24
|
import { defineCustomElement as defineCustomElement$i } from '@dynamic-framework/ui/components/m-quick-action-check.js';
|
|
34
25
|
import { defineCustomElement as defineCustomElement$j } from '@dynamic-framework/ui/components/m-quick-action-select.js';
|
|
35
26
|
import { defineCustomElement as defineCustomElement$k } from '@dynamic-framework/ui/components/m-quick-action-switch.js';
|
|
27
|
+
import { PREFIX_BS, liquidParser, formatCurrency } from '@dynamic-framework/ui';
|
|
28
|
+
export { liquidParser } from '@dynamic-framework/ui';
|
|
29
|
+
import ContentLoader from 'react-content-loader';
|
|
30
|
+
import classNames from 'classnames';
|
|
31
|
+
import { ToastContainer, Slide, toast } from 'react-toastify';
|
|
32
|
+
import 'react-toastify/dist/ReactToastify.css';
|
|
33
|
+
import { useFloating, offset, flip, shift, autoUpdate, useClick, useDismiss, useRole, useInteractions, useId, FloatingFocusManager, arrow, useHover, useFocus, FloatingPortal, FloatingArrow } from '@floating-ui/react';
|
|
34
|
+
import { useField } from 'formik';
|
|
36
35
|
import { useDropzone } from 'react-dropzone';
|
|
37
36
|
import { Splide, SplideSlide } from '@splidejs/react-splide';
|
|
37
|
+
import ResponsivePagination from 'react-responsive-pagination';
|
|
38
38
|
import i18n from 'i18next';
|
|
39
39
|
import { initReactI18next } from 'react-i18next';
|
|
40
40
|
import html2canvas from 'html2canvas';
|
|
@@ -300,7 +300,7 @@ function MSummaryCard({ title, description, icon, iconSize, iconTheme, Summary,
|
|
|
300
300
|
}
|
|
301
301
|
|
|
302
302
|
const LiquidContext = createContext({
|
|
303
|
-
language: 'en
|
|
303
|
+
language: 'en',
|
|
304
304
|
currency: {
|
|
305
305
|
symbol: '$',
|
|
306
306
|
precision: 2,
|
|
@@ -548,25 +548,59 @@ function useOffcanvasContext() {
|
|
|
548
548
|
return context;
|
|
549
549
|
}
|
|
550
550
|
|
|
551
|
-
|
|
552
|
-
|
|
551
|
+
function MDatePickerTime(_a) {
|
|
552
|
+
var { value, onChange, mId, label } = _a, props = __rest(_a, ["value", "onChange", "mId", "label"]);
|
|
553
|
+
return (jsxs("div", Object.assign({ className: "d-flex align-items-center gap-2 flex-column m-datepicker-time" }, { children: [label && (jsx("p", Object.assign({ className: "m-datepicker-time-label" }, { children: label }))), jsx(MInput, Object.assign({}, onChange && {
|
|
554
|
+
onMChange: (time) => onChange(time),
|
|
555
|
+
}, { type: "time", mId: mId, value: value }, props))] })));
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
function MDatePickerInput(_a, ref) {
|
|
559
|
+
var { value, onClick, mId, iconEnd } = _a, props = __rest(_a, ["value", "onClick", "mId", "iconEnd"]);
|
|
560
|
+
useImperativeHandle(ref, () => ({}), []);
|
|
561
|
+
return (jsx("div", Object.assign({ role: "button", onClick: onClick, onKeyDown: () => { }, tabIndex: -1 }, { children: jsx(MInput, Object.assign({ isReadOnly: true, type: "text", mId: mId, value: value, onMIconEndClick: onClick, iconEnd: iconEnd }, props)) })));
|
|
562
|
+
}
|
|
563
|
+
var MDatePickerInput$1 = forwardRef(MDatePickerInput);
|
|
564
|
+
|
|
565
|
+
function MMonthPicker(_a) {
|
|
566
|
+
var { setDate, date } = _a, props = __rest(_a, ["setDate", "date"]);
|
|
553
567
|
const dateJS = (value) => DateTime.fromISO(value).toJSDate();
|
|
554
568
|
const { language } = useLiquidContext();
|
|
555
|
-
const lang = language
|
|
556
|
-
return (jsx(DatePicker, Object.assign({ selected: dateJS(date), onChange: (value) => {
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
569
|
+
const lang = language || 'en';
|
|
570
|
+
return (jsx(DatePicker, Object.assign({ showMonthYearPicker: true, selected: dateJS(date), calendarClassName: "m-month-picker", onChange: (value) => {
|
|
571
|
+
setDate(value);
|
|
572
|
+
}, customInput: (jsx("p", Object.assign({ className: "fw-bold text-capitalize" }, { children: DateTime.fromISO(date).setLocale(lang).toFormat('MMMM yyyy') }))), renderCustomHeader: ({ monthDate, decreaseYear, increaseYear, prevYearButtonDisabled, nextYearButtonDisabled, }) => (jsxs("div", Object.assign({ className: "d-flex align-items-center justify-content-between gap-4 fs-6 bg-dark" }, { children: [jsx(MButton, { iconStart: "chevron-left", size: "sm", variant: "link", theme: "light", onMClick: decreaseYear, isDisabled: prevYearButtonDisabled }), jsx("p", Object.assign({ className: "fs-6 fw-bold" }, { children: monthDate.getFullYear() })), jsx(MButton, { iconStart: "chevron-right", size: "sm", variant: "link", theme: "light", onMClick: increaseYear, isDisabled: nextYearButtonDisabled })] }))) }, props)));
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
function MDatePickerHeader({ monthDate, changeMonth, changeYear, decreaseMonth, increaseMonth, prevMonthButtonDisabled, nextMonthButtonDisabled, withMonthSelector, decreaseMonthIcon, increaseMonthIcon, iconSize, buttonVariant, buttonTheme, }) {
|
|
576
|
+
const { language } = useLiquidContext();
|
|
577
|
+
const lang = language || 'en';
|
|
578
|
+
return (jsxs("div", Object.assign({ className: "d-flex align-items-center justify-content-between m-datepicker-header" }, { children: [jsx(MButton, { iconStart: decreaseMonthIcon, size: iconSize, variant: buttonVariant, theme: buttonTheme, onMClick: decreaseMonth, isDisabled: prevMonthButtonDisabled }), jsx(MMonthPicker, Object.assign({}, !withMonthSelector && { readOnly: true }, { date: monthDate.toISOString(), setDate: (value) => {
|
|
579
|
+
if (value) {
|
|
580
|
+
changeMonth(DateTime.fromJSDate(value).month - 1);
|
|
581
|
+
changeYear(DateTime.fromJSDate(value).year);
|
|
582
|
+
}
|
|
583
|
+
} }, lang && { locale: lang })), jsx(MButton, { iconStart: increaseMonthIcon, size: iconSize, variant: buttonVariant, theme: buttonTheme, onMClick: increaseMonth, isDisabled: nextMonthButtonDisabled })] })));
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
function MDatePicker(_a) {
|
|
587
|
+
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 = __rest(_a, ["setDate", "date", "selectsRange", "withMonthSelector", "inputLabel", "inputIcon", "inputId", "timeId", "timeLabel", "headerDecreaseMonthIcon", "headerIncreaseMonthIcon", "headerIconSize", "headerButtonVariant", "headerButtonTheme"]);
|
|
588
|
+
const dateJS = (value) => DateTime.fromISO(value).toJSDate();
|
|
589
|
+
const { language } = useLiquidContext();
|
|
590
|
+
const lang = language || 'en';
|
|
591
|
+
// eslint-disable-next-line react/no-unstable-nested-components
|
|
592
|
+
const InputPicker = forwardRef(({ value, onClick }, ref) => (jsx(MDatePickerInput$1, { label: inputLabel, mId: inputId, iconEnd: inputIcon, value: value, onClick: onClick, ref: ref })));
|
|
593
|
+
const TimeInputPicker = useCallback(({ value, onChange }) => (jsx(MDatePickerTime, { onChange: onChange, value: value, label: timeLabel, mId: timeId })), [timeLabel, timeId]);
|
|
594
|
+
const DatePickerHeader = useCallback((headerProps) => (jsx(MDatePickerHeader, Object.assign({}, headerProps, { decreaseMonthIcon: headerDecreaseMonthIcon, increaseMonthIcon: headerIncreaseMonthIcon, iconSize: headerIconSize, buttonVariant: headerButtonVariant, buttonTheme: headerButtonTheme, withMonthSelector: !!withMonthSelector }))), [headerButtonTheme,
|
|
595
|
+
headerButtonVariant,
|
|
596
|
+
headerDecreaseMonthIcon,
|
|
597
|
+
headerIconSize,
|
|
598
|
+
headerIncreaseMonthIcon,
|
|
599
|
+
withMonthSelector,
|
|
600
|
+
]);
|
|
601
|
+
return (jsx(DatePicker, Object.assign({ selected: dateJS(date), calendarClassName: "m-date-picker", onChange: (value) => {
|
|
602
|
+
setDate(value);
|
|
603
|
+
}, renderCustomHeader: (headerProps) => jsx(DatePickerHeader, Object.assign({}, headerProps)), customInput: jsx(InputPicker, {}), customTimeInput: jsx(TimeInputPicker, {}), selectsRange: selectsRange }, lang && { locale: lang }, props)));
|
|
570
604
|
}
|
|
571
605
|
|
|
572
606
|
function MSkeleton({ speed = 2, viewBox, backgroundColor, foregroundColor, children, }) {
|
|
@@ -749,7 +783,11 @@ function MTooltip({ classNameContainer, className, offSet = ARROW_HEIGHT + GAP,
|
|
|
749
783
|
function MInputCurrency(_a) {
|
|
750
784
|
var { onChange, onBlur, onFocus } = _a, otherProps = __rest(_a, ["onChange", "onBlur", "onFocus"]);
|
|
751
785
|
const { currency } = useLiquidContext();
|
|
752
|
-
return (jsx(MInputCurrencyBase, Object.assign({ currencyOptions: currency, onMChange: ({ detail }) => onChange(detail)
|
|
786
|
+
return (jsx(MInputCurrencyBase, Object.assign({ currencyOptions: currency, onMChange: ({ detail }) => onChange(detail) }, onBlur && {
|
|
787
|
+
onMBlur: ({ detail }) => onBlur(detail),
|
|
788
|
+
}, onFocus && {
|
|
789
|
+
onMFocus: ({ detail }) => onFocus(detail),
|
|
790
|
+
}, otherProps)));
|
|
753
791
|
}
|
|
754
792
|
|
|
755
793
|
function MBoxFile(_a) {
|
|
@@ -919,6 +957,31 @@ function MFormikInputCurrency(_a) {
|
|
|
919
957
|
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
958
|
}
|
|
921
959
|
|
|
960
|
+
function MCard({ className, style, children, }) {
|
|
961
|
+
return (jsx("div", Object.assign({ style: style, className: classNames('card', className) }, { children: children })));
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
function MCardBody({ className, children, }) {
|
|
965
|
+
return (jsx("div", Object.assign({ className: classNames('card-body', className) }, { children: children })));
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
function MCardAccount({ className, icon, theme, name, number, balance, balanceText, onClick, onClickText, }) {
|
|
969
|
+
return (jsx(MCard, Object.assign({ className: classNames('m-card-account', className) }, { children: jsxs(MCardBody, { children: [jsxs("div", Object.assign({ className: "d-flex gap-3 align-items-center" }, { children: [jsx(MIcon, { 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(MButton, { text: onClickText, variant: "link", size: "sm", theme: "secondary", iconEnd: "chevron-right", onMClick: onClick }) }))] }) })));
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
function MCardHeader({ className, children, }) {
|
|
973
|
+
return (jsx("div", Object.assign({ className: classNames('card-header', className) }, { children: children })));
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
function MCardFooter({ className, children, }) {
|
|
977
|
+
return (jsx("div", Object.assign({ className: classNames('card-footer', className) }, { children: children })));
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
function MPaginator(_a) {
|
|
981
|
+
var { className, nextLabel, previousLabel, showArrows = true } = _a, props = __rest(_a, ["className", "nextLabel", "previousLabel", "showArrows"]);
|
|
982
|
+
return (jsx(ResponsivePagination, Object.assign({ extraClassName: classNames('m-pagination', className), nextClassName: classNames('m-arrow m-arrow-next', !nextLabel && 'no-label'), nextLabel: nextLabel, previousClassName: classNames('m-arrow m-arrow-prev', !previousLabel && 'no-label'), previousLabel: previousLabel, renderNav: showArrows }, props)));
|
|
983
|
+
}
|
|
984
|
+
|
|
922
985
|
const LANG = liquidParser.parse('{{site.language}}');
|
|
923
986
|
async function configureI8n(resources, _a = {}) {
|
|
924
987
|
var { lng = LANG, fallbackLng = 'es' } = _a, config = __rest(_a, ["lng", "fallbackLng"]);
|
|
@@ -934,5 +997,5 @@ async function configureI8n(resources, _a = {}) {
|
|
|
934
997
|
.then((t) => t);
|
|
935
998
|
}
|
|
936
999
|
|
|
937
|
-
export { LiquidContext$1 as LiquidContext, LiquidContextProvider, MAlert, MBadge, MBoxFile, MButton,
|
|
1000
|
+
export { LiquidContext$1 as LiquidContext, LiquidContextProvider, MAlert, MBadge, MBoxFile, MButton, MCard, MCardAccount, MCardBody, MCardFooter, MCardHeader, MCarousel, MCarouselSlide, MChip, MCollapse, MCollapseIconText, MCurrencyText, MDatePicker, MFormikInput, MFormikInputCurrency, MFormikInputSelect, MIcon, MInput, MInputCheck, MInputCounter, MInputCurrency, MInputCurrencyBase, MInputPassword, MInputPin, MInputSearch, MInputSelect, MInputSwitch, MList, MListItem, MListItemMovement, MModal, MOffcanvas, MPaginator, 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 };
|
|
938
1001
|
//# sourceMappingURL=index.esm.js.map
|