@dynamic-framework/ui-react 1.9.1 → 1.10.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 +315 -345
- package/dist/css/dynamic-ui-non-root.min.css +1 -1
- package/dist/css/dynamic-ui.css +315 -345
- package/dist/css/dynamic-ui.min.css +1 -1
- package/dist/index.esm.js +141 -120
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +141 -119
- package/dist/index.js.map +1 -1
- package/dist/types/components/DAlertBox/DAlertBox.d.ts +9 -0
- package/dist/types/components/DAlertBox/index.d.ts +2 -0
- package/dist/types/components/DBadge/DBadge.d.ts +2 -2
- package/dist/types/components/DBoxFile/DBoxFile.d.ts +2 -2
- package/dist/types/components/DButton/DButton.d.ts +7 -5
- package/dist/types/components/DChip/DChip.d.ts +2 -1
- package/dist/types/components/DDatePicker/DDatePicker.d.ts +7 -3
- package/dist/types/components/DDatePickerHeader/DDatePickerHeader.d.ts +5 -3
- package/dist/types/components/DDatePickerInput/DDatePickerInput.d.ts +1 -1
- package/dist/types/components/DIcon/DIcon.d.ts +2 -2
- package/dist/types/components/DInputCheck/DInputCheck.d.ts +5 -4
- package/dist/types/components/DInputPin/DInputPin.d.ts +7 -7
- package/dist/types/components/DInputSelect/DInputSelect.d.ts +3 -3
- package/dist/types/components/DInputSwitch/DInputSwitch.d.ts +5 -4
- package/dist/types/components/DList/DList.d.ts +4 -4
- package/dist/types/components/DList/components/DListItem.d.ts +3 -3
- package/dist/types/components/DModal/DModal.d.ts +5 -5
- package/dist/types/components/DMonthPicker/DMonthPicker.d.ts +3 -1
- package/dist/types/components/DOffcanvas/DOffcanvas.d.ts +3 -3
- package/dist/types/components/DPopover/DPopover.d.ts +4 -4
- package/dist/types/components/DQuickActionButton/DQuickActionButton.d.ts +2 -1
- package/dist/types/components/DQuickActionCheck/DQuickActionCheck.d.ts +2 -2
- package/dist/types/components/DQuickActionSelect/DQuickActionSelect.d.ts +2 -2
- package/dist/types/components/DQuickActionSwitch/DQuickActionSwitch.d.ts +3 -3
- package/dist/types/components/DStepper/DStepper.d.ts +2 -2
- package/dist/types/components/DStepperDesktop/DStepperDesktop.d.ts +2 -2
- package/dist/types/components/DTabs/DTabs.d.ts +3 -3
- package/dist/types/components/{DAlert/DAlert.d.ts → DToast/DToast.d.ts} +3 -3
- package/dist/types/components/DToast/index.d.ts +2 -0
- package/dist/types/components/DToastContainer/useToast.d.ts +2 -2
- package/dist/types/components/DTooltip/DTooltip.d.ts +2 -2
- package/dist/types/components/banking/DPermissionGroup.d.ts +1 -1
- package/dist/types/components/config.d.ts +2 -2
- package/dist/types/components/index.d.ts +2 -1
- package/dist/types/components/interface.d.ts +8 -3
- package/package.json +7 -2
- package/src/style/abstracts/_maps.scss +6 -0
- package/src/style/abstracts/_mixins.scss +53 -42
- package/src/style/abstracts/variables/_alerts.scss +1 -0
- package/src/style/abstracts/variables/_buttons.scss +7 -13
- package/src/style/abstracts/variables/_colors.scss +1 -1
- package/src/style/components/_+import.scss +1 -1
- package/src/style/components/_d-button.scss +12 -41
- package/src/style/components/_d-chip.scss +1 -1
- package/src/style/components/_d-datepicker.scss +9 -0
- package/src/style/components/{_d-alert.scss → _d-toast.scss} +21 -1
- package/dist/types/components/DAlert/index.d.ts +0 -2
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import React, { useMemo, useState, useEffect, useCallback, createContext, useContext, forwardRef,
|
|
2
|
+
import React, { useMemo, useState, useEffect, useCallback, createContext, useContext, forwardRef, useRef } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { __rest } from 'tslib';
|
|
5
5
|
import { useDropzone } from 'react-dropzone';
|
|
@@ -15,34 +15,34 @@ import i18n from 'i18next';
|
|
|
15
15
|
import { initReactI18next } from 'react-i18next';
|
|
16
16
|
import { createPortal } from 'react-dom';
|
|
17
17
|
|
|
18
|
-
function DBadge({ text,
|
|
18
|
+
function DBadge({ text, dot = false, theme = 'primary', id, className, style, }) {
|
|
19
19
|
const generateClasses = useMemo(() => ({
|
|
20
20
|
badge: true,
|
|
21
|
-
'badge-dot':
|
|
21
|
+
'badge-dot': dot,
|
|
22
22
|
[`badge-${theme}`]: !!theme,
|
|
23
|
-
}), [
|
|
23
|
+
}), [dot, theme]);
|
|
24
24
|
return (jsx("span", Object.assign({ className: classNames(generateClasses, className), style: style }, id && { id }, { children: jsx("span", { children: text }) })));
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
function DInputSwitch({ label, id, name,
|
|
28
|
-
const [internalIsChecked, setInternalIsChecked] = useState(
|
|
27
|
+
function DInputSwitch({ label, ariaLabel, id, name, checked, disabled, readonly, className, style, onChange, }) {
|
|
28
|
+
const [internalIsChecked, setInternalIsChecked] = useState(checked);
|
|
29
29
|
useEffect(() => {
|
|
30
|
-
setInternalIsChecked(
|
|
31
|
-
}, [
|
|
30
|
+
setInternalIsChecked(checked);
|
|
31
|
+
}, [checked]);
|
|
32
32
|
const changeHandler = useCallback((event) => {
|
|
33
33
|
const value = event.currentTarget.checked;
|
|
34
34
|
setInternalIsChecked(value);
|
|
35
35
|
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
36
36
|
}, [onChange]);
|
|
37
|
-
return (jsxs("div", { className: "form-check form-switch", children: [jsx("input", { id: id, name: name, onChange:
|
|
37
|
+
return (jsxs("div", { className: "form-check form-switch", children: [jsx("input", { id: id, name: name, onChange: readonly ? () => false : changeHandler, className: classNames('form-check-input', className), style: style, type: "checkbox", role: "switch", checked: internalIsChecked, disabled: disabled, "aria-label": ariaLabel }), label && (jsx("label", { className: "form-check-label", htmlFor: id, children: label }))] }));
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
function DPermissionItem({ permission, permissionState, onChange, onAction = () => { }, }) {
|
|
41
|
-
return (jsxs("div", { role: "button", tabIndex: 0, onKeyDown: () => { }, className: "d-flex permission-item align-items-center", onClick: onAction, children: [jsx("span", { className: "flex-grow-1 label", children: permission.label }), permission.type === 'custom' && (jsx(DBadge, { theme: "tertiary", text: permissionState })), jsx(DInputSwitch, { id: permission.id,
|
|
41
|
+
return (jsxs("div", { role: "button", tabIndex: 0, onKeyDown: () => { }, className: "d-flex permission-item align-items-center", onClick: onAction, children: [jsx("span", { className: "flex-grow-1 label", children: permission.label }), permission.type === 'custom' && (jsx(DBadge, { theme: "tertiary", text: permissionState })), jsx(DInputSwitch, { id: permission.id, checked: !!permission.value, disabled: !permission.enabled, onChange: (isChecked) => onChange(isChecked) })] }));
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
function DPermissionGroup({ title, description, permissionState, permissionList, onChangePermission, onCustomAction = () => { }, }) {
|
|
45
|
-
return (jsxs("div", { className: "row operation-group g-0 mb-3 mb-lg-0", children: [jsxs("div", { className: "col-12 col-lg-4 d-flex flex-column justify-content-center", children: [jsx("h6", { className: "fw-bold mb-3 mb-lg-2", children: title }), jsx("p", { className: "fs-8 d-none d-lg-block m-0", children: description })] }), jsx("div", { className: "col-12 offset-lg-1 col-lg-7", children: permissionList.map((permission) => (jsx(DPermissionItem, { permission: permission, permissionState: permissionState, onChange: (
|
|
45
|
+
return (jsxs("div", { className: "row operation-group g-0 mb-3 mb-lg-0", children: [jsxs("div", { className: "col-12 col-lg-4 d-flex flex-column justify-content-center", children: [jsx("h6", { className: "fw-bold mb-3 mb-lg-2", children: title }), jsx("p", { className: "fs-8 d-none d-lg-block m-0", children: description })] }), jsx("div", { className: "col-12 offset-lg-1 col-lg-7", children: permissionList.map((permission) => (jsx(DPermissionItem, { permission: permission, permissionState: permissionState, onChange: (checked) => onChangePermission(permission, checked), onAction: () => onCustomAction(permission) }, permission.id))) })] }));
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
const PREFIX_BS = 'bs-';
|
|
@@ -51,11 +51,9 @@ const ALERT_TYPE_ICON = {
|
|
|
51
51
|
danger: 'exclamation-triangle',
|
|
52
52
|
success: 'check-circle',
|
|
53
53
|
info: 'info-circle',
|
|
54
|
-
light: 'info-circle',
|
|
55
|
-
dark: 'info-circle',
|
|
56
54
|
};
|
|
57
55
|
|
|
58
|
-
function DIcon({ icon, theme, style, className, size = '1.5rem',
|
|
56
|
+
function DIcon({ icon, theme, style, className, size = '1.5rem', loading = false, loadingDuration = 1.8, hasCircle = false, circleSize = `calc(var(--${PREFIX_BS}icon-component-size) * 1)`, color, backgroundColor, familyClass = 'bi', familyPrefix = 'bi-', }) {
|
|
59
57
|
const colorStyle = useMemo(() => {
|
|
60
58
|
if (color) {
|
|
61
59
|
return { [`--${PREFIX_BS}component-color`]: color };
|
|
@@ -84,7 +82,7 @@ function DIcon({ icon, theme, style, className, size = '1.5rem', isLoading = fal
|
|
|
84
82
|
return { [`--${PREFIX_BS}icon-component-padding`]: '0' };
|
|
85
83
|
}, [circleSize, hasCircle]);
|
|
86
84
|
const generateStyleVariables = 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]);
|
|
87
|
-
const generateClasses = useMemo(() => (Object.assign({ 'd-icon': true, [familyClass]: true, [`${familyPrefix}${icon}`]: true, 'd-icon-loading':
|
|
85
|
+
const generateClasses = useMemo(() => (Object.assign({ 'd-icon': true, [familyClass]: true, [`${familyPrefix}${icon}`]: true, 'd-icon-loading': loading }, className && { [className]: true })), [familyClass, familyPrefix, icon, className, loading]);
|
|
88
86
|
return (jsx("i", { className: classNames(generateClasses), style: generateStyleVariables }));
|
|
89
87
|
}
|
|
90
88
|
|
|
@@ -92,36 +90,39 @@ function DSummaryCard({ title, description, icon, iconSize, iconTheme, Summary,
|
|
|
92
90
|
return (jsxs("div", { children: [jsx("h6", { className: "fw-bold fs-6", children: title }), jsx("p", { className: "fs-8", children: description }), jsxs("div", { className: "bg-white rounded p-4 d-flex gap-3 shadow-sm text-gray-700 fs-8", children: [jsx(DIcon, { icon: icon, theme: iconTheme, size: iconSize }), Summary] })] }));
|
|
93
91
|
}
|
|
94
92
|
|
|
95
|
-
function
|
|
93
|
+
function DToast({ type = 'success', icon, iconFamilyClass, iconFamilyPrefix, showIcon = false, showClose, onClose, children, id, className, style, }) {
|
|
96
94
|
const generateClasses = useMemo(() => (Object.assign({ alert: true, [`alert-${type}`]: true, 'fade show': !!showClose }, className && { [className]: true })), [type, showClose, className]);
|
|
97
95
|
const getIcon = useMemo(() => icon || ALERT_TYPE_ICON[type] || '', [icon, type]);
|
|
98
|
-
const generateStyleVariables = useMemo(() => (Object.assign(Object.assign(
|
|
99
|
-
[`--${PREFIX_BS}alert-component-icon-color`]: `var(--${PREFIX_BS}secondary)`,
|
|
100
|
-
})), [style, type]);
|
|
96
|
+
const generateStyleVariables = useMemo(() => (Object.assign(Object.assign({}, style), { [`--${PREFIX_BS}alert-component-separator-opacity`]: '0.3' })), [style]);
|
|
101
97
|
return (jsxs("div", { className: classNames(generateClasses), style: generateStyleVariables, role: "alert", id: id, children: [(showIcon || icon) && (jsx(DIcon, Object.assign({ className: "alert-icon", icon: getIcon }, iconFamilyClass && { familyClass: iconFamilyClass }, iconFamilyPrefix && { familyPrefix: iconFamilyPrefix }))), jsx("div", { className: "alert-text", children: children }), showClose && (jsx("div", { className: "alert-separator" })), showClose && (jsx("button", { type: "button", className: "btn-close", "aria-label": "Close", onClick: onClose, children: jsx(DIcon, { className: "alert-close-icon", icon: "x-lg", familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) }))] }));
|
|
102
98
|
}
|
|
103
99
|
|
|
100
|
+
function DAlertBox({ theme = 'box-secondary', icon = 'info-circle', iconFamilyClass, iconFamilyPrefix, children, id, className, style, }) {
|
|
101
|
+
const generateClasses = useMemo(() => (Object.assign({ 'alert alert-box': true, [`alert-${theme}`]: true }, className && { [className]: true })), [theme, className]);
|
|
102
|
+
return (jsxs("div", { className: classNames(generateClasses), style: style, role: "alert", id: id, children: [jsx(DIcon, Object.assign({ className: "alert-icon", icon: icon }, iconFamilyClass && { familyClass: iconFamilyClass }, iconFamilyPrefix && { familyPrefix: iconFamilyPrefix })), jsx("div", { className: "alert-text", children: children })] }));
|
|
103
|
+
}
|
|
104
|
+
|
|
104
105
|
function DBoxFile(_a) {
|
|
105
|
-
var { icon = 'cloud-upload', iconFamilyClass, iconFamilyPrefix,
|
|
106
|
-
const { acceptedFiles, getRootProps, getInputProps, } = useDropzone(Object.assign({ disabled
|
|
106
|
+
var { icon = 'cloud-upload', iconFamilyClass, iconFamilyPrefix, disabled = false, children, className, style } = _a, dropzoneOptions = __rest(_a, ["icon", "iconFamilyClass", "iconFamilyPrefix", "disabled", "children", "className", "style"]);
|
|
107
|
+
const { acceptedFiles, getRootProps, getInputProps, } = useDropzone(Object.assign({ disabled }, dropzoneOptions));
|
|
107
108
|
return (jsxs("section", { className: classNames('d-box-file', {
|
|
108
109
|
'd-box-file-selected': !!acceptedFiles.length,
|
|
109
110
|
}, className), style: style, children: [jsxs("div", Object.assign({}, getRootProps({
|
|
110
111
|
className: classNames('d-box-file-dropzone', {
|
|
111
|
-
disabled
|
|
112
|
+
disabled,
|
|
112
113
|
}),
|
|
113
114
|
}), { children: [jsx("input", Object.assign({}, getInputProps())), jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }), jsx("div", { className: "d-box-content", children: children })] })), !!acceptedFiles.length && (jsx("aside", { className: "d-box-files", children: acceptedFiles.map((file) => (jsx("div", { className: "d-box-files-text", children: `${file.name} - ${file.size} bytes` }, file.name))) }))] }));
|
|
114
115
|
}
|
|
115
116
|
|
|
116
|
-
function DButton({ theme = 'primary', size, variant, state, text = '', iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, value, type = 'button',
|
|
117
|
+
function DButton({ theme = 'primary', size, variant, state, text = '', ariaLabel, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, value, type = 'button', pill = false, loading = false, loadingAriaLabel, disabled = false, stopPropagationEnabled = true, className, onClick, }) {
|
|
117
118
|
const generateClasses = useMemo(() => {
|
|
118
119
|
const variantClass = variant
|
|
119
120
|
? `btn-${variant}-${theme}`
|
|
120
121
|
: `btn-${theme}`;
|
|
121
|
-
return Object.assign(Object.assign(Object.assign({ btn: true, [variantClass]: true }, size && { [`btn-${size}`]: true }), (state && state !== 'disabled') && { [state]: true }), { loading
|
|
122
|
-
}, [variant, theme, size, state,
|
|
122
|
+
return Object.assign(Object.assign(Object.assign({ btn: true, [variantClass]: true }, size && { [`btn-${size}`]: true }), (state && state !== 'disabled') && { [state]: true }), { loading });
|
|
123
|
+
}, [variant, theme, size, state, loading]);
|
|
123
124
|
const generateStyleVariables = useMemo(() => {
|
|
124
|
-
if (
|
|
125
|
+
if (pill) {
|
|
125
126
|
return {
|
|
126
127
|
[`--${PREFIX_BS}btn-component-border-radius`]: `var(--${PREFIX_BS}border-radius-pill)`,
|
|
127
128
|
[`--${PREFIX_BS}btn-component-lg-border-radius`]: `var(--${PREFIX_BS}border-radius-pill)`,
|
|
@@ -129,14 +130,18 @@ function DButton({ theme = 'primary', size, variant, state, text = '', iconStart
|
|
|
129
130
|
};
|
|
130
131
|
}
|
|
131
132
|
return {};
|
|
132
|
-
}, [
|
|
133
|
+
}, [pill]);
|
|
133
134
|
const clickHandler = useCallback((event) => {
|
|
134
|
-
if (
|
|
135
|
+
if (stopPropagationEnabled) {
|
|
135
136
|
event.stopPropagation();
|
|
136
137
|
}
|
|
137
138
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
138
|
-
}, [
|
|
139
|
-
|
|
139
|
+
}, [stopPropagationEnabled, onClick]);
|
|
140
|
+
const isDisabled = useMemo(() => (state === 'disabled' || loading || disabled), [state, loading, disabled]);
|
|
141
|
+
const newAriaLabel = useMemo(() => (loading
|
|
142
|
+
? (loadingAriaLabel || ariaLabel || text)
|
|
143
|
+
: (ariaLabel || text)), [loading, loadingAriaLabel, ariaLabel, text]);
|
|
144
|
+
return (jsxs("button", Object.assign({ className: classNames(generateClasses, className), style: generateStyleVariables, type: type, disabled: isDisabled, onClick: clickHandler, "aria-label": newAriaLabel }, value && { value }, { children: [iconStart && (jsx(DIcon, { icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })), (text && !loading) && (jsx("span", { children: text })), loading && (jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsx("span", { className: "visually-hidden", children: "Loading..." }) })), iconEnd && (jsx(DIcon, { icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix }))] })));
|
|
140
145
|
}
|
|
141
146
|
|
|
142
147
|
function DCardHeader({ className, style, children, }) {
|
|
@@ -186,12 +191,12 @@ var DCarousel$1 = Object.assign(DCarousel, {
|
|
|
186
191
|
Slide: DCarouselSlide,
|
|
187
192
|
});
|
|
188
193
|
|
|
189
|
-
function DChip({ theme = 'primary', text, icon, iconFamilyClass, iconFamilyPrefix, showClose = false, className, style, onClose, }) {
|
|
194
|
+
function DChip({ theme = 'primary', text, icon, iconFamilyClass, iconFamilyPrefix, showClose = false, closeAriaLabel = 'close', className, style, onClose, }) {
|
|
190
195
|
const generateClasses = useMemo(() => ({
|
|
191
196
|
'd-chip': true,
|
|
192
197
|
[`d-chip-${theme}`]: !!theme,
|
|
193
198
|
}), [theme]);
|
|
194
|
-
return (jsxs("span", { className: classNames(generateClasses, className), style: style, children: [icon && (jsx("div", { className: "d-chip-icon-container", children: jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), jsx("span", { children: text }), showClose && (jsx("button", { type: "button", className: "d-chip-icon-container", onClick: onClose, children: jsx(DIcon, { icon: "x-lg" }) }))] }));
|
|
199
|
+
return (jsxs("span", { className: classNames(generateClasses, className), style: style, children: [icon && (jsx("div", { className: "d-chip-icon-container", children: jsx(DIcon, { icon: icon, familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), jsx("span", { children: text }), showClose && (jsx("button", { type: "button", className: "d-chip-icon-container", onClick: onClose, "aria-label": closeAriaLabel, children: jsx(DIcon, { icon: "x-lg" }) }))] }));
|
|
195
200
|
}
|
|
196
201
|
|
|
197
202
|
function DCollapse({ id, className, style, Component, hasSeparator = false, defaultCollapsed = false, onChange, children, }) {
|
|
@@ -501,7 +506,7 @@ function useProvidedRefOrCreate(providedRef) {
|
|
|
501
506
|
}
|
|
502
507
|
|
|
503
508
|
function DInput(_a, ref) {
|
|
504
|
-
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 = __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"]);
|
|
509
|
+
var { id, style, className, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, disabled = false, readOnly = false, loading = false, iconFamilyClass, iconFamilyPrefix, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconStartTabIndex, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, hint, invalid = false, valid = false, inputStart, value, onChange, onIconStartClick, onIconEndClick } = _a, inputProps = __rest(_a, ["id", "style", "className", "label", "labelIcon", "labelIconFamilyClass", "labelIconFamilyPrefix", "disabled", "readOnly", "loading", "iconFamilyClass", "iconFamilyPrefix", "iconStart", "iconStartFamilyClass", "iconStartFamilyPrefix", "iconStartAriaLabel", "iconStartTabIndex", "iconEnd", "iconEndFamilyClass", "iconEndFamilyPrefix", "iconEndAriaLabel", "iconEndTabIndex", "hint", "invalid", "valid", "inputStart", "value", "onChange", "onIconStartClick", "onIconEndClick"]);
|
|
505
510
|
const inputRef = useProvidedRefOrCreate(ref);
|
|
506
511
|
const handleOnChange = useCallback((event) => {
|
|
507
512
|
onChange === null || onChange === void 0 ? void 0 : onChange(event.currentTarget.value);
|
|
@@ -512,6 +517,13 @@ function DInput(_a, ref) {
|
|
|
512
517
|
const handleOnIconEndClick = useCallback(() => {
|
|
513
518
|
onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(value);
|
|
514
519
|
}, [onIconEndClick, value]);
|
|
520
|
+
const ariaDescribedby = useMemo(() => ([
|
|
521
|
+
iconStart && `${id}Start`,
|
|
522
|
+
hint && `${id}Hint`,
|
|
523
|
+
iconEnd && `${id}End`,
|
|
524
|
+
]
|
|
525
|
+
.filter(Boolean)
|
|
526
|
+
.join(' ')), [id, iconStart, iconEnd, hint]);
|
|
515
527
|
return (jsxs("div", { className: classNames({
|
|
516
528
|
'd-input': true,
|
|
517
529
|
className: !!className,
|
|
@@ -519,10 +531,10 @@ function DInput(_a, ref) {
|
|
|
519
531
|
'input-group': true,
|
|
520
532
|
'has-validation': invalid,
|
|
521
533
|
disabled: disabled || loading,
|
|
522
|
-
}), children: [!!inputStart && (jsx("div", { className: "input-group-text", children: inputStart })), iconStart && (jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading, children: iconStart && (jsx(DIcon, { className: "d-input-icon", icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })) })), jsx("input", Object.assign({ ref: inputRef, id: id, className: classNames('form-control', {
|
|
534
|
+
}), children: [!!inputStart && (jsx("div", { className: "input-group-text", children: inputStart })), iconStart && (jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: handleOnIconStartClick, disabled: disabled || loading, "aria-label": iconStartAriaLabel, tabIndex: iconStartTabIndex, children: iconStart && (jsx(DIcon, { className: "d-input-icon", icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })) })), jsx("input", Object.assign({ ref: inputRef, id: id, className: classNames('form-control', {
|
|
523
535
|
'is-invalid': invalid,
|
|
524
536
|
'is-valid': valid,
|
|
525
|
-
}),
|
|
537
|
+
}), disabled: disabled || loading, readOnly: readOnly, value: value, onChange: handleOnChange }, ariaDescribedby && { 'aria-describedby': ariaDescribedby }, inputProps)), ((invalid || valid) && !iconEnd && !loading) && (jsx("span", { className: "input-group-text", id: `${id}State`, children: jsx(DIcon, { className: "d-input-validation-icon", icon: invalid ? 'exclamation-circle' : 'check', familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), (iconEnd && !loading) && (jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: handleOnIconEndClick, disabled: disabled || loading, "aria-label": iconEndAriaLabel, tabIndex: iconEndTabIndex, children: iconEnd && (jsx(DIcon, { className: "d-input-icon", icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) })), loading && (jsx("div", { className: "input-group-text d-input-icon", children: jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsx("span", { className: "visually-hidden", children: "Loading..." }) }) }))] }), hint && (jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })] }));
|
|
526
538
|
}
|
|
527
539
|
const ForwardedDInput = forwardRef(DInput);
|
|
528
540
|
ForwardedDInput.displayName = 'DInput';
|
|
@@ -530,53 +542,55 @@ var DInput$1 = ForwardedDInput;
|
|
|
530
542
|
|
|
531
543
|
function DDatePickerTime(_a) {
|
|
532
544
|
var { value, onChange, id, label, className, style } = _a, props = __rest(_a, ["value", "onChange", "id", "label", "className", "style"]);
|
|
533
|
-
return (jsxs("div", { className: classNames('d-flex align-items-center gap-2 flex-column d-datepicker-time', className), style: style, children: [label && (jsx("
|
|
545
|
+
return (jsxs("div", { className: classNames('d-flex align-items-center gap-2 flex-column d-datepicker-time', className), style: style, children: [label && (jsx("label", { htmlFor: id, className: "d-datepicker-time-label", children: label })), jsx(DInput$1, Object.assign({}, onChange && {
|
|
534
546
|
onChange,
|
|
535
547
|
}, { type: "time", id: id, value: value }, props))] }));
|
|
536
548
|
}
|
|
537
549
|
|
|
538
550
|
function DDatePickerInput(_a, ref) {
|
|
539
551
|
var { value, onClick, id, iconEnd, className, style } = _a, props = __rest(_a, ["value", "onClick", "id", "iconEnd", "className", "style"]);
|
|
540
|
-
|
|
541
|
-
return (jsx("div", { role: "button", onClick: onClick, onKeyDown: () => { }, tabIndex: -1, children: jsx(DInput$1, Object.assign({ readOnly: true, type: "text", id: id, value: value, onIconEndClick: onClick, iconEnd: iconEnd, className: className, style: style }, props)) }));
|
|
552
|
+
return (jsx(DInput$1, Object.assign({ ref: ref, onClick: onClick, readOnly: true, type: "text", id: id, value: value, onIconEndClick: onClick, iconEnd: iconEnd, className: className, style: style }, props)));
|
|
542
553
|
}
|
|
543
554
|
const ForwardedDDatePickerInput = forwardRef(DDatePickerInput);
|
|
544
555
|
ForwardedDDatePickerInput.displayName = 'DDatePickerInput';
|
|
545
556
|
var DDatePickerInput$1 = ForwardedDDatePickerInput;
|
|
546
557
|
|
|
547
558
|
function DMonthPicker(_a) {
|
|
548
|
-
var { onChangeDate, date, locale, className } = _a, props = __rest(_a, ["onChangeDate", "date", "locale", "className"]);
|
|
559
|
+
var { onChangeDate, date, locale, className, headerPrevYearAriaLabel = 'decrease year', headerNextYearAriaLabel = 'increase year' } = _a, props = __rest(_a, ["onChangeDate", "date", "locale", "className", "headerPrevYearAriaLabel", "headerNextYearAriaLabel"]);
|
|
549
560
|
const selected = useMemo(() => parseISO(date), [date]);
|
|
550
561
|
const dateFormatted = useMemo(() => (format(new Date(date), 'MMMM yyyy', { locale })), [date, locale]);
|
|
551
|
-
return (jsx(DatePicker, Object.assign({ showMonthYearPicker: true, selected: selected, calendarClassName: classNames('d-month-picker', className), onChange: onChangeDate }, locale && { locale }, { customInput: (jsx("p", { className: "fw-bold text-capitalize", children: dateFormatted })), renderCustomHeader: ({ monthDate, decreaseYear, increaseYear, prevYearButtonDisabled, nextYearButtonDisabled, }) => (jsxs("div", { className: "d-flex align-items-center justify-content-between gap-4 fs-6 bg-dark", children: [jsx(DButton, { iconStart: "chevron-left", size: "sm", variant: "link", theme: "light", onClick: decreaseYear,
|
|
562
|
+
return (jsx(DatePicker, Object.assign({ showMonthYearPicker: true, selected: selected, calendarClassName: classNames('d-month-picker', className), onChange: onChangeDate }, locale && { locale }, { customInput: (jsx("p", { className: "fw-bold text-capitalize", children: dateFormatted })), renderCustomHeader: ({ monthDate, decreaseYear, increaseYear, prevYearButtonDisabled, nextYearButtonDisabled, }) => (jsxs("div", { className: "d-flex align-items-center justify-content-between gap-4 fs-6 bg-dark", children: [jsx(DButton, { iconStart: "chevron-left", size: "sm", variant: "link", theme: "light", onClick: decreaseYear, disabled: prevYearButtonDisabled, ariaLabel: headerPrevYearAriaLabel }), jsx("p", { className: "fs-6 fw-bold", children: monthDate.getFullYear() }), jsx(DButton, { iconStart: "chevron-right", size: "sm", variant: "link", theme: "light", onClick: increaseYear, disabled: nextYearButtonDisabled, ariaLabel: headerNextYearAriaLabel })] })) }, props)));
|
|
552
563
|
}
|
|
553
564
|
|
|
554
|
-
function DDatePickerHeader({ monthDate, changeMonth, changeYear, decreaseMonth, increaseMonth, prevMonthButtonDisabled, nextMonthButtonDisabled, withMonthSelector,
|
|
565
|
+
function DDatePickerHeader({ monthDate, changeMonth, changeYear, decreaseMonth, increaseMonth, prevMonthButtonDisabled, nextMonthButtonDisabled, withMonthSelector, prevMonthIcon, nextMonthIcon, prevMonthAriaLabel = 'decrease month', nextMonthAriaLabel = 'increase month', iconSize, buttonVariant, buttonTheme, locale, style, className, }) {
|
|
555
566
|
const onChangeDate = useCallback((value) => {
|
|
556
567
|
if (value) {
|
|
557
568
|
changeMonth(getMonth(value));
|
|
558
569
|
changeYear(getYear(value));
|
|
559
570
|
}
|
|
560
571
|
}, [changeMonth, changeYear]);
|
|
561
|
-
return (jsxs("div", { className: classNames('d-flex align-items-center justify-content-between d-datepicker-header', className), style: style, children: [jsx(DButton, { iconStart:
|
|
572
|
+
return (jsxs("div", { className: classNames('d-flex align-items-center justify-content-between d-datepicker-header', className), style: style, children: [jsx(DButton, { iconStart: prevMonthIcon, size: iconSize, variant: buttonVariant, theme: buttonTheme, onClick: decreaseMonth, disabled: prevMonthButtonDisabled, ariaLabel: prevMonthAriaLabel }), jsx(DMonthPicker, Object.assign({}, !withMonthSelector && { readOnly: true }, { date: monthDate.toISOString(), onChangeDate: onChangeDate }, locale && { locale })), jsx(DButton, { iconStart: nextMonthIcon, size: iconSize, variant: buttonVariant, theme: buttonTheme, onClick: increaseMonth, disabled: nextMonthButtonDisabled, ariaLabel: nextMonthAriaLabel })] }));
|
|
562
573
|
}
|
|
563
574
|
|
|
564
575
|
function DDatePicker(_a) {
|
|
565
|
-
var { date, selectsRange = false, withMonthSelector, inputLabel, inputIcon = 'calendar', inputId = 'input-calendar', timeId = 'input-time', timeLabel,
|
|
576
|
+
var { date, selectsRange = false, withMonthSelector, inputLabel, inputAriaLabel, inputActionAriaLabel = 'open calendar', inputIcon = 'calendar', inputId = 'input-calendar', timeId = 'input-time', timeLabel, headerPrevMonthIcon = 'chevron-left', headerPrevMonthAriaLabel = 'decrease month', headerNextMonthIcon = 'chevron-right', headerNextMonthAriaLabel = 'increase month', headerIconSize = 'sm', headerButtonVariant = 'link', headerButtonTheme = 'dark', locale, className, style } = _a, props = __rest(_a, ["date", "selectsRange", "withMonthSelector", "inputLabel", "inputAriaLabel", "inputActionAriaLabel", "inputIcon", "inputId", "timeId", "timeLabel", "headerPrevMonthIcon", "headerPrevMonthAriaLabel", "headerNextMonthIcon", "headerNextMonthAriaLabel", "headerIconSize", "headerButtonVariant", "headerButtonTheme", "locale", "className", "style"]);
|
|
566
577
|
const selected = useMemo(() => (date ? parseISO(date) : null), [date]);
|
|
567
|
-
const DatePickerHeader = useCallback((headerProps) => (jsx(DDatePickerHeader, Object.assign({}, headerProps, locale && { locale }, {
|
|
578
|
+
const DatePickerHeader = useCallback((headerProps) => (jsx(DDatePickerHeader, Object.assign({}, headerProps, locale && { locale }, { prevMonthIcon: headerPrevMonthIcon, nextMonthIcon: headerNextMonthIcon, prevMonthAriaLabel: headerPrevMonthAriaLabel, nextMonthAriaLabel: headerNextMonthAriaLabel, iconSize: headerIconSize, buttonVariant: headerButtonVariant, buttonTheme: headerButtonTheme, withMonthSelector: !!withMonthSelector }))), [
|
|
579
|
+
headerButtonTheme,
|
|
568
580
|
headerButtonVariant,
|
|
569
|
-
|
|
581
|
+
headerPrevMonthIcon,
|
|
582
|
+
headerPrevMonthAriaLabel,
|
|
570
583
|
headerIconSize,
|
|
571
|
-
|
|
584
|
+
headerNextMonthIcon,
|
|
585
|
+
headerNextMonthAriaLabel,
|
|
572
586
|
withMonthSelector,
|
|
573
587
|
locale,
|
|
574
588
|
]);
|
|
575
|
-
return (jsx(DatePicker, Object.assign({ selected: selected, calendarClassName: "d-date-picker", renderCustomHeader: (headerProps) => jsx(DatePickerHeader, Object.assign({}, headerProps)), customInput: (jsx(DDatePickerInput$1, { id: inputId, iconEnd: inputIcon, className: className, style: style })), customTimeInput: jsx(DDatePickerTime, { id: timeId, label: timeLabel }), selectsRange: selectsRange }, locale && { locale }, props)));
|
|
589
|
+
return (jsx(DatePicker, Object.assign({ selected: selected, calendarClassName: "d-date-picker", renderCustomHeader: (headerProps) => jsx(DatePickerHeader, Object.assign({}, headerProps)), customInput: (jsx(DDatePickerInput$1, { id: inputId, "aria-label": inputAriaLabel, iconEndAriaLabel: inputActionAriaLabel, iconEnd: inputIcon, className: className, style: style })), customTimeInput: jsx(DDatePickerTime, { id: timeId, label: timeLabel }), selectsRange: selectsRange }, locale && { locale }, props)));
|
|
576
590
|
}
|
|
577
591
|
|
|
578
592
|
function DInputCounter(_a, ref) {
|
|
579
|
-
var { minValue, maxValue, value = minValue, invalid, iconStart = 'dash-square', iconEnd = 'plus-square', style, onChange } = _a, props = __rest(_a, ["minValue", "maxValue", "value", "invalid", "iconStart", "iconEnd", "style", "onChange"]);
|
|
593
|
+
var { minValue, maxValue, value = minValue, invalid, iconStart = 'dash-square', iconEnd = 'plus-square', iconStartAriaLabel = 'decrease action', iconEndAriaLabel = 'increase action', style, onChange } = _a, props = __rest(_a, ["minValue", "maxValue", "value", "invalid", "iconStart", "iconEnd", "iconStartAriaLabel", "iconEndAriaLabel", "style", "onChange"]);
|
|
580
594
|
const inputRef = useProvidedRefOrCreate(ref);
|
|
581
595
|
const [internalIsInvalid, setInternalIsInvalid] = useState(false);
|
|
582
596
|
const [internalValue, setInternalValue] = useState(value);
|
|
@@ -600,7 +614,7 @@ function DInputCounter(_a, ref) {
|
|
|
600
614
|
useEffect(() => {
|
|
601
615
|
setInternalIsInvalid(!(internalValue >= minValue && internalValue <= maxValue));
|
|
602
616
|
}, [internalValue, minValue, maxValue]);
|
|
603
|
-
return (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)));
|
|
617
|
+
return (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, iconStartAriaLabel: iconStartAriaLabel, iconEndAriaLabel: iconEndAriaLabel }, props)));
|
|
604
618
|
}
|
|
605
619
|
const ForwardedDInputCounter = forwardRef(DInputCounter);
|
|
606
620
|
ForwardedDInputCounter.displayName = 'DInputCounter';
|
|
@@ -694,50 +708,50 @@ ForwardedDInputCurrencyBase.displayName = 'DInputCurrency';
|
|
|
694
708
|
var DInputCurrency$1 = ForwardedDInputCurrencyBase;
|
|
695
709
|
|
|
696
710
|
function DInputSearch(_a, ref) {
|
|
697
|
-
var { onClick, type } = _a, props = __rest(_a, ["onClick", "type"]);
|
|
711
|
+
var { onClick, type, iconEndAriaLabel = 'search' } = _a, props = __rest(_a, ["onClick", "type", "iconEndAriaLabel"]);
|
|
698
712
|
const inputRef = useProvidedRefOrCreate(ref);
|
|
699
|
-
return (jsx(DInput$1, Object.assign({ ref: inputRef, type: "text", iconEnd: "search", onIconEndClick: onClick }, props)));
|
|
713
|
+
return (jsx(DInput$1, Object.assign({ ref: inputRef, type: "text", iconEnd: "search", iconEndAriaLabel: iconEndAriaLabel, onIconEndClick: onClick }, props)));
|
|
700
714
|
}
|
|
701
715
|
const ForwardedDInputSearch = forwardRef(DInputSearch);
|
|
702
716
|
ForwardedDInputSearch.displayName = 'DInputSearch';
|
|
703
717
|
var DInputSearch$1 = ForwardedDInputSearch;
|
|
704
718
|
|
|
705
719
|
function DInputPassword(_a, ref) {
|
|
706
|
-
var { onIconEndClick } = _a, props = __rest(_a, ["onIconEndClick"]);
|
|
720
|
+
var { onIconEndClick, iconEndAriaLabel = 'show/hide password' } = _a, props = __rest(_a, ["onIconEndClick", "iconEndAriaLabel"]);
|
|
707
721
|
const inputRef = useProvidedRefOrCreate(ref);
|
|
708
722
|
const [visible, setVisible] = useState(false);
|
|
709
723
|
const handleOnIconEndClick = useCallback(() => {
|
|
710
724
|
setVisible((prevVisible) => !prevVisible);
|
|
711
725
|
onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick();
|
|
712
726
|
}, [onIconEndClick]);
|
|
713
|
-
return (jsx(DInput$1, Object.assign({ ref: inputRef, iconEnd: !visible ? 'eye-slash' : 'eye', type: !visible ? 'password' : 'text', onIconEndClick: handleOnIconEndClick }, props)));
|
|
727
|
+
return (jsx(DInput$1, Object.assign({ ref: inputRef, iconEnd: !visible ? 'eye-slash' : 'eye', type: !visible ? 'password' : 'text', onIconEndClick: handleOnIconEndClick, iconEndAriaLabel: iconEndAriaLabel }, props)));
|
|
714
728
|
}
|
|
715
729
|
const ForwardedDInputPassword = forwardRef(DInputPassword);
|
|
716
730
|
ForwardedDInputPassword.displayName = 'DInputPassword';
|
|
717
731
|
var DInputPassword$1 = ForwardedDInputPassword;
|
|
718
732
|
|
|
719
|
-
function DInputCheck({ type, name, label,
|
|
733
|
+
function DInputCheck({ type, name, label, ariaLabel, checked = false, id, disabled = false, indeterminate, value, onChange, className, style, }) {
|
|
720
734
|
const innerRef = useRef(null);
|
|
721
735
|
const handleChange = useCallback((event) => {
|
|
722
736
|
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
723
737
|
}, [onChange]);
|
|
724
738
|
useEffect(() => {
|
|
725
739
|
if (innerRef.current) {
|
|
726
|
-
innerRef.current.indeterminate = Boolean(
|
|
740
|
+
innerRef.current.indeterminate = Boolean(indeterminate);
|
|
727
741
|
}
|
|
728
|
-
}, [
|
|
742
|
+
}, [indeterminate]);
|
|
729
743
|
useEffect(() => {
|
|
730
744
|
if (innerRef.current) {
|
|
731
|
-
innerRef.current.checked =
|
|
745
|
+
innerRef.current.checked = checked;
|
|
732
746
|
}
|
|
733
|
-
}, [
|
|
747
|
+
}, [checked]);
|
|
734
748
|
if (!label) {
|
|
735
|
-
return (jsx("input", { ref: innerRef, onChange: handleChange, className: classNames('form-check-input', className), style: style, id: id, disabled:
|
|
749
|
+
return (jsx("input", { ref: innerRef, onChange: handleChange, className: classNames('form-check-input', className), style: style, id: id, disabled: disabled, type: type, name: name, value: value, "aria-label": ariaLabel }));
|
|
736
750
|
}
|
|
737
|
-
return (jsxs("div", { className: "form-check", children: [jsx("input", { ref: innerRef, onChange: handleChange, className: classNames('form-check-input', className), style: style, id: id, disabled:
|
|
751
|
+
return (jsxs("div", { className: "form-check", children: [jsx("input", { ref: innerRef, onChange: handleChange, className: classNames('form-check-input', className), style: style, id: id, disabled: disabled, type: type, name: name, value: value }), jsx("label", { className: "form-check-label", htmlFor: id, children: label })] }));
|
|
738
752
|
}
|
|
739
753
|
|
|
740
|
-
function DInputPin({ id, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, placeholder = '•', type = 'text',
|
|
754
|
+
function DInputPin({ id, label = '', labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, placeholder = '•', type = 'text', disabled = false, loading = false, secret = false, iconFamilyClass, iconFamilyPrefix, characters = 4, innerInputMode = 'text', hint, invalid = false, valid = false, className, style, onChange, }) {
|
|
741
755
|
const [pattern, setPattern] = useState('');
|
|
742
756
|
useEffect(() => {
|
|
743
757
|
setPattern(type === 'number' ? '[0-9]+' : '^[a-zA-Z0-9]+$');
|
|
@@ -788,12 +802,12 @@ function DInputPin({ id, label = '', labelIcon, labelIconFamilyClass, labelIconF
|
|
|
788
802
|
}, []);
|
|
789
803
|
return (jsxs("div", { className: classNames('d-input-pin', className), style: style, children: [label && (jsxs("label", { htmlFor: "pinIndex0", children: [label, labelIcon && (jsx(DIcon, { className: "d-input-pin-icon", icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxs("form", { id: id, className: "d-input-pin-controls", onInput: formChange, onSubmit: preventDefaultEvent, children: [Array.from({ length: characters }).map((_, index) => (jsx("input", Object.assign({ className: classNames({
|
|
790
804
|
'form-control': true,
|
|
791
|
-
'is-invalid':
|
|
792
|
-
'is-valid':
|
|
793
|
-
}), type:
|
|
805
|
+
'is-invalid': invalid,
|
|
806
|
+
'is-valid': valid,
|
|
807
|
+
}), type: secret ? '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: disabled || loading, required: true }, type === 'number' && ({ min: 0, max: 9 })), index))), (invalid || valid) && !loading && (jsx("span", { className: "input-group-text", id: `${id}State`, children: jsx(DIcon, { className: "d-input-pin-validation-icon", icon: invalid ? 'exclamation-circle' : 'check', familyClass: iconFamilyClass, familyPrefix: iconFamilyPrefix }) })), loading && (jsx("div", { className: "input-group-text d-input-pin-icon", children: jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsx("span", { className: "visually-hidden", children: "Loading..." }) }) }))] }), hint && (jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] }));
|
|
794
808
|
}
|
|
795
809
|
|
|
796
|
-
function DInputSelect({ id, name, label = '', className, style, options, labelIcon, labelIconFamilyClass, labelIconFamilyPrefix,
|
|
810
|
+
function DInputSelect({ id, name, label = '', className, style, options, labelIcon, labelIconFamilyClass, labelIconFamilyPrefix, disabled = false, loading = false, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, hint, selectedOption, valueExtractor, labelExtractor, onChange, onBlur, onIconStartClick, onIconEndClick, }) {
|
|
797
811
|
const internalValueExtractor = useCallback((option) => {
|
|
798
812
|
if (valueExtractor) {
|
|
799
813
|
return valueExtractor(option);
|
|
@@ -826,32 +840,39 @@ function DInputSelect({ id, name, label = '', className, style, options, labelIc
|
|
|
826
840
|
const iconEndClickHandler = useCallback((event) => {
|
|
827
841
|
onIconEndClick === null || onIconEndClick === void 0 ? void 0 : onIconEndClick(event);
|
|
828
842
|
}, [onIconEndClick]);
|
|
843
|
+
const ariaDescribedby = useMemo(() => ([
|
|
844
|
+
iconStart && `${id}Start`,
|
|
845
|
+
hint && `${id}Hint`,
|
|
846
|
+
iconEnd && `${id}End`,
|
|
847
|
+
]
|
|
848
|
+
.filter(Boolean)
|
|
849
|
+
.join(' ')), [id, iconStart, iconEnd, hint]);
|
|
829
850
|
return (jsxs("div", { className: classNames('d-input', className), style: style, children: [label && (jsxs("label", { htmlFor: id, children: [label, labelIcon && (jsx(DIcon, { className: "mdinput-icon", icon: labelIcon, size: `var(--${PREFIX_BS}input-label-font-size)`, familyClass: labelIconFamilyClass, familyPrefix: labelIconFamilyPrefix }))] })), jsxs("div", { className: "d-input-control", children: [jsxs("div", { className: classNames({
|
|
830
851
|
'input-group': true,
|
|
831
|
-
disabled:
|
|
832
|
-
}), children: [iconStart && (jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: iconStartClickHandler, disabled:
|
|
852
|
+
disabled: disabled || loading,
|
|
853
|
+
}), children: [iconStart && (jsx("button", { type: "button", className: "input-group-text", id: `${id}Start`, onClick: iconStartClickHandler, disabled: disabled || loading, "aria-label": iconStartAriaLabel, children: iconStart && (jsx(DIcon, { className: "d-input-icon", icon: iconStart, familyClass: iconStartFamilyClass, familyPrefix: iconStartFamilyPrefix })) })), jsx("select", Object.assign({ id: id, name: name, className: "form-select", "aria-label": label, disabled: disabled || loading, onChange: changeHandler, onBlur: blurHandler }, ariaDescribedby && { 'aria-describedby': ariaDescribedby }, selectedOption && { value: internalValueExtractor(selectedOption) }, { children: options.map((option) => (jsx("option", { value: internalValueExtractor(option), children: internalLabelExtractor(option) }, internalValueExtractor(option)))) })), iconEnd && !loading && (jsx("button", { type: "button", className: "input-group-text", id: `${id}End`, onClick: iconEndClickHandler, disabled: disabled || loading, "aria-label": iconEndAriaLabel, children: iconEnd && (jsx(DIcon, { className: "d-input-icon", icon: iconEnd, familyClass: iconEndFamilyClass, familyPrefix: iconEndFamilyPrefix })) })), loading && (jsx("div", { className: "input-group-text form-control-icon loading", children: jsx("span", { className: "spinner-border spinner-border-sm", role: "status", "aria-hidden": "true", children: jsx("span", { className: "visually-hidden", children: "Loading..." }) }) }))] }), hint && (jsx("div", { className: "form-text", id: `${id}Hint`, children: hint }))] })] }));
|
|
833
854
|
}
|
|
834
855
|
|
|
835
|
-
function DListItem({ children, className, style,
|
|
856
|
+
function DListItem({ children, className, style, active = false, disabled = false, theme, onClick, }) {
|
|
836
857
|
const Tag = useMemo(() => (onClick ? 'button' : 'div'), [onClick]);
|
|
837
858
|
return (jsx(Tag, Object.assign({}, Tag === 'button' && {
|
|
838
859
|
onClick,
|
|
839
860
|
type: 'button',
|
|
840
861
|
}, { className: classNames('list-group-item list-group-item-action', theme ? `list-group-item-${theme}` : undefined, className, {
|
|
841
|
-
active
|
|
842
|
-
disabled
|
|
843
|
-
}), style: style },
|
|
862
|
+
active,
|
|
863
|
+
disabled,
|
|
864
|
+
}), style: style }, active && { 'aria-current': true }, { children: children })));
|
|
844
865
|
}
|
|
845
866
|
|
|
846
|
-
function DList({ children, className, style,
|
|
847
|
-
if (
|
|
867
|
+
function DList({ children, className, style, flush = false, numbered = false, horizontal = false, horizontalBreakpoint, }) {
|
|
868
|
+
if (flush && horizontal) {
|
|
848
869
|
throw new Error("Horizontal and Flush props don't work together");
|
|
849
870
|
}
|
|
850
871
|
return (jsx("div", { className: classNames('list-group', {
|
|
851
|
-
'list-group-flush':
|
|
852
|
-
'list-group-numbered':
|
|
853
|
-
'list-group-horizontal':
|
|
854
|
-
}, (
|
|
872
|
+
'list-group-flush': flush && !horizontal,
|
|
873
|
+
'list-group-numbered': numbered,
|
|
874
|
+
'list-group-horizontal': horizontal && !horizontalBreakpoint,
|
|
875
|
+
}, (horizontal && horizontalBreakpoint) && `list-group-horizontal-${horizontalBreakpoint}`, className), style: style, children: children }));
|
|
855
876
|
}
|
|
856
877
|
var DList$1 = Object.assign(DList, {
|
|
857
878
|
Item: DListItem,
|
|
@@ -888,19 +909,19 @@ function DModalFooter({ className, style, actionPlacement = 'fill', children, })
|
|
|
888
909
|
return (jsxs(Fragment, { children: [jsx("div", { className: "d-modal-separator" }), jsx("div", { className: classNames(`d-modal-slot modal-footer d-modal-action-${actionPlacement}`, className), style: style, children: children })] }));
|
|
889
910
|
}
|
|
890
911
|
|
|
891
|
-
function DModal({ name, className, style,
|
|
912
|
+
function DModal({ name, className, style, staticBackdrop, scrollable, centered, fullScreen, fullScreenFrom, modalSize, children, }) {
|
|
892
913
|
const fullScreenClass = useMemo(() => {
|
|
893
|
-
if (
|
|
914
|
+
if (fullScreen) {
|
|
894
915
|
if (fullScreenFrom) {
|
|
895
916
|
return `modal-fullscreen-${fullScreenFrom}-down`;
|
|
896
917
|
}
|
|
897
918
|
return 'modal-fullscreen';
|
|
898
919
|
}
|
|
899
920
|
return '';
|
|
900
|
-
}, [fullScreenFrom,
|
|
921
|
+
}, [fullScreenFrom, fullScreen]);
|
|
901
922
|
const generateClasses = useMemo(() => (Object.assign({ 'modal fade show': true }, className && { [className]: true })), [className]);
|
|
902
|
-
const generateModalDialogClasses = useMemo(() => (Object.assign({ 'modal-dialog': true, 'modal-dialog-centered': !!
|
|
903
|
-
return (jsx("div", Object.assign({ className: classNames(generateClasses), id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false", style: style },
|
|
923
|
+
const generateModalDialogClasses = useMemo(() => (Object.assign({ 'modal-dialog': true, 'modal-dialog-centered': !!centered, 'modal-dialog-scrollable': !!scrollable, [fullScreenClass]: !!fullScreen }, modalSize && { [`modal-${modalSize}`]: true })), [fullScreenClass, centered, fullScreen, scrollable, modalSize]);
|
|
924
|
+
return (jsx("div", Object.assign({ className: classNames(generateClasses), id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false", style: style }, staticBackdrop && ({
|
|
904
925
|
[`data-${PREFIX_BS}backdrop`]: 'static',
|
|
905
926
|
[`data-${PREFIX_BS}keyboard`]: 'false',
|
|
906
927
|
}), { children: jsx("div", { className: classNames(generateModalDialogClasses), children: jsx("div", { className: "modal-content", children: children }) }) })));
|
|
@@ -923,13 +944,13 @@ function DOffcanvasFooter({ footerActionPlacement = 'fill', children, className,
|
|
|
923
944
|
return (jsx("div", { className: classNames(`d-offcanvas-slot d-offcanvas-footer d-offcanvas-action-${footerActionPlacement}`, className), style: style, children: children }));
|
|
924
945
|
}
|
|
925
946
|
|
|
926
|
-
function DOffcanvas({ name, className, style,
|
|
947
|
+
function DOffcanvas({ name, className, style, staticBackdrop, scrollable, openFrom = 'end', children, }) {
|
|
927
948
|
return (jsx("div", Object.assign({ className: classNames('offcanvas show', {
|
|
928
949
|
[`offcanvas-${openFrom}`]: openFrom,
|
|
929
|
-
}, className), style: style, id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false" },
|
|
950
|
+
}, className), style: style, id: name, tabIndex: -1, "aria-labelledby": `${name}Label`, "aria-hidden": "false" }, staticBackdrop && ({
|
|
930
951
|
[`data-${PREFIX_BS}backdrop`]: 'static',
|
|
931
952
|
[`data-${PREFIX_BS}keyboard`]: 'false',
|
|
932
|
-
}),
|
|
953
|
+
}), scrollable && ({
|
|
933
954
|
[`data-${PREFIX_BS}scroll`]: 'true',
|
|
934
955
|
[`data-${PREFIX_BS}keyboard`]: 'false',
|
|
935
956
|
}), { children: children })));
|
|
@@ -945,19 +966,19 @@ function DPaginator(_a) {
|
|
|
945
966
|
return (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)));
|
|
946
967
|
}
|
|
947
968
|
|
|
948
|
-
function DPopover({ children, renderComponent,
|
|
949
|
-
const [
|
|
969
|
+
function DPopover({ children, renderComponent, open, setOpen, adjustContentToRender = false, className, style, }) {
|
|
970
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
950
971
|
useEffect(() => {
|
|
951
|
-
|
|
952
|
-
}, [
|
|
972
|
+
setIsOpen(open);
|
|
973
|
+
}, [open]);
|
|
953
974
|
const onOpenChange = useCallback((value) => {
|
|
954
|
-
|
|
955
|
-
if (
|
|
956
|
-
|
|
975
|
+
setIsOpen(value);
|
|
976
|
+
if (setOpen) {
|
|
977
|
+
setOpen(value);
|
|
957
978
|
}
|
|
958
|
-
}, [
|
|
979
|
+
}, [setOpen]);
|
|
959
980
|
const { refs, floatingStyles, context, } = useFloating({
|
|
960
|
-
open:
|
|
981
|
+
open: isOpen,
|
|
961
982
|
onOpenChange,
|
|
962
983
|
middleware: [
|
|
963
984
|
offset(0),
|
|
@@ -978,7 +999,7 @@ function DPopover({ children, renderComponent, isOpen, setEventIsOpen, adjustCon
|
|
|
978
999
|
const generateStyleVariables = useMemo(() => (Object.assign(Object.assign({}, style), adjustContentToRender && {
|
|
979
1000
|
[`--${PREFIX_BS}popover-component-min-width`]: 'auto',
|
|
980
1001
|
})), [style, adjustContentToRender]);
|
|
981
|
-
return (jsxs("div", { className: classNames('d-popover', className), style: generateStyleVariables, children: [jsx("div", Object.assign({ ref: refs.setReference }, getReferenceProps(), { children: renderComponent(
|
|
1002
|
+
return (jsxs("div", { className: classNames('d-popover', className), style: generateStyleVariables, children: [jsx("div", Object.assign({ ref: refs.setReference }, getReferenceProps(), { children: renderComponent(isOpen) })), isOpen && (jsx(FloatingFocusManager, { context: context, modal: false, children: jsx("div", Object.assign({ className: classNames('d-popover-content', {
|
|
982
1003
|
'w-100': adjustContentToRender,
|
|
983
1004
|
}), ref: refs.setFloating, style: floatingStyles, "aria-labelledby": headingId }, getFloatingProps(), { children: children })) }))] }));
|
|
984
1005
|
}
|
|
@@ -992,7 +1013,7 @@ function DProgress({ className, style, currentValue, minValue = 0, maxValue = 10
|
|
|
992
1013
|
return (jsx("div", { className: "progress", children: 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 }) }));
|
|
993
1014
|
}
|
|
994
1015
|
|
|
995
|
-
function DQuickActionButton({ line1, line2, className, actionLinkText, actionLinkTheme = 'secondary', actionIcon, secondaryActionIcon, actionIconFamilyClass, actionIconFamilyPrefix, representativeImage, representativeIcon, representativeIconTheme = 'secondary', representativeIconHasCircle = false, representativeIconFamilyClass, representativeIconFamilyPrefix, onClick, onClickSecondary, style, }) {
|
|
1016
|
+
function DQuickActionButton({ line1, line2, className, actionLinkText, actionLinkTheme = 'secondary', actionIcon, secondaryActionIcon, secondaryActionAriaLabel, actionIconFamilyClass, actionIconFamilyPrefix, representativeImage, representativeIcon, representativeIconTheme = 'secondary', representativeIconHasCircle = false, representativeIconFamilyClass, representativeIconFamilyPrefix, onClick, onClickSecondary, style, }) {
|
|
996
1017
|
const globalClickHandler = useCallback(() => {
|
|
997
1018
|
if (actionLinkText) {
|
|
998
1019
|
return;
|
|
@@ -1011,18 +1032,18 @@ function DQuickActionButton({ line1, line2, className, actionLinkText, actionLin
|
|
|
1011
1032
|
const Tag = useMemo(() => (actionLinkText ? 'div' : 'button'), [actionLinkText]);
|
|
1012
1033
|
return (jsxs(Tag, { className: classNames('d-quick-action-button', className), onClick: !actionLinkText ? globalClickHandler : undefined, style: style, children: [representativeIcon && (jsx(DIcon, { className: "d-quick-action-button-representative-icon", size: representativeIconHasCircle
|
|
1013
1034
|
? `var(--${PREFIX_BS}quick-action-button-representative-icon-size)`
|
|
1014
|
-
: `var(--${PREFIX_BS}quick-action-button-representative-image-size)`, icon: representativeIcon, hasCircle: representativeIconHasCircle, theme: representativeIconTheme, familyClass: representativeIconFamilyClass, familyPrefix: representativeIconFamilyPrefix })), representativeImage && (jsx("img", { className: "d-quick-action-button-representative-image", src: representativeImage, alt: "" })), jsx("div", { className: "d-quick-action-button-content", children: jsxs("div", { className: "d-quick-action-button-text", children: [jsx("span", { className: "d-quick-action-button-line1", children: line1 }), jsx("small", { className: "d-quick-action-button-line2", children: line2 })] }) }), secondaryActionIcon && (jsx(DButton, { className: "d-quick-action-button-secondary-action-link", type: "button", variant: "link", iconStart: secondaryActionIcon, iconStartFamilyClass: actionIconFamilyClass, iconStartFamilyPrefix: actionIconFamilyPrefix, theme: actionLinkTheme, onClick: secondaryActionLinkClickHandler,
|
|
1035
|
+
: `var(--${PREFIX_BS}quick-action-button-representative-image-size)`, icon: representativeIcon, hasCircle: representativeIconHasCircle, theme: representativeIconTheme, familyClass: representativeIconFamilyClass, familyPrefix: representativeIconFamilyPrefix })), representativeImage && (jsx("img", { className: "d-quick-action-button-representative-image", src: representativeImage, alt: "" })), jsx("div", { className: "d-quick-action-button-content", children: jsxs("div", { className: "d-quick-action-button-text", children: [jsx("span", { className: "d-quick-action-button-line1", children: line1 }), jsx("small", { className: "d-quick-action-button-line2", children: line2 })] }) }), secondaryActionIcon && (jsx(DButton, { className: "d-quick-action-button-secondary-action-link", type: "button", variant: "link", iconStart: secondaryActionIcon, ariaLabel: secondaryActionAriaLabel, iconStartFamilyClass: actionIconFamilyClass, iconStartFamilyPrefix: actionIconFamilyPrefix, theme: actionLinkTheme, onClick: secondaryActionLinkClickHandler, stopPropagationEnabled: true })), actionLinkText && !actionIcon && (jsx(DButton, { className: "d-quick-action-button-action-link", type: "button", variant: "link", theme: actionLinkTheme, text: actionLinkText, onClick: actionLinkClickHandler, stopPropagationEnabled: true })), actionIcon && !actionLinkText && (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 }))] }));
|
|
1015
1036
|
}
|
|
1016
1037
|
|
|
1017
|
-
function DQuickActionCheck({ id, name, value, line1, line2, line3, className, style,
|
|
1038
|
+
function DQuickActionCheck({ id, name, value, line1, line2, line3, className, style, checked, onChange, }) {
|
|
1018
1039
|
const changeHandler = useCallback((event) => {
|
|
1019
1040
|
event.stopPropagation();
|
|
1020
1041
|
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
1021
1042
|
}, [onChange]);
|
|
1022
|
-
return (jsxs("label", { className: classNames('d-quick-action-check', className), htmlFor: id, style: style, children: [jsx(DInputCheck, { id: id, type: "radio", name: name, value: value,
|
|
1043
|
+
return (jsxs("label", { className: classNames('d-quick-action-check', className), htmlFor: id, style: style, children: [jsx(DInputCheck, { id: id, type: "radio", name: name, value: value, checked: checked, onChange: changeHandler }), jsxs("div", { className: "d-quick-action-check-detail", children: [jsx("span", { className: "d-quick-action-check-line1", children: line1 }), jsx("span", { className: "d-quick-action-check-line2", children: line2 })] }), jsx("span", { className: "d-quick-action-check-line3", children: line3 })] }));
|
|
1023
1044
|
}
|
|
1024
1045
|
|
|
1025
|
-
function DQuickActionSelect({ id, name, value, line1, line2, className, style,
|
|
1046
|
+
function DQuickActionSelect({ id, name, value, line1, line2, className, style, selected = false, onChange, }) {
|
|
1026
1047
|
const innerRef = useRef(null);
|
|
1027
1048
|
const changeHandler = useCallback((event) => {
|
|
1028
1049
|
event.stopPropagation();
|
|
@@ -1030,18 +1051,18 @@ function DQuickActionSelect({ id, name, value, line1, line2, className, style, i
|
|
|
1030
1051
|
}, [onChange]);
|
|
1031
1052
|
useEffect(() => {
|
|
1032
1053
|
if (innerRef.current) {
|
|
1033
|
-
innerRef.current.checked =
|
|
1054
|
+
innerRef.current.checked = selected;
|
|
1034
1055
|
}
|
|
1035
|
-
}, [
|
|
1056
|
+
}, [selected]);
|
|
1036
1057
|
return (jsxs("label", { className: classNames('d-quick-action-select', className), htmlFor: id, style: style, children: [jsx("input", { ref: innerRef, id: id, type: "radio", name: name, value: value, onChange: changeHandler }), jsx("span", { className: "d-quick-action-select-line1", children: line1 }), jsx("span", { className: "d-quick-action-select-line2", children: line2 })] }));
|
|
1037
1058
|
}
|
|
1038
1059
|
|
|
1039
|
-
function DQuickActionSwitch({ id, name, label, hint,
|
|
1060
|
+
function DQuickActionSwitch({ id, name, label, hint, checked, disabled, className, style, onClick, }) {
|
|
1040
1061
|
const clickHandler = useCallback((event) => {
|
|
1041
1062
|
event.stopPropagation();
|
|
1042
|
-
onClick === null || onClick === void 0 ? void 0 : onClick(
|
|
1043
|
-
}, [
|
|
1044
|
-
return (jsxs("button", { className: classNames('d-quick-action-switch', className), type: "button", onClick: clickHandler, style: style, children: [jsxs("div", { className: "d-quick-action-switch-content", children: [jsx(DInputSwitch, { id: id, name: name,
|
|
1063
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(checked);
|
|
1064
|
+
}, [checked, onClick]);
|
|
1065
|
+
return (jsxs("button", { className: classNames('d-quick-action-switch', className), type: "button", onClick: clickHandler, style: style, children: [jsxs("div", { className: "d-quick-action-switch-content", children: [jsx(DInputSwitch, { id: id, name: name, disabled: disabled, checked: checked, readonly: true }), jsx("label", { className: "d-quick-action-switch-label", htmlFor: id, children: label })] }), jsx("div", { className: "d-quick-action-switch-hint", children: hint })] }));
|
|
1045
1066
|
}
|
|
1046
1067
|
|
|
1047
1068
|
function DSkeleton({ speed = 2, viewBox, backgroundColor, foregroundColor, children, }) {
|
|
@@ -1062,13 +1083,13 @@ function DSkeleton({ speed = 2, viewBox, backgroundColor, foregroundColor, child
|
|
|
1062
1083
|
return (jsx(ContentLoader, { speed: speed, viewBox: viewBox, backgroundColor: innerBackgroundColor, foregroundColor: innerForegroundColor, children: children }));
|
|
1063
1084
|
}
|
|
1064
1085
|
|
|
1065
|
-
function DStepper$2({ options, currentStep, successIcon = 'check',
|
|
1086
|
+
function DStepper$2({ options, currentStep, successIcon = 'check', vertical = false, className, style, }) {
|
|
1066
1087
|
if (currentStep < 1 || currentStep > options.length) {
|
|
1067
1088
|
throw new Error('Current step should be in the range from 1 to options length');
|
|
1068
1089
|
}
|
|
1069
1090
|
return (jsx("div", { className: classNames({
|
|
1070
1091
|
'd-stepper-desktop': true,
|
|
1071
|
-
'is-vertical':
|
|
1092
|
+
'is-vertical': vertical,
|
|
1072
1093
|
}, className), style: style, children: options.map(({ label, value }) => (jsxs("div", { className: "d-step", children: [jsx("div", { className: "d-step-value", children: jsx("div", { className: classNames({
|
|
1073
1094
|
'd-step-icon-container': true,
|
|
1074
1095
|
'd-step-check': value < currentStep,
|
|
@@ -1108,8 +1129,8 @@ function DStepper$1({ options, currentStep, className, style, }) {
|
|
|
1108
1129
|
return (jsxs("div", { className: classNames('d-stepper', className), style: style, children: [jsx("div", { className: "d-step-bar", style: { background: progressStyle }, children: jsx("p", { className: "d-step-number", children: `${currentStep}/${options.length}` }) }), jsx("div", { className: "d-step-info", children: Object.keys(currentOption).length > 0 && (jsxs(Fragment, { children: [jsx("div", { className: "d-step-label", children: currentOption.label }), jsx("div", { className: "d-step-description", children: currentOption.description || '' })] })) })] }));
|
|
1109
1130
|
}
|
|
1110
1131
|
|
|
1111
|
-
function DStepper({ options, currentStep, successIcon = 'check',
|
|
1112
|
-
return (jsxs("div", { className: className, style: style, children: [jsx("div", { className: `d-block d-${breakpoint}-none`, children: jsx(DStepper$1, { options: options, currentStep: currentStep }) }), jsx("div", { className: `d-none d-${breakpoint}-block`, children: jsx(DStepper$2, { options: options, currentStep: currentStep, successIcon: successIcon,
|
|
1132
|
+
function DStepper({ options, currentStep, successIcon = 'check', vertical = false, breakpoint = 'lg', className, style, }) {
|
|
1133
|
+
return (jsxs("div", { className: className, style: style, children: [jsx("div", { className: `d-block d-${breakpoint}-none`, children: jsx(DStepper$1, { options: options, currentStep: currentStep }) }), jsx("div", { className: `d-none d-${breakpoint}-block`, children: jsx(DStepper$2, { options: options, currentStep: currentStep, successIcon: successIcon, vertical: vertical }) })] }));
|
|
1113
1134
|
}
|
|
1114
1135
|
|
|
1115
1136
|
const TOOLTIP_FONT_SIZE_BY_SIZE = {
|
|
@@ -1120,8 +1141,8 @@ const TOOLTIP_FONT_SIZE_BY_SIZE = {
|
|
|
1120
1141
|
const ARROW_WIDTH = 8;
|
|
1121
1142
|
const ARROW_HEIGHT = 4;
|
|
1122
1143
|
const GAP = 2;
|
|
1123
|
-
function DTooltip({ classNameContainer, className, style, offSet = ARROW_HEIGHT + GAP, padding, withFocus = false, withClick = false, withHover = true,
|
|
1124
|
-
const [
|
|
1144
|
+
function DTooltip({ classNameContainer, className, style, offSet = ARROW_HEIGHT + GAP, padding, withFocus = false, withClick = false, withHover = true, open = false, placement = 'top', size, Component, children, }) {
|
|
1145
|
+
const [isOpen, setIsOpen] = useState(open);
|
|
1125
1146
|
const styleVariables = useMemo(() => {
|
|
1126
1147
|
const defaultFontSize = size
|
|
1127
1148
|
? TOOLTIP_FONT_SIZE_BY_SIZE[size]
|
|
@@ -1130,8 +1151,8 @@ function DTooltip({ classNameContainer, className, style, offSet = ARROW_HEIGHT
|
|
|
1130
1151
|
}, [size, style]);
|
|
1131
1152
|
const arrowRef = useRef(null);
|
|
1132
1153
|
const { refs, context, floatingStyles, } = useFloating({
|
|
1133
|
-
open,
|
|
1134
|
-
onOpenChange:
|
|
1154
|
+
open: isOpen,
|
|
1155
|
+
onOpenChange: setIsOpen,
|
|
1135
1156
|
placement,
|
|
1136
1157
|
whileElementsMounted: autoUpdate,
|
|
1137
1158
|
middleware: [
|
|
@@ -1157,7 +1178,7 @@ function DTooltip({ classNameContainer, className, style, offSet = ARROW_HEIGHT
|
|
|
1157
1178
|
dismiss,
|
|
1158
1179
|
role,
|
|
1159
1180
|
]);
|
|
1160
|
-
return (jsxs(Fragment, { children: [jsx("div", Object.assign({ className: className, ref: refs.setReference }, getReferenceProps(), { children: Component })), jsx(FloatingPortal, { children:
|
|
1181
|
+
return (jsxs(Fragment, { children: [jsx("div", Object.assign({ className: className, ref: refs.setReference }, getReferenceProps(), { children: Component })), jsx(FloatingPortal, { children: isOpen && (jsxs("div", Object.assign({ className: classNameContainer, ref: refs.setFloating, style: Object.assign(Object.assign({}, floatingStyles), styleVariables) }, getFloatingProps(), { children: [jsx(FloatingArrow, { ref: arrowRef, context: context, style: {
|
|
1161
1182
|
fill: styleVariables.background,
|
|
1162
1183
|
}, width: ARROW_WIDTH, height: ARROW_HEIGHT }), children] }))) })] }));
|
|
1163
1184
|
}
|
|
@@ -1179,7 +1200,7 @@ function DTabContent({ tab, children, className, style, }) {
|
|
|
1179
1200
|
return (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 }));
|
|
1180
1201
|
}
|
|
1181
1202
|
|
|
1182
|
-
function DTabs({ children, defaultSelected, onChange, options, className, style,
|
|
1203
|
+
function DTabs({ children, defaultSelected, onChange, options, className, style, vertical, }) {
|
|
1183
1204
|
const [selected, setSelected] = useState(defaultSelected);
|
|
1184
1205
|
const onSelect = useCallback((option) => {
|
|
1185
1206
|
if (option.tab) {
|
|
@@ -1196,10 +1217,10 @@ function DTabs({ children, defaultSelected, onChange, options, className, style,
|
|
|
1196
1217
|
}), [isSelected]);
|
|
1197
1218
|
return (jsx(TabContext.Provider, { value: value, children: jsxs("div", { className: classNames({
|
|
1198
1219
|
'd-tabs': true,
|
|
1199
|
-
'd-tabs-vertical':
|
|
1220
|
+
'd-tabs-vertical': vertical,
|
|
1200
1221
|
}, className), style: style, children: [jsx("nav", { className: "nav", children: options.map((option) => (jsx("button", { id: `${option.tab}Tab`, className: classNames('nav-link', {
|
|
1201
1222
|
active: option.tab === selected,
|
|
1202
|
-
}, className), type: "button", role: "tab", "aria-controls": `${option.tab}Pane`, "aria-selected": option.tab === selected, disabled: option.
|
|
1223
|
+
}, className), type: "button", role: "tab", "aria-controls": `${option.tab}Pane`, "aria-selected": option.tab === selected, disabled: option.disabled, onClick: () => onSelect(option), children: option.label }, option.label))) }), jsx("div", { className: "tab-content", children: children })] }) }));
|
|
1203
1224
|
}
|
|
1204
1225
|
var DTabs$1 = Object.assign(DTabs, {
|
|
1205
1226
|
Tab: DTabContent,
|
|
@@ -1211,7 +1232,7 @@ function DToastContainer({ style, position = 'top-right', className, }) {
|
|
|
1211
1232
|
|
|
1212
1233
|
function useToast() {
|
|
1213
1234
|
const toast$1 = useCallback((message, { position = 'top-right', type = 'info', showClose = true, autoClose = false, } = {}) => {
|
|
1214
|
-
toast(({ closeToast }) => (jsx(
|
|
1235
|
+
toast(({ closeToast }) => (jsx(DToast, { type: type, showClose: showClose, onClose: closeToast, id: "alertID", children: message })), {
|
|
1215
1236
|
transition: Slide,
|
|
1216
1237
|
position,
|
|
1217
1238
|
autoClose,
|
|
@@ -1236,5 +1257,5 @@ async function configureI8n(resources, _a = {}) {
|
|
|
1236
1257
|
.then((t) => t);
|
|
1237
1258
|
}
|
|
1238
1259
|
|
|
1239
|
-
export {
|
|
1260
|
+
export { DAlertBox, DBadge, DBoxFile, DButton, DCard$1 as DCard, DCardAccount, DCardBody, DCardFooter, DCardHeader, DCarousel$1 as DCarousel, DCarouselSlide, DChip, DCollapse, DCollapseIconText, DContext, DContextProvider, DCurrencyText, DDatePicker, DIcon, DInput$1 as DInput, DInputCheck, DInputCounter$1 as DInputCounter, DInputCurrency$1 as DInputCurrency, DInputCurrencyBase$1 as DInputCurrencyBase, DInputPassword$1 as DInputPassword, DInputPin, DInputSearch$1 as DInputSearch, DInputSelect, DInputSwitch, DList$1 as DList, DListItem, DListItemMovement, DModal$1 as DModal, DModalBody, DModalFooter, DModalHeader, DOffcanvas$1 as DOffcanvas, DOffcanvasBody, DOffcanvasFooter, DOffcanvasHeader, DPaginator, DPermissionGroup, DPermissionItem, DPopover, DProgress, DQuickActionButton, DQuickActionCheck, DQuickActionSelect, DQuickActionSwitch, DSkeleton, DStepper, DStepper$2 as DStepperDesktop, DStepper$1 as DStepperMobile, DSummaryCard, DTabContent, DTabs$1 as DTabs, DToast, DToastContainer, DTooltip, ModalContext, ModalContextProvider, OffcanvasContext, OffcanvasContextProvider, configureI8n as configureI18n, formatCurrency, useDContext, useFormatCurrency, useInputCurrency, useModalContext, useOffcanvasContext, useProvidedRefOrCreate, useStackState, useTabContext, useToast };
|
|
1240
1261
|
//# sourceMappingURL=index.esm.js.map
|