@dynamic-framework/ui-react 1.7.3 → 1.8.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-non-root.css +17060 -0
- package/dist/css/dynamic-ui-non-root.min.css +1 -0
- package/dist/css/{dynamic-root.css → dynamic-ui-root.css} +5 -0
- package/dist/css/{dynamic-root.min.css → dynamic-ui-root.min.css} +1 -1
- package/dist/css/dynamic-ui.css +132 -60
- package/dist/css/dynamic-ui.min.css +1 -1
- package/dist/index.esm.js +414 -551
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +572 -725
- package/dist/index.js.map +1 -1
- package/dist/types/components/{DAlert.d.ts → DAlert/DAlert.d.ts} +3 -5
- package/dist/types/components/DAlert/index.d.ts +2 -0
- package/dist/types/components/{DBadge.d.ts → DBadge/DBadge.d.ts} +2 -4
- package/dist/types/components/DBadge/index.d.ts +2 -0
- package/dist/types/components/DBoxFile/DBoxFile.d.ts +9 -0
- package/dist/types/components/DBoxFile/index.d.ts +2 -0
- package/dist/types/components/{DButton.d.ts → DButton/DButton.d.ts} +3 -5
- package/dist/types/components/DButton/index.d.ts +2 -0
- package/dist/types/components/DCard/DCard.d.ts +13 -0
- package/dist/types/components/DCard/components/DCardBody.d.ts +5 -0
- package/dist/types/components/DCard/components/DCardFooter.d.ts +5 -0
- package/dist/types/components/DCard/components/DCardHeader.d.ts +5 -0
- package/dist/types/components/DCard/index.d.ts +5 -0
- package/dist/types/components/DCardAccount/DCardAccount.d.ts +13 -0
- package/dist/types/components/DCardAccount/index.d.ts +2 -0
- package/dist/types/components/DCarousel/DCarousel.d.ts +10 -0
- package/dist/types/components/DCarousel/index.d.ts +3 -0
- package/dist/types/components/DChip/DChip.d.ts +10 -0
- package/dist/types/components/DChip/index.d.ts +2 -0
- package/dist/types/components/DCollapse/DCollapse.d.ts +11 -0
- package/dist/types/components/DCollapse/index.d.ts +2 -0
- package/dist/types/components/{DCollapseIconText.d.ts → DCollapseIconText/DCollapseIconText.d.ts} +3 -3
- package/dist/types/components/DCollapseIconText/index.d.ts +2 -0
- package/dist/types/components/DCurrencyText/DCurrencyText.d.ts +7 -0
- package/dist/types/components/DCurrencyText/index.d.ts +2 -0
- package/dist/types/components/DDatePicker/DDatePicker.d.ts +21 -0
- package/dist/types/components/DDatePicker/index.d.ts +2 -0
- package/dist/types/components/{DDatePickerHeader.d.ts → DDatePickerHeader/DDatePickerHeader.d.ts} +5 -4
- package/dist/types/components/DDatePickerHeader/index.d.ts +2 -0
- package/dist/types/components/{DDatePickerInput.d.ts → DDatePickerInput/DDatePickerInput.d.ts} +3 -2
- package/dist/types/components/DDatePickerInput/index.d.ts +2 -0
- package/dist/types/components/DDatePickerTime/DDatePickerTime.d.ts +9 -0
- package/dist/types/components/DDatePickerTime/index.d.ts +2 -0
- package/dist/types/components/DIcon/DIcon.d.ts +16 -0
- package/dist/types/components/DIcon/index.d.ts +2 -0
- package/dist/types/components/DInput/DInput.d.ts +15 -0
- package/dist/types/components/DInput/index.d.ts +2 -0
- package/dist/types/components/{DInputCheck.d.ts → DInputCheck/DInputCheck.d.ts} +3 -3
- package/dist/types/components/DInputCheck/index.d.ts +2 -0
- package/dist/types/components/DInputCounter/DInputCounter.d.ts +20 -0
- package/dist/types/components/DInputCounter/index.d.ts +2 -0
- package/dist/types/components/DInputCurrency/DInputCurrency.d.ts +21 -0
- package/dist/types/components/DInputCurrency/index.d.ts +2 -0
- package/dist/types/components/DInputCurrencyBase/DInputCurrencyBase.d.ts +23 -0
- package/dist/types/components/DInputCurrencyBase/index.d.ts +2 -0
- package/dist/types/components/DInputPassword/DInputPassword.d.ts +5 -0
- package/dist/types/components/DInputPassword/index.d.ts +2 -0
- package/dist/types/components/{DInputPin.d.ts → DInputPin/DInputPin.d.ts} +3 -3
- package/dist/types/components/DInputPin/index.d.ts +2 -0
- package/dist/types/components/DInputSearch/DInputSearch.d.ts +17 -0
- package/dist/types/components/DInputSearch/index.d.ts +2 -0
- package/dist/types/components/{DInputSelect.d.ts → DInputSelect/DInputSelect.d.ts} +3 -4
- package/dist/types/components/DInputSelect/index.d.ts +3 -0
- package/dist/types/components/{DInputSwitch.d.ts → DInputSwitch/DInputSwitch.d.ts} +4 -3
- package/dist/types/components/DInputSwitch/index.d.ts +2 -0
- package/dist/types/components/DList/DList.d.ts +14 -0
- package/dist/types/components/DList/components/DListItem.d.ts +10 -0
- package/dist/types/components/DList/index.d.ts +3 -0
- package/dist/types/components/DListItemMovement/DListItemMovement.d.ts +10 -0
- package/dist/types/components/DListItemMovement/index.d.ts +2 -0
- package/dist/types/components/DModal/DModal.d.ts +21 -0
- package/dist/types/components/DModal/components/DModalBody.d.ts +7 -0
- package/dist/types/components/DModal/components/DModalFooter.d.ts +7 -0
- package/dist/types/components/{DModalHeader.d.ts → DModal/components/DModalHeader.d.ts} +3 -2
- package/dist/types/components/DModal/index.d.ts +5 -0
- package/dist/types/components/DMonthPicker/DMonthPicker.d.ts +9 -0
- package/dist/types/components/DMonthPicker/index.d.ts +2 -0
- package/dist/types/components/DOffcanvas/DOffcanvas.d.ts +18 -0
- package/dist/types/components/DOffcanvas/components/DOffcanvasBody.d.ts +7 -0
- package/dist/types/components/{DOffcanvasFooter.d.ts → DOffcanvas/components/DOffcanvasFooter.d.ts} +3 -2
- package/dist/types/components/{DOffcanvasHeader.d.ts → DOffcanvas/components/DOffcanvasHeader.d.ts} +3 -2
- package/dist/types/components/DOffcanvas/index.d.ts +5 -0
- package/dist/types/components/DPaginator/index.d.ts +2 -0
- package/dist/types/components/{DPopover.d.ts → DPopover/DPopover.d.ts} +3 -2
- package/dist/types/components/DPopover/index.d.ts +2 -0
- package/dist/types/components/DProgress/DProgress.d.ts +10 -0
- package/dist/types/components/DProgress/index.d.ts +2 -0
- package/dist/types/components/{DQuickActionButton.d.ts → DQuickActionButton/DQuickActionButton.d.ts} +2 -4
- package/dist/types/components/DQuickActionButton/index.d.ts +2 -0
- package/dist/types/components/{DQuickActionCheck.d.ts → DQuickActionCheck/DQuickActionCheck.d.ts} +3 -3
- package/dist/types/components/DQuickActionCheck/index.d.ts +2 -0
- package/dist/types/components/{DQuickActionSelect.d.ts → DQuickActionSelect/DQuickActionSelect.d.ts} +3 -3
- package/dist/types/components/DQuickActionSelect/index.d.ts +2 -0
- package/dist/types/components/{DQuickActionSwitch.d.ts → DQuickActionSwitch/DQuickActionSwitch.d.ts} +3 -3
- package/dist/types/components/DQuickActionSwitch/index.d.ts +2 -0
- package/dist/types/components/DSkeleton/index.d.ts +2 -0
- package/dist/types/components/{DStepper.d.ts → DStepper/DStepper.d.ts} +3 -3
- package/dist/types/components/DStepper/index.d.ts +2 -0
- package/dist/types/components/{DStepperDesktop.d.ts → DStepperDesktop/DStepperDesktop.d.ts} +3 -2
- package/dist/types/components/DStepperDesktop/index.d.ts +2 -0
- package/dist/types/components/DStepperMobile/DStepperMobile.d.ts +12 -0
- package/dist/types/components/DStepperMobile/index.d.ts +2 -0
- package/dist/types/components/DTabs/DTabs.d.ts +19 -0
- package/dist/types/components/DTabs/TabContext.d.ts +8 -0
- package/dist/types/components/DTabs/components/DTabContent.d.ts +7 -0
- package/dist/types/components/DTabs/index.d.ts +5 -0
- package/dist/types/components/{DToastContainer.d.ts → DToastContainer/DToastContainer.d.ts} +3 -2
- package/dist/types/components/DToastContainer/index.d.ts +3 -0
- package/dist/types/{hooks → components/DToastContainer}/useToast.d.ts +1 -1
- package/dist/types/components/{DTooltip.d.ts → DTooltip/DTooltip.d.ts} +3 -4
- package/dist/types/components/DTooltip/index.d.ts +2 -0
- package/dist/types/components/index.d.ts +11 -26
- package/dist/types/components/interface.d.ts +9 -4
- package/dist/types/contexts/DContext.d.ts +13 -0
- package/dist/types/contexts/index.d.ts +1 -1
- package/dist/types/hooks/index.d.ts +3 -4
- package/dist/types/hooks/useInputCurrency.d.ts +16 -0
- package/dist/types/hooks/useProvidedRefOrCreate.d.ts +16 -0
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/polymorphic.d.ts +37 -0
- package/dist/types/utils/index.d.ts +0 -1
- package/package.json +48 -55
- package/src/style/abstracts/variables/_buttons.scss +1 -1
- package/src/style/abstracts/variables/_forms.scss +4 -4
- package/src/style/abstracts/variables/_toasts.scss +1 -1
- package/src/style/abstracts/variables/_typography.scss +1 -1
- package/src/style/base/_+import.scss +0 -3
- package/src/style/components/_d-input.scss +10 -5
- package/src/style/components/_d-monthpicker.scss +8 -0
- package/src/style/dynamic-ui-non-root.scss +13 -0
- package/src/style/dynamic-ui-root.scss +5 -0
- package/src/style/dynamic-ui.scss +2 -0
- package/src/style/root/_+import.scss +2 -0
- package/src/style/{base → root}/_root.scss +6 -0
- package/dist/types/components/DBoxFile.d.ts +0 -9
- package/dist/types/components/DCard.d.ts +0 -7
- package/dist/types/components/DCardAccount.d.ts +0 -13
- package/dist/types/components/DCardBody.d.ts +0 -6
- package/dist/types/components/DCardFooter.d.ts +0 -6
- package/dist/types/components/DCardHeader.d.ts +0 -6
- package/dist/types/components/DCarousel.d.ts +0 -7
- package/dist/types/components/DChip.d.ts +0 -10
- package/dist/types/components/DCollapse.d.ts +0 -11
- package/dist/types/components/DCurrencyText.d.ts +0 -6
- package/dist/types/components/DDatePicker.d.ts +0 -20
- package/dist/types/components/DDatePickerTime.d.ts +0 -8
- package/dist/types/components/DFormikInput.d.ts +0 -7
- package/dist/types/components/DFormikInputCurrency.d.ts +0 -7
- package/dist/types/components/DFormikInputSelect.d.ts +0 -6
- package/dist/types/components/DIcon.d.ts +0 -16
- package/dist/types/components/DInput.d.ts +0 -32
- package/dist/types/components/DInputCounter.d.ts +0 -22
- package/dist/types/components/DInputCurrency.d.ts +0 -5
- package/dist/types/components/DInputCurrencyBase.d.ts +0 -25
- package/dist/types/components/DInputPassword.d.ts +0 -17
- package/dist/types/components/DInputSearch.d.ts +0 -19
- package/dist/types/components/DList.d.ts +0 -11
- package/dist/types/components/DListItem.d.ts +0 -10
- package/dist/types/components/DListItemMovement.d.ts +0 -10
- package/dist/types/components/DModal.d.ts +0 -14
- package/dist/types/components/DModalBody.d.ts +0 -6
- package/dist/types/components/DModalFooter.d.ts +0 -6
- package/dist/types/components/DMonthPicker.d.ts +0 -7
- package/dist/types/components/DOffcanvas.d.ts +0 -11
- package/dist/types/components/DOffcanvasBody.d.ts +0 -6
- package/dist/types/components/DProgress.d.ts +0 -9
- package/dist/types/components/DStepperMobile.d.ts +0 -11
- package/dist/types/components/DTabContent.d.ts +0 -6
- package/dist/types/components/DTabs.d.ts +0 -19
- package/dist/types/contexts/LiquidContext.d.ts +0 -14
- package/dist/types/hooks/useScreenshot.d.ts +0 -5
- package/dist/types/hooks/useScreenshotDownload.d.ts +0 -5
- package/dist/types/hooks/useScreenshotWebShare.d.ts +0 -5
- package/dist/types/stories/components/DBadge.stories.d.ts +0 -8
- package/dist/types/stories/components/DBoxFile.stories.d.ts +0 -6
- package/dist/types/stories/components/DButton.stories.d.ts +0 -35
- package/dist/types/stories/components/DChip.stories.d.ts +0 -9
- package/dist/types/stories/components/DCurrencyText.stories.d.ts +0 -6
- package/dist/types/stories/components/DDatePicker.stories.d.ts +0 -14
- package/dist/types/stories/components/DFormikInput.stories.d.ts +0 -7
- package/dist/types/stories/components/DFormikInputCurrency.stories.d.ts +0 -8
- package/dist/types/stories/components/DFormikInputSelect.stories.d.ts +0 -7
- package/dist/types/stories/components/DIcon.stories.d.ts +0 -7
- package/dist/types/stories/components/DInput.stories.d.ts +0 -11
- package/dist/types/stories/components/DInputCheck.stories.d.ts +0 -13
- package/dist/types/stories/components/DInputCounter.stories.d.ts +0 -9
- package/dist/types/stories/components/DInputCurrency.stories.d.ts +0 -11
- package/dist/types/stories/components/DInputCurrencyBase.stories.d.ts +0 -11
- package/dist/types/stories/components/DInputPassword.stories.d.ts +0 -10
- package/dist/types/stories/components/DInputPin.stories.d.ts +0 -10
- package/dist/types/stories/components/DInputSearch.stories.d.ts +0 -10
- package/dist/types/stories/components/DInputSelect.stories.d.ts +0 -14
- package/dist/types/stories/components/DInputSwitch.stories.d.ts +0 -11
- package/dist/types/stories/components/DList.stories.d.ts +0 -10
- package/dist/types/stories/components/DListItem.stories.d.ts +0 -9
- package/dist/types/stories/components/DListItemMovement.stories.d.ts +0 -7
- package/dist/types/stories/components/DPaginator.stories.d.ts +0 -10
- package/dist/types/stories/components/DProgress.stories.d.ts +0 -12
- package/dist/types/stories/components/DQuickActionButton.stories.d.ts +0 -10
- package/dist/types/stories/components/DQuickActionCheck.stories.d.ts +0 -8
- package/dist/types/stories/components/DQuickActionSelect.stories.d.ts +0 -8
- package/dist/types/stories/components/DQuickActionSwitch.stories.d.ts +0 -9
- package/dist/types/stories/components/DSkeleton.stories.d.ts +0 -6
- package/dist/types/stories/components/DStepper.stories.d.ts +0 -7
- package/dist/types/stories/components/DStepperDesktop.stories.d.ts +0 -7
- package/dist/types/stories/components/DStepperMobile.stories.d.ts +0 -6
- package/dist/types/stories/components/DTooltip.stories.d.ts +0 -18
- package/dist/types/stories/config/constants.d.ts +0 -7
- package/dist/types/stories/config/liquidConfig.d.ts +0 -1
- package/dist/types/stories/hooks/useFormatCurrency.stories.d.ts +0 -6
- package/dist/types/stories/hooks/useModalContext.stories.d.ts +0 -6
- package/dist/types/stories/hooks/useOffcanvasContext.stories.d.ts +0 -7
- package/dist/types/stories/hooks/useToast.stories.d.ts +0 -17
- package/dist/types/stories/patterns/DAlert.stories.d.ts +0 -24
- package/dist/types/stories/patterns/DCard.stories.d.ts +0 -10
- package/dist/types/stories/patterns/DCardAccount.stories.d.ts +0 -6
- package/dist/types/stories/patterns/DCarousel.stories.d.ts +0 -9
- package/dist/types/stories/patterns/DCollapse.stories.d.ts +0 -8
- package/dist/types/stories/patterns/DCollapseIconText.stories.d.ts +0 -6
- package/dist/types/stories/patterns/DModal.stories.d.ts +0 -12
- package/dist/types/stories/patterns/DOffcanvas.stories.d.ts +0 -12
- package/dist/types/stories/patterns/DPopover.stories.d.ts +0 -9
- package/dist/types/stories/patterns/DTabs.stories.d.ts +0 -7
- package/dist/types/utils/liquid-parser.d.ts +0 -20
- package/src/style/dynamic-root.scss +0 -6
- /package/dist/types/components/{DCarouselSlide.d.ts → DCarousel/components/DCarouselSlide.d.ts} +0 -0
- /package/dist/types/components/{DPaginator.d.ts → DPaginator/DPaginator.d.ts} +0 -0
- /package/dist/types/components/{DSkeleton.d.ts → DSkeleton/DSkeleton.d.ts} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,56 +1,42 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const i18n = require('i18next');
|
|
20
|
-
const reactI18next = require('react-i18next');
|
|
21
|
-
const html2canvas = require('html2canvas');
|
|
22
|
-
const reactDom = require('react-dom');
|
|
23
|
-
|
|
24
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
25
|
-
|
|
26
|
-
const classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
27
|
-
const currency__default = /*#__PURE__*/_interopDefaultLegacy(currency);
|
|
28
|
-
const DatePicker__default = /*#__PURE__*/_interopDefaultLegacy(DatePicker);
|
|
29
|
-
const ResponsivePagination__default = /*#__PURE__*/_interopDefaultLegacy(ResponsivePagination);
|
|
30
|
-
const ContentLoader__default = /*#__PURE__*/_interopDefaultLegacy(ContentLoader);
|
|
31
|
-
const i18n__default = /*#__PURE__*/_interopDefaultLegacy(i18n);
|
|
32
|
-
const html2canvas__default = /*#__PURE__*/_interopDefaultLegacy(html2canvas);
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var classNames = require('classnames');
|
|
6
|
+
var tslib = require('tslib');
|
|
7
|
+
var reactDropzone = require('react-dropzone');
|
|
8
|
+
var reactSplide = require('@splidejs/react-splide');
|
|
9
|
+
var currency = require('currency.js');
|
|
10
|
+
var DatePicker = require('react-datepicker');
|
|
11
|
+
var dateFns = require('date-fns');
|
|
12
|
+
var ResponsivePagination = require('react-responsive-pagination');
|
|
13
|
+
var react = require('@floating-ui/react');
|
|
14
|
+
var ContentLoader = require('react-content-loader');
|
|
15
|
+
var reactToastify = require('react-toastify');
|
|
16
|
+
var i18n = require('i18next');
|
|
17
|
+
var reactI18next = require('react-i18next');
|
|
18
|
+
var reactDom = require('react-dom');
|
|
33
19
|
|
|
34
20
|
function DBadge({ text, isDot = false, theme = 'primary', id, className, style, }) {
|
|
35
|
-
const generateClasses =
|
|
21
|
+
const generateClasses = React.useMemo(() => ({
|
|
36
22
|
badge: true,
|
|
37
23
|
'badge-dot': isDot,
|
|
38
24
|
[`badge-${theme}`]: !!theme,
|
|
39
25
|
}), [isDot, theme]);
|
|
40
|
-
return (jsxRuntime.jsx("span", Object.assign({ className:
|
|
26
|
+
return (jsxRuntime.jsx("span", Object.assign({ className: classNames(generateClasses, className), style: style }, id && { id }, { children: jsxRuntime.jsx("span", { children: text }) })));
|
|
41
27
|
}
|
|
42
28
|
|
|
43
|
-
function DInputSwitch({ label, id, name, isChecked, isDisabled, isReadonly, onChange, }) {
|
|
44
|
-
const [internalIsChecked, setInternalIsChecked] =
|
|
45
|
-
|
|
29
|
+
function DInputSwitch({ label, id, name, isChecked, isDisabled, isReadonly, className, style, onChange, }) {
|
|
30
|
+
const [internalIsChecked, setInternalIsChecked] = React.useState(isChecked);
|
|
31
|
+
React.useEffect(() => {
|
|
46
32
|
setInternalIsChecked(isChecked);
|
|
47
33
|
}, [isChecked]);
|
|
48
|
-
const changeHandler =
|
|
34
|
+
const changeHandler = React.useCallback((event) => {
|
|
49
35
|
const value = event.currentTarget.checked;
|
|
50
36
|
setInternalIsChecked(value);
|
|
51
37
|
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
52
38
|
}, [onChange]);
|
|
53
|
-
return (jsxRuntime.jsxs("div", { className: "form-check form-switch", children: [jsxRuntime.jsx("input", { id: id, name: name, onChange: isReadonly ? () => false : changeHandler, className:
|
|
39
|
+
return (jsxRuntime.jsxs("div", { className: "form-check form-switch", children: [jsxRuntime.jsx("input", { id: id, name: name, onChange: isReadonly ? () => false : changeHandler, className: classNames('form-check-input', className), style: style, type: "checkbox", role: "switch", checked: internalIsChecked, disabled: isDisabled }), label && (jsxRuntime.jsx("label", { className: "form-check-label", htmlFor: id, children: label }))] }));
|
|
54
40
|
}
|
|
55
41
|
|
|
56
42
|
function DPermissionItem({ permission, permissionState, onChange, onAction = () => { }, }) {
|
|
@@ -71,8 +57,8 @@ const ALERT_TYPE_ICON = {
|
|
|
71
57
|
dark: 'info-circle',
|
|
72
58
|
};
|
|
73
59
|
|
|
74
|
-
function DIcon({ icon, theme, className
|
|
75
|
-
const
|
|
60
|
+
function DIcon({ icon, theme, style, className, size = '1.5rem', isLoading = false, loadingDuration = 1.8, hasCircle = false, circleSize = `calc(var(--${PREFIX_BS}icon-component-size) * 1)`, color, backgroundColor, familyClass = 'bi', familyPrefix = 'bi-', }) {
|
|
61
|
+
const colorStyle = React.useMemo(() => {
|
|
76
62
|
if (color) {
|
|
77
63
|
return { [`--${PREFIX_BS}component-color`]: color };
|
|
78
64
|
}
|
|
@@ -81,7 +67,7 @@ function DIcon({ icon, theme, className = '', size = '1.5rem', isLoading = false
|
|
|
81
67
|
}
|
|
82
68
|
return {};
|
|
83
69
|
}, [color, theme]);
|
|
84
|
-
const
|
|
70
|
+
const backgroundStyle = React.useMemo(() => {
|
|
85
71
|
if (backgroundColor) {
|
|
86
72
|
return { [`--${PREFIX_BS}icon-component-bg-color`]: backgroundColor };
|
|
87
73
|
}
|
|
@@ -93,21 +79,15 @@ function DIcon({ icon, theme, className = '', size = '1.5rem', isLoading = false
|
|
|
93
79
|
}
|
|
94
80
|
return {};
|
|
95
81
|
}, [backgroundColor, hasCircle, theme]);
|
|
96
|
-
const
|
|
82
|
+
const circleSizeStyle = React.useMemo(() => {
|
|
97
83
|
if (hasCircle) {
|
|
98
84
|
return { [`--${PREFIX_BS}icon-component-padding`]: circleSize };
|
|
99
85
|
}
|
|
100
86
|
return { [`--${PREFIX_BS}icon-component-padding`]: '0' };
|
|
101
87
|
}, [circleSize, hasCircle]);
|
|
102
|
-
const generateStyleVariables =
|
|
103
|
-
const generateClasses =
|
|
104
|
-
|
|
105
|
-
[className]: !!className,
|
|
106
|
-
[familyClass]: true,
|
|
107
|
-
[`${familyPrefix}${icon}`]: true,
|
|
108
|
-
'd-icon-loading': isLoading,
|
|
109
|
-
}), [familyClass, familyPrefix, icon, className, isLoading]);
|
|
110
|
-
return (jsxRuntime.jsx("i", { className: classNames__default["default"](generateClasses), style: generateStyleVariables }));
|
|
88
|
+
const generateStyleVariables = React.useMemo(() => (Object.assign(Object.assign(Object.assign(Object.assign({ [`--${PREFIX_BS}icon-component-size`]: size, [`--${PREFIX_BS}icon-component-loading-duration`]: `${loadingDuration}s` }, colorStyle), backgroundStyle), circleSizeStyle), style)), [size, loadingDuration, colorStyle, backgroundStyle, circleSizeStyle, style]);
|
|
89
|
+
const generateClasses = React.useMemo(() => (Object.assign({ 'd-icon': true, [familyClass]: true, [`${familyPrefix}${icon}`]: true, 'd-icon-loading': isLoading }, className && { [className]: true })), [familyClass, familyPrefix, icon, className, isLoading]);
|
|
90
|
+
return (jsxRuntime.jsx("i", { className: classNames(generateClasses), style: generateStyleVariables }));
|
|
111
91
|
}
|
|
112
92
|
|
|
113
93
|
function DSummaryCard({ title, description, icon, iconSize, iconTheme, Summary, }) {
|
|
@@ -115,39 +95,39 @@ function DSummaryCard({ title, description, icon, iconSize, iconTheme, Summary,
|
|
|
115
95
|
}
|
|
116
96
|
|
|
117
97
|
function DAlert({ type = 'light', icon, iconFamilyClass, iconFamilyPrefix, showIcon = false, showClose, onClose, children, id, className, style, }) {
|
|
118
|
-
const generateClasses =
|
|
98
|
+
const generateClasses = React.useMemo(() => ({
|
|
119
99
|
alert: true,
|
|
120
100
|
[`alert-${type}`]: true,
|
|
121
101
|
'fade show': !!showClose,
|
|
122
102
|
className: !!className,
|
|
123
103
|
}), [type, showClose, className]);
|
|
124
|
-
const getIcon =
|
|
125
|
-
const generateStyleVariables =
|
|
104
|
+
const getIcon = React.useMemo(() => icon || ALERT_TYPE_ICON[type] || '', [icon, type]);
|
|
105
|
+
const generateStyleVariables = React.useMemo(() => (Object.assign(Object.assign(Object.assign({}, style), { [`--${PREFIX_BS}alert-component-separator-opacity`]: '0.3' }), type === 'light' && {
|
|
126
106
|
[`--${PREFIX_BS}alert-component-icon-color`]: `var(--${PREFIX_BS}secondary)`,
|
|
127
107
|
})), [style, type]);
|
|
128
|
-
return (jsxRuntime.jsxs("div", { className:
|
|
108
|
+
return (jsxRuntime.jsxs("div", { className: classNames(generateClasses), style: generateStyleVariables, role: "alert", id: id, children: [(showIcon || icon) && (jsxRuntime.jsx(DIcon, Object.assign({ className: "alert-icon", icon: getIcon }, iconFamilyClass && { familyClass: iconFamilyClass }, iconFamilyPrefix && { familyPrefix: iconFamilyPrefix }))), jsxRuntime.jsx("div", { className: "alert-text", children: children }), showClose && (jsxRuntime.jsx("div", { className: "alert-separator" })), showClose && (jsxRuntime.jsx("button", { type: "button", className: "btn-close", "aria-label": "Close", onClick: onClose, children: jsxRuntime.jsx(DIcon, { className: "alert-close-icon", icon: "x-lg", familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) }))] }));
|
|
129
109
|
}
|
|
130
110
|
|
|
131
111
|
function DBoxFile(_a) {
|
|
132
|
-
var { icon = 'cloud-upload', iconFamilyClass, iconFamilyPrefix, isDisabled = false, children } = _a, dropzoneOptions = tslib.__rest(_a, ["icon", "iconFamilyClass", "iconFamilyPrefix", "isDisabled", "children"]);
|
|
112
|
+
var { icon = 'cloud-upload', iconFamilyClass, iconFamilyPrefix, isDisabled = false, children, className, style } = _a, dropzoneOptions = tslib.__rest(_a, ["icon", "iconFamilyClass", "iconFamilyPrefix", "isDisabled", "children", "className", "style"]);
|
|
133
113
|
const { acceptedFiles, getRootProps, getInputProps, } = reactDropzone.useDropzone(Object.assign({ disabled: isDisabled }, dropzoneOptions));
|
|
134
|
-
return (jsxRuntime.jsxs("section", { className:
|
|
114
|
+
return (jsxRuntime.jsxs("section", { className: classNames('d-box-file', {
|
|
135
115
|
'd-box-file-selected': !!acceptedFiles.length,
|
|
136
|
-
}), children: [jsxRuntime.jsxs("div", Object.assign({}, getRootProps({
|
|
137
|
-
className:
|
|
116
|
+
}, className), style: style, children: [jsxRuntime.jsxs("div", Object.assign({}, getRootProps({
|
|
117
|
+
className: classNames('d-box-file-dropzone', {
|
|
138
118
|
disabled: isDisabled,
|
|
139
119
|
}),
|
|
140
120
|
}), { children: [jsxRuntime.jsx("input", Object.assign({}, getInputProps())), jsxRuntime.jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }), jsxRuntime.jsx("div", { className: "d-box-content", children: children })] })), !!acceptedFiles.length && (jsxRuntime.jsx("aside", { className: "d-box-files", children: acceptedFiles.map((file) => (jsxRuntime.jsx("div", { className: "d-box-files-text", children: `${file.name} - ${file.size} bytes` }, file.name))) }))] }));
|
|
141
121
|
}
|
|
142
122
|
|
|
143
123
|
function DButton({ theme = 'primary', size, variant, state, text = '', iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, value, type = 'button', isPill = false, isLoading = false, isDisabled = false, isStopPropagationEnabled = true, className, onClick, }) {
|
|
144
|
-
const generateClasses =
|
|
124
|
+
const generateClasses = React.useMemo(() => {
|
|
145
125
|
const variantClass = variant
|
|
146
126
|
? `btn-${variant}-${theme}`
|
|
147
127
|
: `btn-${theme}`;
|
|
148
128
|
return Object.assign(Object.assign(Object.assign({ btn: true, [variantClass]: true }, size && { [`btn-${size}`]: true }), (state && state !== 'disabled') && { [state]: true }), { loading: isLoading });
|
|
149
129
|
}, [variant, theme, size, state, isLoading]);
|
|
150
|
-
const generateStyleVariables =
|
|
130
|
+
const generateStyleVariables = React.useMemo(() => {
|
|
151
131
|
if (isPill) {
|
|
152
132
|
return {
|
|
153
133
|
[`--${PREFIX_BS}btn-component-border-radius`]: `var(--${PREFIX_BS}border-radius-pill)`,
|
|
@@ -157,38 +137,48 @@ function DButton({ theme = 'primary', size, variant, state, text = '', iconStart
|
|
|
157
137
|
}
|
|
158
138
|
return {};
|
|
159
139
|
}, [isPill]);
|
|
160
|
-
const clickHandler =
|
|
140
|
+
const clickHandler = React.useCallback((event) => {
|
|
161
141
|
if (isStopPropagationEnabled) {
|
|
162
142
|
event.stopPropagation();
|
|
163
143
|
}
|
|
164
144
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
165
145
|
}, [isStopPropagationEnabled, onClick]);
|
|
166
|
-
return (jsxRuntime.jsxs("button", Object.assign({ className:
|
|
146
|
+
return (jsxRuntime.jsxs("button", Object.assign({ className: classNames(generateClasses, className), style: generateStyleVariables, type: type, disabled: state === 'disabled' || isLoading || isDisabled }, value && { value }, { onClick: clickHandler, children: [iconStart && (jsxRuntime.jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })), (text && !isLoading) && (jsxRuntime.jsx("span", { children: text })), isLoading && (jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) })), iconEnd && (jsxRuntime.jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix }))] })));
|
|
167
147
|
}
|
|
168
148
|
|
|
169
|
-
function
|
|
170
|
-
return (jsxRuntime.jsx("div", {
|
|
149
|
+
function DCardHeader({ className, style, children, }) {
|
|
150
|
+
return (jsxRuntime.jsx("div", { className: classNames('card-header', className), style: style, children: children }));
|
|
171
151
|
}
|
|
172
152
|
|
|
173
|
-
function DCardBody({ className, children, }) {
|
|
174
|
-
return (jsxRuntime.jsx("div", { className:
|
|
153
|
+
function DCardBody({ className, style, children, }) {
|
|
154
|
+
return (jsxRuntime.jsx("div", { className: classNames('card-body', className), style: style, children: children }));
|
|
175
155
|
}
|
|
176
156
|
|
|
177
|
-
function DCardFooter({ className, children, }) {
|
|
178
|
-
return (jsxRuntime.jsx("div", { className:
|
|
157
|
+
function DCardFooter({ className, style, children, }) {
|
|
158
|
+
return (jsxRuntime.jsx("div", { className: classNames('card-footer', className), style: style, children: children }));
|
|
179
159
|
}
|
|
180
160
|
|
|
181
|
-
function
|
|
182
|
-
return (jsxRuntime.jsx("div", { className:
|
|
161
|
+
function DCard({ className, style, children, }) {
|
|
162
|
+
return (jsxRuntime.jsx("div", { style: style, className: classNames('card', className), children: children }));
|
|
163
|
+
}
|
|
164
|
+
var DCard$1 = Object.assign(DCard, {
|
|
165
|
+
Header: DCardHeader,
|
|
166
|
+
Body: DCardBody,
|
|
167
|
+
Footer: DCardFooter,
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
function DCardAccount({ className, style, icon, theme, name, number, balance, balanceText, onClick, actionText, }) {
|
|
171
|
+
return (jsxRuntime.jsx(DCard$1, { className: classNames('d-card-account', className), style: style, children: jsxRuntime.jsxs(DCard$1.Body, { children: [jsxRuntime.jsxs("div", { className: "d-flex gap-3 align-items-center", children: [jsxRuntime.jsx(DIcon, { icon: icon, hasCircle: true, theme: theme, size: "1.5rem" }), jsxRuntime.jsxs("div", { className: "d-block flex-grow-1", children: [jsxRuntime.jsx("p", { className: "text-gray-700", children: name }), jsxRuntime.jsx("small", { className: "text-gray-500", children: number })] })] }), jsxRuntime.jsxs("div", { className: "d-block", children: [jsxRuntime.jsx("p", { className: "fw-bold fs-6 text-body", children: balance }), jsxRuntime.jsx("small", { className: "text-gray-700", children: balanceText })] }), jsxRuntime.jsx("div", { className: "d-flex justify-content-end", children: jsxRuntime.jsx(DButton, { text: actionText, variant: "link", size: "sm", theme: "secondary", iconEnd: "chevron-right", onClick: onClick }) })] }) }));
|
|
183
172
|
}
|
|
184
173
|
|
|
185
|
-
function
|
|
186
|
-
|
|
174
|
+
function DCarouselSlide(_a) {
|
|
175
|
+
var { className } = _a, props = tslib.__rest(_a, ["className"]);
|
|
176
|
+
return (jsxRuntime.jsx(reactSplide.SplideSlide, Object.assign({ className: classNames('d-carousel-slide', className) }, props)));
|
|
187
177
|
}
|
|
188
178
|
|
|
189
179
|
function DCarousel(_a) {
|
|
190
|
-
var { children, className, options } = _a, props = tslib.__rest(_a, ["children", "className", "options"]);
|
|
191
|
-
return (jsxRuntime.jsx(reactSplide.Splide, Object.assign({ className:
|
|
180
|
+
var { children, className, style, options } = _a, props = tslib.__rest(_a, ["children", "className", "style", "options"]);
|
|
181
|
+
return (jsxRuntime.jsx(reactSplide.Splide, Object.assign({ className: classNames('d-carousel', className), style: style, options: Object.assign(Object.assign({}, options), { classes: {
|
|
192
182
|
// Arrows
|
|
193
183
|
arrows: 'splide__arrows d-carousel-arrows',
|
|
194
184
|
arrow: 'splide__arrow d-carousel-arrow',
|
|
@@ -199,122 +189,42 @@ function DCarousel(_a) {
|
|
|
199
189
|
page: 'splide__pagination__page d-carousel-pagination-page',
|
|
200
190
|
} }) }, props, { children: children })));
|
|
201
191
|
}
|
|
192
|
+
var DCarousel$1 = Object.assign(DCarousel, {
|
|
193
|
+
Slide: DCarouselSlide,
|
|
194
|
+
});
|
|
202
195
|
|
|
203
|
-
function
|
|
204
|
-
|
|
205
|
-
return (jsxRuntime.jsx(reactSplide.SplideSlide, Object.assign({ className: classNames__default["default"]('d-carousel-slide', className) }, props)));
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
function DChip({ theme = 'primary', text, icon, iconFamilyClass, iconFamilyPrefix, showClose = false, onClose, }) {
|
|
209
|
-
const generateClasses = react.useMemo(() => ({
|
|
196
|
+
function DChip({ theme = 'primary', text, icon, iconFamilyClass, iconFamilyPrefix, showClose = false, className, style, onClose, }) {
|
|
197
|
+
const generateClasses = React.useMemo(() => ({
|
|
210
198
|
'd-chip': true,
|
|
211
199
|
[`d-chip-${theme}`]: !!theme,
|
|
212
200
|
}), [theme]);
|
|
213
|
-
return (jsxRuntime.jsxs("span", { className:
|
|
201
|
+
return (jsxRuntime.jsxs("span", { className: classNames(generateClasses, className), style: style, children: [icon && (jsxRuntime.jsx("div", { className: "d-chip-icon-container", children: jsxRuntime.jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), jsxRuntime.jsx("span", { children: text }), showClose && (jsxRuntime.jsx("button", { type: "button", className: "d-chip-icon-container", onClick: onClose, children: jsxRuntime.jsx(DIcon, { icon: "x-lg" }) }))] }));
|
|
214
202
|
}
|
|
215
203
|
|
|
216
|
-
function DCollapse({ id, className, Component, hasSeparator = false, defaultCollapsed = false, onChange, children, }) {
|
|
217
|
-
const [toggle, setToggle] =
|
|
204
|
+
function DCollapse({ id, className, style, Component, hasSeparator = false, defaultCollapsed = false, onChange, children, }) {
|
|
205
|
+
const [toggle, setToggle] = React.useState(defaultCollapsed);
|
|
218
206
|
const onChangeCollapse = () => setToggle((prev) => !prev);
|
|
219
|
-
|
|
207
|
+
React.useEffect(() => {
|
|
220
208
|
if (onChange) {
|
|
221
209
|
onChange(toggle);
|
|
222
210
|
}
|
|
223
211
|
}, [toggle, onChange]);
|
|
224
|
-
|
|
212
|
+
React.useEffect(() => {
|
|
225
213
|
setToggle(defaultCollapsed);
|
|
226
214
|
}, [defaultCollapsed]);
|
|
227
|
-
const generateStyles =
|
|
215
|
+
const generateStyles = React.useMemo(() => ({
|
|
228
216
|
[`--${PREFIX_BS}collapse-separator-display`]: hasSeparator ? 'block' : 'none',
|
|
229
217
|
}), [hasSeparator]);
|
|
230
|
-
return (jsxRuntime.jsxs("div", { id: id, className:
|
|
218
|
+
return (jsxRuntime.jsxs("div", { id: id, className: classNames('collapse-container', className), style: style, children: [jsxRuntime.jsxs("button", { className: "collapse-button", type: "button", onClick: onChangeCollapse, children: [jsxRuntime.jsx("div", { className: "flex-grow-1", children: Component }), jsxRuntime.jsx(DIcon, { color: `var(--${PREFIX_BS}gray)`, size: `var(--${PREFIX_BS}ref-fs-small)`, icon: toggle ? 'chevron-up' : 'chevron-down' })] }), toggle && (jsxRuntime.jsx("div", { className: classNames({
|
|
231
219
|
'collapse-body': true,
|
|
232
220
|
}), style: generateStyles, children: children }))] }));
|
|
233
221
|
}
|
|
234
222
|
|
|
235
|
-
function DCollapseIconText({ children, icon, iconSize = '1.5rem', iconTheme = 'primary', title, iconFamilyClass, iconFamilyPrefix, }) {
|
|
236
|
-
return (jsxRuntime.jsx(DCollapse, { defaultCollapsed: true, className:
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
240
|
-
/* eslint-disable @typescript-eslint/require-await */
|
|
241
|
-
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
242
|
-
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
243
|
-
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
244
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
245
|
-
const liquidParser = {
|
|
246
|
-
library: {},
|
|
247
|
-
engine: undefined,
|
|
248
|
-
init(library, Liquid) {
|
|
249
|
-
this.library = library;
|
|
250
|
-
if (Liquid) {
|
|
251
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires,global-require
|
|
252
|
-
this.engine = new Liquid.Liquid({
|
|
253
|
-
strictFilters: true,
|
|
254
|
-
strictVariables: true,
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
},
|
|
258
|
-
/**
|
|
259
|
-
* Parse a liquid string
|
|
260
|
-
* @param liquidString Target Content Space UID
|
|
261
|
-
* @returns a usable object or string
|
|
262
|
-
*/
|
|
263
|
-
async parseLiquidAsync(liquidString) {
|
|
264
|
-
try {
|
|
265
|
-
return this.engine.parseAndRender(liquidString, this.library);
|
|
266
|
-
}
|
|
267
|
-
catch (error) {
|
|
268
|
-
return error.message;
|
|
269
|
-
}
|
|
270
|
-
},
|
|
271
|
-
/**
|
|
272
|
-
* Parse a liquid string
|
|
273
|
-
* @param liquidString Target Content Space UID
|
|
274
|
-
* @returns a usable object or string
|
|
275
|
-
*/
|
|
276
|
-
parseLiquid(liquidString) {
|
|
277
|
-
try {
|
|
278
|
-
return this.engine.parseAndRenderSync(liquidString, this.library);
|
|
279
|
-
}
|
|
280
|
-
catch (error) {
|
|
281
|
-
return error.message;
|
|
282
|
-
}
|
|
283
|
-
},
|
|
284
|
-
parse(liquidString) {
|
|
285
|
-
if (this.engine) {
|
|
286
|
-
return this.parseLiquid(liquidString);
|
|
287
|
-
}
|
|
288
|
-
return liquidString;
|
|
289
|
-
},
|
|
290
|
-
async parseAsync(liquidString) {
|
|
291
|
-
if (this.engine) {
|
|
292
|
-
return this.parseLiquidAsync(liquidString);
|
|
293
|
-
}
|
|
294
|
-
return liquidString;
|
|
295
|
-
},
|
|
296
|
-
};
|
|
297
|
-
|
|
298
|
-
function formatCurrency(amount, options) {
|
|
299
|
-
return currency__default["default"](amount, options).format();
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
const LANG = liquidParser.parse('{{site.language}}');
|
|
303
|
-
async function configureI8n(resources, _a = {}) {
|
|
304
|
-
var { lng = LANG, fallbackLng = 'es' } = _a, config = tslib.__rest(_a, ["lng", "fallbackLng"]);
|
|
305
|
-
return i18n__default["default"]
|
|
306
|
-
.use(reactI18next.initReactI18next)
|
|
307
|
-
.init(Object.assign({ resources,
|
|
308
|
-
lng, initImmediate: true, fallbackLng, interpolation: {
|
|
309
|
-
escapeValue: false,
|
|
310
|
-
prefix: '{',
|
|
311
|
-
suffix: '}',
|
|
312
|
-
// skipOnVariables: false,
|
|
313
|
-
} }, config))
|
|
314
|
-
.then((t) => t);
|
|
223
|
+
function DCollapseIconText({ children, icon, iconSize = '1.5rem', iconTheme = 'primary', title, iconFamilyClass, iconFamilyPrefix, className, style, }) {
|
|
224
|
+
return (jsxRuntime.jsx(DCollapse, { defaultCollapsed: true, className: classNames('d-collapse-icon-text', className), style: style, Component: (jsxRuntime.jsxs("div", { className: "d-collapse-icon-text-header", children: [jsxRuntime.jsx(DIcon, { icon: icon, size: iconSize, theme: iconTheme, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix, hasCircle: true }), jsxRuntime.jsx("span", { className: "d-collapse-icon-text-title", children: title })] })), children: children }));
|
|
315
225
|
}
|
|
316
226
|
|
|
317
|
-
const
|
|
227
|
+
const defaultState = {
|
|
318
228
|
language: 'en',
|
|
319
229
|
currency: {
|
|
320
230
|
symbol: '$',
|
|
@@ -322,27 +232,22 @@ const LiquidContext = react.createContext({
|
|
|
322
232
|
separator: ',',
|
|
323
233
|
decimal: '.',
|
|
324
234
|
},
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
return (jsxRuntime.jsx(LiquidContext.Provider, { value: value, children: children }));
|
|
337
|
-
}
|
|
338
|
-
function useLiquidContext() {
|
|
339
|
-
const context = react.useContext(LiquidContext);
|
|
235
|
+
};
|
|
236
|
+
const DContext = React.createContext(defaultState);
|
|
237
|
+
function DContextProvider({ language = defaultState.language, currency = defaultState.currency, children, }) {
|
|
238
|
+
const value = React.useMemo(() => ({
|
|
239
|
+
language,
|
|
240
|
+
currency,
|
|
241
|
+
}), [language, currency]);
|
|
242
|
+
return (jsxRuntime.jsx(DContext.Provider, { value: value, children: children }));
|
|
243
|
+
}
|
|
244
|
+
function useDContext() {
|
|
245
|
+
const context = React.useContext(DContext);
|
|
340
246
|
if (context === undefined) {
|
|
341
|
-
throw new Error('
|
|
247
|
+
throw new Error('useDContext was used outside of DContextProvider');
|
|
342
248
|
}
|
|
343
249
|
return context;
|
|
344
250
|
}
|
|
345
|
-
const LiquidContext$1 = LiquidContext;
|
|
346
251
|
|
|
347
252
|
/**
|
|
348
253
|
* useStackState inspired from rooks
|
|
@@ -353,15 +258,15 @@ const LiquidContext$1 = LiquidContext;
|
|
|
353
258
|
* @see https://react-hooks.org/docs/useStackState
|
|
354
259
|
*/
|
|
355
260
|
function useStackState(initialList) {
|
|
356
|
-
const [list, setList] =
|
|
261
|
+
const [list, setList] = React.useState(initialList);
|
|
357
262
|
const { length } = list;
|
|
358
|
-
const push =
|
|
263
|
+
const push = React.useCallback((item) => {
|
|
359
264
|
setList((prevList) => [
|
|
360
265
|
...prevList,
|
|
361
266
|
item,
|
|
362
267
|
]);
|
|
363
268
|
}, []);
|
|
364
|
-
const pop =
|
|
269
|
+
const pop = React.useCallback(() => {
|
|
365
270
|
setList((prevList) => {
|
|
366
271
|
if (prevList.length === 0) {
|
|
367
272
|
return prevList;
|
|
@@ -370,14 +275,14 @@ function useStackState(initialList) {
|
|
|
370
275
|
return newList;
|
|
371
276
|
});
|
|
372
277
|
}, []);
|
|
373
|
-
const peek =
|
|
278
|
+
const peek = React.useCallback(() => {
|
|
374
279
|
if (list.length > 0) {
|
|
375
280
|
return list[list.length - 1];
|
|
376
281
|
}
|
|
377
282
|
return undefined;
|
|
378
283
|
}, [list]);
|
|
379
284
|
const clear = () => setList([]);
|
|
380
|
-
const isEmpty =
|
|
285
|
+
const isEmpty = React.useCallback(() => list.length === 0, [list]);
|
|
381
286
|
const controls = {
|
|
382
287
|
clear,
|
|
383
288
|
isEmpty,
|
|
@@ -389,11 +294,11 @@ function useStackState(initialList) {
|
|
|
389
294
|
return [list, controls];
|
|
390
295
|
}
|
|
391
296
|
|
|
392
|
-
const ModalContext =
|
|
297
|
+
const ModalContext = React.createContext(undefined);
|
|
393
298
|
function enhanceModal(Modal, callbacks) {
|
|
394
299
|
return function EnhancedModal(_a) {
|
|
395
300
|
var { name, payload } = _a, otherProps = tslib.__rest(_a, ["name", "payload"]);
|
|
396
|
-
|
|
301
|
+
React.useEffect(() => {
|
|
397
302
|
if (callbacks === null || callbacks === void 0 ? void 0 : callbacks.onAfterOpen) {
|
|
398
303
|
callbacks.onAfterOpen(payload);
|
|
399
304
|
}
|
|
@@ -409,8 +314,8 @@ function enhanceModal(Modal, callbacks) {
|
|
|
409
314
|
};
|
|
410
315
|
}
|
|
411
316
|
function ModalContextProvider({ portalName, children, availableModals, }) {
|
|
412
|
-
const [hasPortal, setHasPortal] =
|
|
413
|
-
|
|
317
|
+
const [hasPortal, setHasPortal] = React.useState(false);
|
|
318
|
+
React.useEffect(() => {
|
|
414
319
|
const previousPortal = document.querySelector(`#${portalName}`);
|
|
415
320
|
if (previousPortal) {
|
|
416
321
|
previousPortal.remove();
|
|
@@ -421,7 +326,7 @@ function ModalContextProvider({ portalName, children, availableModals, }) {
|
|
|
421
326
|
setHasPortal(true);
|
|
422
327
|
}, [portalName]);
|
|
423
328
|
const [stack, { push, pop, peek }] = useStackState([]);
|
|
424
|
-
|
|
329
|
+
React.useEffect(() => {
|
|
425
330
|
if (stack.length) {
|
|
426
331
|
document.body.style.overflow = 'hidden';
|
|
427
332
|
document.body.style.paddingRight = '0';
|
|
@@ -431,7 +336,7 @@ function ModalContextProvider({ portalName, children, availableModals, }) {
|
|
|
431
336
|
document.body.style.paddingRight = 'unset';
|
|
432
337
|
}
|
|
433
338
|
}, [stack.length]);
|
|
434
|
-
const openModal =
|
|
339
|
+
const openModal = React.useCallback((modalName, { payload, callbacks } = { payload: {} }) => {
|
|
435
340
|
const Component = availableModals[modalName];
|
|
436
341
|
if (!Component) {
|
|
437
342
|
throw new Error(`there is no component for modal ${modalName}`);
|
|
@@ -447,7 +352,7 @@ function ModalContextProvider({ portalName, children, availableModals, }) {
|
|
|
447
352
|
}
|
|
448
353
|
push(stackItem);
|
|
449
354
|
}, [availableModals, push]);
|
|
450
|
-
const closeModal =
|
|
355
|
+
const closeModal = React.useCallback((context = { fromModal: false }) => {
|
|
451
356
|
var _a;
|
|
452
357
|
const stackItem = peek();
|
|
453
358
|
if (!stackItem) {
|
|
@@ -458,7 +363,7 @@ function ModalContextProvider({ portalName, children, availableModals, }) {
|
|
|
458
363
|
}
|
|
459
364
|
pop();
|
|
460
365
|
}, [peek, pop]);
|
|
461
|
-
const value =
|
|
366
|
+
const value = React.useMemo(() => ({
|
|
462
367
|
stack,
|
|
463
368
|
openModal,
|
|
464
369
|
closeModal,
|
|
@@ -469,18 +374,18 @@ function ModalContextProvider({ portalName, children, availableModals, }) {
|
|
|
469
374
|
}), !!stack.length && jsxRuntime.jsx("div", { className: "modal-backdrop fade show" })] }), document.getElementById(portalName))] }));
|
|
470
375
|
}
|
|
471
376
|
function useModalContext() {
|
|
472
|
-
const context =
|
|
377
|
+
const context = React.useContext(ModalContext);
|
|
473
378
|
if (context === undefined) {
|
|
474
379
|
throw new Error('useModalContext was used outside of ModalContextProvider');
|
|
475
380
|
}
|
|
476
381
|
return context;
|
|
477
382
|
}
|
|
478
383
|
|
|
479
|
-
const OffcanvasContext =
|
|
384
|
+
const OffcanvasContext = React.createContext(undefined);
|
|
480
385
|
function enhanceOffcanvas(Offcanvas, callbacks) {
|
|
481
386
|
return function EnhancedOffcanvas(_a) {
|
|
482
387
|
var { name, payload } = _a, otherProps = tslib.__rest(_a, ["name", "payload"]);
|
|
483
|
-
|
|
388
|
+
React.useEffect(() => {
|
|
484
389
|
if (callbacks === null || callbacks === void 0 ? void 0 : callbacks.onAfterOpen) {
|
|
485
390
|
callbacks.onAfterOpen(payload);
|
|
486
391
|
}
|
|
@@ -496,8 +401,8 @@ function enhanceOffcanvas(Offcanvas, callbacks) {
|
|
|
496
401
|
};
|
|
497
402
|
}
|
|
498
403
|
function OffcanvasContextProvider({ portalName, children, availableOffcanvas, }) {
|
|
499
|
-
const [hasPortal, setHasPortal] =
|
|
500
|
-
|
|
404
|
+
const [hasPortal, setHasPortal] = React.useState(false);
|
|
405
|
+
React.useEffect(() => {
|
|
501
406
|
const previousPortal = document.querySelector(`#${portalName}`);
|
|
502
407
|
if (previousPortal) {
|
|
503
408
|
previousPortal.remove();
|
|
@@ -508,7 +413,7 @@ function OffcanvasContextProvider({ portalName, children, availableOffcanvas, })
|
|
|
508
413
|
setHasPortal(true);
|
|
509
414
|
}, [portalName]);
|
|
510
415
|
const [stack, { push, pop, peek }] = useStackState([]);
|
|
511
|
-
|
|
416
|
+
React.useEffect(() => {
|
|
512
417
|
if (stack.length) {
|
|
513
418
|
document.body.style.overflow = 'hidden';
|
|
514
419
|
document.body.style.paddingRight = '0';
|
|
@@ -518,7 +423,7 @@ function OffcanvasContextProvider({ portalName, children, availableOffcanvas, })
|
|
|
518
423
|
document.body.style.paddingRight = 'unset';
|
|
519
424
|
}
|
|
520
425
|
}, [stack.length]);
|
|
521
|
-
const openOffcanvas =
|
|
426
|
+
const openOffcanvas = React.useCallback((offcanvasName, { payload, callbacks } = { payload: {} }) => {
|
|
522
427
|
const Component = availableOffcanvas[offcanvasName];
|
|
523
428
|
if (!Component) {
|
|
524
429
|
throw new Error(`there is no component for offcanvas ${offcanvasName}`);
|
|
@@ -534,7 +439,7 @@ function OffcanvasContextProvider({ portalName, children, availableOffcanvas, })
|
|
|
534
439
|
}
|
|
535
440
|
push(stackItem);
|
|
536
441
|
}, [availableOffcanvas, push]);
|
|
537
|
-
const closeOffcanvas =
|
|
442
|
+
const closeOffcanvas = React.useCallback((context = { fromOffcanvas: false }) => {
|
|
538
443
|
var _a;
|
|
539
444
|
const stackItem = peek();
|
|
540
445
|
if (!stackItem) {
|
|
@@ -545,7 +450,7 @@ function OffcanvasContextProvider({ portalName, children, availableOffcanvas, })
|
|
|
545
450
|
}
|
|
546
451
|
pop();
|
|
547
452
|
}, [peek, pop]);
|
|
548
|
-
const value =
|
|
453
|
+
const value = React.useMemo(() => ({
|
|
549
454
|
stack,
|
|
550
455
|
openOffcanvas,
|
|
551
456
|
closeOffcanvas,
|
|
@@ -556,16 +461,20 @@ function OffcanvasContextProvider({ portalName, children, availableOffcanvas, })
|
|
|
556
461
|
}), !!stack.length && jsxRuntime.jsx("div", { className: "offcanvas-backdrop fade show" })] }), document.getElementById(portalName))] }));
|
|
557
462
|
}
|
|
558
463
|
function useOffcanvasContext() {
|
|
559
|
-
const context =
|
|
464
|
+
const context = React.useContext(OffcanvasContext);
|
|
560
465
|
if (context === undefined) {
|
|
561
466
|
throw new Error('useOffcanvasContext was used outside of OffcanvasContextProvider');
|
|
562
467
|
}
|
|
563
468
|
return context;
|
|
564
469
|
}
|
|
565
470
|
|
|
471
|
+
function formatCurrency(amount, options) {
|
|
472
|
+
return currency(amount, options).format();
|
|
473
|
+
}
|
|
474
|
+
|
|
566
475
|
function useFormatCurrency(...args) {
|
|
567
|
-
const { currency } =
|
|
568
|
-
const format =
|
|
476
|
+
const { currency } = useDContext();
|
|
477
|
+
const format = React.useCallback((value) => formatCurrency(value, currency), [currency]);
|
|
569
478
|
const values = (args || []).map((value) => (formatCurrency(value !== null && value !== void 0 ? value : 0, currency)));
|
|
570
479
|
return {
|
|
571
480
|
format,
|
|
@@ -573,307 +482,269 @@ function useFormatCurrency(...args) {
|
|
|
573
482
|
};
|
|
574
483
|
}
|
|
575
484
|
|
|
576
|
-
function DCurrencyText({ value, className, }) {
|
|
485
|
+
function DCurrencyText({ value, className, style, }) {
|
|
577
486
|
const { values: [valueFormatted] } = useFormatCurrency(value);
|
|
578
|
-
return (jsxRuntime.jsx("span", { className: className, children: valueFormatted }));
|
|
487
|
+
return (jsxRuntime.jsx("span", { className: className, style: style, children: valueFormatted }));
|
|
579
488
|
}
|
|
580
489
|
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
const
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
490
|
+
/* eslint-disable */
|
|
491
|
+
/**
|
|
492
|
+
* This file is originally from `@primer/react`
|
|
493
|
+
* The original source for this lived in the URL below.
|
|
494
|
+
*
|
|
495
|
+
* @see https://github.com/primer/react/blob/216d2a9f57b8acb0701ab4e04a23e057fc325c90/src/hooks/useProvidedRefOrCreate.ts
|
|
496
|
+
*/
|
|
497
|
+
/**
|
|
498
|
+
* There are some situations where we only want to create a new ref if one is not provided to a component
|
|
499
|
+
* or hook as a prop. However, due to the `rules-of-hooks`, we cannot conditionally make a call to `React.useRef`
|
|
500
|
+
* only in the situations where the ref is not provided as a prop.
|
|
501
|
+
* This hook aims to encapsulate that logic, so the consumer doesn't need to be concerned with violating `rules-of-hooks`.
|
|
502
|
+
* @param providedRef The ref to use - if undefined, will use the ref from a call to React.useRef
|
|
503
|
+
* @type TRef The type of the RefObject which should be created.
|
|
504
|
+
*/
|
|
505
|
+
function useProvidedRefOrCreate(providedRef) {
|
|
506
|
+
const createdRef = React.useRef(null);
|
|
507
|
+
return providedRef !== null && providedRef !== void 0 ? providedRef : createdRef;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
function DInput(_a, ref) {
|
|
511
|
+
var { id, style, className, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, disabled = false, readOnly = false, loading = false, iconFamilyClass, iconFamilyPrefix, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, hint, invalid = false, valid = false, inputStart, value, onChange, onIconStartClick, onIconEndClick } = _a, inputProps = tslib.__rest(_a, ["id", "style", "className", "label", "labelIcon", "labelIconFamilyClass", "labelIconFamilyPrefix", "disabled", "readOnly", "loading", "iconFamilyClass", "iconFamilyPrefix", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "hint", "invalid", "valid", "inputStart", "value", "onChange", "onIconStartClick", "onIconEndClick"]);
|
|
512
|
+
const inputRef = useProvidedRefOrCreate(ref);
|
|
513
|
+
const handleOnChange = React.useCallback(() => {
|
|
514
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
515
|
+
}, [onChange, value]);
|
|
516
|
+
const handleOnIconStartClick = React.useCallback(() => {
|
|
517
|
+
onIconStartClick === null || onIconStartClick === void 0 ? void 0 : onIconStartClick(value);
|
|
518
|
+
}, [onIconStartClick, value]);
|
|
519
|
+
const handleOnIconEndClick = React.useCallback(() => {
|
|
520
|
+
onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(value);
|
|
521
|
+
}, [onIconEndClick, value]);
|
|
522
|
+
return (jsxRuntime.jsxs("div", { className: classNames({
|
|
602
523
|
'd-input': true,
|
|
603
524
|
className: !!className,
|
|
604
|
-
}), style: style, children: [label && (jsxRuntime.jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsxRuntime.jsx(DIcon, { className: "d-input-icon", icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxRuntime.jsxs("div", { className: "d-input-control", children: [jsxRuntime.jsxs("div", { className:
|
|
525
|
+
}), style: style, children: [label && (jsxRuntime.jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsxRuntime.jsx(DIcon, { className: "d-input-icon", icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxRuntime.jsxs("div", { className: "d-input-control", children: [jsxRuntime.jsxs("div", { className: classNames({
|
|
605
526
|
'input-group': true,
|
|
606
|
-
'has-validation':
|
|
607
|
-
disabled:
|
|
608
|
-
}), children: [!!inputStart && (jsxRuntime.jsx("div", { className: "input-group-text", children: inputStart })), iconStart && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick:
|
|
609
|
-
'is-invalid':
|
|
610
|
-
'is-valid':
|
|
611
|
-
}),
|
|
612
|
-
}
|
|
613
|
-
const ForwardedDInput =
|
|
527
|
+
'has-validation': invalid,
|
|
528
|
+
disabled: disabled || loading,
|
|
529
|
+
}), children: [!!inputStart && (jsxRuntime.jsx("div", { className: "input-group-text", children: inputStart })), iconStart && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading, children: iconStart && (jsxRuntime.jsx(DIcon, { className: "d-input-icon", icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })) })), jsxRuntime.jsx("input", Object.assign({ ref: inputRef, id: id, className: classNames('form-control', {
|
|
530
|
+
'is-invalid': invalid,
|
|
531
|
+
'is-valid': valid,
|
|
532
|
+
}), "aria-label": label, disabled: disabled || loading, readOnly: readOnly, "aria-describedby": `${id}Add ${id}Hint`, value: value, onChange: handleOnChange }, inputProps)), ((invalid || valid) && !iconEnd && !loading) && (jsxRuntime.jsx("span", { className: "input-group-text", id: `${id}State`, children: jsxRuntime.jsx(DIcon, { className: "d-input-validation-icon", icon: invalid ? 'exclamation-circle' : 'check', familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), (iconEnd && !loading) && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: handleOnIconEndClick, disabled: disabled || loading, children: iconEnd && (jsxRuntime.jsx(DIcon, { className: "d-input-icon", icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) })), loading && (jsxRuntime.jsx("div", { className: "input-group-text d-input-icon", children: jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }) }))] }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })] }));
|
|
533
|
+
}
|
|
534
|
+
const ForwardedDInput = React.forwardRef(DInput);
|
|
614
535
|
ForwardedDInput.displayName = 'DInput';
|
|
615
|
-
|
|
536
|
+
var DInput$1 = ForwardedDInput;
|
|
616
537
|
|
|
617
538
|
function DDatePickerTime(_a) {
|
|
618
|
-
var { value, onChange, id, label } = _a, props = tslib.__rest(_a, ["value", "onChange", "id", "label"]);
|
|
619
|
-
return (jsxRuntime.jsxs("div", { className:
|
|
620
|
-
onChange
|
|
539
|
+
var { value, onChange, id, label, className, style } = _a, props = tslib.__rest(_a, ["value", "onChange", "id", "label", "className", "style"]);
|
|
540
|
+
return (jsxRuntime.jsxs("div", { className: classNames('d-flex align-items-center gap-2 flex-column d-datepicker-time', className), style: style, children: [label && (jsxRuntime.jsx("p", { className: "d-datepicker-time-label", children: label })), jsxRuntime.jsx(DInput$1, Object.assign({}, onChange && {
|
|
541
|
+
onChange,
|
|
621
542
|
}, { type: "time", id: id, value: value }, props))] }));
|
|
622
543
|
}
|
|
623
544
|
|
|
624
545
|
function DDatePickerInput(_a, ref) {
|
|
625
|
-
var { value, onClick, id, iconEnd } = _a, props = tslib.__rest(_a, ["value", "onClick", "id", "iconEnd"]);
|
|
626
|
-
|
|
627
|
-
return (jsxRuntime.jsx("div", { role: "button", onClick: onClick, onKeyDown: () => { }, tabIndex: -1, children: jsxRuntime.jsx(DInput$1, Object.assign({
|
|
546
|
+
var { value, onClick, id, iconEnd, className, style } = _a, props = tslib.__rest(_a, ["value", "onClick", "id", "iconEnd", "className", "style"]);
|
|
547
|
+
React.useImperativeHandle(ref, () => ({}), []);
|
|
548
|
+
return (jsxRuntime.jsx("div", { role: "button", onClick: onClick, onKeyDown: () => { }, tabIndex: -1, children: jsxRuntime.jsx(DInput$1, Object.assign({ readOnly: true, type: "text", id: id, value: value, onIconEndClick: onClick, iconEnd: iconEnd, className: className, style: style }, props)) }));
|
|
628
549
|
}
|
|
629
|
-
const ForwardedDDatePickerInput =
|
|
550
|
+
const ForwardedDDatePickerInput = React.forwardRef(DDatePickerInput);
|
|
630
551
|
ForwardedDDatePickerInput.displayName = 'DDatePickerInput';
|
|
631
|
-
|
|
552
|
+
var DDatePickerInput$1 = ForwardedDDatePickerInput;
|
|
632
553
|
|
|
633
554
|
function DMonthPicker(_a) {
|
|
634
|
-
var { onChangeDate, date } = _a, props = tslib.__rest(_a, ["onChangeDate", "date"]);
|
|
635
|
-
const
|
|
636
|
-
const
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
function DDatePickerHeader({ monthDate, changeMonth, changeYear, decreaseMonth, increaseMonth, prevMonthButtonDisabled, nextMonthButtonDisabled, withMonthSelector, decreaseMonthIcon, increaseMonthIcon, iconSize, buttonVariant, buttonTheme, }) {
|
|
643
|
-
const { language } = useLiquidContext();
|
|
644
|
-
const locale = react.useMemo(() => language || 'en', [language]);
|
|
645
|
-
const onChangeDate = react.useCallback((value) => {
|
|
555
|
+
var { onChangeDate, date, locale, className } = _a, props = tslib.__rest(_a, ["onChangeDate", "date", "locale", "className"]);
|
|
556
|
+
const selected = React.useMemo(() => dateFns.parseISO(date), [date]);
|
|
557
|
+
const dateFormatted = React.useMemo(() => (dateFns.format(new Date(date), 'MMMM yyyy', { locale })), [date, locale]);
|
|
558
|
+
return (jsxRuntime.jsx(DatePicker, Object.assign({ showMonthYearPicker: true, selected: selected, calendarClassName: classNames('d-month-picker', className), onChange: onChangeDate }, locale && { locale }, { customInput: (jsxRuntime.jsx("p", { className: "fw-bold text-capitalize", children: dateFormatted })), renderCustomHeader: ({ monthDate, decreaseYear, increaseYear, prevYearButtonDisabled, nextYearButtonDisabled, }) => (jsxRuntime.jsxs("div", { className: "d-flex align-items-center justify-content-between gap-4 fs-6 bg-dark", children: [jsxRuntime.jsx(DButton, { iconStart: "chevron-left", size: "sm", variant: "link", theme: "light", onClick: decreaseYear, isDisabled: prevYearButtonDisabled }), jsxRuntime.jsx("p", { className: "fs-6 fw-bold", children: monthDate.getFullYear() }), jsxRuntime.jsx(DButton, { iconStart: "chevron-right", size: "sm", variant: "link", theme: "light", onClick: increaseYear, isDisabled: nextYearButtonDisabled })] })) }, props)));
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
function DDatePickerHeader({ monthDate, changeMonth, changeYear, decreaseMonth, increaseMonth, prevMonthButtonDisabled, nextMonthButtonDisabled, withMonthSelector, decreaseMonthIcon, increaseMonthIcon, iconSize, buttonVariant, buttonTheme, locale, style, className, }) {
|
|
562
|
+
const onChangeDate = React.useCallback((value) => {
|
|
646
563
|
if (value) {
|
|
647
|
-
changeMonth(
|
|
648
|
-
changeYear(
|
|
564
|
+
changeMonth(dateFns.getMonth(value));
|
|
565
|
+
changeYear(dateFns.getYear(value));
|
|
649
566
|
}
|
|
650
567
|
}, [changeMonth, changeYear]);
|
|
651
|
-
return (jsxRuntime.jsxs("div", { className:
|
|
568
|
+
return (jsxRuntime.jsxs("div", { className: classNames('d-flex align-items-center justify-content-between d-datepicker-header', className), style: style, children: [jsxRuntime.jsx(DButton, { iconStart: decreaseMonthIcon, size: iconSize, variant: buttonVariant, theme: buttonTheme, onClick: decreaseMonth, isDisabled: prevMonthButtonDisabled }), jsxRuntime.jsx(DMonthPicker, Object.assign({}, !withMonthSelector && { readOnly: true }, { date: monthDate.toISOString(), onChangeDate: onChangeDate }, locale && { locale })), jsxRuntime.jsx(DButton, { iconStart: increaseMonthIcon, size: iconSize, variant: buttonVariant, theme: buttonTheme, onClick: increaseMonth, isDisabled: nextMonthButtonDisabled })] }));
|
|
652
569
|
}
|
|
653
570
|
|
|
654
571
|
function DDatePicker(_a) {
|
|
655
|
-
var {
|
|
656
|
-
const selected =
|
|
657
|
-
const {
|
|
658
|
-
const locale = react.useMemo(() => language || 'en', [language]);
|
|
659
|
-
const DatePickerHeader = react.useCallback((headerProps) => (jsxRuntime.jsx(DDatePickerHeader, Object.assign({}, headerProps, { decreaseMonthIcon: headerDecreaseMonthIcon, increaseMonthIcon: headerIncreaseMonthIcon, iconSize: headerIconSize, buttonVariant: headerButtonVariant, buttonTheme: headerButtonTheme, withMonthSelector: !!withMonthSelector }))), [headerButtonTheme,
|
|
572
|
+
var { date, selectsRange = false, withMonthSelector, inputLabel, inputIcon = 'calendar', inputId = 'input-calendar', timeId = 'input-time', timeLabel, headerDecreaseMonthIcon = 'chevron-left', headerIncreaseMonthIcon = 'chevron-right', headerIconSize = 'sm', headerButtonVariant = 'link', headerButtonTheme = 'dark', locale, className, style } = _a, props = tslib.__rest(_a, ["date", "selectsRange", "withMonthSelector", "inputLabel", "inputIcon", "inputId", "timeId", "timeLabel", "headerDecreaseMonthIcon", "headerIncreaseMonthIcon", "headerIconSize", "headerButtonVariant", "headerButtonTheme", "locale", "className", "style"]);
|
|
573
|
+
const selected = React.useMemo(() => (date ? dateFns.parseISO(date) : null), [date]);
|
|
574
|
+
const DatePickerHeader = React.useCallback((headerProps) => (jsxRuntime.jsx(DDatePickerHeader, Object.assign({}, headerProps, locale && { locale }, { decreaseMonthIcon: headerDecreaseMonthIcon, increaseMonthIcon: headerIncreaseMonthIcon, iconSize: headerIconSize, buttonVariant: headerButtonVariant, buttonTheme: headerButtonTheme, withMonthSelector: !!withMonthSelector }))), [headerButtonTheme,
|
|
660
575
|
headerButtonVariant,
|
|
661
576
|
headerDecreaseMonthIcon,
|
|
662
577
|
headerIconSize,
|
|
663
578
|
headerIncreaseMonthIcon,
|
|
664
579
|
withMonthSelector,
|
|
580
|
+
locale,
|
|
665
581
|
]);
|
|
666
|
-
return (jsxRuntime.jsx(
|
|
582
|
+
return (jsxRuntime.jsx(DatePicker, Object.assign({ selected: selected, calendarClassName: "d-date-picker", renderCustomHeader: (headerProps) => jsxRuntime.jsx(DatePickerHeader, Object.assign({}, headerProps)), customInput: (jsxRuntime.jsx(DDatePickerInput$1, { id: inputId, iconEnd: inputIcon, className: className, style: style })), customTimeInput: jsxRuntime.jsx(DDatePickerTime, { id: timeId, label: timeLabel }), selectsRange: selectsRange }, locale && { locale }, props)));
|
|
667
583
|
}
|
|
668
584
|
|
|
669
|
-
function
|
|
670
|
-
var {
|
|
671
|
-
const
|
|
672
|
-
|
|
585
|
+
function DInputCounter(_a, ref) {
|
|
586
|
+
var { minValue, maxValue, value = minValue, invalid, iconStart = 'dash-square', iconEnd = 'plus-square', style, onChange } = _a, props = tslib.__rest(_a, ["minValue", "maxValue", "value", "invalid", "iconStart", "iconEnd", "style", "onChange"]);
|
|
587
|
+
const inputRef = useProvidedRefOrCreate(ref);
|
|
588
|
+
const [internalIsInvalid, setInternalIsInvalid] = React.useState(false);
|
|
589
|
+
const [internalValue, setInternalValue] = React.useState(value);
|
|
590
|
+
React.useEffect(() => {
|
|
591
|
+
setInternalValue(value);
|
|
592
|
+
}, [value]);
|
|
593
|
+
React.useEffect(() => {
|
|
594
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(Number(internalValue));
|
|
595
|
+
}, [onChange, internalValue]);
|
|
596
|
+
const handleOnChange = React.useCallback((newValue) => {
|
|
597
|
+
setInternalValue(Number(newValue || '0'));
|
|
598
|
+
}, []);
|
|
599
|
+
const handleOnIconStartClick = React.useCallback(() => {
|
|
600
|
+
setInternalValue((prevInternalValue) => Math.max(prevInternalValue - 1, minValue));
|
|
601
|
+
}, [minValue]);
|
|
602
|
+
const handleOnIconEndClick = React.useCallback(() => {
|
|
603
|
+
setInternalValue((prevInternalValue) => Math.min(prevInternalValue + 1, maxValue));
|
|
604
|
+
}, [maxValue]);
|
|
605
|
+
const generateStyleVariables = React.useMemo(() => (Object.assign(Object.assign({}, style), { [`--${PREFIX_BS}input-component-form-control-text-align`]: 'center' })), [style]);
|
|
606
|
+
const valueString = React.useMemo(() => (internalValue.toString()), [internalValue]);
|
|
607
|
+
React.useEffect(() => {
|
|
608
|
+
setInternalIsInvalid(!(internalValue >= minValue && internalValue <= maxValue));
|
|
609
|
+
}, [internalValue, minValue, maxValue]);
|
|
610
|
+
return (jsxRuntime.jsx(DInput$1, Object.assign({ ref: inputRef, value: valueString, style: generateStyleVariables, iconStart: iconStart, iconEnd: iconEnd, invalid: internalIsInvalid || invalid, type: "number", onChange: handleOnChange, onIconStartClick: handleOnIconStartClick, onIconEndClick: handleOnIconEndClick }, props)));
|
|
673
611
|
}
|
|
612
|
+
const ForwardedDInputCounter = React.forwardRef(DInputCounter);
|
|
613
|
+
ForwardedDInputCounter.displayName = 'DInputCounter';
|
|
614
|
+
var DInputCounter$1 = ForwardedDInputCounter;
|
|
674
615
|
|
|
675
|
-
function
|
|
676
|
-
|
|
677
|
-
const
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
const valueAsFormat = valueAsNumber !== undefined
|
|
687
|
-
? currency__default["default"](valueAsNumber, Object.assign(Object.assign({}, currencyOptions), { symbol: '' })).format()
|
|
688
|
-
: '';
|
|
689
|
-
setInternalValueAsNumber(valueAsNumber);
|
|
690
|
-
setInternalValueAsFormat(valueAsFormat);
|
|
691
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(valueAsNumber);
|
|
692
|
-
}, [currencyOptions, onChange]);
|
|
693
|
-
const blurHandler = react.useCallback((event) => {
|
|
616
|
+
function useInputCurrency(currencyOptions, value, onFocus, onChange, onBlur, ref) {
|
|
617
|
+
const inputRef = useProvidedRefOrCreate(ref);
|
|
618
|
+
const valueFormatted = React.useMemo(() => {
|
|
619
|
+
if (value === undefined) {
|
|
620
|
+
return '';
|
|
621
|
+
}
|
|
622
|
+
return currency(value, Object.assign(Object.assign({}, currencyOptions), { symbol: '' })).format();
|
|
623
|
+
}, [currencyOptions, value]);
|
|
624
|
+
const [innerValue, setInnerValue] = React.useState(valueFormatted);
|
|
625
|
+
const [innerType, setInnerType] = React.useState('text');
|
|
626
|
+
const handleOnFocus = React.useCallback((event) => {
|
|
694
627
|
event.stopPropagation();
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
628
|
+
if (inputRef.current) {
|
|
629
|
+
if (event.currentTarget.value) {
|
|
630
|
+
const currencyValue = currency(event.currentTarget.value, Object.assign(Object.assign({}, currencyOptions), { symbol: '' }));
|
|
631
|
+
setInnerValue((currencyValue.intValue / 100).toString());
|
|
632
|
+
}
|
|
633
|
+
setInnerType('number');
|
|
634
|
+
}
|
|
635
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
|
|
636
|
+
}, [currencyOptions, inputRef, onFocus]);
|
|
637
|
+
const handleOnBlur = React.useCallback((event) => {
|
|
702
638
|
event.stopPropagation();
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
639
|
+
if (inputRef.current) {
|
|
640
|
+
setInnerType('text');
|
|
641
|
+
if (event.currentTarget.value) {
|
|
642
|
+
setInnerValue(currency(event.currentTarget.value, Object.assign(Object.assign({}, currencyOptions), { symbol: '' })).format());
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
646
|
+
}, [currencyOptions, inputRef, onBlur]);
|
|
647
|
+
const handleOnWheel = React.useCallback((event) => {
|
|
710
648
|
var _a;
|
|
711
649
|
event.stopPropagation();
|
|
712
|
-
(_a =
|
|
713
|
-
}, []);
|
|
714
|
-
const
|
|
715
|
-
if (internalValue === undefined) {
|
|
716
|
-
return true;
|
|
717
|
-
}
|
|
718
|
-
if (internalType === 'number') {
|
|
719
|
-
return ((minValue === undefined || internalValue >= minValue)
|
|
720
|
-
&& (maxValue === undefined || internalValue <= maxValue));
|
|
721
|
-
}
|
|
722
|
-
return true;
|
|
723
|
-
}, [internalType, maxValue, minValue]);
|
|
724
|
-
const valueAsType = react.useMemo(() => {
|
|
725
|
-
if (internalType === 'number') {
|
|
726
|
-
return internalValueAsNumber;
|
|
727
|
-
}
|
|
728
|
-
return internalValueAsFormat;
|
|
729
|
-
}, [internalType, internalValueAsFormat, internalValueAsNumber]);
|
|
730
|
-
react.useEffect(() => {
|
|
731
|
-
setInternalIsInvalid(!isValidValue(value));
|
|
732
|
-
}, [isValidValue, value]);
|
|
733
|
-
react.useEffect(() => {
|
|
734
|
-
setInternalValueAsNumber(value);
|
|
735
|
-
}, [value]);
|
|
736
|
-
const generateStyleVariables = react.useMemo(() => ({
|
|
650
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
651
|
+
}, [inputRef]);
|
|
652
|
+
const generateStyleVariables = React.useMemo(() => ({
|
|
737
653
|
[`--${PREFIX_BS}input-currency-component-symbol-color`]: `var(--${PREFIX_BS}secondary)`,
|
|
738
654
|
[`--${PREFIX_BS}input-currency-symbol-color`]: `var(--${PREFIX_BS}input-currency-component-symbol-color)`,
|
|
739
655
|
}), []);
|
|
740
|
-
const generateSymbolStyleVariables =
|
|
656
|
+
const generateSymbolStyleVariables = React.useMemo(() => ({
|
|
741
657
|
color: `var(--${PREFIX_BS}m-input-currency-symbol-color)`,
|
|
742
658
|
}), []);
|
|
743
|
-
|
|
659
|
+
const handleOnChange = React.useCallback((newValue) => {
|
|
660
|
+
setInnerValue(newValue);
|
|
661
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newValue !== undefined ? Number(newValue) : undefined);
|
|
662
|
+
}, [onChange]);
|
|
663
|
+
React.useEffect(() => {
|
|
664
|
+
setInnerValue(valueFormatted);
|
|
665
|
+
}, [valueFormatted]);
|
|
666
|
+
return {
|
|
667
|
+
inputRef,
|
|
668
|
+
innerValue,
|
|
669
|
+
innerType,
|
|
670
|
+
handleOnFocus,
|
|
671
|
+
handleOnChange,
|
|
672
|
+
handleOnBlur,
|
|
673
|
+
handleOnWheel,
|
|
674
|
+
generateStyleVariables,
|
|
675
|
+
generateSymbolStyleVariables,
|
|
676
|
+
};
|
|
744
677
|
}
|
|
745
678
|
|
|
746
|
-
function
|
|
747
|
-
|
|
748
|
-
|
|
679
|
+
function DInputCurrencyBase(_a, ref) {
|
|
680
|
+
var { value, minValue, maxValue, currencyOptions, currencyCode, invalid, onFocus, onBlur, onChange } = _a, inputProps = tslib.__rest(_a, ["value", "minValue", "maxValue", "currencyOptions", "currencyCode", "invalid", "onFocus", "onBlur", "onChange"]);
|
|
681
|
+
const { inputRef, innerValue, innerType, handleOnFocus, handleOnChange, handleOnBlur, handleOnWheel, generateStyleVariables, generateSymbolStyleVariables, } = useInputCurrency(currencyOptions, value, onFocus, onChange, onBlur, ref);
|
|
682
|
+
return (jsxRuntime.jsx(DInput$1, Object.assign({ ref: inputRef, value: innerValue, onChange: handleOnChange, style: generateStyleVariables, inputMode: "decimal", pattern: "^[0-9]", type: innerType, onFocus: handleOnFocus, onBlur: handleOnBlur, onWheel: handleOnWheel, inputStart: (jsxRuntime.jsx("span", { slot: "input-start", style: generateSymbolStyleVariables, children: currencyCode || currencyOptions.symbol })) }, inputProps)));
|
|
749
683
|
}
|
|
684
|
+
const ForwardedDInputCurrencyBase$1 = React.forwardRef(DInputCurrencyBase);
|
|
685
|
+
ForwardedDInputCurrencyBase$1.displayName = 'DInputCurrencyBase';
|
|
686
|
+
var DInputCurrencyBase$1 = ForwardedDInputCurrencyBase$1;
|
|
750
687
|
|
|
751
|
-
function
|
|
752
|
-
var {
|
|
753
|
-
const
|
|
754
|
-
|
|
688
|
+
function DInputCurrency(_a, ref) {
|
|
689
|
+
var { value, minValue, maxValue, currencyCode, invalid, onFocus, onBlur, onChange } = _a, props = tslib.__rest(_a, ["value", "minValue", "maxValue", "currencyCode", "invalid", "onFocus", "onBlur", "onChange"]);
|
|
690
|
+
const { currency: currencyOptions } = useDContext();
|
|
691
|
+
const { inputRef, innerValue, innerType, handleOnFocus, handleOnChange, handleOnBlur, handleOnWheel, generateStyleVariables, generateSymbolStyleVariables, } = useInputCurrency(currencyOptions, value, onFocus, onChange, onBlur, ref);
|
|
692
|
+
return (jsxRuntime.jsx(DInput$1, Object.assign({ ref: inputRef, value: innerValue, onChange: handleOnChange, style: generateStyleVariables, inputMode: "decimal", pattern: "^[0-9]", type: innerType, onFocus: handleOnFocus, onBlur: handleOnBlur, onWheel: handleOnWheel, inputStart: (jsxRuntime.jsx("span", { slot: "input-start", style: generateSymbolStyleVariables, children: currencyCode || currencyOptions.symbol })) }, props)));
|
|
755
693
|
}
|
|
694
|
+
const ForwardedDInputCurrencyBase = React.forwardRef(DInputCurrency);
|
|
695
|
+
ForwardedDInputCurrencyBase.displayName = 'DInputCurrency';
|
|
696
|
+
var DInputCurrency$1 = ForwardedDInputCurrencyBase;
|
|
756
697
|
|
|
757
|
-
function
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
}
|
|
762
|
-
if ('value' in option) {
|
|
763
|
-
return option === null || option === void 0 ? void 0 : option.value;
|
|
764
|
-
}
|
|
765
|
-
throw new Error('Must provide a valueExtractor for custom object forms');
|
|
766
|
-
}, [valueExtractor]);
|
|
767
|
-
const internalLabelExtractor = react.useCallback((option) => {
|
|
768
|
-
if (labelExtractor) {
|
|
769
|
-
return labelExtractor(option);
|
|
770
|
-
}
|
|
771
|
-
if ('label' in option) {
|
|
772
|
-
return option === null || option === void 0 ? void 0 : option.label;
|
|
773
|
-
}
|
|
774
|
-
throw new Error('Must provide a labelExtractor for custom object forms');
|
|
775
|
-
}, [labelExtractor]);
|
|
776
|
-
const changeHandler = react.useCallback((event) => {
|
|
777
|
-
const selected = options
|
|
778
|
-
.find((option) => internalValueExtractor(option).toString() === event.currentTarget.value);
|
|
779
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(selected);
|
|
780
|
-
}, [onChange, options, internalValueExtractor]);
|
|
781
|
-
const blurHandler = react.useCallback((event) => {
|
|
782
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
783
|
-
}, [onBlur]);
|
|
784
|
-
const iconStartClickHandler = react.useCallback((event) => {
|
|
785
|
-
onIconStartClick === null || onIconStartClick === void 0 ? void 0 : onIconStartClick(event);
|
|
786
|
-
}, [onIconStartClick]);
|
|
787
|
-
const iconEndClickHandler = react.useCallback((event) => {
|
|
788
|
-
onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(event);
|
|
789
|
-
}, [onIconEndClick]);
|
|
790
|
-
return (jsxRuntime.jsxs("div", { className: classNames__default["default"]('d-input', className), children: [label && (jsxRuntime.jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsxRuntime.jsx(DIcon, { className: "mdinput-icon", icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxRuntime.jsxs("div", { className: "d-input-control", children: [jsxRuntime.jsxs("div", { className: classNames__default["default"]({
|
|
791
|
-
'input-group': true,
|
|
792
|
-
disabled: isDisabled || isLoading,
|
|
793
|
-
}), children: [iconStart && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: iconStartClickHandler, disabled: isDisabled || isLoading, children: iconStart && (jsxRuntime.jsx(DIcon, { className: "d-input-icon", icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })) })), jsxRuntime.jsx("select", Object.assign({ id: id, name: name, className: "form-select", "aria-label": label, disabled: isDisabled || isLoading, "aria-describedby": `${id}Add ${id}Hint`, onChange: changeHandler, onBlur: blurHandler }, selectedOption && { value: internalValueExtractor(selectedOption) }, { children: options.map((option) => (jsxRuntime.jsx("option", { value: internalValueExtractor(option), children: internalLabelExtractor(option) }, internalValueExtractor(option)))) })), iconEnd && !isLoading && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: iconEndClickHandler, disabled: isDisabled || isLoading, children: iconEnd && (jsxRuntime.jsx(DIcon, { className: "d-input-icon", icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) })), isLoading && (jsxRuntime.jsx("div", { className: "input-group-text form-control-icon loading", children: jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }) }))] }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })] }));
|
|
698
|
+
function DInputSearch(_a, ref) {
|
|
699
|
+
var { onClick, type } = _a, props = tslib.__rest(_a, ["onClick", "type"]);
|
|
700
|
+
const inputRef = useProvidedRefOrCreate(ref);
|
|
701
|
+
return (jsxRuntime.jsx(DInput$1, Object.assign({ ref: inputRef, type: "text", iconEnd: "search", onIconEndClick: onClick }, props)));
|
|
794
702
|
}
|
|
703
|
+
const ForwardedDInputSearch = React.forwardRef(DInputSearch);
|
|
704
|
+
ForwardedDInputSearch.displayName = 'DInputSearch';
|
|
705
|
+
var DInputSearch$1 = ForwardedDInputSearch;
|
|
795
706
|
|
|
796
|
-
function
|
|
797
|
-
var {
|
|
798
|
-
const
|
|
799
|
-
|
|
707
|
+
function DInputPassword(_a, ref) {
|
|
708
|
+
var { onIconEndClick } = _a, props = tslib.__rest(_a, ["onIconEndClick"]);
|
|
709
|
+
const inputRef = useProvidedRefOrCreate(ref);
|
|
710
|
+
const [visible, setVisible] = React.useState(false);
|
|
711
|
+
const handleOnIconEndClick = React.useCallback(() => {
|
|
712
|
+
setVisible((prevVisible) => !prevVisible);
|
|
713
|
+
onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick();
|
|
714
|
+
}, [onIconEndClick]);
|
|
715
|
+
return (jsxRuntime.jsx(DInput$1, Object.assign({ ref: inputRef, iconEnd: !visible ? 'eye-slash' : 'eye', type: !visible ? 'password' : 'text', onIconEndClick: handleOnIconEndClick }, props)));
|
|
800
716
|
}
|
|
717
|
+
const ForwardedDInputPassword = React.forwardRef(DInputPassword);
|
|
718
|
+
ForwardedDInputPassword.displayName = 'DInputPassword';
|
|
719
|
+
var DInputPassword$1 = ForwardedDInputPassword;
|
|
801
720
|
|
|
802
|
-
function DInputCheck({ type, name, label, isChecked = false, id, isDisabled = false, isIndeterminate, value, onChange, }) {
|
|
803
|
-
const innerRef =
|
|
804
|
-
const handleChange =
|
|
721
|
+
function DInputCheck({ type, name, label, isChecked = false, id, isDisabled = false, isIndeterminate, value, onChange, className, style, }) {
|
|
722
|
+
const innerRef = React.useRef(null);
|
|
723
|
+
const handleChange = React.useCallback((event) => {
|
|
805
724
|
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
806
725
|
}, [onChange]);
|
|
807
|
-
|
|
726
|
+
React.useEffect(() => {
|
|
808
727
|
if (innerRef.current) {
|
|
809
728
|
innerRef.current.indeterminate = Boolean(isIndeterminate);
|
|
810
729
|
}
|
|
811
730
|
}, [isIndeterminate]);
|
|
812
|
-
|
|
731
|
+
React.useEffect(() => {
|
|
813
732
|
if (innerRef.current) {
|
|
814
733
|
innerRef.current.checked = isChecked;
|
|
815
734
|
}
|
|
816
735
|
}, [isChecked]);
|
|
817
736
|
if (!label) {
|
|
818
|
-
return (jsxRuntime.jsx("input", { ref: innerRef, onChange: handleChange, className:
|
|
737
|
+
return (jsxRuntime.jsx("input", { ref: innerRef, onChange: handleChange, className: classNames('form-check-input', className), style: style, id: id, disabled: isDisabled, type: type, name: name, value: value }));
|
|
819
738
|
}
|
|
820
|
-
return (jsxRuntime.jsxs("div", { className: "form-check", children: [jsxRuntime.jsx("input", { ref: innerRef, onChange: handleChange, className:
|
|
739
|
+
return (jsxRuntime.jsxs("div", { className: "form-check", children: [jsxRuntime.jsx("input", { ref: innerRef, onChange: handleChange, className: classNames('form-check-input', className), style: style, id: id, disabled: isDisabled, type: type, name: name, value: value }), jsxRuntime.jsx("label", { className: "form-check-label", htmlFor: id, children: label })] }));
|
|
821
740
|
}
|
|
822
741
|
|
|
823
|
-
function
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
const [internalValue, setInternalValue] = react.useState(value);
|
|
827
|
-
react.useEffect(() => {
|
|
828
|
-
setInternalValue(value);
|
|
829
|
-
}, [value]);
|
|
830
|
-
react.useEffect(() => {
|
|
831
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(internalValue);
|
|
832
|
-
}, [internalValue, onChange]);
|
|
833
|
-
const changeHandler = react.useCallback((event) => {
|
|
834
|
-
event.stopPropagation();
|
|
835
|
-
const newValue = parseInt(event.target.value || '0', 10);
|
|
836
|
-
setInternalValue(newValue);
|
|
837
|
-
}, []);
|
|
838
|
-
const clickHandler = react.useCallback((action) => {
|
|
839
|
-
if (action) {
|
|
840
|
-
setInternalValue((prevInternalValue) => {
|
|
841
|
-
const newValue = prevInternalValue + 1;
|
|
842
|
-
return newValue <= maxValue ? newValue : maxValue;
|
|
843
|
-
});
|
|
844
|
-
}
|
|
845
|
-
else {
|
|
846
|
-
setInternalValue((prevInternalValue) => {
|
|
847
|
-
const newValue = prevInternalValue - 1;
|
|
848
|
-
return newValue >= minValue ? newValue : minValue;
|
|
849
|
-
});
|
|
850
|
-
}
|
|
851
|
-
}, [maxValue, minValue]);
|
|
852
|
-
const generateStyleVariables = react.useMemo(() => (Object.assign(Object.assign({}, style), { [`--${PREFIX_BS}input-component-form-control-text-align`]: 'center' })), [style]);
|
|
853
|
-
react.useEffect(() => {
|
|
854
|
-
setInternalIsInvalid(!(internalValue >= minValue && internalValue <= maxValue));
|
|
855
|
-
}, [internalValue, minValue, maxValue]);
|
|
856
|
-
return (jsxRuntime.jsx(DInput$1, Object.assign({ id: id, style: generateStyleVariables, className: className, name: name, label: label, value: internalValue, isDisabled: isDisabled, isReadOnly: isReadOnly, isLoading: isLoading, hint: hint, iconStart: iconStart, iconEnd: iconEnd, isInvalid: internalIsInvalid || isInvalid, isValid: isValid, type: "number", onChange: changeHandler, onIconStartClick: () => clickHandler(false), onIconEndClick: () => clickHandler(true) }, rest)));
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
function DInputPassword(_a) {
|
|
860
|
-
var { id, name, label = '', placeholder = '', value = '', isDisabled = false, isReadOnly = false, isLoading = false, hint, isInvalid = false, isValid = false, onChange } = _a, rest = tslib.__rest(_a, ["id", "name", "label", "placeholder", "value", "isDisabled", "isReadOnly", "isLoading", "hint", "isInvalid", "isValid", "onChange"]);
|
|
861
|
-
const [visible, setVisible] = react.useState(false);
|
|
862
|
-
const changeHandler = react.useCallback((event) => {
|
|
863
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(event.target.value);
|
|
864
|
-
}, [onChange]);
|
|
865
|
-
const visibilityHandler = react.useCallback(() => {
|
|
866
|
-
setVisible((prevVisible) => !prevVisible);
|
|
867
|
-
}, []);
|
|
868
|
-
return (jsxRuntime.jsx(DInput$1, Object.assign({ id: id, name: name, label: label, placeholder: placeholder, value: value, iconEnd: !visible ? 'eye-slash' : 'eye', type: !visible ? 'password' : 'text', isDisabled: isDisabled, isReadOnly: isReadOnly, isLoading: isLoading, hint: hint, isInvalid: isInvalid, isValid: isValid, onChange: changeHandler, onIconEndClick: visibilityHandler }, rest)));
|
|
869
|
-
}
|
|
870
|
-
|
|
871
|
-
function DInputPin({ id, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, placeholder = '•', type = 'text', isDisabled = false, isLoading = false, isSecret = false, iconFamilyClass, iconFamilyPrefix, characters = 4, innerInputMode = 'text', hint, isInvalid = false, isValid = false, onChange, }) {
|
|
872
|
-
const [pattern, setPattern] = react.useState('');
|
|
873
|
-
react.useEffect(() => {
|
|
742
|
+
function DInputPin({ id, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, placeholder = '•', type = 'text', isDisabled = false, isLoading = false, isSecret = false, iconFamilyClass, iconFamilyPrefix, characters = 4, innerInputMode = 'text', hint, isInvalid = false, isValid = false, className, style, onChange, }) {
|
|
743
|
+
const [pattern, setPattern] = React.useState('');
|
|
744
|
+
React.useEffect(() => {
|
|
874
745
|
setPattern(type === 'number' ? '[0-9]+' : '^[a-zA-Z0-9]+$');
|
|
875
746
|
}, [type]);
|
|
876
|
-
const nextInput =
|
|
747
|
+
const nextInput = React.useCallback((event) => {
|
|
877
748
|
var _a;
|
|
878
749
|
const input = event.target;
|
|
879
750
|
const regex = new RegExp(pattern);
|
|
@@ -889,7 +760,7 @@ function DInputPin({ id, label = '', labelIcon, labelIconFamilyClass, labelIconF
|
|
|
889
760
|
}
|
|
890
761
|
}
|
|
891
762
|
}, [pattern]);
|
|
892
|
-
const prevInput =
|
|
763
|
+
const prevInput = React.useCallback((event) => {
|
|
893
764
|
var _a;
|
|
894
765
|
if (event.key === 'Backspace') {
|
|
895
766
|
const { value } = event.currentTarget;
|
|
@@ -902,147 +773,96 @@ function DInputPin({ id, label = '', labelIcon, labelIconFamilyClass, labelIconF
|
|
|
902
773
|
}
|
|
903
774
|
}
|
|
904
775
|
}, []);
|
|
905
|
-
const focusInput =
|
|
776
|
+
const focusInput = React.useCallback((event) => {
|
|
906
777
|
// eslint-disable-next-line no-param-reassign
|
|
907
778
|
event.currentTarget.value = '';
|
|
908
779
|
}, []);
|
|
909
|
-
const wheelInput =
|
|
780
|
+
const wheelInput = React.useCallback((event) => {
|
|
910
781
|
event.currentTarget.blur();
|
|
911
782
|
}, []);
|
|
912
|
-
const formChange =
|
|
783
|
+
const formChange = React.useCallback((event) => {
|
|
913
784
|
const formData = new FormData(event.currentTarget);
|
|
914
785
|
const values = Array.from(formData.values()).join('');
|
|
915
786
|
onChange === null || onChange === void 0 ? void 0 : onChange(values);
|
|
916
787
|
}, [onChange]);
|
|
917
|
-
const preventDefaultEvent =
|
|
788
|
+
const preventDefaultEvent = React.useCallback((event) => {
|
|
918
789
|
event.preventDefault();
|
|
919
790
|
}, []);
|
|
920
|
-
return (jsxRuntime.jsxs("div", { className:
|
|
791
|
+
return (jsxRuntime.jsxs("div", { className: classNames('d-input-pin', className), style: style, children: [label && (jsxRuntime.jsxs("label", { htmlFor: "pinIndex0", children: [label, labelIcon && (jsxRuntime.jsx(DIcon, { className: "d-input-pin-icon", icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxRuntime.jsxs("form", { id: id, className: "d-input-pin-controls", onInput: formChange, onSubmit: preventDefaultEvent, children: [Array.from({ length: characters }).map((_, index) => (jsxRuntime.jsx("input", Object.assign({ className: classNames({
|
|
921
792
|
'form-control': true,
|
|
922
793
|
'is-invalid': isInvalid,
|
|
923
794
|
'is-valid': isValid,
|
|
924
795
|
}), type: isSecret ? 'password' : type, "aria-describedby": `${id}State`, inputMode: innerInputMode, id: `pinIndex${index}`, name: `pin-${index}`, maxLength: 1, onChange: nextInput, onKeyDown: prevInput, onFocus: focusInput, onWheel: wheelInput, onClick: preventDefaultEvent, autoComplete: "off", placeholder: placeholder, disabled: isDisabled || isLoading, required: true }, type === 'number' && ({ min: 0, max: 9 })), index))), (isInvalid || isValid) && !isLoading && (jsxRuntime.jsx("span", { className: "input-group-text", id: `${id}State`, children: jsxRuntime.jsx(DIcon, { className: "d-input-pin-validation-icon", icon: isInvalid ? 'exclamation-circle' : 'check', familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), isLoading && (jsxRuntime.jsx("div", { className: "input-group-text d-input-pin-icon", children: jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }) }))] }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] }));
|
|
925
796
|
}
|
|
926
797
|
|
|
927
|
-
function
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
798
|
+
function DInputSelect({ id, name, label = '', className, style, options, labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, isDisabled = false, isLoading = false, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, hint, selectedOption, valueExtractor, labelExtractor, onChange, onBlur, onIconStartClick, onIconEndClick, }) {
|
|
799
|
+
const internalValueExtractor = React.useCallback((option) => {
|
|
800
|
+
if (valueExtractor) {
|
|
801
|
+
return valueExtractor(option);
|
|
802
|
+
}
|
|
803
|
+
if ('value' in option) {
|
|
804
|
+
return option === null || option === void 0 ? void 0 : option.value;
|
|
805
|
+
}
|
|
806
|
+
throw new Error('Must provide a valueExtractor for custom object forms');
|
|
807
|
+
}, [valueExtractor]);
|
|
808
|
+
const internalLabelExtractor = React.useCallback((option) => {
|
|
809
|
+
if (labelExtractor) {
|
|
810
|
+
return labelExtractor(option);
|
|
811
|
+
}
|
|
812
|
+
if ('label' in option) {
|
|
813
|
+
return option === null || option === void 0 ? void 0 : option.label;
|
|
814
|
+
}
|
|
815
|
+
throw new Error('Must provide a labelExtractor for custom object forms');
|
|
816
|
+
}, [labelExtractor]);
|
|
817
|
+
const changeHandler = React.useCallback((event) => {
|
|
818
|
+
const selected = options
|
|
819
|
+
.find((option) => internalValueExtractor(option).toString() === event.currentTarget.value);
|
|
820
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(selected);
|
|
821
|
+
}, [onChange, options, internalValueExtractor]);
|
|
822
|
+
const blurHandler = React.useCallback((event) => {
|
|
823
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
824
|
+
}, [onBlur]);
|
|
825
|
+
const iconStartClickHandler = React.useCallback((event) => {
|
|
826
|
+
onIconStartClick === null || onIconStartClick === void 0 ? void 0 : onIconStartClick(event);
|
|
827
|
+
}, [onIconStartClick]);
|
|
828
|
+
const iconEndClickHandler = React.useCallback((event) => {
|
|
829
|
+
onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(event);
|
|
830
|
+
}, [onIconEndClick]);
|
|
831
|
+
return (jsxRuntime.jsxs("div", { className: classNames('d-input', className), style: style, children: [label && (jsxRuntime.jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsxRuntime.jsx(DIcon, { className: "mdinput-icon", icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxRuntime.jsxs("div", { className: "d-input-control", children: [jsxRuntime.jsxs("div", { className: classNames({
|
|
832
|
+
'input-group': true,
|
|
833
|
+
disabled: isDisabled || isLoading,
|
|
834
|
+
}), children: [iconStart && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: iconStartClickHandler, disabled: isDisabled || isLoading, children: iconStart && (jsxRuntime.jsx(DIcon, { className: "d-input-icon", icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })) })), jsxRuntime.jsx("select", Object.assign({ id: id, name: name, className: "form-select", "aria-label": label, disabled: isDisabled || isLoading, "aria-describedby": `${id}Add ${id}Hint`, onChange: changeHandler, onBlur: blurHandler }, selectedOption && { value: internalValueExtractor(selectedOption) }, { children: options.map((option) => (jsxRuntime.jsx("option", { value: internalValueExtractor(option), children: internalLabelExtractor(option) }, internalValueExtractor(option)))) })), iconEnd && !isLoading && (jsxRuntime.jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: iconEndClickHandler, disabled: isDisabled || isLoading, children: iconEnd && (jsxRuntime.jsx(DIcon, { className: "d-input-icon", icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) })), isLoading && (jsxRuntime.jsx("div", { className: "input-group-text form-control-icon loading", children: jsxRuntime.jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsxRuntime.jsx("span", { className: "visually-hidden", children: "Loading..." }) }) }))] }), hint && (jsxRuntime.jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })] }));
|
|
953
835
|
}
|
|
954
836
|
|
|
955
|
-
function DListItem({ children, className, isActive = false, isDisabled = false, theme, onClick, }) {
|
|
956
|
-
const Tag =
|
|
837
|
+
function DListItem({ children, className, style, isActive = false, isDisabled = false, theme, onClick, }) {
|
|
838
|
+
const Tag = React.useMemo(() => (onClick ? 'button' : 'div'), [onClick]);
|
|
957
839
|
return (jsxRuntime.jsx(Tag, Object.assign({}, Tag === 'button' && {
|
|
958
840
|
onClick,
|
|
959
841
|
type: 'button',
|
|
960
|
-
}, { className:
|
|
842
|
+
}, { className: classNames('list-group-item list-group-item-action', theme ? `list-group-item-${theme}` : undefined, className, {
|
|
961
843
|
active: isActive,
|
|
962
844
|
disabled: isDisabled,
|
|
963
|
-
}) }, isActive && { 'aria-current': true }, { children: children })));
|
|
964
|
-
}
|
|
965
|
-
|
|
966
|
-
function useToast() {
|
|
967
|
-
const toast = react.useCallback((message, { position = 'top-right', type = 'info', showClose = true, autoClose = false, } = {}) => {
|
|
968
|
-
reactToastify.toast(({ closeToast }) => (jsxRuntime.jsx(DAlert, { type: type, showClose: showClose, onClose: closeToast, id: "alertID", children: message })), {
|
|
969
|
-
transition: reactToastify.Slide,
|
|
970
|
-
position,
|
|
971
|
-
autoClose,
|
|
972
|
-
});
|
|
973
|
-
}, []);
|
|
974
|
-
return {
|
|
975
|
-
toast,
|
|
976
|
-
};
|
|
977
|
-
}
|
|
978
|
-
|
|
979
|
-
function useScreenshot() {
|
|
980
|
-
const clipRef = react.useRef(null);
|
|
981
|
-
const takeBlob = react.useCallback(async (type) => {
|
|
982
|
-
if (!clipRef.current) {
|
|
983
|
-
throw new Error('set the clipRef');
|
|
984
|
-
}
|
|
985
|
-
const canvas = await html2canvas__default["default"](clipRef === null || clipRef === void 0 ? void 0 : clipRef.current, {
|
|
986
|
-
allowTaint: true,
|
|
987
|
-
useCORS: true,
|
|
988
|
-
});
|
|
989
|
-
return (new Promise((resolve, reject) => {
|
|
990
|
-
canvas.toBlob((innerBlob) => {
|
|
991
|
-
if (!innerBlob) {
|
|
992
|
-
return reject();
|
|
993
|
-
}
|
|
994
|
-
return resolve(innerBlob);
|
|
995
|
-
}, type);
|
|
996
|
-
}));
|
|
997
|
-
}, []);
|
|
998
|
-
return {
|
|
999
|
-
clipRef,
|
|
1000
|
-
takeBlob,
|
|
1001
|
-
};
|
|
1002
|
-
}
|
|
1003
|
-
|
|
1004
|
-
function useScreenshotDownload() {
|
|
1005
|
-
const { clipRef, takeBlob } = useScreenshot();
|
|
1006
|
-
const download = react.useCallback(async () => {
|
|
1007
|
-
const blob = await takeBlob();
|
|
1008
|
-
const url = window.URL.createObjectURL(blob);
|
|
1009
|
-
const link = window.document.createElement('a');
|
|
1010
|
-
link.style.display = 'none';
|
|
1011
|
-
link.href = url;
|
|
1012
|
-
link.download = 'voucher.jpg';
|
|
1013
|
-
document.body.appendChild(link);
|
|
1014
|
-
link.click();
|
|
1015
|
-
document.body.removeChild(link);
|
|
1016
|
-
window.URL.revokeObjectURL(url);
|
|
1017
|
-
}, [takeBlob]);
|
|
1018
|
-
return {
|
|
1019
|
-
download,
|
|
1020
|
-
downloadRef: clipRef,
|
|
1021
|
-
};
|
|
845
|
+
}), style: style }, isActive && { 'aria-current': true }, { children: children })));
|
|
1022
846
|
}
|
|
1023
847
|
|
|
1024
|
-
function
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
}
|
|
1034
|
-
await navigator.share({ files: [image] });
|
|
1035
|
-
}, [takeBlob]);
|
|
1036
|
-
return {
|
|
1037
|
-
share,
|
|
1038
|
-
shareRef: clipRef,
|
|
1039
|
-
};
|
|
848
|
+
function DList({ children, className, style, isFlush = false, isNumbered = false, isHorizontal = false, horizontalBreakpoint, }) {
|
|
849
|
+
if (isFlush && isHorizontal) {
|
|
850
|
+
throw new Error("Horizontal and Flush props don't work together");
|
|
851
|
+
}
|
|
852
|
+
return (jsxRuntime.jsx("div", { className: classNames('list-group', {
|
|
853
|
+
'list-group-flush': isFlush && !isHorizontal,
|
|
854
|
+
'list-group-numbered': isNumbered,
|
|
855
|
+
'list-group-horizontal': isHorizontal && !horizontalBreakpoint,
|
|
856
|
+
}, (isHorizontal && horizontalBreakpoint) && `list-group-horizontal-${horizontalBreakpoint}`, className), style: style, children: children }));
|
|
1040
857
|
}
|
|
858
|
+
var DList$1 = Object.assign(DList, {
|
|
859
|
+
Item: DListItem,
|
|
860
|
+
});
|
|
1041
861
|
|
|
1042
862
|
function DListItemMovement(_a) {
|
|
1043
|
-
var { description, date, amount,
|
|
863
|
+
var { description, date, amount, className, style } = _a, props = tslib.__rest(_a, ["description", "date", "amount", "className", "style"]);
|
|
1044
864
|
const { format } = useFormatCurrency();
|
|
1045
|
-
const value =
|
|
865
|
+
const value = React.useMemo(() => {
|
|
1046
866
|
const valueFormatted = format(amount);
|
|
1047
867
|
if (amount > 0) {
|
|
1048
868
|
return {
|
|
@@ -1055,11 +875,23 @@ function DListItemMovement(_a) {
|
|
|
1055
875
|
valueFormatted,
|
|
1056
876
|
};
|
|
1057
877
|
}, [format, amount]);
|
|
1058
|
-
return (jsxRuntime.jsx(DListItem, Object.assign({}, props, { children: jsxRuntime.jsxs("div", { className:
|
|
878
|
+
return (jsxRuntime.jsx(DListItem, Object.assign({}, props, { children: jsxRuntime.jsxs("div", { className: classNames('d-flex justify-content-between align-items-center p-3 gap-3', className), style: style, children: [jsxRuntime.jsxs("div", { className: "d-flex flex-column gap-1", children: [jsxRuntime.jsx("span", { className: "fs-6", children: description }), jsxRuntime.jsx("span", { className: "small text-gray-700", children: date })] }), jsxRuntime.jsx("span", { className: classNames('fs-6', value.theme), children: value.valueFormatted })] }) })));
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
function DModalHeader({ showCloseButton, onClose, children, className, style, }) {
|
|
882
|
+
return (jsxRuntime.jsxs("div", { className: classNames('modal-header', className), style: style, children: [showCloseButton && (jsxRuntime.jsx("button", { type: "button", className: "d-modal-close", "aria-label": "Close", onClick: onClose, children: jsxRuntime.jsx(DIcon, { icon: "x-lg" }) })), children] }));
|
|
1059
883
|
}
|
|
1060
884
|
|
|
1061
|
-
function
|
|
1062
|
-
|
|
885
|
+
function DModalBody({ children, className, style, }) {
|
|
886
|
+
return (jsxRuntime.jsx("div", { className: classNames('d-modal-slot modal-body', className), style: style, children: children }));
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
function DModalFooter({ className, style, actionPlacement = 'fill', children, }) {
|
|
890
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "d-modal-separator" }), jsxRuntime.jsx("div", { className: classNames(`d-modal-slot modal-footer d-modal-action-${actionPlacement}`, className), style: style, children: children })] }));
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
function DModal({ name, className, style, isStatic, isScrollable, isCentered, isFullScreen, fullScreenFrom, modalSize, children, }) {
|
|
894
|
+
const fullScreenClass = React.useMemo(() => {
|
|
1063
895
|
if (isFullScreen) {
|
|
1064
896
|
if (fullScreenFrom) {
|
|
1065
897
|
return `modal-fullscreen-${fullScreenFrom}-down`;
|
|
@@ -1068,33 +900,35 @@ function DModal({ name, className = '', isStatic, isScrollable, isCentered, isFu
|
|
|
1068
900
|
}
|
|
1069
901
|
return '';
|
|
1070
902
|
}, [fullScreenFrom, isFullScreen]);
|
|
1071
|
-
const generateClasses =
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
}), [className]);
|
|
1075
|
-
const generateModalDialogClasses = react.useMemo(() => (Object.assign({ 'modal-dialog': true, 'modal-dialog-centered': !!isCentered, 'modal-dialog-scrollable': !!isScrollable, [fullScreenClass]: !!isFullScreen }, modalSize && { [`modal-${modalSize}`]: true })), [fullScreenClass, isCentered, isFullScreen, isScrollable, modalSize]);
|
|
1076
|
-
return (jsxRuntime.jsx("div", Object.assign({ className: classNames__default["default"](generateClasses), id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false" }, isStatic && ({
|
|
903
|
+
const generateClasses = React.useMemo(() => (Object.assign({ 'modal fade show': true }, className && { [className]: true })), [className]);
|
|
904
|
+
const generateModalDialogClasses = React.useMemo(() => (Object.assign({ 'modal-dialog': true, 'modal-dialog-centered': !!isCentered, 'modal-dialog-scrollable': !!isScrollable, [fullScreenClass]: !!isFullScreen }, modalSize && { [`modal-${modalSize}`]: true })), [fullScreenClass, isCentered, isFullScreen, isScrollable, modalSize]);
|
|
905
|
+
return (jsxRuntime.jsx("div", Object.assign({ className: classNames(generateClasses), id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false", style: style }, isStatic && ({
|
|
1077
906
|
[`data-${PREFIX_BS}backdrop`]: 'static',
|
|
1078
907
|
[`data-${PREFIX_BS}keyboard`]: 'false',
|
|
1079
|
-
}), { children: jsxRuntime.jsx("div", { className:
|
|
908
|
+
}), { children: jsxRuntime.jsx("div", { className: classNames(generateModalDialogClasses), children: jsxRuntime.jsx("div", { className: "modal-content", children: children }) }) })));
|
|
1080
909
|
}
|
|
910
|
+
var DModal$1 = Object.assign(DModal, {
|
|
911
|
+
Header: DModalHeader,
|
|
912
|
+
Body: DModalBody,
|
|
913
|
+
Footer: DModalFooter,
|
|
914
|
+
});
|
|
1081
915
|
|
|
1082
|
-
function
|
|
1083
|
-
return (jsxRuntime.jsx("div", { className: "d-
|
|
916
|
+
function DOffcanvasHeader({ showCloseButton, onClose, children, className, style, }) {
|
|
917
|
+
return (jsxRuntime.jsxs("div", { className: classNames('offcanvas-header', className), style: style, children: [jsxRuntime.jsx("div", { className: "d-offcanvas-slot", children: children }), showCloseButton && (jsxRuntime.jsx("button", { type: "button", className: "d-offcanvas-close", "aria-label": "Close", onClick: onClose, children: jsxRuntime.jsx(DIcon, { icon: "x-lg" }) }))] }));
|
|
1084
918
|
}
|
|
1085
919
|
|
|
1086
|
-
function
|
|
1087
|
-
return (jsxRuntime.
|
|
920
|
+
function DOffcanvasBody({ children, className, style, }) {
|
|
921
|
+
return (jsxRuntime.jsx("div", { className: classNames('d-offcanvas-slot offcanvas-body', className), style: style, children: children }));
|
|
1088
922
|
}
|
|
1089
923
|
|
|
1090
|
-
function
|
|
1091
|
-
return (jsxRuntime.
|
|
924
|
+
function DOffcanvasFooter({ footerActionPlacement = 'fill', children, className, style, }) {
|
|
925
|
+
return (jsxRuntime.jsx("div", { className: classNames(`d-offcanvas-slot d-offcanvas-footer d-offcanvas-action-${footerActionPlacement}`, className), style: style, children: children }));
|
|
1092
926
|
}
|
|
1093
927
|
|
|
1094
|
-
function DOffcanvas({ name, className, isStatic, isScrollable, openFrom = 'end', children, }) {
|
|
1095
|
-
return (jsxRuntime.jsx("div", Object.assign({ className:
|
|
928
|
+
function DOffcanvas({ name, className, style, isStatic, isScrollable, openFrom = 'end', children, }) {
|
|
929
|
+
return (jsxRuntime.jsx("div", Object.assign({ className: classNames('offcanvas show', {
|
|
1096
930
|
[`offcanvas-${openFrom}`]: openFrom,
|
|
1097
|
-
}, className), id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false" }, isStatic && ({
|
|
931
|
+
}, className), style: style, id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false" }, isStatic && ({
|
|
1098
932
|
[`data-${PREFIX_BS}backdrop`]: 'static',
|
|
1099
933
|
[`data-${PREFIX_BS}keyboard`]: 'false',
|
|
1100
934
|
}), isScrollable && ({
|
|
@@ -1102,146 +936,139 @@ function DOffcanvas({ name, className, isStatic, isScrollable, openFrom = 'end',
|
|
|
1102
936
|
[`data-${PREFIX_BS}keyboard`]: 'false',
|
|
1103
937
|
}), { children: children })));
|
|
1104
938
|
}
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
function DOffcanvasFooter({ footerActionPlacement = 'fill', children, }) {
|
|
1111
|
-
return (jsxRuntime.jsx("div", { className: `d-offcanvas-slot d-offcanvas-footer d-offcanvas-action-${footerActionPlacement}`, children: children }));
|
|
1112
|
-
}
|
|
1113
|
-
|
|
1114
|
-
function DOffcanvasHeader({ showCloseButton, onClose, children, }) {
|
|
1115
|
-
return (jsxRuntime.jsxs("div", { className: "offcanvas-header", children: [jsxRuntime.jsx("div", { className: "d-offcanvas-slot", children: children }), showCloseButton && (jsxRuntime.jsx("button", { type: "button", className: "d-offcanvas-close", "aria-label": "Close", onClick: onClose, children: jsxRuntime.jsx(DIcon, { icon: "x-lg" }) }))] }));
|
|
1116
|
-
}
|
|
939
|
+
var DOffcanvas$1 = Object.assign(DOffcanvas, {
|
|
940
|
+
Header: DOffcanvasHeader,
|
|
941
|
+
Body: DOffcanvasBody,
|
|
942
|
+
Footer: DOffcanvasFooter,
|
|
943
|
+
});
|
|
1117
944
|
|
|
1118
945
|
function DPaginator(_a) {
|
|
1119
946
|
var { className, nextLabel, previousLabel, showArrows = true, page, onPageChange } = _a, props = tslib.__rest(_a, ["className", "nextLabel", "previousLabel", "showArrows", "page", "onPageChange"]);
|
|
1120
|
-
return (jsxRuntime.jsx(
|
|
947
|
+
return (jsxRuntime.jsx(ResponsivePagination, Object.assign({ extraClassName: classNames('pagination', className), nextClassName: classNames('arrow arrow-next', !nextLabel && 'no-label'), nextLabel: nextLabel, previousClassName: classNames('arrow arrow-prev', !previousLabel && 'no-label'), previousLabel: previousLabel, renderNav: showArrows, current: page, onPageChange: onPageChange }, props)));
|
|
1121
948
|
}
|
|
1122
949
|
|
|
1123
|
-
function DPopover({ children, renderComponent, isOpen, setEventIsOpen, adjustContentToRender = false, }) {
|
|
1124
|
-
const [innerIsOpen, setInnerIsOpen] =
|
|
1125
|
-
|
|
950
|
+
function DPopover({ children, renderComponent, isOpen, setEventIsOpen, adjustContentToRender = false, className, style, }) {
|
|
951
|
+
const [innerIsOpen, setInnerIsOpen] = React.useState(false);
|
|
952
|
+
React.useEffect(() => {
|
|
1126
953
|
setInnerIsOpen(isOpen);
|
|
1127
954
|
}, [isOpen]);
|
|
1128
|
-
const onOpenChange =
|
|
955
|
+
const onOpenChange = React.useCallback((value) => {
|
|
1129
956
|
setInnerIsOpen(value);
|
|
1130
957
|
if (setEventIsOpen) {
|
|
1131
958
|
setEventIsOpen(value);
|
|
1132
959
|
}
|
|
1133
960
|
}, [setEventIsOpen]);
|
|
1134
|
-
const { refs, floatingStyles, context } = react
|
|
961
|
+
const { refs, floatingStyles, context } = react.useFloating({
|
|
1135
962
|
open: innerIsOpen,
|
|
1136
963
|
onOpenChange,
|
|
1137
964
|
middleware: [
|
|
1138
|
-
react
|
|
1139
|
-
react
|
|
1140
|
-
react
|
|
965
|
+
react.offset(0),
|
|
966
|
+
react.flip({ fallbackAxisSideDirection: 'none' }),
|
|
967
|
+
react.shift(),
|
|
1141
968
|
],
|
|
1142
|
-
whileElementsMounted: react
|
|
969
|
+
whileElementsMounted: react.autoUpdate,
|
|
1143
970
|
});
|
|
1144
|
-
const click = react
|
|
1145
|
-
const dismiss = react
|
|
1146
|
-
const role = react
|
|
1147
|
-
const { getReferenceProps, getFloatingProps } = react
|
|
971
|
+
const click = react.useClick(context);
|
|
972
|
+
const dismiss = react.useDismiss(context);
|
|
973
|
+
const role = react.useRole(context);
|
|
974
|
+
const { getReferenceProps, getFloatingProps } = react.useInteractions([
|
|
1148
975
|
click,
|
|
1149
976
|
dismiss,
|
|
1150
977
|
role,
|
|
1151
978
|
]);
|
|
1152
|
-
const headingId = react
|
|
1153
|
-
return (jsxRuntime.jsxs("div", { className:
|
|
979
|
+
const headingId = react.useId();
|
|
980
|
+
return (jsxRuntime.jsxs("div", { className: classNames('d-popover', className), style: style, children: [jsxRuntime.jsx("div", Object.assign({ ref: refs.setReference }, getReferenceProps(), { children: renderComponent(innerIsOpen) })), innerIsOpen && (jsxRuntime.jsx(react.FloatingFocusManager, { context: context, modal: false, children: jsxRuntime.jsx("div", Object.assign({ className: classNames('d-popover-content', {
|
|
1154
981
|
'w-100': adjustContentToRender,
|
|
1155
982
|
}), ref: refs.setFloating, style: floatingStyles, "aria-labelledby": headingId }, getFloatingProps(), { children: children })) }))] }));
|
|
1156
983
|
}
|
|
1157
984
|
|
|
1158
|
-
function DProgress({ currentValue, minValue = 0, maxValue = 100, hideCurrentValue = false, enableStripedAnimation = false, }) {
|
|
1159
|
-
const formatProgress =
|
|
1160
|
-
const generateClasses =
|
|
985
|
+
function DProgress({ className, style, currentValue, minValue = 0, maxValue = 100, hideCurrentValue = false, enableStripedAnimation = false, }) {
|
|
986
|
+
const formatProgress = React.useMemo(() => `${currentValue}%`, [currentValue]);
|
|
987
|
+
const generateClasses = React.useMemo(() => ({
|
|
1161
988
|
'progress-bar': true,
|
|
1162
989
|
'progress-bar-striped progress-bar-animated': enableStripedAnimation,
|
|
1163
990
|
}), [enableStripedAnimation]);
|
|
1164
|
-
return (jsxRuntime.jsx("div", { className: "progress", children: jsxRuntime.jsx("div", { className:
|
|
991
|
+
return (jsxRuntime.jsx("div", { className: "progress", children: jsxRuntime.jsx("div", { className: classNames(generateClasses, className), role: "progressbar", "aria-label": "Progress bar", style: Object.assign({ width: `${currentValue}%` }, style), "aria-valuenow": currentValue, "aria-valuemin": minValue, "aria-valuemax": maxValue, children: !hideCurrentValue && formatProgress }) }));
|
|
1165
992
|
}
|
|
1166
993
|
|
|
1167
994
|
function DQuickActionButton({ line1, line2, className, actionLinkText, actionLinkTheme = 'secondary', actionIcon, secondaryActionIcon, actionIconFamilyClass, actionIconFamilyPrefix, representativeImage, representativeIcon, representativeIconTheme = 'secondary', representativeIconHasCircle = false, representativeIconFamilyClass, representativeIconFamilyPrefix, onClick, onClickSecondary, style, }) {
|
|
1168
|
-
const globalClickHandler =
|
|
995
|
+
const globalClickHandler = React.useCallback(() => {
|
|
1169
996
|
if (actionLinkText) {
|
|
1170
997
|
return;
|
|
1171
998
|
}
|
|
1172
999
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
1173
1000
|
}, [actionLinkText, onClick]);
|
|
1174
|
-
const actionLinkClickHandler =
|
|
1001
|
+
const actionLinkClickHandler = React.useCallback(() => {
|
|
1175
1002
|
if (!actionLinkText) {
|
|
1176
1003
|
return;
|
|
1177
1004
|
}
|
|
1178
1005
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
1179
1006
|
}, [actionLinkText, onClick]);
|
|
1180
|
-
const secondaryActionLinkClickHandler =
|
|
1007
|
+
const secondaryActionLinkClickHandler = React.useCallback(() => {
|
|
1181
1008
|
onClickSecondary === null || onClickSecondary === void 0 ? void 0 : onClickSecondary();
|
|
1182
1009
|
}, [onClickSecondary]);
|
|
1183
|
-
const Tag =
|
|
1184
|
-
return (jsxRuntime.jsxs(Tag, { className:
|
|
1010
|
+
const Tag = React.useMemo(() => (actionLinkText ? 'div' : 'button'), [actionLinkText]);
|
|
1011
|
+
return (jsxRuntime.jsxs(Tag, { className: classNames('d-quick-action-button', className), onClick: !actionLinkText ? globalClickHandler : undefined, style: style, children: [representativeIcon && (jsxRuntime.jsx(DIcon, { className: "d-quick-action-button-representative-icon", size: representativeIconHasCircle
|
|
1185
1012
|
? `var(--${PREFIX_BS}quick-action-button-representative-icon-size)`
|
|
1186
1013
|
: `var(--${PREFIX_BS}quick-action-button-representative-image-size)`, icon: representativeIcon, hasCircle: representativeIconHasCircle, theme: representativeIconTheme, familyClass: representativeIconFamilyClass, familyPrefix: representativeIconFamilyPrefix })), representativeImage && (jsxRuntime.jsx("img", { className: "d-quick-action-button-representative-image", src: representativeImage, alt: "" })), jsxRuntime.jsx("div", { className: "d-quick-action-button-content", children: jsxRuntime.jsxs("div", { className: "d-quick-action-button-text", children: [jsxRuntime.jsx("span", { className: "d-quick-action-button-line1", children: line1 }), jsxRuntime.jsx("small", { className: "d-quick-action-button-line2", children: line2 })] }) }), secondaryActionIcon && (jsxRuntime.jsx(DButton, { className: "d-quick-action-button-secondary-action-link", type: "button", variant: "link", iconStart: secondaryActionIcon, iconStartFamilyClass: actionIconFamilyClass, iconStartFamilyPrefix: actionIconFamilyPrefix, theme: actionLinkTheme, onClick: secondaryActionLinkClickHandler, isStopPropagationEnabled: true })), actionLinkText && !actionIcon && (jsxRuntime.jsx(DButton, { className: "d-quick-action-button-action-link", type: "button", variant: "link", theme: actionLinkTheme, text: actionLinkText, onClick: actionLinkClickHandler, isStopPropagationEnabled: true })), actionIcon && !actionLinkText && (jsxRuntime.jsx(DIcon, { className: "d-quick-action-button-action-icon", icon: actionIcon, size: `var(--${PREFIX_BS}quick-action-button-action-icon-size)`, familyClass: actionIconFamilyClass, familyPrefix: actionIconFamilyPrefix }))] }));
|
|
1187
1014
|
}
|
|
1188
1015
|
|
|
1189
|
-
function DQuickActionCheck({ id, name, value, line1, line2, line3, className, isChecked, onChange, }) {
|
|
1190
|
-
const changeHandler =
|
|
1016
|
+
function DQuickActionCheck({ id, name, value, line1, line2, line3, className, style, isChecked, onChange, }) {
|
|
1017
|
+
const changeHandler = React.useCallback((event) => {
|
|
1191
1018
|
event.stopPropagation();
|
|
1192
1019
|
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
1193
1020
|
}, [onChange]);
|
|
1194
|
-
return (jsxRuntime.jsxs("label", { className:
|
|
1021
|
+
return (jsxRuntime.jsxs("label", { className: classNames('d-quick-action-check', className), htmlFor: id, style: style, children: [jsxRuntime.jsx(DInputCheck, { id: id, type: "radio", name: name, value: value, isChecked: isChecked, onChange: changeHandler }), jsxRuntime.jsxs("div", { className: "d-quick-action-check-detail", children: [jsxRuntime.jsx("span", { className: "d-quick-action-check-line1", children: line1 }), jsxRuntime.jsx("span", { className: "d-quick-action-check-line2", children: line2 })] }), jsxRuntime.jsx("span", { className: "d-quick-action-check-line3", children: line3 })] }));
|
|
1195
1022
|
}
|
|
1196
1023
|
|
|
1197
|
-
function DQuickActionSelect({ id, name, value, line1, line2, className, isSelected = false, onChange, }) {
|
|
1198
|
-
const innerRef =
|
|
1199
|
-
const changeHandler =
|
|
1024
|
+
function DQuickActionSelect({ id, name, value, line1, line2, className, style, isSelected = false, onChange, }) {
|
|
1025
|
+
const innerRef = React.useRef(null);
|
|
1026
|
+
const changeHandler = React.useCallback((event) => {
|
|
1200
1027
|
event.stopPropagation();
|
|
1201
1028
|
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
1202
1029
|
}, [onChange]);
|
|
1203
|
-
|
|
1030
|
+
React.useEffect(() => {
|
|
1204
1031
|
if (innerRef.current) {
|
|
1205
1032
|
innerRef.current.checked = isSelected;
|
|
1206
1033
|
}
|
|
1207
1034
|
}, [isSelected]);
|
|
1208
|
-
return (jsxRuntime.jsxs("label", { className:
|
|
1035
|
+
return (jsxRuntime.jsxs("label", { className: classNames('d-quick-action-select', className), htmlFor: id, style: style, children: [jsxRuntime.jsx("input", { ref: innerRef, id: id, type: "radio", name: name, value: value, onChange: changeHandler }), jsxRuntime.jsx("span", { className: "d-quick-action-select-line1", children: line1 }), jsxRuntime.jsx("span", { className: "d-quick-action-select-line2", children: line2 })] }));
|
|
1209
1036
|
}
|
|
1210
1037
|
|
|
1211
|
-
function DQuickActionSwitch({ id, name, label, hint,
|
|
1212
|
-
const clickHandler =
|
|
1038
|
+
function DQuickActionSwitch({ id, name, label, hint, isChecked, isDisabled, className, style, onClick, }) {
|
|
1039
|
+
const clickHandler = React.useCallback((event) => {
|
|
1213
1040
|
event.stopPropagation();
|
|
1214
1041
|
onClick === null || onClick === void 0 ? void 0 : onClick(isChecked);
|
|
1215
1042
|
}, [isChecked, onClick]);
|
|
1216
|
-
return (jsxRuntime.jsxs("button", { className:
|
|
1043
|
+
return (jsxRuntime.jsxs("button", { className: classNames('d-quick-action-switch', className), type: "button", onClick: clickHandler, style: style, children: [jsxRuntime.jsxs("div", { className: "d-quick-action-switch-content", children: [jsxRuntime.jsx(DInputSwitch, { id: id, name: name, isDisabled: isDisabled, isChecked: isChecked, isReadonly: true }), jsxRuntime.jsx("label", { className: "d-quick-action-switch-label", htmlFor: id, children: label })] }), jsxRuntime.jsx("div", { className: "d-quick-action-switch-hint", children: hint })] }));
|
|
1217
1044
|
}
|
|
1218
1045
|
|
|
1219
1046
|
function DSkeleton({ speed = 2, viewBox, backgroundColor, foregroundColor, children, }) {
|
|
1220
|
-
const innerBackgroundColor =
|
|
1047
|
+
const innerBackgroundColor = React.useMemo(() => {
|
|
1221
1048
|
if (backgroundColor) {
|
|
1222
1049
|
return backgroundColor;
|
|
1223
1050
|
}
|
|
1224
1051
|
const computedStyle = getComputedStyle(document.documentElement);
|
|
1225
1052
|
return computedStyle.getPropertyValue(`--${PREFIX_BS}secondary-100`);
|
|
1226
1053
|
}, [backgroundColor]);
|
|
1227
|
-
const innerForegroundColor =
|
|
1054
|
+
const innerForegroundColor = React.useMemo(() => {
|
|
1228
1055
|
if (foregroundColor) {
|
|
1229
1056
|
return foregroundColor;
|
|
1230
1057
|
}
|
|
1231
1058
|
const computedStyle = getComputedStyle(document.documentElement);
|
|
1232
1059
|
return computedStyle.getPropertyValue(`--${PREFIX_BS}gray-100`);
|
|
1233
1060
|
}, [foregroundColor]);
|
|
1234
|
-
return (jsxRuntime.jsx(
|
|
1061
|
+
return (jsxRuntime.jsx(ContentLoader, { speed: speed, viewBox: viewBox, backgroundColor: innerBackgroundColor, foregroundColor: innerForegroundColor, children: children }));
|
|
1235
1062
|
}
|
|
1236
1063
|
|
|
1237
|
-
function DStepper$2({ options, currentStep, successIcon = 'check', isVertical = false, }) {
|
|
1064
|
+
function DStepper$2({ options, currentStep, successIcon = 'check', isVertical = false, className, style, }) {
|
|
1238
1065
|
if (currentStep < 1 || currentStep > options.length) {
|
|
1239
1066
|
throw new Error('Current step should be in the range from 1 to options length');
|
|
1240
1067
|
}
|
|
1241
|
-
return (jsxRuntime.jsx("div", { className:
|
|
1068
|
+
return (jsxRuntime.jsx("div", { className: classNames({
|
|
1242
1069
|
'd-stepper-desktop': true,
|
|
1243
1070
|
'is-vertical': isVertical,
|
|
1244
|
-
}), children: options.map(({ label, value }) => (jsxRuntime.jsxs("div", { className: "d-step", children: [jsxRuntime.jsx("div", { className: "d-step-value", children: jsxRuntime.jsx("div", { className:
|
|
1071
|
+
}, className), style: style, children: options.map(({ label, value }) => (jsxRuntime.jsxs("div", { className: "d-step", children: [jsxRuntime.jsx("div", { className: "d-step-value", children: jsxRuntime.jsx("div", { className: classNames({
|
|
1245
1072
|
'd-step-icon-container': true,
|
|
1246
1073
|
'd-step-check': value < currentStep,
|
|
1247
1074
|
'd-step-current': value === currentStep,
|
|
@@ -1250,13 +1077,13 @@ function DStepper$2({ options, currentStep, successIcon = 'check', isVertical =
|
|
|
1250
1077
|
: value }) }), jsxRuntime.jsx("div", { className: "d-step-label", children: label })] }, value))) }));
|
|
1251
1078
|
}
|
|
1252
1079
|
|
|
1253
|
-
function DStepper$1({ options, currentStep, }) {
|
|
1080
|
+
function DStepper$1({ options, currentStep, className, style, }) {
|
|
1254
1081
|
if (currentStep < 1 || currentStep > options.length) {
|
|
1255
1082
|
throw new Error('Current step should be in the range from 1 to options length');
|
|
1256
1083
|
}
|
|
1257
|
-
const currentOption =
|
|
1258
|
-
const [currentAngle, setCurrentAngle] =
|
|
1259
|
-
|
|
1084
|
+
const currentOption = React.useMemo(() => { var _a; return (_a = options[currentStep - 1]) !== null && _a !== void 0 ? _a : {}; }, [currentStep, options]);
|
|
1085
|
+
const [currentAngle, setCurrentAngle] = React.useState(0);
|
|
1086
|
+
React.useEffect(() => {
|
|
1260
1087
|
const targetAngle = (currentStep / options.length) * 360;
|
|
1261
1088
|
const animationInterval = setInterval(() => {
|
|
1262
1089
|
const angleDifference = targetAngle - currentAngle;
|
|
@@ -1273,54 +1100,15 @@ function DStepper$1({ options, currentStep, }) {
|
|
|
1273
1100
|
clearInterval(animationInterval);
|
|
1274
1101
|
};
|
|
1275
1102
|
}, [currentAngle, currentStep, options.length]);
|
|
1276
|
-
const progressStyle =
|
|
1103
|
+
const progressStyle = React.useMemo(() => `conic-gradient(
|
|
1277
1104
|
from 180deg,
|
|
1278
1105
|
var(--${PREFIX_BS}step-progress-outter-fill-background-color) ${currentAngle}deg,
|
|
1279
1106
|
var(--${PREFIX_BS}step-progress-outter-background-color) 0deg)`, [currentAngle]);
|
|
1280
|
-
return (jsxRuntime.jsxs("div", { className:
|
|
1107
|
+
return (jsxRuntime.jsxs("div", { className: classNames('d-stepper', className), style: style, children: [jsxRuntime.jsx("div", { className: "d-step-bar", style: { background: progressStyle }, children: jsxRuntime.jsx("p", { className: "d-step-number", children: `${currentStep}/${options.length}` }) }), jsxRuntime.jsx("div", { className: "d-step-info", children: Object.keys(currentOption).length > 0 && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "d-step-label", children: currentOption.label }), jsxRuntime.jsx("div", { className: "d-step-description", children: currentOption.description || '' })] })) })] }));
|
|
1281
1108
|
}
|
|
1282
1109
|
|
|
1283
|
-
function DStepper({ options, currentStep, successIcon = 'check', isVertical = false, breakpoint = 'lg', }) {
|
|
1284
|
-
return (jsxRuntime.jsxs(
|
|
1285
|
-
}
|
|
1286
|
-
|
|
1287
|
-
const TabContext = react.createContext(undefined);
|
|
1288
|
-
function DTabs({ children, defaultSelected, onChange, options, className, isVertical, }) {
|
|
1289
|
-
const [selected, setSelected] = react.useState(defaultSelected);
|
|
1290
|
-
const onSelect = react.useCallback((option) => {
|
|
1291
|
-
if (option.tab) {
|
|
1292
|
-
setSelected(option.tab);
|
|
1293
|
-
}
|
|
1294
|
-
onChange(option);
|
|
1295
|
-
}, [onChange]);
|
|
1296
|
-
react.useEffect(() => {
|
|
1297
|
-
setSelected(defaultSelected);
|
|
1298
|
-
}, [defaultSelected]);
|
|
1299
|
-
const isSelected = react.useCallback((tab) => (selected === tab), [selected]);
|
|
1300
|
-
const value = react.useMemo(() => ({
|
|
1301
|
-
isSelected,
|
|
1302
|
-
}), [isSelected]);
|
|
1303
|
-
return (jsxRuntime.jsx(TabContext.Provider, { value: value, children: jsxRuntime.jsxs("div", { className: classNames__default["default"]({
|
|
1304
|
-
'd-tabs': true,
|
|
1305
|
-
'd-tabs-vertical': isVertical,
|
|
1306
|
-
}), children: [jsxRuntime.jsx("nav", { className: "nav", children: options.map((option) => (jsxRuntime.jsx("button", { id: `${option.tab}Tab`, className: classNames__default["default"]('nav-link', {
|
|
1307
|
-
active: option.tab === selected,
|
|
1308
|
-
}, 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))) }), jsxRuntime.jsx("div", { className: "tab-content", children: children })] }) }));
|
|
1309
|
-
}
|
|
1310
|
-
function useTabContext() {
|
|
1311
|
-
const context = react.useContext(TabContext);
|
|
1312
|
-
if (context === undefined) {
|
|
1313
|
-
throw new Error('useTabContext was used outside of MTab');
|
|
1314
|
-
}
|
|
1315
|
-
return context;
|
|
1316
|
-
}
|
|
1317
|
-
|
|
1318
|
-
function DTabContent({ tab, children }) {
|
|
1319
|
-
const { isSelected } = useTabContext();
|
|
1320
|
-
if (!isSelected(tab)) {
|
|
1321
|
-
return null;
|
|
1322
|
-
}
|
|
1323
|
-
return (jsxRuntime.jsx("div", { className: "tab-pane fade show active", id: `${tab}Pane`, role: "tabpanel", tabIndex: 0, "aria-labelledby": `${tab}Tab`, children: children }));
|
|
1110
|
+
function DStepper({ options, currentStep, successIcon = 'check', isVertical = false, breakpoint = 'lg', className, style, }) {
|
|
1111
|
+
return (jsxRuntime.jsxs("div", { className: className, style: style, children: [jsxRuntime.jsx("div", { className: `d-block d-${breakpoint}-none`, children: jsxRuntime.jsx(DStepper$1, { options: options, currentStep: currentStep }) }), jsxRuntime.jsx("div", { className: `d-none d-${breakpoint}-block`, children: jsxRuntime.jsx(DStepper$2, { options: options, currentStep: currentStep, successIcon: successIcon, isVertical: isVertical }) })] }));
|
|
1324
1112
|
}
|
|
1325
1113
|
|
|
1326
1114
|
const TOOLTIP_FONT_SIZE_BY_SIZE = {
|
|
@@ -1331,97 +1119,159 @@ const TOOLTIP_FONT_SIZE_BY_SIZE = {
|
|
|
1331
1119
|
const ARROW_WIDTH = 8;
|
|
1332
1120
|
const ARROW_HEIGHT = 4;
|
|
1333
1121
|
const GAP = 2;
|
|
1334
|
-
function DTooltip({ classNameContainer, className, offSet = ARROW_HEIGHT + GAP, padding, withFocus = false, withClick = false, withHover = true, isOpen = false, placement = 'top', size, Component, children, }) {
|
|
1335
|
-
const [open, setOpen] =
|
|
1336
|
-
const styleVariables =
|
|
1122
|
+
function DTooltip({ classNameContainer, className, style, offSet = ARROW_HEIGHT + GAP, padding, withFocus = false, withClick = false, withHover = true, isOpen = false, placement = 'top', size, Component, children, }) {
|
|
1123
|
+
const [open, setOpen] = React.useState(isOpen);
|
|
1124
|
+
const styleVariables = React.useMemo(() => {
|
|
1337
1125
|
const defaultFontSize = size
|
|
1338
1126
|
? TOOLTIP_FONT_SIZE_BY_SIZE[size]
|
|
1339
1127
|
: TOOLTIP_FONT_SIZE_BY_SIZE.default;
|
|
1340
|
-
return {
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
fontSize: `var(--${PREFIX_BS}tooltip-font-size, var(--${PREFIX_BS}tooltip-component-font-size, ${defaultFontSize}))`,
|
|
1345
|
-
padding: `var(--${PREFIX_BS}tooltip-padding, var(--${PREFIX_BS}tooltip-component-padding, var(--${PREFIX_BS}ref-spacer-2)))`,
|
|
1346
|
-
maxWidth: `var(--${PREFIX_BS}tooltip-max-width, var(--${PREFIX_BS}tooltip-component-max-width, 300px))`,
|
|
1347
|
-
};
|
|
1348
|
-
}, [size]);
|
|
1349
|
-
const arrowRef = react.useRef(null);
|
|
1350
|
-
const { refs, context, floatingStyles, } = react$1.useFloating({
|
|
1128
|
+
return Object.assign(Object.assign({}, style), { background: `var(--${PREFIX_BS}tooltip-bg, var(--${PREFIX_BS}tooltip-component-bg, var(--${PREFIX_BS}secondary)))`, borderRadius: `var(--${PREFIX_BS}tooltip-border-radius, var(--${PREFIX_BS}tooltip-component-border-radius, var(--${PREFIX_BS}border-radius)))`, color: `var(--${PREFIX_BS}tooltip-color, var(--${PREFIX_BS}tooltip-component-color, var(--${PREFIX_BS}white)))`, fontSize: `var(--${PREFIX_BS}tooltip-font-size, var(--${PREFIX_BS}tooltip-component-font-size, ${defaultFontSize}))`, padding: `var(--${PREFIX_BS}tooltip-padding, var(--${PREFIX_BS}tooltip-component-padding, var(--${PREFIX_BS}ref-spacer-2)))`, maxWidth: `var(--${PREFIX_BS}tooltip-max-width, var(--${PREFIX_BS}tooltip-component-max-width, 300px))` });
|
|
1129
|
+
}, [size, style]);
|
|
1130
|
+
const arrowRef = React.useRef(null);
|
|
1131
|
+
const { refs, context, floatingStyles, } = react.useFloating({
|
|
1351
1132
|
open,
|
|
1352
1133
|
onOpenChange: setOpen,
|
|
1353
1134
|
placement,
|
|
1354
|
-
whileElementsMounted: react
|
|
1135
|
+
whileElementsMounted: react.autoUpdate,
|
|
1355
1136
|
middleware: [
|
|
1356
|
-
react
|
|
1357
|
-
react
|
|
1358
|
-
react
|
|
1137
|
+
react.offset(offSet),
|
|
1138
|
+
react.flip(),
|
|
1139
|
+
react.shift({
|
|
1359
1140
|
padding,
|
|
1360
1141
|
}),
|
|
1361
|
-
react
|
|
1142
|
+
react.arrow({
|
|
1362
1143
|
element: arrowRef,
|
|
1363
1144
|
}),
|
|
1364
1145
|
],
|
|
1365
1146
|
});
|
|
1366
|
-
const hover = react
|
|
1367
|
-
const focus = react
|
|
1368
|
-
const dismiss = react
|
|
1369
|
-
const click = react
|
|
1370
|
-
const role = react
|
|
1371
|
-
const { getReferenceProps, getFloatingProps } = react
|
|
1147
|
+
const hover = react.useHover(context, { move: false });
|
|
1148
|
+
const focus = react.useFocus(context);
|
|
1149
|
+
const dismiss = react.useDismiss(context);
|
|
1150
|
+
const click = react.useClick(context);
|
|
1151
|
+
const role = react.useRole(context, { role: 'tooltip' });
|
|
1152
|
+
const { getReferenceProps, getFloatingProps } = react.useInteractions([
|
|
1372
1153
|
withHover ? hover : undefined,
|
|
1373
1154
|
withClick ? click : undefined,
|
|
1374
1155
|
withFocus ? focus : undefined,
|
|
1375
1156
|
dismiss,
|
|
1376
1157
|
role,
|
|
1377
1158
|
]);
|
|
1378
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", Object.assign({ className: className, ref: refs.setReference }, getReferenceProps(), { children: Component })), jsxRuntime.jsx(react
|
|
1159
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", Object.assign({ className: className, ref: refs.setReference }, getReferenceProps(), { children: Component })), jsxRuntime.jsx(react.FloatingPortal, { children: open && (jsxRuntime.jsxs("div", Object.assign({ className: classNameContainer, ref: refs.setFloating, style: Object.assign(Object.assign({}, floatingStyles), styleVariables) }, getFloatingProps(), { children: [jsxRuntime.jsx(react.FloatingArrow, { ref: arrowRef, context: context, style: {
|
|
1379
1160
|
fill: styleVariables.background,
|
|
1380
1161
|
}, width: ARROW_WIDTH, height: ARROW_HEIGHT }), children] }))) })] }));
|
|
1381
1162
|
}
|
|
1382
1163
|
|
|
1383
|
-
|
|
1384
|
-
|
|
1164
|
+
const TabContext = React.createContext(undefined);
|
|
1165
|
+
function useTabContext() {
|
|
1166
|
+
const context = React.useContext(TabContext);
|
|
1167
|
+
if (context === undefined) {
|
|
1168
|
+
throw new Error('useTabContext was used outside of MTab');
|
|
1169
|
+
}
|
|
1170
|
+
return context;
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
function DTabContent({ tab, children, className, style, }) {
|
|
1174
|
+
const { isSelected } = useTabContext();
|
|
1175
|
+
if (!isSelected(tab)) {
|
|
1176
|
+
return null;
|
|
1177
|
+
}
|
|
1178
|
+
return (jsxRuntime.jsx("div", { className: classNames('tab-pane fade show active', className), id: `${tab}Pane`, role: "tabpanel", tabIndex: 0, "aria-labelledby": `${tab}Tab`, style: style, children: children }));
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
function DTabs({ children, defaultSelected, onChange, options, className, style, isVertical, }) {
|
|
1182
|
+
const [selected, setSelected] = React.useState(defaultSelected);
|
|
1183
|
+
const onSelect = React.useCallback((option) => {
|
|
1184
|
+
if (option.tab) {
|
|
1185
|
+
setSelected(option.tab);
|
|
1186
|
+
}
|
|
1187
|
+
onChange(option);
|
|
1188
|
+
}, [onChange]);
|
|
1189
|
+
React.useEffect(() => {
|
|
1190
|
+
setSelected(defaultSelected);
|
|
1191
|
+
}, [defaultSelected]);
|
|
1192
|
+
const isSelected = React.useCallback((tab) => (selected === tab), [selected]);
|
|
1193
|
+
const value = React.useMemo(() => ({
|
|
1194
|
+
isSelected,
|
|
1195
|
+
}), [isSelected]);
|
|
1196
|
+
return (jsxRuntime.jsx(TabContext.Provider, { value: value, children: jsxRuntime.jsxs("div", { className: classNames({
|
|
1197
|
+
'd-tabs': true,
|
|
1198
|
+
'd-tabs-vertical': isVertical,
|
|
1199
|
+
}, className), style: style, children: [jsxRuntime.jsx("nav", { className: "nav", children: options.map((option) => (jsxRuntime.jsx("button", { id: `${option.tab}Tab`, className: classNames('nav-link', {
|
|
1200
|
+
active: option.tab === selected,
|
|
1201
|
+
}, 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))) }), jsxRuntime.jsx("div", { className: "tab-content", children: children })] }) }));
|
|
1202
|
+
}
|
|
1203
|
+
var DTabs$1 = Object.assign(DTabs, {
|
|
1204
|
+
Tab: DTabContent,
|
|
1205
|
+
});
|
|
1206
|
+
|
|
1207
|
+
function DToastContainer({ style, position = 'top-right', className, }) {
|
|
1208
|
+
return (jsxRuntime.jsx(reactToastify.ToastContainer, { toastClassName: () => classNames('shadow-none p-0 cursor-default', className), position: position, autoClose: false, hideProgressBar: true, closeOnClick: false, closeButton: false, transition: reactToastify.Slide, style: style }));
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
function useToast() {
|
|
1212
|
+
const toast = React.useCallback((message, { position = 'top-right', type = 'info', showClose = true, autoClose = false, } = {}) => {
|
|
1213
|
+
reactToastify.toast(({ closeToast }) => (jsxRuntime.jsx(DAlert, { type: type, showClose: showClose, onClose: closeToast, id: "alertID", children: message })), {
|
|
1214
|
+
transition: reactToastify.Slide,
|
|
1215
|
+
position,
|
|
1216
|
+
autoClose,
|
|
1217
|
+
});
|
|
1218
|
+
}, []);
|
|
1219
|
+
return {
|
|
1220
|
+
toast,
|
|
1221
|
+
};
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
async function configureI8n(resources, _a = {}) {
|
|
1225
|
+
var { lng = 'en', fallbackLng = 'en' } = _a, config = tslib.__rest(_a, ["lng", "fallbackLng"]);
|
|
1226
|
+
return i18n
|
|
1227
|
+
.use(reactI18next.initReactI18next)
|
|
1228
|
+
.init(Object.assign({ resources,
|
|
1229
|
+
lng, initImmediate: true, fallbackLng, interpolation: {
|
|
1230
|
+
escapeValue: false,
|
|
1231
|
+
prefix: '{',
|
|
1232
|
+
suffix: '}',
|
|
1233
|
+
// skipOnVariables: false,
|
|
1234
|
+
} }, config))
|
|
1235
|
+
.then((t) => t);
|
|
1385
1236
|
}
|
|
1386
1237
|
|
|
1387
1238
|
exports.DAlert = DAlert;
|
|
1388
1239
|
exports.DBadge = DBadge;
|
|
1389
1240
|
exports.DBoxFile = DBoxFile;
|
|
1390
1241
|
exports.DButton = DButton;
|
|
1391
|
-
exports.DCard = DCard;
|
|
1242
|
+
exports.DCard = DCard$1;
|
|
1392
1243
|
exports.DCardAccount = DCardAccount;
|
|
1393
1244
|
exports.DCardBody = DCardBody;
|
|
1394
1245
|
exports.DCardFooter = DCardFooter;
|
|
1395
1246
|
exports.DCardHeader = DCardHeader;
|
|
1396
|
-
exports.DCarousel = DCarousel;
|
|
1247
|
+
exports.DCarousel = DCarousel$1;
|
|
1397
1248
|
exports.DCarouselSlide = DCarouselSlide;
|
|
1398
1249
|
exports.DChip = DChip;
|
|
1399
1250
|
exports.DCollapse = DCollapse;
|
|
1400
1251
|
exports.DCollapseIconText = DCollapseIconText;
|
|
1252
|
+
exports.DContext = DContext;
|
|
1253
|
+
exports.DContextProvider = DContextProvider;
|
|
1401
1254
|
exports.DCurrencyText = DCurrencyText;
|
|
1402
1255
|
exports.DDatePicker = DDatePicker;
|
|
1403
|
-
exports.DFormikInput = DFormikInput;
|
|
1404
|
-
exports.DFormikInputCurrency = DFormikInputCurrency;
|
|
1405
|
-
exports.DFormikInputSelect = DFormikInputSelect;
|
|
1406
1256
|
exports.DIcon = DIcon;
|
|
1407
1257
|
exports.DInput = DInput$1;
|
|
1408
1258
|
exports.DInputCheck = DInputCheck;
|
|
1409
|
-
exports.DInputCounter = DInputCounter;
|
|
1410
|
-
exports.DInputCurrency = DInputCurrency;
|
|
1411
|
-
exports.DInputCurrencyBase = DInputCurrencyBase;
|
|
1412
|
-
exports.DInputPassword = DInputPassword;
|
|
1259
|
+
exports.DInputCounter = DInputCounter$1;
|
|
1260
|
+
exports.DInputCurrency = DInputCurrency$1;
|
|
1261
|
+
exports.DInputCurrencyBase = DInputCurrencyBase$1;
|
|
1262
|
+
exports.DInputPassword = DInputPassword$1;
|
|
1413
1263
|
exports.DInputPin = DInputPin;
|
|
1414
|
-
exports.DInputSearch = DInputSearch;
|
|
1264
|
+
exports.DInputSearch = DInputSearch$1;
|
|
1415
1265
|
exports.DInputSelect = DInputSelect;
|
|
1416
1266
|
exports.DInputSwitch = DInputSwitch;
|
|
1417
|
-
exports.DList = DList;
|
|
1267
|
+
exports.DList = DList$1;
|
|
1418
1268
|
exports.DListItem = DListItem;
|
|
1419
1269
|
exports.DListItemMovement = DListItemMovement;
|
|
1420
|
-
exports.DModal = DModal;
|
|
1270
|
+
exports.DModal = DModal$1;
|
|
1421
1271
|
exports.DModalBody = DModalBody;
|
|
1422
1272
|
exports.DModalFooter = DModalFooter;
|
|
1423
1273
|
exports.DModalHeader = DModalHeader;
|
|
1424
|
-
exports.DOffcanvas = DOffcanvas;
|
|
1274
|
+
exports.DOffcanvas = DOffcanvas$1;
|
|
1425
1275
|
exports.DOffcanvasBody = DOffcanvasBody;
|
|
1426
1276
|
exports.DOffcanvasFooter = DOffcanvasFooter;
|
|
1427
1277
|
exports.DOffcanvasHeader = DOffcanvasHeader;
|
|
@@ -1440,25 +1290,22 @@ exports.DStepperDesktop = DStepper$2;
|
|
|
1440
1290
|
exports.DStepperMobile = DStepper$1;
|
|
1441
1291
|
exports.DSummaryCard = DSummaryCard;
|
|
1442
1292
|
exports.DTabContent = DTabContent;
|
|
1443
|
-
exports.DTabs = DTabs;
|
|
1293
|
+
exports.DTabs = DTabs$1;
|
|
1444
1294
|
exports.DToastContainer = DToastContainer;
|
|
1445
1295
|
exports.DTooltip = DTooltip;
|
|
1446
|
-
exports.LiquidContext = LiquidContext$1;
|
|
1447
|
-
exports.LiquidContextProvider = LiquidContextProvider;
|
|
1448
1296
|
exports.ModalContext = ModalContext;
|
|
1449
1297
|
exports.ModalContextProvider = ModalContextProvider;
|
|
1450
1298
|
exports.OffcanvasContext = OffcanvasContext;
|
|
1451
1299
|
exports.OffcanvasContextProvider = OffcanvasContextProvider;
|
|
1452
1300
|
exports.configureI18n = configureI8n;
|
|
1453
1301
|
exports.formatCurrency = formatCurrency;
|
|
1454
|
-
exports.
|
|
1302
|
+
exports.useDContext = useDContext;
|
|
1455
1303
|
exports.useFormatCurrency = useFormatCurrency;
|
|
1456
|
-
exports.
|
|
1304
|
+
exports.useInputCurrency = useInputCurrency;
|
|
1457
1305
|
exports.useModalContext = useModalContext;
|
|
1458
1306
|
exports.useOffcanvasContext = useOffcanvasContext;
|
|
1459
|
-
exports.
|
|
1460
|
-
exports.
|
|
1461
|
-
exports.useScreenshotWebShare = useScreenshotWebShare;
|
|
1307
|
+
exports.useProvidedRefOrCreate = useProvidedRefOrCreate;
|
|
1308
|
+
exports.useStackState = useStackState;
|
|
1462
1309
|
exports.useTabContext = useTabContext;
|
|
1463
1310
|
exports.useToast = useToast;
|
|
1464
1311
|
//# sourceMappingURL=index.js.map
|