@dynamic-framework/ui-react 1.2.0 → 1.2.1
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 +89 -32
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +91 -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 +6 -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,6 +24,14 @@ 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';
|
|
38
37
|
import i18n from 'i18next';
|
|
@@ -300,7 +299,7 @@ function MSummaryCard({ title, description, icon, iconSize, iconTheme, Summary,
|
|
|
300
299
|
}
|
|
301
300
|
|
|
302
301
|
const LiquidContext = createContext({
|
|
303
|
-
language: 'en
|
|
302
|
+
language: 'en',
|
|
304
303
|
currency: {
|
|
305
304
|
symbol: '$',
|
|
306
305
|
precision: 2,
|
|
@@ -548,25 +547,59 @@ function useOffcanvasContext() {
|
|
|
548
547
|
return context;
|
|
549
548
|
}
|
|
550
549
|
|
|
551
|
-
|
|
552
|
-
|
|
550
|
+
function MDatePickerTime(_a) {
|
|
551
|
+
var { value, onChange, mId, label } = _a, props = __rest(_a, ["value", "onChange", "mId", "label"]);
|
|
552
|
+
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 && {
|
|
553
|
+
onMChange: (time) => onChange(time),
|
|
554
|
+
}, { type: "time", mId: mId, value: value }, props))] })));
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
function MDatePickerInput(_a, ref) {
|
|
558
|
+
var { value, onClick, mId, iconEnd } = _a, props = __rest(_a, ["value", "onClick", "mId", "iconEnd"]);
|
|
559
|
+
useImperativeHandle(ref, () => ({}), []);
|
|
560
|
+
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)) })));
|
|
561
|
+
}
|
|
562
|
+
var MDatePickerInput$1 = forwardRef(MDatePickerInput);
|
|
563
|
+
|
|
564
|
+
function MMonthPicker(_a) {
|
|
565
|
+
var { setDate, date } = _a, props = __rest(_a, ["setDate", "date"]);
|
|
553
566
|
const dateJS = (value) => DateTime.fromISO(value).toJSDate();
|
|
554
567
|
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
|
-
|
|
568
|
+
const lang = language || 'en';
|
|
569
|
+
return (jsx(DatePicker, Object.assign({ showMonthYearPicker: true, selected: dateJS(date), calendarClassName: "m-month-picker", onChange: (value) => {
|
|
570
|
+
setDate(value);
|
|
571
|
+
}, 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)));
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
function MDatePickerHeader({ monthDate, changeMonth, changeYear, decreaseMonth, increaseMonth, prevMonthButtonDisabled, nextMonthButtonDisabled, withMonthSelector, decreaseMonthIcon, increaseMonthIcon, iconSize, buttonVariant, buttonTheme, }) {
|
|
575
|
+
const { language } = useLiquidContext();
|
|
576
|
+
const lang = language || 'en';
|
|
577
|
+
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) => {
|
|
578
|
+
if (value) {
|
|
579
|
+
changeMonth(DateTime.fromJSDate(value).month - 1);
|
|
580
|
+
changeYear(DateTime.fromJSDate(value).year);
|
|
581
|
+
}
|
|
582
|
+
} }, lang && { locale: lang })), jsx(MButton, { iconStart: increaseMonthIcon, size: iconSize, variant: buttonVariant, theme: buttonTheme, onMClick: increaseMonth, isDisabled: nextMonthButtonDisabled })] })));
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
function MDatePicker(_a) {
|
|
586
|
+
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"]);
|
|
587
|
+
const dateJS = (value) => DateTime.fromISO(value).toJSDate();
|
|
588
|
+
const { language } = useLiquidContext();
|
|
589
|
+
const lang = language || 'en';
|
|
590
|
+
// eslint-disable-next-line react/no-unstable-nested-components
|
|
591
|
+
const InputPicker = forwardRef(({ value, onClick }, ref) => (jsx(MDatePickerInput$1, { label: inputLabel, mId: inputId, iconEnd: inputIcon, value: value, onClick: onClick, ref: ref })));
|
|
592
|
+
const TimeInputPicker = useCallback(({ value, onChange }) => (jsx(MDatePickerTime, { onChange: onChange, value: value, label: timeLabel, mId: timeId })), [timeLabel, timeId]);
|
|
593
|
+
const DatePickerHeader = useCallback((headerProps) => (jsx(MDatePickerHeader, Object.assign({}, headerProps, { decreaseMonthIcon: headerDecreaseMonthIcon, increaseMonthIcon: headerIncreaseMonthIcon, iconSize: headerIconSize, buttonVariant: headerButtonVariant, buttonTheme: headerButtonTheme, withMonthSelector: !!withMonthSelector }))), [headerButtonTheme,
|
|
594
|
+
headerButtonVariant,
|
|
595
|
+
headerDecreaseMonthIcon,
|
|
596
|
+
headerIconSize,
|
|
597
|
+
headerIncreaseMonthIcon,
|
|
598
|
+
withMonthSelector,
|
|
599
|
+
]);
|
|
600
|
+
return (jsx(DatePicker, Object.assign({ selected: dateJS(date), calendarClassName: "m-date-picker", onChange: (value) => {
|
|
601
|
+
setDate(value);
|
|
602
|
+
}, renderCustomHeader: (headerProps) => jsx(DatePickerHeader, Object.assign({}, headerProps)), customInput: jsx(InputPicker, {}), customTimeInput: jsx(TimeInputPicker, {}), selectsRange: selectsRange }, lang && { locale: lang }, props)));
|
|
570
603
|
}
|
|
571
604
|
|
|
572
605
|
function MSkeleton({ speed = 2, viewBox, backgroundColor, foregroundColor, children, }) {
|
|
@@ -749,7 +782,11 @@ function MTooltip({ classNameContainer, className, offSet = ARROW_HEIGHT + GAP,
|
|
|
749
782
|
function MInputCurrency(_a) {
|
|
750
783
|
var { onChange, onBlur, onFocus } = _a, otherProps = __rest(_a, ["onChange", "onBlur", "onFocus"]);
|
|
751
784
|
const { currency } = useLiquidContext();
|
|
752
|
-
return (jsx(MInputCurrencyBase, Object.assign({ currencyOptions: currency, onMChange: ({ detail }) => onChange(detail)
|
|
785
|
+
return (jsx(MInputCurrencyBase, Object.assign({ currencyOptions: currency, onMChange: ({ detail }) => onChange(detail) }, onBlur && {
|
|
786
|
+
onMBlur: ({ detail }) => onBlur(detail),
|
|
787
|
+
}, onFocus && {
|
|
788
|
+
onMFocus: ({ detail }) => onFocus(detail),
|
|
789
|
+
}, otherProps)));
|
|
753
790
|
}
|
|
754
791
|
|
|
755
792
|
function MBoxFile(_a) {
|
|
@@ -919,6 +956,26 @@ function MFormikInputCurrency(_a) {
|
|
|
919
956
|
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
957
|
}
|
|
921
958
|
|
|
959
|
+
function MCard({ className, style, children, }) {
|
|
960
|
+
return (jsx("div", Object.assign({ style: style, className: classNames('card', className) }, { children: children })));
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
function MCardBody({ className, children, }) {
|
|
964
|
+
return (jsx("div", Object.assign({ className: classNames('card-body', className) }, { children: children })));
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
function MCardAccount({ className, icon, theme, name, number, balance, balanceText, onClick, onClickText, }) {
|
|
968
|
+
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 }) }))] }) })));
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
function MCardHeader({ className, children, }) {
|
|
972
|
+
return (jsx("div", Object.assign({ className: classNames('card-header', className) }, { children: children })));
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
function MCardFooter({ className, children, }) {
|
|
976
|
+
return (jsx("div", Object.assign({ className: classNames('card-footer', className) }, { children: children })));
|
|
977
|
+
}
|
|
978
|
+
|
|
922
979
|
const LANG = liquidParser.parse('{{site.language}}');
|
|
923
980
|
async function configureI8n(resources, _a = {}) {
|
|
924
981
|
var { lng = LANG, fallbackLng = 'es' } = _a, config = __rest(_a, ["lng", "fallbackLng"]);
|
|
@@ -934,5 +991,5 @@ async function configureI8n(resources, _a = {}) {
|
|
|
934
991
|
.then((t) => t);
|
|
935
992
|
}
|
|
936
993
|
|
|
937
|
-
export { LiquidContext$1 as LiquidContext, LiquidContextProvider, MAlert, MBadge, MBoxFile, MButton,
|
|
994
|
+
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, 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
995
|
//# sourceMappingURL=index.esm.js.map
|